Author: chatellier Date: 2009-04-24 15:57:15 +0000 (Fri, 24 Apr 2009) New Revision: 2145 Added: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/ContinuousPanelContainerUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/DefaultContinuousPanelUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanelUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizardUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanelUI.jaxx Removed: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/ContinuousPanelContainer.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/DefaultContinuousPanel.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanel.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizard.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanel.jaxx Modified: isis-fish/trunk/pom.xml isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelper.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorAction.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeCellRenderer.java isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivitySecondPassUI.jaxx Log: Refactoring (pour faire du code propre). Les UI, ont leur nom suffix?\195?\169es par 'UI'. Modified: isis-fish/trunk/pom.xml =================================================================== --- isis-fish/trunk/pom.xml 2009-04-24 15:56:19 UTC (rev 2144) +++ isis-fish/trunk/pom.xml 2009-04-24 15:57:15 UTC (rev 2145) @@ -451,9 +451,9 @@ <entry> <basedir>${maven.gen.dir}/java/</basedir> <specificGoal>parserJava</specificGoal> - <!-- <includes> + <includes> <param>**\/**UI.java</param> - </includes> --> + </includes> </entry> </entries> </configuration> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2009-04-24 15:56:19 UTC (rev 2144) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/InputContentUI.jaxx 2009-04-24 15:57:15 UTC (rev 2145) @@ -42,7 +42,7 @@ import java.lang.reflect.Method; import org.apache.commons.beanutils.MethodUtils; import fr.ifremer.isisfish.ui.util.UtilsUI; -import fr.ifremer.isisfish.ui.sensitivity.FactorWizard; +import fr.ifremer.isisfish.ui.sensitivity.FactorWizardUI; import fr.ifremer.isisfish.ui.sensitivity.EditorHelper; import fr.ifremer.isisfish.ui.sensitivity.SensitivityTabUI; import jaxx.runtime.JAXXInitialContext; @@ -112,7 +112,7 @@ bean = getVerifier().getEntity(classBean, beanID); } if (bean != null){ - FactorWizard wizard = new FactorWizard(this); + FactorWizardUI wizard = new FactorWizardUI(this); wizard.initNew(source, bean, EditorHelper.canBeContinue(source, bean)); wizard.pack(); Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/ContinuousPanelContainer.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/ContinuousPanelContainer.jaxx 2009-04-24 15:56:19 UTC (rev 2144) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/ContinuousPanelContainer.jaxx 2009-04-24 15:57:15 UTC (rev 2145) @@ -1,41 +0,0 @@ -<!-- -/* *##% - * Copyright (C) 2005 - * Ifremer, Code Lutin, Cedric 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. - *##%*/ - -/* * - * IsisFish.java - * - * Created: 1 aout 2005 18:37:25 CEST - * - * @author Benjamin POUSSIN <poussin at codelutin.com> - * @version $Revision: 1312 $ - * - * Last update: $Date: 2008-08-28 10:21:07 +0200 (jeu, 28 aoû 2008) $ - * by : $Author: sletellier $ - */ - --> -<JPanel id='continuousPanelContainer' layout='{new BorderLayout()}'> - - <Boolean id='continuePossible' javaBean='true'/> - - <Boolean id='continueSelected' javaBean='false'/> - - <JPanel id='content' constraints='BorderLayout.CENTER'/> - -</JPanel> \ No newline at end of file Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/ContinuousPanelContainerUI.jaxx (from rev 2134, isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/ContinuousPanelContainer.jaxx) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/ContinuousPanelContainerUI.jaxx (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/ContinuousPanelContainerUI.jaxx 2009-04-24 15:57:15 UTC (rev 2145) @@ -0,0 +1,28 @@ +<!-- +/* *##% + * Copyright (C) 2005 - 2009 Ifremer, 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. + *##%*/ + --> +<JPanel id='continuousPanelContainer' layout='{new BorderLayout()}'> + + <Boolean id='continuePossible' javaBean='true'/> + + <Boolean id='continueSelected' javaBean='false'/> + + <JPanel id='content' constraints='BorderLayout.CENTER'/> + +</JPanel> \ No newline at end of file Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/DefaultContinuousPanel.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/DefaultContinuousPanel.jaxx 2009-04-24 15:56:19 UTC (rev 2144) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/DefaultContinuousPanel.jaxx 2009-04-24 15:57:15 UTC (rev 2145) @@ -1,94 +0,0 @@ -<!-- -/* *##% - * Copyright (C) 2005 - * Ifremer, Code Lutin, Cedric 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. - *##%*/ - -/* * - * IsisFish.java - * - * Created: 1 aout 2005 18:37:25 CEST - * - * @author Benjamin POUSSIN <poussin at codelutin.com> - * @version $Revision: 1312 $ - * - * Last update: $Date: 2008-08-28 10:21:07 +0200 (jeu, 28 aoû 2008) $ - * by : $Author: sletellier $ - */ - --> -<ContinuousPanelContainer> - <script><![CDATA[ - -protected JTextField continueMax = null; -protected JTextField continueMin = null; - -addPropertyChangeListener("continuePossible", new PropertyChangeListener(){ - - @Override - public void propertyChange(PropertyChangeEvent evt) { - continueMax.setVisible((Boolean)evt.getNewValue()); - continueMin.setVisible((Boolean)evt.getNewValue()); - } - -}); - -addPropertyChangeListener("continueSelected", new PropertyChangeListener(){ - - @Override - public void propertyChange(PropertyChangeEvent evt) { - continueMax.setEnabled((Boolean)evt.getNewValue()); - continueMin.setEnabled((Boolean)evt.getNewValue()); - } - -}); - -public void init(JTextField cMin, JTextField cMax){ - continueMax = cMax; - continueMin = cMin; - continueMax.setEnabled(isContinueSelected()); - continueMin.setEnabled(isContinueSelected()); - continueMax.setVisible(isContinuePossible()); - continueMin.setVisible(isContinuePossible()); - - continueMaxPanel.add(continueMax, BorderLayout.CENTER); - continueMinPanel.add(continueMin, BorderLayout.CENTER); -} -public String getMin(){ - return continueMin.getText(); -} -public String getMax(){ - return continueMax.getText(); -} - ]]> - </script> - <Table id='content' constraints='BorderLayout.CENTER'> - <row> - <cell fill='horizontal'> - <JLabel text='isisfish.factor.firstValue' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JPanel id='continueMinPanel' layout='{new BorderLayout()}'/> - </cell> - <cell fill='horizontal'> - <JLabel text='isisfish.factor.lastValue' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JPanel id='continueMaxPanel' layout='{new BorderLayout()}'/> - </cell> - </row> - </Table> -</ContinuousPanelContainer> \ No newline at end of file Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/DefaultContinuousPanelUI.jaxx (from rev 2134, isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/DefaultContinuousPanel.jaxx) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/DefaultContinuousPanelUI.jaxx (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/DefaultContinuousPanelUI.jaxx 2009-04-24 15:57:15 UTC (rev 2145) @@ -0,0 +1,81 @@ +<!-- +/* *##% + * Copyright (C) 2005 - 2009 Ifremer, 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. + *##%*/ + --> +<ContinuousPanelContainerUI> + <script><![CDATA[ + +protected JTextField continueMax = null; +protected JTextField continueMin = null; + +addPropertyChangeListener("continuePossible", new PropertyChangeListener(){ + + @Override + public void propertyChange(PropertyChangeEvent evt) { + continueMax.setVisible((Boolean)evt.getNewValue()); + continueMin.setVisible((Boolean)evt.getNewValue()); + } + +}); + +addPropertyChangeListener("continueSelected", new PropertyChangeListener(){ + + @Override + public void propertyChange(PropertyChangeEvent evt) { + continueMax.setEnabled((Boolean)evt.getNewValue()); + continueMin.setEnabled((Boolean)evt.getNewValue()); + } + +}); + +public void init(JTextField cMin, JTextField cMax){ + continueMax = cMax; + continueMin = cMin; + continueMax.setEnabled(isContinueSelected()); + continueMin.setEnabled(isContinueSelected()); + continueMax.setVisible(isContinuePossible()); + continueMin.setVisible(isContinuePossible()); + + continueMaxPanel.add(continueMax, BorderLayout.CENTER); + continueMinPanel.add(continueMin, BorderLayout.CENTER); +} +public String getMin(){ + return continueMin.getText(); +} +public String getMax(){ + return continueMax.getText(); +} + ]]> + </script> + <Table id='content' constraints='BorderLayout.CENTER'> + <row> + <cell fill='horizontal'> + <JLabel text='isisfish.factor.firstValue' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JPanel id='continueMinPanel' layout='{new BorderLayout()}'/> + </cell> + <cell fill='horizontal'> + <JLabel text='isisfish.factor.lastValue' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JPanel id='continueMaxPanel' layout='{new BorderLayout()}'/> + </cell> + </row> + </Table> +</ContinuousPanelContainerUI> \ No newline at end of file Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelper.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelper.java 2009-04-24 15:56:19 UTC (rev 2144) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EditorHelper.java 2009-04-24 15:57:15 UTC (rev 2145) @@ -199,14 +199,14 @@ } return result; } - public static ContinuousPanelContainer getContinuousPanel(JComponent c, TopiaEntity e){ - ContinuousPanelContainer result = null; + public static ContinuousPanelContainerUI getContinuousPanel(JComponent c, TopiaEntity e){ + ContinuousPanelContainerUI result = null; try { String fieldName = getMethod(c); - DefaultContinuousPanel continuousPanel = null; + DefaultContinuousPanelUI continuousPanel = null; if (c instanceof InputOneEquationUI){ InputOneEquationUI origine = (InputOneEquationUI) c; - EquationContinuousPanel ui = new EquationContinuousPanel(new JAXXInitialContext().add(new InputAction())); + EquationContinuousPanelUI ui = new EquationContinuousPanelUI(new JAXXInitialContext().add(new InputAction())); ui.setSelectedEquation(origine.getSelectedEquation()); ui.setLblText(origine.getLblText()); ui.setNameEquation(origine.getNameEquation()); @@ -216,14 +216,14 @@ ui.setBean(e); result = ui; } else if (c instanceof MatrixEditor){ - MatrixContinuousPanel matrixPanel = new MatrixContinuousPanel(); + MatrixContinuousPanelUI matrixPanel = new MatrixContinuousPanelUI(); MatrixND m = (MatrixND)callMethod(e, fieldName); if (m != null){ matrixPanel.setMatrix(m.clone()); } result = matrixPanel; } else { - continuousPanel = new DefaultContinuousPanel(); + continuousPanel = new DefaultContinuousPanelUI(); result = continuousPanel; } if (continuousPanel != null){ @@ -242,13 +242,13 @@ } return new JTextField(); } - public static ContinuousPanelContainer getContinuousPanelWithValue(JComponent c, ContinuousDomain domain, Factor f) { - ContinuousPanelContainer result = null; + public static ContinuousPanelContainerUI getContinuousPanelWithValue(JComponent c, ContinuousDomain domain, Factor f) { + ContinuousPanelContainerUI result = null; try { - DefaultContinuousPanel continuousPanel = null; + DefaultContinuousPanelUI continuousPanel = null; if (c instanceof InputOneEquationUI){ InputOneEquationUI origine = (InputOneEquationUI) c; - EquationContinuousPanel ui = new EquationContinuousPanel(new JAXXInitialContext().add(new InputAction())); + EquationContinuousPanelUI ui = new EquationContinuousPanelUI(new JAXXInitialContext().add(new InputAction())); ui.setLblText(origine.getLblText()); ui.setNameEquation(origine.getNameEquation()); ui.getEditor().getEditor().setText((String)f.getValue()); @@ -263,7 +263,7 @@ result = ui; } else if (c instanceof MatrixEditor){ - MatrixContinuousPanel panel = new MatrixContinuousPanel(); + MatrixContinuousPanelUI panel = new MatrixContinuousPanelUI(); MatrixContinuousDomain matrixDomain = (MatrixContinuousDomain)domain; MatrixND m = matrixDomain.getMatrix(); if (m != null){ @@ -273,7 +273,7 @@ panel.getCoef().setText("" + matrixDomain.getCoefficient()); result = panel; } else { - continuousPanel = new DefaultContinuousPanel(); + continuousPanel = new DefaultContinuousPanelUI(); result = continuousPanel; } if (continuousPanel != null){ @@ -537,8 +537,8 @@ } // RangeOfValue - public static ContinuousPanelContainer getContinuousRangeOfValuePanel(JComponent cOrigine, TopiaEntity bean){ - DefaultContinuousPanel continuousPanel = new DefaultContinuousPanel(); + public static ContinuousPanelContainerUI getContinuousRangeOfValuePanel(JComponent cOrigine, TopiaEntity bean){ + DefaultContinuousPanelUI continuousPanel = new DefaultContinuousPanelUI(); RangeOfValuesUI ui = (RangeOfValuesUI)cOrigine; String value = ui.getFieldGearParamPossibleValue().getText(); String min = "0"; Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanel.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanel.jaxx 2009-04-24 15:56:19 UTC (rev 2144) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanel.jaxx 2009-04-24 15:57:15 UTC (rev 2145) @@ -1,267 +0,0 @@ -<!-- -/* *##% - * Copyright (C) 2005 - * Ifremer, Code Lutin, Cedric 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. - *##%*/ - -/* * - * IsisFish.java - * - * Created: 1 aout 2005 18:37:25 CEST - * - * @author Benjamin POUSSIN <poussin at codelutin.com> - * @version $Revision: 1312 $ - * - * Last update: $Date: 2008-08-28 10:21:07 +0200 (jeu, 28 aoû 2008) $ - * by : $Author: sletellier $ - */ - --> -<ContinuousPanelContainer> - - <!-- bean property --> - <fr.ifremer.isisfish.entities.Formule id='formule' javaBean='null'/> - <String id='lblText' javaBean='null'/> - <org.codelutin.topia.persistence.TopiaEntity id='bean' javaBean='null'/> - <Class id='clazz' javaBean='null'/> - <String id='methodGet' javaBean='null'/> - <String id='methodSet' javaBean='null'/> - <String id='nameEquation' javaBean='null'/> - <fr.ifremer.isisfish.entities.Equation id='selectedEquation' javaBean='null'/> - - <script><![CDATA[ -import javax.swing.table.AbstractTableModel; -import javax.swing.table.DefaultTableModel; -import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; -import javax.swing.table.TableCellEditor; -import javax.swing.table.TableModel; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.apache.commons.lang.StringUtils; - -protected String[] columnNames = {"Name", "Value", "Coef (in %)", "Operator", "Action"}; -protected java.util.List<EquationContinuousDomain> datas = new ArrayList<EquationContinuousDomain>(); -protected java.util.List<JComboBox> operateurs = new ArrayList<JComboBox>(); -protected java.util.List<JButton> actions = new ArrayList<JButton>(); - -public java.util.List<EquationContinuousDomain> getDomains(){ - return datas; -} -public void setDomains(java.util.List<EquationContinuousDomain> domains){ - datas.clear(); - for (EquationContinuousDomain d : domains){ - addDomain(d); - } -} -public void addDomain(EquationContinuousDomain domain){ - newButton(); - datas.add(domain); -} -protected AbstractTableModel getTableModel(){ - AbstractTableModel model = new AbstractTableModel() { - - @Override - public int getRowCount() { - return datas.size(); - } - - @Override - public int getColumnCount() { - return columnNames.length; - } - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - return true; - } - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - if (columnIndex == 0){ - return datas.get(rowIndex).getVariableName(); - } else if (columnIndex == 1){ - return datas.get(rowIndex).getReferenceValue(); - } else if (columnIndex == 2){ - return datas.get(rowIndex).getCoefficient() == null ? 100 : datas.get(rowIndex).getCoefficient() * 100; - } else if (columnIndex == 3){ - return datas.get(rowIndex).getOperator(); - } else if (columnIndex == 4){ - return _("isisfish.factor.validDiscretNumber"); - } - return null; - } - - @Override - public void setValueAt(Object aValue, int rowIndex, int columnIndex) { - if (String.class.isInstance(aValue)){ - if (!((String)aValue).equals("")){ - if (columnIndex == 0){ - datas.get(rowIndex).setVariableName((String)aValue); - } else if (columnIndex == 1){ - datas.get(rowIndex).setReferenceValue(Double.parseDouble((String)aValue)); - } else if (columnIndex == 2){ - datas.get(rowIndex).setCoefficient(Double.parseDouble((String)aValue) / 100); - } else if (columnIndex == 3){ - datas.get(rowIndex).setOperator((String)aValue); - } - } - } - } - - @Override - public String getColumnName(int col) { - return columnNames[col].toString(); - } - - }; - return model; -} -protected JComboBox getOperateur(){ - JComboBox result = new JComboBox(); - result.addItem("+"); - result.addItem("-"); - result.addItem("*"); - result.addItem("/"); - operateurs.add(result); - result.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - JComboBox source = (JComboBox)e.getSource(); - int i = operateurs.indexOf(source); - if (datas.size() <= i){ - datas.get(i).setOperator((String)source.getSelectedItem()); - } - } - }); - return result; -} -protected void newButton(){ - JButton result = new JButton(); - result.setText(_("isisfish.factor.validDiscretNumber")); - actions.add(result); - result.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - JButton source = (JButton)e.getSource(); - int i = actions.indexOf(source); - valid(i); - } - }); -} -protected JButton getActionButton(int i){ - return actions.get(i); -} -protected void valid(int i) { - String variableName = datas.get(i).getVariableName(); - String[] lines = editor.getEditor().getText().split("\n"); - String result = ""; - for (String line : lines) { - Pattern p = Pattern.compile("(^.*\\s+" + variableName + "\\s*\\=\\s*)([\\d\\.]+).*\\;$"); - Matcher matcher = p.matcher(line); - if (matcher.find()) { - String fullVariableName = bean.toString() + "." + StringUtils.uncapitalize(methodGet) + "." + variableName; - line = matcher.group(1) + "context.getValueAndCompute(\"" + fullVariableName + "\", " + matcher.group(2) + ");"; - } - result += line + "\n"; - } - editor.getEditor().setText(result); -} -protected void setTable(){ - params.setModel(getTableModel()); - params.getColumnModel().getColumn(3).setCellEditor(new DefaultCellEditor(getOperateur())); - params.getColumnModel().getColumn(4).setCellEditor(new TableCellEditor() { - - @Override - public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { - return getActionButton(row); - } - - @Override - public Object getCellEditorValue() { - return null; - } - - @Override - public boolean isCellEditable(EventObject anEvent) { - return true; - } - - @Override - public boolean shouldSelectCell(EventObject anEvent) { - return true; - } - - @Override - public boolean stopCellEditing() { - return true; - } - - @Override - public void cancelCellEditing() { - } - - @Override - public void addCellEditorListener(CellEditorListener l) { - } - - @Override - public void removeCellEditorListener(CellEditorListener l) { - } - }); -} -protected void add(){ - datas.add(new EquationContinuousDomain()); - newButton(); - setTable(); -} -protected void remove(){ - int i = params.getSelectedRow(); - if (i != -1){ - datas.remove(i); - operateurs.remove(i); - actions.remove(i); - setTable(); - } -} - ]]> - </script> - <Table id='content' constraints='BorderLayout.CENTER'> - <row> - <cell fill='both' columns='2' weightx='1' weighty='0.5'> - <JScrollPane> - <JTable id='params' visible='{isContinuePossible()}' model='{getTableModel()}' enabled='{isContinueSelected()}'/> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.5'> - <JButton id='add' text='isisfish.common.add' visible='{isContinuePossible()}' enabled='{isContinueSelected()}' onActionPerformed='add()'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JButton id='remove' text='isisfish.common.remove' visible='{isContinuePossible()}' enabled='{isContinueSelected()}' onActionPerformed='remove()'/> - </cell> - </row> - <row> - <cell fill='both' columns='2' weightx='1' weighty='0.5'> - <fr.ifremer.isisfish.ui.input.InputOneEquationUI id='editor' formule='{getFormule()}' lblText='{getLblText()}' - constructorParams='this' bean='{getBean()}' clazz='{getClazz()}' methodGet='{getMethodGet()}' actif='{isContinueSelected()}' - methodSet='{getMethodSet()}' nameEquation='{getNameEquation()}' selectedEquation='{getSelectedEquation()}' - visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> - </cell> - </row> - </Table> -</ContinuousPanelContainer> \ No newline at end of file Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanelUI.jaxx (from rev 2134, isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanel.jaxx) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanelUI.jaxx (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/EquationContinuousPanelUI.jaxx 2009-04-24 15:57:15 UTC (rev 2145) @@ -0,0 +1,254 @@ +<!-- +/* *##% + * Copyright (C) 2005 - 2009 Ifremer, 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. + *##%*/ + --> +<ContinuousPanelContainerUI> + + <!-- bean property --> + <fr.ifremer.isisfish.entities.Formule id='formule' javaBean='null'/> + <String id='lblText' javaBean='null'/> + <org.codelutin.topia.persistence.TopiaEntity id='bean' javaBean='null'/> + <Class id='clazz' javaBean='null'/> + <String id='methodGet' javaBean='null'/> + <String id='methodSet' javaBean='null'/> + <String id='nameEquation' javaBean='null'/> + <fr.ifremer.isisfish.entities.Equation id='selectedEquation' javaBean='null'/> + + <script><![CDATA[ +import javax.swing.table.AbstractTableModel; +import javax.swing.table.DefaultTableModel; +import fr.ifremer.isisfish.simulator.sensitivity.domain.EquationContinuousDomain; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableModel; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.apache.commons.lang.StringUtils; + +protected String[] columnNames = {"Name", "Value", "Coef (in %)", "Operator", "Action"}; +protected java.util.List<EquationContinuousDomain> datas = new ArrayList<EquationContinuousDomain>(); +protected java.util.List<JComboBox> operateurs = new ArrayList<JComboBox>(); +protected java.util.List<JButton> actions = new ArrayList<JButton>(); + +public java.util.List<EquationContinuousDomain> getDomains(){ + return datas; +} +public void setDomains(java.util.List<EquationContinuousDomain> domains){ + datas.clear(); + for (EquationContinuousDomain d : domains){ + addDomain(d); + } +} +public void addDomain(EquationContinuousDomain domain){ + newButton(); + datas.add(domain); +} +protected AbstractTableModel getTableModel(){ + AbstractTableModel model = new AbstractTableModel() { + + @Override + public int getRowCount() { + return datas.size(); + } + + @Override + public int getColumnCount() { + return columnNames.length; + } + + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + return true; + } + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + if (columnIndex == 0){ + return datas.get(rowIndex).getVariableName(); + } else if (columnIndex == 1){ + return datas.get(rowIndex).getReferenceValue(); + } else if (columnIndex == 2){ + return datas.get(rowIndex).getCoefficient() == null ? 100 : datas.get(rowIndex).getCoefficient() * 100; + } else if (columnIndex == 3){ + return datas.get(rowIndex).getOperator(); + } else if (columnIndex == 4){ + return _("isisfish.factor.validDiscretNumber"); + } + return null; + } + + @Override + public void setValueAt(Object aValue, int rowIndex, int columnIndex) { + if (String.class.isInstance(aValue)){ + if (!((String)aValue).equals("")){ + if (columnIndex == 0){ + datas.get(rowIndex).setVariableName((String)aValue); + } else if (columnIndex == 1){ + datas.get(rowIndex).setReferenceValue(Double.parseDouble((String)aValue)); + } else if (columnIndex == 2){ + datas.get(rowIndex).setCoefficient(Double.parseDouble((String)aValue) / 100); + } else if (columnIndex == 3){ + datas.get(rowIndex).setOperator((String)aValue); + } + } + } + } + + @Override + public String getColumnName(int col) { + return columnNames[col].toString(); + } + + }; + return model; +} +protected JComboBox getOperateur(){ + JComboBox result = new JComboBox(); + result.addItem("+"); + result.addItem("-"); + result.addItem("*"); + result.addItem("/"); + operateurs.add(result); + result.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + JComboBox source = (JComboBox)e.getSource(); + int i = operateurs.indexOf(source); + if (datas.size() <= i){ + datas.get(i).setOperator((String)source.getSelectedItem()); + } + } + }); + return result; +} +protected void newButton(){ + JButton result = new JButton(); + result.setText(_("isisfish.factor.validDiscretNumber")); + actions.add(result); + result.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + JButton source = (JButton)e.getSource(); + int i = actions.indexOf(source); + valid(i); + } + }); +} +protected JButton getActionButton(int i){ + return actions.get(i); +} +protected void valid(int i) { + String variableName = datas.get(i).getVariableName(); + String[] lines = editor.getEditor().getText().split("\n"); + String result = ""; + for (String line : lines) { + Pattern p = Pattern.compile("(^.*\\s+" + variableName + "\\s*\\=\\s*)([\\d\\.]+).*\\;$"); + Matcher matcher = p.matcher(line); + if (matcher.find()) { + String fullVariableName = bean.toString() + "." + StringUtils.uncapitalize(methodGet) + "." + variableName; + line = matcher.group(1) + "context.getValueAndCompute(\"" + fullVariableName + "\", " + matcher.group(2) + ");"; + } + result += line + "\n"; + } + editor.getEditor().setText(result); +} +protected void setTable(){ + params.setModel(getTableModel()); + params.getColumnModel().getColumn(3).setCellEditor(new DefaultCellEditor(getOperateur())); + params.getColumnModel().getColumn(4).setCellEditor(new TableCellEditor() { + + @Override + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + return getActionButton(row); + } + + @Override + public Object getCellEditorValue() { + return null; + } + + @Override + public boolean isCellEditable(EventObject anEvent) { + return true; + } + + @Override + public boolean shouldSelectCell(EventObject anEvent) { + return true; + } + + @Override + public boolean stopCellEditing() { + return true; + } + + @Override + public void cancelCellEditing() { + } + + @Override + public void addCellEditorListener(CellEditorListener l) { + } + + @Override + public void removeCellEditorListener(CellEditorListener l) { + } + }); +} +protected void add(){ + datas.add(new EquationContinuousDomain()); + newButton(); + setTable(); +} +protected void remove(){ + int i = params.getSelectedRow(); + if (i != -1){ + datas.remove(i); + operateurs.remove(i); + actions.remove(i); + setTable(); + } +} + ]]> + </script> + <Table id='content' constraints='BorderLayout.CENTER'> + <row> + <cell fill='both' columns='2' weightx='1' weighty='0.5'> + <JScrollPane> + <JTable id='params' visible='{isContinuePossible()}' model='{getTableModel()}' enabled='{isContinueSelected()}'/> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.5'> + <JButton id='add' text='isisfish.common.add' visible='{isContinuePossible()}' enabled='{isContinueSelected()}' onActionPerformed='add()'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JButton id='remove' text='isisfish.common.remove' visible='{isContinuePossible()}' enabled='{isContinueSelected()}' onActionPerformed='remove()'/> + </cell> + </row> + <row> + <cell fill='both' columns='2' weightx='1' weighty='0.5'> + <fr.ifremer.isisfish.ui.input.InputOneEquationUI id='editor' formule='{getFormule()}' lblText='{getLblText()}' + constructorParams='this' bean='{getBean()}' clazz='{getClazz()}' methodGet='{getMethodGet()}' actif='{isContinueSelected()}' + methodSet='{getMethodSet()}' nameEquation='{getNameEquation()}' selectedEquation='{getSelectedEquation()}' + visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> + </cell> + </row> + </Table> +</ContinuousPanelContainerUI> \ No newline at end of file Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorAction.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorAction.java 2009-04-24 15:56:19 UTC (rev 2144) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorAction.java 2009-04-24 15:57:15 UTC (rev 2145) @@ -44,18 +44,18 @@ /** to use log facility, just put in your code: log.info(\"...\"); */ private static Log log = LogFactory.getLog(SimulAction.class); - public static void saveContinue(JComponent cOrigine, String name, String comment, String path, ContinuousPanelContainer panel, SimulAction action, boolean exist){ - DefaultContinuousPanel defaultPanel = null; - if (MatrixContinuousPanel.class.isInstance(panel)){ - MatrixContinuousPanel matrixPanel = (MatrixContinuousPanel)panel; + public static void saveContinue(JComponent cOrigine, String name, String comment, String path, ContinuousPanelContainerUI panel, SimulAction action, boolean exist){ + DefaultContinuousPanelUI defaultPanel = null; + if (MatrixContinuousPanelUI.class.isInstance(panel)){ + MatrixContinuousPanelUI matrixPanel = (MatrixContinuousPanelUI)panel; Double coef = Double.valueOf(matrixPanel.getCoef().getText()); MatrixND matrix = matrixPanel.getMatrix(); String operateur = (String)matrixPanel.getOperator().getSelectedItem(); action.addContinuousMatrixFactor(name, comment, path, coef, matrix, operateur, cOrigine, exist); - } else if (EquationContinuousPanel.class.isInstance(panel)){ + } else if (EquationContinuousPanelUI.class.isInstance(panel)){ try { - EquationContinuousPanel equationPanel = (EquationContinuousPanel) panel; + EquationContinuousPanelUI equationPanel = (EquationContinuousPanelUI) panel; TopiaEntity bean = equationPanel.getBean(); String methodSet = equationPanel.getMethodSet(); @@ -80,15 +80,15 @@ log.error("Can't call method : ", ex); } } - } else if (DefaultContinuousPanel.class.isInstance(panel)){ - defaultPanel = (DefaultContinuousPanel)panel; + } else if (DefaultContinuousPanelUI.class.isInstance(panel)){ + defaultPanel = (DefaultContinuousPanelUI)panel; action.addContinuousFactor(name, comment, path, getMin(defaultPanel), getMax(defaultPanel), cOrigine, exist); } } - protected static Double getMin(DefaultContinuousPanel defaultPanel){ + protected static Double getMin(DefaultContinuousPanelUI defaultPanel){ return Double.parseDouble(defaultPanel.getMin()); } - protected static Double getMax(DefaultContinuousPanel defaultPanel){ + protected static Double getMax(DefaultContinuousPanelUI defaultPanel){ return Double.parseDouble(defaultPanel.getMax()); } public static void saveDiscret(JComponent cOrigine, String name, String comment, String path, List<JComponent> components, SimulAction action, boolean exist){ Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeCellRenderer.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeCellRenderer.java 2009-04-24 15:56:19 UTC (rev 2144) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorTreeCellRenderer.java 2009-04-24 15:57:15 UTC (rev 2145) @@ -37,6 +37,8 @@ * * Last update : $Date: 9 mars 2009 $ * By : $Author: chatellier $ + * + * TODO extends AbstractTreeCellRenderer and remove DefaultMutableTreeNode reference */ public class FactorTreeCellRenderer extends DefaultTreeCellRenderer { Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizard.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizard.jaxx 2009-04-24 15:56:19 UTC (rev 2144) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizard.jaxx 2009-04-24 15:57:15 UTC (rev 2145) @@ -1,267 +0,0 @@ -<!-- -/* *##% - * Copyright (C) 2005 - 2009 Ifremer, 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. - *##%*/ --> -<JDialog id="FactorTypeChooser" title='isisfish.factor.title' modal='{true}' layout='{new BorderLayout()}'> - - <Boolean id='continuePossible' javaBean='true'/> - - <Boolean id='continueSelected' javaBean='false'/> - - <Boolean id='saveEnabled' javaBean='false'/> - - <Boolean id='existingValue' javaBean='false'/> - - <script><![CDATA[ -import org.apache.commons.lang.StringUtils; -import org.codelutin.topia.persistence.TopiaEntity; -import fr.ifremer.isisfish.ui.simulator.SimulAction; -import fr.ifremer.isisfish.ui.input.InputSaveVerifier; -import fr.ifremer.isisfish.simulator.sensitivity.Factor; -import fr.ifremer.isisfish.simulator.sensitivity.Domain; -import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; -import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; - -protected JComponent cOrigine = null; -protected TopiaEntity bean = null; -protected java.util.List<JComponent> discretComponents = new ArrayList<JComponent>(); -protected String path = null; -protected ContinuousPanelContainer continuousPanel = null; -protected Factor factor = null; - -addPropertyChangeListener("continuePossible", new PropertyChangeListener(){ - - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (continuousPanel != null){ - continuousPanel.setContinuePossible((Boolean)evt.getNewValue()); - } - } - -}); - -addPropertyChangeListener("continueSelected", new PropertyChangeListener(){ - - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (continuousPanel != null){ - continuousPanel.setContinueSelected((Boolean)evt.getNewValue()); - } - } - -}); - -public void initNew(JComponent c, TopiaEntity be, Boolean b){ - this.bean = be; - this.cOrigine = c; - - // path is topiaId#property - // ex : fwn#fsd#0.3425345#name - // for JAXX : cOrigine start with upper case - // for commons beanutils : must be lower case - String methodName = StringUtils.uncapitalize(EditorHelper.getMethod(cOrigine)); - this.path = bean.getTopiaId() + "#" + methodName; - - factorName.setText(bean.toString() + "." + methodName); - setContinuePossible(b); - boolean selected = EditorHelper.isContinue(cOrigine); - setContinueSelected(selected); - continueRadion.setSelected(selected); - if (isContinuePossible()){ - if (EditorHelper.isRangeOfValue(cOrigine)){ - continuousPanel = EditorHelper.getContinuousRangeOfValuePanel(cOrigine, bean); - } - else { - continuousPanel = EditorHelper.getContinuousPanel(cOrigine, bean); - } - init(); - } - if (!isContinueSelected() && EditorHelper.isRangeOfValue(cOrigine)){ - int i = 0; - for (String s : EditorHelper.getDiscretRangeOfValueValues(cOrigine, bean)){ - JTextField text = new JTextField(s); - discretComponents.add(text); - tabPane.add(text, "Factor " + (i+1)); - i++; - } - } - if (continuousPanel != null){ - continuousPanel.setContinueSelected(selected); - } - setContinueSelected(EditorHelper.isContinue(cOrigine)); - setSaveEnabled(!factorName.getText().equals("")); -} - -public void initExisting(JComponent cOrigine, Factor f){ - setExistingValue(true); - this.cOrigine = cOrigine; - this.path = f.getPath(); - factorName.setText(f.getName()); - comment.setText(f.getComment()); - Domain domain = f.getDomain(); - this.factor = f; - - if (ContinuousDomain.class.isInstance(domain)){ - ContinuousDomain cDomain = (ContinuousDomain) domain; - - continuousPanel = EditorHelper.getContinuousPanelWithValue(cOrigine, cDomain, f); - init(); - - continueRadion.setSelected(true); - setContinueSelected(true); - setContinuePossible(true); - }else{ - DiscreteDomain dDomain = (DiscreteDomain)domain; - - int nb = dDomain.getValues().size(); - discretNumber.setText(nb + ""); - - discretComponents.clear(); - tabPane.removeAll(); - - SortedMap values = dDomain.getValues(); - int i = 0; - Object cache = null; - for (Object o : values.values()) { - i++; - cache = o; - JComponent c = null; - if (o != null){ - c = EditorHelper.getEditorWithValue(cOrigine, o); - } - else { - c = EditorHelper.getEditorWithValue(cOrigine); - } - discretComponents.add(c); - JScrollPane js = new JScrollPane(c); - tabPane.addTab("Factor " + i, js); - } - setContinuePossible(EditorHelper.canBeContinue(cOrigine, cache)); - - this.pack(); - } - setSaveEnabled(!factorName.getText().equals("")); -} -protected void init(){ - continuousPanelContainer.add(continuousPanel, BorderLayout.CENTER); - this.pack(); -} -protected JComponent getNewComponent(){ - return EditorHelper.getEditor(cOrigine, bean); -} -protected void addTabs(String sNbTab){ - int nbTab = Integer.parseInt(sNbTab); - discretComponents.clear(); - tabPane.removeAll(); - for (int i=0;i<nbTab;i++){ - JComponent c = getNewComponent(); - discretComponents.add(c); - JScrollPane js = new JScrollPane(c); - tabPane.addTab("Factor " + (i+1), js); - } - this.pack(); -} -protected FactorAction getFactorAction(){ - return getContextValue(FactorAction.class); -} -protected SimulAction getSimulAction(){ - return getContextValue(SimulAction.class); -} -protected void save(){ - if (continueRadion.isSelected()){ - getFactorAction().saveContinue(cOrigine, factorName.getText(), comment.getText(), path, continuousPanel, getSimulAction(), isExistingValue()); - } else { - getFactorAction().saveDiscret(cOrigine, factorName.getText(), comment.getText(), path, discretComponents, getSimulAction(), isExistingValue()); - } - getContextValue(InputSaveVerifier.class).getSensPanel().setFactorModel(); - exit(); -} -protected void remove(){ - getSimulAction().removeFactor(factor); - getContextValue(InputSaveVerifier.class).getSensPanel().setFactorModel(); - exit(); -} -protected void exit(){ - this.dispose(); -} - ]]> - </script> - <Table constraints='BorderLayout.CENTER'> - <row> - <cell columns='1' fill='horizontal'> - <JLabel text='isisfish.factor.name'/> - </cell> - <cell columns='3' fill='horizontal' weightx='1'> - <JTextField id='factorName' onKeyReleased='setSaveEnabled(!factorName.getText().equals(""))'/> - </cell> - </row> - <row> - <cell columns='4' fill='horizontal' weightx='1'> - <JRadioButton id='continueRadion' text='isisfish.factor.continue' buttonGroup='factorType' visible='{isContinuePossible()}' selected='{false}' onActionPerformed='setContinueSelected(continueRadion.isSelected())'/> - </cell> - </row> - <row> - <cell fill='both' columns='4' weightx='1' weighty='0.5'> - <JPanel id='continuousPanelContainer' layout='{new BorderLayout()}'/> - </cell> - </row> - <row> - <cell columns='4' fill='horizontal' weightx='1'> - <JRadioButton id='discret' text='isisfish.factor.discret' selected='{true}' buttonGroup='factorType' onActionPerformed='setContinueSelected(continueRadion.isSelected())'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JLabel text='isisfish.factor.selectDiscretNumber' enabled='{!isContinueSelected()}'/> - </cell> - <cell fill='horizontal' weightx='0.5'> - <JTextField id='discretNumber' enabled='{!isContinueSelected()}'/> - </cell> - <cell columns='2' fill='horizontal' weightx='0.5'> - <JButton text='isisfish.factor.validDiscretNumber' enabled='{!isContinueSelected()}' onActionPerformed='addTabs(discretNumber.getText())'/> - </cell> - </row> - <row> - <cell columns='4' fill='both' weightx='1' weighty='0.3'> - <JTabbedPane id='tabPane' visible='{!isContinueSelected()}' enabled='{!isContinueSelected()}'/> - </cell> - </row> - <row> - <cell columns='4' fill='horizontal'> - <JLabel text='isisfish.factor.comment'/> - </cell> - </row> - <row> - <cell columns='4' fill='both' weightx='1' weighty='0.3'> - <JScrollPane> - <JTextArea id='comment'/> - </JScrollPane> - </cell> - </row> - <row> - <cell fill='horizontal' weightx='0.25'> - <JButton id='cancel' text='isisfish.common.cancel' onActionPerformed='exit()'/> - </cell> - <cell fill='horizontal' weightx='0.25'> - <JButton id='remove' text='isisfish.common.remove' visible='{isExistingValue()}' onActionPerformed='remove()'/> - </cell> - <cell columns='2' fill='horizontal' weightx='0.5'> - <JButton id='save' text='isisfish.common.save' enabled='{isSaveEnabled()}' onActionPerformed='save()'/> - </cell> - </row> - </Table> -</JDialog> \ No newline at end of file Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizardUI.jaxx (from rev 2134, isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizard.jaxx) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizardUI.jaxx (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/FactorWizardUI.jaxx 2009-04-24 15:57:15 UTC (rev 2145) @@ -0,0 +1,267 @@ +<!-- +/* *##% + * Copyright (C) 2005 - 2009 Ifremer, 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. + *##%*/ --> +<JDialog id="FactorTypeChooser" title='isisfish.factor.title' modal='{true}' layout='{new BorderLayout()}'> + + <Boolean id='continuePossible' javaBean='true'/> + + <Boolean id='continueSelected' javaBean='false'/> + + <Boolean id='saveEnabled' javaBean='false'/> + + <Boolean id='existingValue' javaBean='false'/> + + <script><![CDATA[ +import org.apache.commons.lang.StringUtils; +import org.codelutin.topia.persistence.TopiaEntity; +import fr.ifremer.isisfish.ui.simulator.SimulAction; +import fr.ifremer.isisfish.ui.input.InputSaveVerifier; +import fr.ifremer.isisfish.simulator.sensitivity.Factor; +import fr.ifremer.isisfish.simulator.sensitivity.Domain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.ContinuousDomain; +import fr.ifremer.isisfish.simulator.sensitivity.domain.DiscreteDomain; + +protected JComponent cOrigine = null; +protected TopiaEntity bean = null; +protected java.util.List<JComponent> discretComponents = new ArrayList<JComponent>(); +protected String path = null; +protected ContinuousPanelContainerUI continuousPanel = null; +protected Factor factor = null; + +addPropertyChangeListener("continuePossible", new PropertyChangeListener(){ + + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (continuousPanel != null){ + continuousPanel.setContinuePossible((Boolean)evt.getNewValue()); + } + } + +}); + +addPropertyChangeListener("continueSelected", new PropertyChangeListener(){ + + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (continuousPanel != null){ + continuousPanel.setContinueSelected((Boolean)evt.getNewValue()); + } + } + +}); + +public void initNew(JComponent c, TopiaEntity be, Boolean b){ + this.bean = be; + this.cOrigine = c; + + // path is topiaId#property + // ex : fwn#fsd#0.3425345#name + // for JAXX : cOrigine start with upper case + // for commons beanutils : must be lower case + String methodName = StringUtils.uncapitalize(EditorHelper.getMethod(cOrigine)); + this.path = bean.getTopiaId() + "#" + methodName; + + factorName.setText(bean.toString() + "." + methodName); + setContinuePossible(b); + boolean selected = EditorHelper.isContinue(cOrigine); + setContinueSelected(selected); + continueRadion.setSelected(selected); + if (isContinuePossible()){ + if (EditorHelper.isRangeOfValue(cOrigine)){ + continuousPanel = EditorHelper.getContinuousRangeOfValuePanel(cOrigine, bean); + } + else { + continuousPanel = EditorHelper.getContinuousPanel(cOrigine, bean); + } + init(); + } + if (!isContinueSelected() && EditorHelper.isRangeOfValue(cOrigine)){ + int i = 0; + for (String s : EditorHelper.getDiscretRangeOfValueValues(cOrigine, bean)){ + JTextField text = new JTextField(s); + discretComponents.add(text); + tabPane.add(text, "Factor " + (i+1)); + i++; + } + } + if (continuousPanel != null){ + continuousPanel.setContinueSelected(selected); + } + setContinueSelected(EditorHelper.isContinue(cOrigine)); + setSaveEnabled(!factorName.getText().equals("")); +} + +public void initExisting(JComponent cOrigine, Factor f){ + setExistingValue(true); + this.cOrigine = cOrigine; + this.path = f.getPath(); + factorName.setText(f.getName()); + comment.setText(f.getComment()); + Domain domain = f.getDomain(); + this.factor = f; + + if (ContinuousDomain.class.isInstance(domain)){ + ContinuousDomain cDomain = (ContinuousDomain) domain; + + continuousPanel = EditorHelper.getContinuousPanelWithValue(cOrigine, cDomain, f); + init(); + + continueRadion.setSelected(true); + setContinueSelected(true); + setContinuePossible(true); + }else{ + DiscreteDomain dDomain = (DiscreteDomain)domain; + + int nb = dDomain.getValues().size(); + discretNumber.setText(nb + ""); + + discretComponents.clear(); + tabPane.removeAll(); + + SortedMap values = dDomain.getValues(); + int i = 0; + Object cache = null; + for (Object o : values.values()) { + i++; + cache = o; + JComponent c = null; + if (o != null){ + c = EditorHelper.getEditorWithValue(cOrigine, o); + } + else { + c = EditorHelper.getEditorWithValue(cOrigine); + } + discretComponents.add(c); + JScrollPane js = new JScrollPane(c); + tabPane.addTab("Factor " + i, js); + } + setContinuePossible(EditorHelper.canBeContinue(cOrigine, cache)); + + this.pack(); + } + setSaveEnabled(!factorName.getText().equals("")); +} +protected void init(){ + continuousPanelContainer.add(continuousPanel, BorderLayout.CENTER); + this.pack(); +} +protected JComponent getNewComponent(){ + return EditorHelper.getEditor(cOrigine, bean); +} +protected void addTabs(String sNbTab){ + int nbTab = Integer.parseInt(sNbTab); + discretComponents.clear(); + tabPane.removeAll(); + for (int i=0;i<nbTab;i++){ + JComponent c = getNewComponent(); + discretComponents.add(c); + JScrollPane js = new JScrollPane(c); + tabPane.addTab("Factor " + (i+1), js); + } + this.pack(); +} +protected FactorAction getFactorAction(){ + return getContextValue(FactorAction.class); +} +protected SimulAction getSimulAction(){ + return getContextValue(SimulAction.class); +} +protected void save(){ + if (continueRadion.isSelected()){ + getFactorAction().saveContinue(cOrigine, factorName.getText(), comment.getText(), path, continuousPanel, getSimulAction(), isExistingValue()); + } else { + getFactorAction().saveDiscret(cOrigine, factorName.getText(), comment.getText(), path, discretComponents, getSimulAction(), isExistingValue()); + } + getContextValue(InputSaveVerifier.class).getSensPanel().setFactorModel(); + exit(); +} +protected void remove(){ + getSimulAction().removeFactor(factor); + getContextValue(InputSaveVerifier.class).getSensPanel().setFactorModel(); + exit(); +} +protected void exit(){ + this.dispose(); +} + ]]> + </script> + <Table constraints='BorderLayout.CENTER'> + <row> + <cell columns='1' fill='horizontal'> + <JLabel text='isisfish.factor.name'/> + </cell> + <cell columns='3' fill='horizontal' weightx='1'> + <JTextField id='factorName' onKeyReleased='setSaveEnabled(!factorName.getText().equals(""))'/> + </cell> + </row> + <row> + <cell columns='4' fill='horizontal' weightx='1'> + <JRadioButton id='continueRadion' text='isisfish.factor.continue' buttonGroup='factorType' visible='{isContinuePossible()}' selected='{false}' onActionPerformed='setContinueSelected(continueRadion.isSelected())'/> + </cell> + </row> + <row> + <cell fill='both' columns='4' weightx='1' weighty='0.5'> + <JPanel id='continuousPanelContainer' layout='{new BorderLayout()}'/> + </cell> + </row> + <row> + <cell columns='4' fill='horizontal' weightx='1'> + <JRadioButton id='discret' text='isisfish.factor.discret' selected='{true}' buttonGroup='factorType' onActionPerformed='setContinueSelected(continueRadion.isSelected())'/> + </cell> + </row> + <row> + <cell fill='horizontal'> + <JLabel text='isisfish.factor.selectDiscretNumber' enabled='{!isContinueSelected()}'/> + </cell> + <cell fill='horizontal' weightx='0.5'> + <JTextField id='discretNumber' enabled='{!isContinueSelected()}'/> + </cell> + <cell columns='2' fill='horizontal' weightx='0.5'> + <JButton text='isisfish.factor.validDiscretNumber' enabled='{!isContinueSelected()}' onActionPerformed='addTabs(discretNumber.getText())'/> + </cell> + </row> + <row> + <cell columns='4' fill='both' weightx='1' weighty='0.3'> + <JTabbedPane id='tabPane' visible='{!isContinueSelected()}' enabled='{!isContinueSelected()}'/> + </cell> + </row> + <row> + <cell columns='4' fill='horizontal'> + <JLabel text='isisfish.factor.comment'/> + </cell> + </row> + <row> + <cell columns='4' fill='both' weightx='1' weighty='0.3'> + <JScrollPane> + <JTextArea id='comment'/> + </JScrollPane> + </cell> + </row> + <row> + <cell fill='horizontal' weightx='0.25'> + <JButton id='cancel' text='isisfish.common.cancel' onActionPerformed='exit()'/> + </cell> + <cell fill='horizontal' weightx='0.25'> + <JButton id='remove' text='isisfish.common.remove' visible='{isExistingValue()}' onActionPerformed='remove()'/> + </cell> + <cell columns='2' fill='horizontal' weightx='0.5'> + <JButton id='save' text='isisfish.common.save' enabled='{isSaveEnabled()}' onActionPerformed='save()'/> + </cell> + </row> + </Table> +</JDialog> \ No newline at end of file Deleted: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanel.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanel.jaxx 2009-04-24 15:56:19 UTC (rev 2144) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanel.jaxx 2009-04-24 15:57:15 UTC (rev 2145) @@ -1,75 +0,0 @@ -<!-- -/* *##% - * Copyright (C) 2005 - * Ifremer, Code Lutin, Cedric 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. - *##%*/ - -/* * - * IsisFish.java - * - * Created: 1 aout 2005 18:37:25 CEST - * - * @author Benjamin POUSSIN <poussin at codelutin.com> - * @version $Revision: 1312 $ - * - * Last update: $Date: 2008-08-28 10:21:07 +0200 (jeu, 28 aoû 2008) $ - * by : $Author: sletellier $ - */ - --> -<ContinuousPanelContainer> - - <org.codelutin.math.matrix.MatrixND id='matrix' javaBean='null'/> - - <script><![CDATA[ -import org.codelutin.math.matrix.MatrixND; -import org.codelutin.math.matrix.gui.JAXXMatrixEditor; - ]]> - </script> - <Table id='content' constraints='BorderLayout.CENTER'> - <row> - <cell fill='horizontal'> - <JLabel text='isisfish.factor.value' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> - </cell> - <cell fill='both' weightx='1' weighty='1'> - <!--JScrollPane--> - <JAXXMatrixEditor id='componentPanel' dimensionEdit='{false}' matrix='{getMatrix() == null ? null : getMatrix().clone()}' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> - <!--/JScrollPane--> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JLabel text='isisfish.factor.coefficient' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> - </cell> - <cell fill='both' columns='2' weightx='1' weighty='1'> - <JTextField id='coef' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> - </cell> - </row> - <row> - <cell fill='horizontal'> - <JLabel text='isisfish.factor.operateur' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> - </cell> - <cell fill='horizontal' weightx='1' columns='3'> - <JComboBox id='operator' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'> - <item id='plus' value="+"/> - <item id='moins' value="-"/> - <item id='mult' value="*"/> - <item id='div' value="/"/> - </JComboBox> - </cell> - </row> - </Table> -</ContinuousPanelContainer> \ No newline at end of file Copied: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanelUI.jaxx (from rev 2134, isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanel.jaxx) =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanelUI.jaxx (rev 0) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/MatrixContinuousPanelUI.jaxx 2009-04-24 15:57:15 UTC (rev 2145) @@ -0,0 +1,62 @@ +<!-- +/* *##% + * Copyright (C) 2005 - 2009 Ifremer, 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. + *##%*/ + --> +<ContinuousPanelContainerUI> + + <org.codelutin.math.matrix.MatrixND id='matrix' javaBean='null'/> + + <script><![CDATA[ +import org.codelutin.math.matrix.MatrixND; +import org.codelutin.math.matrix.gui.JAXXMatrixEditor; + ]]> + </script> + <Table id='content' constraints='BorderLayout.CENTER'> + <row> + <cell fill='horizontal'> + <JLabel text='isisfish.factor.value' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> + </cell> + <cell fill='both' weightx='1' weighty='1'> + <!--JScrollPane--> + <JAXXMatrixEditor id='componentPanel' dimensionEdit='{false}' matrix='{getMatrix() == null ? null : getMatrix().clone()}' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> + <!--/JScrollPane--> + </cell> + </row> + <row> + <cell fill='horizontal'> + <JLabel text='isisfish.factor.coefficient' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> + </cell> + <cell fill='both' columns='2' weightx='1' weighty='1'> + <JTextField id='coef' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> + </cell> + </row> + <row> + <cell fill='horizontal'> + <JLabel text='isisfish.factor.operateur' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'/> + </cell> + <cell fill='horizontal' weightx='1' columns='3'> + <JComboBox id='operator' visible='{isContinuePossible()}' enabled='{isContinueSelected()}'> + <item id='plus' value="+"/> + <item id='moins' value="-"/> + <item id='mult' value="*"/> + <item id='div' value="/"/> + </JComboBox> + </cell> + </row> + </Table> +</ContinuousPanelContainerUI> \ No newline at end of file Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx 2009-04-24 15:56:19 UTC (rev 2144) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivityChooserUI.jaxx 2009-04-24 15:57:15 UTC (rev 2145) @@ -15,7 +15,8 @@ * 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. - *##%*/ --> + *##%*/ +--> <Table> <script><![CDATA[ import javax.swing.table.DefaultTableModel; Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivitySecondPassUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivitySecondPassUI.jaxx 2009-04-24 15:56:19 UTC (rev 2144) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/sensitivity/SensitivitySecondPassUI.jaxx 2009-04-24 15:57:15 UTC (rev 2145) @@ -16,16 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *##%*/ - -/* * - * SensitivitySecondPassUI. - * - * @author chatellier - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ - */ --> <Table> <script><![CDATA[