This is an automated email from the git hooks/post-receive script. New change to branch feature/1182-translation in repository lima. See http://git.chorem.org/lima.git from 599a742 refs #1182 Ajout de traductions new d732a50 refs #1182 Traduction des dates pickers The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit d732a508ef1d5ad822a8ffcd3ee2aaad03d50b79 Author: dcosse <cosse@codelutin.com> Date: Wed Sep 16 21:57:35 2015 +0200 refs #1182 Traduction des dates pickers Summary of changes: .../Filter/dateCondition/DateConditionHandler.java | 19 ++- .../ui/Filter/dateCondition/DateConditionView.jaxx | 3 +- .../DateIntervalConditionHandler.java | 19 ++- .../DateIntervalConditionView.jaxx | 6 +- .../ui/celleditor/DateLimaTableCellRenderer.java | 4 +- .../lima/ui/celleditor/DateTableCellEditor.java | 154 --------------------- .../chorem/lima/ui/common/AbstractLimaTable.java | 2 - .../chorem/lima/ui/lettering/LetteringView.jaxx | 7 +- .../lima/ui/lettering/LetteringViewHandler.java | 12 ++ 9 files changed, 52 insertions(+), 174 deletions(-) delete mode 100644 lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/1182-translation in repository lima. See http://git.chorem.org/lima.git commit d732a508ef1d5ad822a8ffcd3ee2aaad03d50b79 Author: dcosse <cosse@codelutin.com> Date: Wed Sep 16 21:57:35 2015 +0200 refs #1182 Traduction des dates pickers --- .../Filter/dateCondition/DateConditionHandler.java | 19 ++- .../ui/Filter/dateCondition/DateConditionView.jaxx | 3 +- .../DateIntervalConditionHandler.java | 19 ++- .../DateIntervalConditionView.jaxx | 6 +- .../ui/celleditor/DateLimaTableCellRenderer.java | 4 +- .../lima/ui/celleditor/DateTableCellEditor.java | 154 --------------------- .../chorem/lima/ui/common/AbstractLimaTable.java | 2 - .../chorem/lima/ui/lettering/LetteringView.jaxx | 7 +- .../lima/ui/lettering/LetteringViewHandler.java | 12 ++ 9 files changed, 52 insertions(+), 174 deletions(-) diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionHandler.java index 584919e..22adca0 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionHandler.java @@ -22,6 +22,7 @@ package org.chorem.lima.ui.Filter.dateCondition; * #L% */ +import org.chorem.lima.LimaSwingConfig; import org.chorem.lima.beans.Condition; import org.chorem.lima.beans.DateCondition; import org.chorem.lima.ui.Filter.ConditionHandler; @@ -29,8 +30,8 @@ import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransact import java.awt.event.ItemEvent; import java.text.DateFormat; -import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Locale; /** * @author Sylvain Bavencoff - bavencoff@codelutin.com @@ -64,11 +65,6 @@ public class DateConditionHandler implements ConditionHandler { return condition.getOperand(); } - public DateFormat[] getFormats() { - DateFormat[] formats = {DateFormat.getDateInstance(DateFormat.SHORT), new SimpleDateFormat("dd/MM/yyyy")}; - return formats; - } - public void delete() { filterHandler.removeCondition(this); } @@ -91,4 +87,15 @@ public class DateConditionHandler implements ConditionHandler { public void setFilterHandler(FinancialTransactionConditionHandler filterHandler) { this.filterHandler = filterHandler; } + + protected DateFormat getDateFormat() { + Locale locale = LimaSwingConfig.getInstance().getLocale(); + DateFormat result = DateFormat.getDateInstance(DateFormat.SHORT, locale); + return result; + } + + protected Locale getLocale() { + Locale locale = LimaSwingConfig.getInstance().getLocale(); + return locale; + } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx index 93e365c..340d13e 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateCondition/DateConditionView.jaxx @@ -37,7 +37,8 @@ onItemStateChanged="handler.operandSelected(event)"/> <JAXXDatePicker id='datePicker' + constructorParams="handler.getLocale()" + formats="{handler.getDateFormat()}" date='{handler.getDate()}' - formats='{handler.getFormats()}' onActionPerformed='handler.setDate(datePicker.getDate())'/> </JInternalFrame> diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionHandler.java index ef91994..329c785 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionHandler.java @@ -22,14 +22,15 @@ package org.chorem.lima.ui.Filter.dateIntervalCondition; * #L% */ +import org.chorem.lima.LimaSwingConfig; import org.chorem.lima.beans.Condition; import org.chorem.lima.beans.DateIntervalCondition; import org.chorem.lima.ui.Filter.ConditionHandler; import org.chorem.lima.ui.Filter.financialTransactionCondition.FinancialTransactionConditionHandler; import java.text.DateFormat; -import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Locale; /** * @author Sylvain Bavencoff - bavencoff@codelutin.com @@ -62,11 +63,6 @@ public class DateIntervalConditionHandler implements ConditionHandler { this.filterHandler = filterHandler; } - public DateFormat[] getFormats() { - DateFormat[] formats = {DateFormat.getDateInstance(DateFormat.SHORT), new SimpleDateFormat("dd/MM/yyyy")}; - return formats; - } - public void delete() { filterHandler.removeCondition(this); } @@ -86,4 +82,15 @@ public class DateIntervalConditionHandler implements ConditionHandler { public void setEndDate(Date endDate) { condition.setEndDate(endDate); } + + protected DateFormat getDateFormat() { + Locale locale = LimaSwingConfig.getInstance().getLocale(); + DateFormat result = DateFormat.getDateInstance(DateFormat.SHORT, locale); + return result; + } + + protected Locale getLocale() { + Locale locale = LimaSwingConfig.getInstance().getLocale(); + return locale; + } } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionView.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionView.jaxx index a5fa4f6..58c5994 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionView.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/Filter/dateIntervalCondition/DateIntervalConditionView.jaxx @@ -36,8 +36,9 @@ </cell> <cell> <JAXXDatePicker id='beginDatePicker' + constructorParams="handler.getLocale()" + formats="{handler.getDateFormat()}" date='{handler.getBeginDate()}' - formats='{handler.getFormats()}' onActionPerformed='handler.setBeginDate(beginDatePicker.getDate())'/> </cell> </row> @@ -47,8 +48,9 @@ </cell> <cell> <JAXXDatePicker id='endDatePicker' + constructorParams="handler.getLocale()" + formats="{handler.getDateFormat()}" date='{handler.getEndDate()}' - formats='{handler.getFormats()}' onActionPerformed='handler.setEndDate(endDatePicker.getDate())'/> </cell> </row> diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateLimaTableCellRenderer.java b/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateLimaTableCellRenderer.java index 01a81a1..37c5d9b 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateLimaTableCellRenderer.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateLimaTableCellRenderer.java @@ -22,6 +22,8 @@ package org.chorem.lima.ui.celleditor; * #L% */ +import org.chorem.lima.LimaSwingConfig; + import java.text.DateFormat; import java.util.Date; @@ -33,7 +35,7 @@ public class DateLimaTableCellRenderer extends DefaultLimaTableCellRenderer { @Override protected void setValue(Object value) { if (value instanceof Date) { - DateFormat format = DateFormat.getDateInstance(DateFormat.MEDIUM); + DateFormat format = DateFormat.getDateInstance(DateFormat.MEDIUM, LimaSwingConfig.getInstance().getLocale()); super.setValue(format.format((Date) value)); } else { super.setValue(value); diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java b/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java deleted file mode 100644 index 7d1bb6f..0000000 --- a/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/DateTableCellEditor.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * #%L - * Lima :: Swing - * %% - * Copyright (C) 2008 - 2010 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -package org.chorem.lima.ui.celleditor; - -import org.apache.commons.lang3.time.DateUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.LimaSwingApplicationContext; -import org.chorem.lima.LimaSwingConfig; -import org.jdesktop.swingx.JXDatePicker; - -import javax.swing.AbstractCellEditor; -import javax.swing.JFormattedTextField; -import javax.swing.JTable; -import javax.swing.SwingUtilities; -import javax.swing.event.AncestorEvent; -import javax.swing.event.AncestorListener; -import javax.swing.table.TableCellEditor; -import java.awt.Component; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - -/** @author ore */ -public class DateTableCellEditor extends AbstractCellEditor - implements TableCellEditor, FocusListener, AncestorListener { - - private static final Log log = LogFactory.getLog(DateTableCellEditor.class); - - private static final long serialVersionUID = 1L; - - private final JXDatePicker datePicker; - //protected String comportmentEditingCell; - - //used to tell if the user has pressed a key - private Date date; - - /** constructor */ - public DateTableCellEditor() { - datePicker = new JXDatePicker(LimaSwingApplicationContext.getContext().getConfig().getLocale()); - datePicker.getEditor().addFocusListener(this); - datePicker.getEditor().addAncestorListener(this); - datePicker.setFormats( - DateFormat.getDateInstance(DateFormat.SHORT), - new SimpleDateFormat("dd/MM/yyyy"), - new SimpleDateFormat("dd/MM") - ); - //comportmentEditingCell = LimaConfig.getInstance().getComportmentEditingCell(); - } - - @Override - public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { - if (value instanceof Date) { - datePicker.setDate((Date) value); - date = (Date) value; - } - return datePicker; - } - - @Override - public Object getCellEditorValue() { - if (log.isDebugEnabled()) { - log.debug("getDate : input Date : " + datePicker.getDate() + "; text : " + datePicker.getEditor().getText()); - } - try { - datePicker.commitEdit(); - } catch (ParseException e) { - if (log.isErrorEnabled()) { - log.error("Could not commit date editor value", e); - } - } - - Calendar calendar = Calendar.getInstance(); - calendar.setTime(datePicker.getDate()); - int year = calendar.get(Calendar.YEAR); - if (year == 1970) { - calendar.setTime(date); - year = calendar.get(Calendar.YEAR); - Date newDate = DateUtils.setYears(datePicker.getDate(), year); - datePicker.setDate(newDate); - } - - if (log.isDebugEnabled()) { - log.debug("getDate : output Date : " + datePicker.getDate()); - } - return datePicker.getDate(); - } - - /*@Override - public boolean isCellEditable(EventObject evt) { - return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2; - } */ - - @Override - public void focusGained(FocusEvent e) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - JFormattedTextField dateFormattedTextField = datePicker.getEditor(); - LimaSwingConfig config = LimaSwingConfig.getInstance(); - if (config.isSelectAllEditingCell()) { - dateFormattedTextField.selectAll(); - } else { - int textFieldSize = dateFormattedTextField.getText().length(); - dateFormattedTextField.select(textFieldSize, textFieldSize); - } - } - }); - } - - public void focusLost(FocusEvent e) { - } - - @Override - public void ancestorAdded(AncestorEvent e) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - datePicker.requestFocus(); - } - }); - } - - @Override - public void ancestorRemoved(AncestorEvent e) { - } - - @Override - public void ancestorMoved(AncestorEvent e) { - } - -} diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTable.java b/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTable.java index 3a53520..9a36e58 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTable.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/common/AbstractLimaTable.java @@ -29,7 +29,6 @@ import org.chorem.lima.ui.celleditor.AccountTableCellRenderer; import org.chorem.lima.ui.celleditor.BigDecimalTableCellEditor; import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer; import org.chorem.lima.ui.celleditor.DateLimaTableCellRenderer; -import org.chorem.lima.ui.celleditor.DateTableCellEditor; import org.chorem.lima.ui.celleditor.DefaultLimaTableCellRenderer; import org.chorem.lima.ui.celleditor.EntryBookTableCellEditor; import org.chorem.lima.ui.celleditor.EntryBookTableCellRender; @@ -68,7 +67,6 @@ public abstract class AbstractLimaTable<H> extends JXTable { setDefaultRenderer(EntryBook.class, new EntryBookTableCellRender()); // editor - setDefaultEditor(Date.class, new DateTableCellEditor()); setDefaultEditor(BigDecimal.class, new BigDecimalTableCellEditor()); setDefaultEditor(Account.class, new AccountTableCellEditor()); setDefaultEditor(EntryBook.class, new EntryBookTableCellEditor()); diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx index 76ee663..98ef5c2 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx @@ -31,6 +31,7 @@ org.jdesktop.swingx.JXDatePicker static org.nuiton.i18n.I18n.t org.chorem.lima.ui.combobox.AccountComboBox + java.text.DateFormat; </import> <LetteringViewHandler id="handler" constructorParams="this"/> @@ -73,12 +74,14 @@ <JLabel id="beginPeriodLabel"/> <JAXXDatePicker id="beginPeriodPicker" - patternLayout="dd/MM/yyy" + constructorParams="handler.getLocale()" + formats="{handler.getDateFormat()}" onActionPerformed="handler.setDateStart(beginPeriodPicker.getDate())"/> <JLabel id="endPeriodLabel"/> <JAXXDatePicker id="endPeriodPicker" - patternLayout="dd/MM/yyy" + constructorParams="handler.getLocale()" + formats="{handler.getDateFormat()}" onActionPerformed="handler.setDateEnd(endPeriodPicker.getDate())"/> <JToolBar.Separator/> diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java index fd77b1a..2025e00 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java @@ -58,9 +58,11 @@ import java.awt.event.KeyEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.math.BigDecimal; +import java.text.DateFormat; import java.util.Calendar; import java.util.Date; import java.util.List; +import java.util.Locale; import static org.nuiton.i18n.I18n.t; @@ -607,4 +609,14 @@ public class LetteringViewHandler{ } } + protected DateFormat getDateFormat() { + Locale locale = LimaSwingConfig.getInstance().getLocale(); + DateFormat result = DateFormat.getDateInstance(DateFormat.SHORT, locale); + return result; + } + + protected Locale getLocale() { + Locale locale = LimaSwingConfig.getInstance().getLocale(); + return locale; + } } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm