Author: chatellier Date: 2009-05-29 13:32:33 +0000 (Fri, 29 May 2009) New Revision: 2292 Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx Log: Ajout d'une bordure avec les noms des mois pour les strategies Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2009-05-28 17:24:56 UTC (rev 2291) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyMonthInfoUI.jaxx 2009-05-29 13:32:33 UTC (rev 2292) @@ -1,7 +1,6 @@ <!-- /* *##% - * Copyright (C) 2005 - * Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin + * 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 @@ -17,24 +16,12 @@ * 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 $ - */ --> <fr.ifremer.isisfish.ui.input.InputContentUI> <script><![CDATA[ -import fr.ifremer.isisfish.types.Month; +import org.apache.commons.lang.StringUtils; public void refresh() { getVerifier().setSaveButton(save); @@ -51,60 +38,69 @@ strategyOctober.init(9); strategyNovember.init(10); strategyDecember.init(11); - getVerifier().addCurrentPanel(strategyJanuary, strategyFebuary, strategyMarch, strategyApril, strategyMay, strategyJune, strategyJuly, strategyAugust, strategySeptember, strategyOctober, strategyNovember, strategyDecember); + getVerifier().addCurrentPanel(strategyJanuary, strategyFebuary, strategyMarch, + strategyApril, strategyMay, strategyJune, + strategyJuly, strategyAugust, strategySeptember, + strategyOctober, strategyNovember, strategyDecember); } ]]></script> <JPanel id='body' layout='{new BorderLayout()}'> <Table constraints='BorderLayout.CENTER'> <row> - <cell fill='both' weightx='0.25' weighty='0.3'> - <StrategyOneMonthInfoUI id='strategyJanuary' constructorParams='this'/> + <cell fill='both' weightx='0.25' weighty='0.3' insets='0'> + <StrategyOneMonthInfoUI id='strategyJanuary' constructorParams='this' + border='{BorderFactory.createTitledBorder(StringUtils.capitalize(_("isisfish.month.january")))}' /> </cell> - <cell fill='both' weightx='0.25' weighty='0.3'> - <StrategyOneMonthInfoUI id='strategyFebuary' constructorParams='this'/> + <cell fill='both' weightx='0.25' weighty='0.3' insets='0'> + <StrategyOneMonthInfoUI id='strategyFebuary' constructorParams='this' + border='{BorderFactory.createTitledBorder(StringUtils.capitalize(_("isisfish.month.february")))}' /> </cell> - <cell fill='both' weightx='0.25' weighty='0.3'> - <StrategyOneMonthInfoUI id='strategyMarch' constructorParams='this'/> + <cell fill='both' weightx='0.25' weighty='0.3' insets='0'> + <StrategyOneMonthInfoUI id='strategyMarch' constructorParams='this' + border='{BorderFactory.createTitledBorder(StringUtils.capitalize(_("isisfish.month.march")))}' /> </cell> - <cell fill='both' weightx='0.25' weighty='0.3'> - <StrategyOneMonthInfoUI id='strategyApril' constructorParams='this'/> + <cell fill='both' weightx='0.25' weighty='0.3' insets='0'> + <StrategyOneMonthInfoUI id='strategyApril' constructorParams='this' + border='{BorderFactory.createTitledBorder(StringUtils.capitalize(_("isisfish.month.april")))}' /> </cell> </row> <row> - <cell fill='both' weightx='0.25' weighty='0.3'> - <StrategyOneMonthInfoUI id='strategyMay' constructorParams='this'/> + <cell fill='both' weightx='0.25' weighty='0.3' insets='0'> + <StrategyOneMonthInfoUI id='strategyMay' constructorParams='this' + border='{BorderFactory.createTitledBorder(StringUtils.capitalize(_("isisfish.month.may")))}' /> </cell> - <cell fill='both' weightx='0.25' weighty='0.3'> - <StrategyOneMonthInfoUI id='strategyJune' constructorParams='this'/> + <cell fill='both' weightx='0.25' weighty='0.3' insets='0'> + <StrategyOneMonthInfoUI id='strategyJune' constructorParams='this' + border='{BorderFactory.createTitledBorder(StringUtils.capitalize(_("isisfish.month.june")))}' /> </cell> - <cell fill='both' weightx='0.25' weighty='0.3'> - <StrategyOneMonthInfoUI id='strategyJuly' constructorParams='this'/> + <cell fill='both' weightx='0.25' weighty='0.3' insets='0'> + <StrategyOneMonthInfoUI id='strategyJuly' constructorParams='this' + border='{BorderFactory.createTitledBorder(StringUtils.capitalize(_("isisfish.month.july")))}' /> </cell> - <cell fill='both' weightx='0.25' weighty='0.3'> - <StrategyOneMonthInfoUI id='strategyAugust' constructorParams='this'/> + <cell fill='both' weightx='0.25' weighty='0.3' insets='0'> + <StrategyOneMonthInfoUI id='strategyAugust' constructorParams='this' + border='{BorderFactory.createTitledBorder(StringUtils.capitalize(_("isisfish.month.august")))}' /> </cell> </row> <row> - <cell fill='both' weightx='0.25' weighty='0.3'> - <StrategyOneMonthInfoUI id='strategySeptember' constructorParams='this'/> + <cell fill='both' weightx='0.25' weighty='0.3' insets='0'> + <StrategyOneMonthInfoUI id='strategySeptember' constructorParams='this' + border='{BorderFactory.createTitledBorder(StringUtils.capitalize(_("isisfish.month.september")))}' /> </cell> - <cell fill='both' weightx='0.25' weighty='0.3'> - <StrategyOneMonthInfoUI id='strategyOctober' constructorParams='this'/> + <cell fill='both' weightx='0.25' weighty='0.3' insets='0'> + <StrategyOneMonthInfoUI id='strategyOctober' constructorParams='this' + border='{BorderFactory.createTitledBorder(StringUtils.capitalize(_("isisfish.month.october")))}' /> </cell> - <cell fill='both' weightx='0.25' weighty='0.3'> - <StrategyOneMonthInfoUI id='strategyNovember' constructorParams='this'/> + <cell fill='both' weightx='0.25' weighty='0.3' insets='0'> + <StrategyOneMonthInfoUI id='strategyNovember' constructorParams='this' + border='{BorderFactory.createTitledBorder(StringUtils.capitalize(_("isisfish.month.november")))}' /> </cell> - <cell fill='both' weightx='0.25' weighty='0.3'> - <StrategyOneMonthInfoUI id='strategyDecember' constructorParams='this'/> + <cell fill='both' weightx='0.25' weighty='0.3' insets='0'> + <StrategyOneMonthInfoUI id='strategyDecember' constructorParams='this' + border='{BorderFactory.createTitledBorder(StringUtils.capitalize(_("isisfish.month.december")))}' /> </cell> </row> </Table> - - <!-- - | - | Button action - | - +--> <Table constraints='BorderLayout.SOUTH'> <row> <cell fill='horizontal' weightx='0.5'> Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2009-05-28 17:24:56 UTC (rev 2291) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/ui/input/StrategyOneMonthInfoUI.jaxx 2009-05-29 13:32:33 UTC (rev 2292) @@ -1,7 +1,6 @@ <!-- /* *##% - * Copyright (C) 2005 - * Ifremer, Code Lutin, Cedric Pineau, Benjamin Poussin + * 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 @@ -17,21 +16,8 @@ * 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 $ - */ --> - <fr.ifremer.isisfish.ui.input.InputContentUI> <!-- bean property --> @@ -40,38 +26,32 @@ <fr.ifremer.isisfish.entities.StrategyMonthInfoImpl id='strategyMonthInfo' javaBean='null'/> <script><![CDATA[ - -import fr.ifremer.isisfish.entities.StrategyMonthInfo; import fr.ifremer.isisfish.entities.StrategyMonthInfoImpl; import fr.ifremer.isisfish.entities.Strategy; import fr.ifremer.isisfish.entities.StrategyImpl; import org.codelutin.math.matrix.gui.MatrixPanelEvent; import org.codelutin.math.matrix.gui.MatrixPanelListener; import jaxx.runtime.swing.editor.NumberEditor; -import fr.ifremer.isisfish.types.Month; import fr.ifremer.isisfish.entities.TripType; -import fr.ifremer.isisfish.ui.widget.editor.GenericCell; -MatrixPanelListener matrixListener = null; +protected MatrixPanelListener matrixListener; -int month = 0; -PropertyChangeListener listener = null; +protected int month = 0; +protected PropertyChangeListener listener; addPropertyChangeListener("strategyMonthInfo", 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");fieldPopulationBasicsName.setText(""); numberOfTrips.setText(""); fieldStrategyMonthInfoMinInactivityDays.setModelText(""); fieldStrategyMonthInfoProportion.setMatrix(null); } if (evt.getNewValue() != null) { - // add binding on getBean() - //jaxx.runtime.SwingUtil.applyDataBinding(get$Table0(), "fieldCellName.text", "fieldCellLongitude.text", "fieldCellLatitude.text", "fieldCellLand.selected", "fieldCellComment.text"); + } } }); + fieldStrategyMonthInfoProportion.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { @@ -82,47 +62,54 @@ } } }); + public void refresh() { Strategy strategy = (Strategy)getVerifier().getEntity(Strategy.class); setBean((StrategyImpl) strategy); - if (getBean() != null){ + if (getBean() != null) { Object[] monthInfos = getBean().getStrategyMonthInfo().toArray(); - if (monthInfos.length != 0){ + if (monthInfos.length != 0) { setStrategyMonthInfo((StrategyMonthInfoImpl) monthInfos[month]); getVerifier().addCurrentEntity(getStrategyMonthInfo()); } } - if (getStrategyMonthInfo() != null){ + if (getStrategyMonthInfo() != null) { numberOfTrips.putClientProperty("beanID", getStrategyMonthInfo().getTopiaId()); fieldStrategyMonthInfoProportion.putClientProperty("beanID", getStrategyMonthInfo().getTopiaId()); fieldStrategyMonthInfoMinInactivityDays.putClientProperty("beanID", getStrategyMonthInfo().getTopiaId()); ActionListener[] listeners = fieldStrategyMonthInfoTripType.getActionListeners(); - for (ActionListener listener : listeners){ + for (ActionListener listener : listeners) { fieldStrategyMonthInfoTripType.removeActionListener(listener); } jaxx.runtime.SwingUtil.fillComboBox(fieldStrategyMonthInfoTripType,getRegion().getTripType(), getStrategyMonthInfo().getTripType(), true); - for (ActionListener listener : listeners){ + for (ActionListener listener : listeners) { fieldStrategyMonthInfoTripType.addActionListener(listener); } - setMatrix(); + setProportionMetierMatrix(); fieldStrategyMonthInfoMinInactivityDays.init(); } matrixListener = new MatrixPanelListener() { - @Override - public void matrixChanged(MatrixPanelEvent arg0) { - if (getStrategyMonthInfo() != null && fieldStrategyMonthInfoProportion.getMatrix() != null){ + public void matrixChanged(MatrixPanelEvent event) { + if (getStrategyMonthInfo() != null && fieldStrategyMonthInfoProportion.getMatrix() != null) { getStrategyMonthInfo().setProportionMetier(fieldStrategyMonthInfoProportion.getMatrix().copy()); } } }; fieldStrategyMonthInfoProportion.addMatrixListener(matrixListener); } -public void init(int m){ + +public void init(int m) { month = m; } -protected void setMatrix(){ - fieldStrategyMonthInfoProportion.setMatrix(getStrategyMonthInfo().getProportionMetier() == null ? null : getStrategyMonthInfo().getProportionMetier().copy()); + +protected void setProportionMetierMatrix() { + if (getStrategyMonthInfo().getProportionMetier() != null) { + fieldStrategyMonthInfoProportion.setMatrix(getStrategyMonthInfo().getProportionMetier().copy()); + } + else { + fieldStrategyMonthInfoProportion.setMatrix(null); + } } ]]></script> <Table id='body'>