r3296 - in trunk: lima-business/src/main/java/org/chorem/lima/business/migration lima-business/src/main/java/org/chorem/lima/business/utils lima-callao/src/main/xmi lima-swing/src/main/java/org/chorem/lima/ui lima-swing/src/main/java/org/chorem/lima/ui/account lima-swing/src/main/java/org/chorem/lima/ui/accountsreports lima-swing/src/main/java/org/chorem/lima/ui/balance lima-swing/src/main/java/org/chorem/lima/ui/celleditor lima-swing/src/main/java/org/chorem/lima/ui/entrybook lima-swing/src/
Author: tchemit Date: 2011-09-20 19:49:06 +0200 (Tue, 20 Sep 2011) New Revision: 3296 Url: http://chorem.org/repositories/revision/lima/3296 Log: add svn properties Evolution #445: [Plan comptable] Cr?\195?\169ation des num?\195?\169ros de compte interm?\195?\169diaires lors d'un import Added: trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_5_2.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/migration/DatabaseMigrationClass.java trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0V0_5.java trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java trunk/lima-callao/src/main/xmi/accounting.properties trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaDecoratorProvider.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaModelUtil.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollBasicComboPopup.java trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollMetalComboUI.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/migration/DatabaseMigrationClass.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/migration/DatabaseMigrationClass.java 2011-09-20 14:51:40 UTC (rev 3295) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/migration/DatabaseMigrationClass.java 2011-09-20 17:49:06 UTC (rev 3296) @@ -1,72 +1,74 @@ -/* - * #%L - * Lima :: business - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2011 CodeLutin, Victor Salaun - * %% - * 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.business.migration; - -import org.chorem.lima.entity.LimaCallaoDAOHelper; -import org.nuiton.topia.migration.TopiaMigrationCallbackByClass; -import org.nuiton.util.Version; - -import java.util.List; - -public class DatabaseMigrationClass extends TopiaMigrationCallbackByClass { - - protected static final Version VERSION_0_5 = new Version("0.5"); - - - public DatabaseMigrationClass() { - super(new MigrationResolver()); - } - - protected static class MigrationResolver implements MigrationCallBackForVersionResolver { - - @Override - public Class<? extends MigrationCallBackForVersion> getCallBack(Version version) { - Class<? extends MigrationCallBackForVersion> result = null; - - if (version.equals(VERSION_0_5)) { - result = MigrationV0V0_5.class; - } - return result; - } - - } - - @Override - public Version[] getAvailableVersions() { - Version[] result = new Version[]{VERSION_0_5}; - return result; - } - - @Override - public Version getApplicationVersion() { - Version appVersion = new Version(LimaCallaoDAOHelper.getModelVersion()); - return appVersion; - } - - @Override - public boolean askUser(Version dbVersion, List<Version> versions) { - return true; - } -} +/* + * #%L + * Lima :: business + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 CodeLutin, Victor Salaun + * %% + * 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.business.migration; + +import org.chorem.lima.entity.LimaCallaoDAOHelper; +import org.nuiton.topia.migration.TopiaMigrationCallbackByClass; +import org.nuiton.util.Version; + +import java.util.List; + +public class DatabaseMigrationClass extends TopiaMigrationCallbackByClass { + + protected static final Version VERSION_0_5 = new Version("0.5"); + protected static final Version VERSION_0_5_2 = new Version("0.5.2"); + + public DatabaseMigrationClass() { + super(new MigrationResolver()); + } + + protected static class MigrationResolver implements MigrationCallBackForVersionResolver { + + @Override + public Class<? extends MigrationCallBackForVersion> getCallBack(Version version) { + Class<? extends MigrationCallBackForVersion> result = null; + + if (version.equals(VERSION_0_5)) { + result = MigrationV0V0_5.class; + } else if (version.equals(VERSION_0_5_2)) { + result = MigrationV0_5_2.class; + } + return result; + } + + } + + @Override + public Version[] getAvailableVersions() { + Version[] result = new Version[]{VERSION_0_5, VERSION_0_5_2}; + return result; + } + + @Override + public Version getApplicationVersion() { + Version appVersion = new Version(LimaCallaoDAOHelper.getModelVersion()); + return appVersion; + } + + @Override + public boolean askUser(Version dbVersion, List<Version> versions) { + return true; + } +} Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/migration/DatabaseMigrationClass.java ___________________________________________________________________ Added: svn:eol-style + native Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0V0_5.java ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_5_2.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_5_2.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_5_2.java 2011-09-20 17:49:06 UTC (rev 3296) @@ -0,0 +1,122 @@ +package org.chorem.lima.business.migration; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.entity.Account; +import org.chorem.lima.entity.AccountDAO; +import org.chorem.lima.entity.LimaCallaoDAOHelper; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.framework.TopiaContextImplementor; +import org.nuiton.topia.migration.TopiaMigrationCallbackByClass; +import org.nuiton.util.Version; + +import java.util.List; + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 0.6 + */ +public class MigrationV0_5_2 extends TopiaMigrationCallbackByClass.MigrationCallBackForVersion { + + /** Logger. */ + private static final Log log = LogFactory.getLog(MigrationV0_5_2.class); + + public MigrationV0_5_2(Version version, TopiaMigrationCallbackByClass callBack) { + super(version, callBack); + } + + @Override + protected void prepareMigrationScript(TopiaContextImplementor tx, + List<String> queries, + boolean showSql, + boolean showProgression) + throws TopiaException { + if (log.isInfoEnabled()) { + log.info("Migrates to version 0.6"); + } + + // find all account with no master account and attach them to a master + // if master does not exists let's create it also + AccountDAO accountDAO = LimaCallaoDAOHelper.getAccountDAO(tx); + + List<Account> accounts = accountDAO.findAll(); + + for (Account account : accounts) { + + fillMasterAccountNumber(accountDAO, account); + } + } + + protected void fillMasterAccountNumber(AccountDAO accountDAO, Account account) throws TopiaException { + if (account.getMasterAccount() != null) { + + // have already a master account + return; + } + String accountNumber = account.getAccountNumber(); + + if (log.isInfoEnabled()) { + log.info("Account " + accountNumber + " does not have a masterAccount, will fill one."); + } + int length = accountNumber.length(); + if (length == 1) { + + // this is a master account, nothing to do + return; + } + if (length > 3) { + + // fill with master account with 3 digits + String masterAccountNumber = accountNumber.substring(0, 3); + Account masterAccount = getMasterAccount(accountDAO, account, masterAccountNumber); + account.setMasterAccount(masterAccount); + + // let's fill master account + fillMasterAccountNumber(accountDAO, masterAccount); + return; + } + + if (length == 3) { + + // fill with master account with 3 digits + String masterAccountNumber = accountNumber.substring(0, 2); + Account masterAccount = getMasterAccount(accountDAO, account, masterAccountNumber); + account.setMasterAccount(masterAccount); + + // let's fill master account + fillMasterAccountNumber(accountDAO, masterAccount); + return; + } + + + if (length == 2) { + + // fill with master account with 3 digits + String masterAccountNumber = accountNumber.substring(0, 1); + Account masterAccount = getMasterAccount(accountDAO, account, masterAccountNumber); + account.setMasterAccount(masterAccount); + + // let's fill master account + fillMasterAccountNumber(accountDAO, masterAccount); + return; + } + + + } + + protected Account getMasterAccount(AccountDAO accountDAO, + Account subAccount, + String masterAccountNumber) throws TopiaException { + Account masterAccount = + accountDAO.findByAccountNumber(masterAccountNumber); + if (masterAccount == null) { + + // creates it + masterAccount = accountDAO.create(Account.PROPERTY_ACCOUNT_NUMBER, masterAccountNumber); + } + masterAccount.addSubAccounts(subAccount); + return masterAccount; + } +} Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/migration/MigrationV0_5_2.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java 2011-09-20 14:51:40 UTC (rev 3295) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java 2011-09-20 17:49:06 UTC (rev 3296) @@ -1,54 +1,54 @@ -/* - * #%L - * Lima :: business - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2011 CodeLutin, Victor Salaun - * %% - * 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.business.utils; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.entity.ClosedPeriodicEntryBook; - -import java.io.Serializable; -import java.util.Comparator; - -public class FinancialPeriodComparator implements Serializable, Comparator<ClosedPeriodicEntryBook> { - - private static final long serialVersionUID = 1L; - - private static final Log log = - LogFactory.getLog(FinancialPeriodComparator.class); - - @Override - public int compare(ClosedPeriodicEntryBook o1, ClosedPeriodicEntryBook o2) { - if (o1.getFinancialPeriod().getBeginDate().compareTo(o2.getFinancialPeriod().getBeginDate()) == 0) { - if (o1.getEntryBook().getLabel().compareToIgnoreCase(o2.getEntryBook().getLabel()) == 0) { - return o1.getTopiaCreateDate().compareTo(o2.getTopiaCreateDate()); - } else { - return o1.getEntryBook().getCode().compareToIgnoreCase(o2.getEntryBook().getCode()); - } - } else { - return o1.getFinancialPeriod().getBeginDate().compareTo(o2.getFinancialPeriod().getBeginDate()); - } - } - -} +/* + * #%L + * Lima :: business + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 CodeLutin, Victor Salaun + * %% + * 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.business.utils; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.entity.ClosedPeriodicEntryBook; + +import java.io.Serializable; +import java.util.Comparator; + +public class FinancialPeriodComparator implements Serializable, Comparator<ClosedPeriodicEntryBook> { + + private static final long serialVersionUID = 1L; + + private static final Log log = + LogFactory.getLog(FinancialPeriodComparator.class); + + @Override + public int compare(ClosedPeriodicEntryBook o1, ClosedPeriodicEntryBook o2) { + if (o1.getFinancialPeriod().getBeginDate().compareTo(o2.getFinancialPeriod().getBeginDate()) == 0) { + if (o1.getEntryBook().getLabel().compareToIgnoreCase(o2.getEntryBook().getLabel()) == 0) { + return o1.getTopiaCreateDate().compareTo(o2.getTopiaCreateDate()); + } else { + return o1.getEntryBook().getCode().compareToIgnoreCase(o2.getEntryBook().getCode()); + } + } else { + return o1.getFinancialPeriod().getBeginDate().compareTo(o2.getFinancialPeriod().getBeginDate()); + } + } + +} Property changes on: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/lima-callao/src/main/xmi/accounting.properties =================================================================== --- trunk/lima-callao/src/main/xmi/accounting.properties 2011-09-20 14:51:40 UTC (rev 3295) +++ trunk/lima-callao/src/main/xmi/accounting.properties 2011-09-20 17:49:06 UTC (rev 3296) @@ -24,6 +24,7 @@ ### # Precise l'entete de l'ensemble des fichiers generes model.tagvalue.copyright=/*\n Copyright (C) 2009-2010 Lima Callao\n */ +model.tagvalue.version=0.5.2 model.tagvalue.constantPrefix=PROPERTY_ model.tagValue.notGenerateToString=true Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaDecoratorProvider.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaModelUtil.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/LimaRendererUtil.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTable.java 2011-09-20 14:51:40 UTC (rev 3295) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTable.java 2011-09-20 17:49:06 UTC (rev 3296) @@ -1,102 +1,102 @@ -/* - * #%L - * Lima :: Swing - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2011 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.account; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.swingx.JXTreeTable; - -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; - -public class AccountTreeTable extends JXTreeTable - implements KeyListener, MouseListener { - - /** serialVersionUID. */ - private static final long serialVersionUID = 1092873442245932784L; - - /** log. */ - private static final Log log = LogFactory - .getLog(AccountTreeTable.class); - - protected AccountViewHandler handler; - - public AccountTreeTable(AccountViewHandler handler) { - - this.handler = handler; - - addKeyListener(this); - addMouseListener(this); - - } - - @Override - public void mouseClicked(MouseEvent e) { - } - - @Override - public void mousePressed(MouseEvent e) { - if (rowAtPoint(e.getPoint()) == -1) { - clearSelection(); - } - } - - @Override - public void mouseReleased(MouseEvent e) { - } - - @Override - public void mouseEntered(MouseEvent e) { - } - - @Override - public void mouseExited(MouseEvent e) { - } - - @Override - public void keyTyped(KeyEvent e) { - } - - /** - * for each action combination key are think - * for extend keyboard and laptop keyboard - */ - @Override - public void keyPressed(KeyEvent e) { - // clear row selection with the key: escape - if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { - if (!isEditing()) { - clearSelection(); - } - } - } - - @Override - public void keyReleased(KeyEvent e) { - } - -} +/* + * #%L + * Lima :: Swing + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2011 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.account; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.swingx.JXTreeTable; + +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +public class AccountTreeTable extends JXTreeTable + implements KeyListener, MouseListener { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1092873442245932784L; + + /** log. */ + private static final Log log = LogFactory + .getLog(AccountTreeTable.class); + + protected AccountViewHandler handler; + + public AccountTreeTable(AccountViewHandler handler) { + + this.handler = handler; + + addKeyListener(this); + addMouseListener(this); + + } + + @Override + public void mouseClicked(MouseEvent e) { + } + + @Override + public void mousePressed(MouseEvent e) { + if (rowAtPoint(e.getPoint()) == -1) { + clearSelection(); + } + } + + @Override + public void mouseReleased(MouseEvent e) { + } + + @Override + public void mouseEntered(MouseEvent e) { + } + + @Override + public void mouseExited(MouseEvent e) { + } + + @Override + public void keyTyped(KeyEvent e) { + } + + /** + * for each action combination key are think + * for extend keyboard and laptop keyboard + */ + @Override + public void keyPressed(KeyEvent e) { + // clear row selection with the key: escape + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + if (!isEditing()) { + clearSelection(); + } + } + } + + @Override + public void keyReleased(KeyEvent e) { + } + +} Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTable.java ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java 2011-09-20 14:51:40 UTC (rev 3295) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java 2011-09-20 17:49:06 UTC (rev 3296) @@ -1,107 +1,107 @@ -/* - * #%L - * Lima :: Swing - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2011 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.accountsreports; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer; -import org.jdesktop.swingx.JXTable; - -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.math.BigDecimal; - -public class AccountsReportsTable extends JXTable - implements KeyListener, MouseListener { - - /** serialVersionUID. */ - private static final long serialVersionUID = 6093850347322834480L; - - /** log. */ - private static final Log log = LogFactory - .getLog(AccountsReportsTable.class); - - protected AccountsReportsViewHandler handler; - - public AccountsReportsTable(AccountsReportsViewHandler handler) { - - this.handler = handler; - - addKeyListener(this); - addMouseListener(this); - - //Get new BigDecimal renderer - setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer()); - - } - - @Override - public void mouseClicked(MouseEvent e) { - } - - @Override - public void mousePressed(MouseEvent e) { - if (rowAtPoint(e.getPoint()) == -1) { - clearSelection(); - } - } - - @Override - public void mouseReleased(MouseEvent e) { - } - - @Override - public void mouseEntered(MouseEvent e) { - } - - @Override - public void mouseExited(MouseEvent e) { - } - - @Override - public void keyTyped(KeyEvent e) { - } - - /** - * for each action combination key are think - * for extend keyboard and laptop keyboard - */ - @Override - public void keyPressed(KeyEvent e) { - // clear row selection with the key: escape - if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { - if (!isEditing()) { - clearSelection(); - } - } - } - - @Override - public void keyReleased(KeyEvent e) { - } - -} +/* + * #%L + * Lima :: Swing + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2011 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.accountsreports; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer; +import org.jdesktop.swingx.JXTable; + +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.math.BigDecimal; + +public class AccountsReportsTable extends JXTable + implements KeyListener, MouseListener { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6093850347322834480L; + + /** log. */ + private static final Log log = LogFactory + .getLog(AccountsReportsTable.class); + + protected AccountsReportsViewHandler handler; + + public AccountsReportsTable(AccountsReportsViewHandler handler) { + + this.handler = handler; + + addKeyListener(this); + addMouseListener(this); + + //Get new BigDecimal renderer + setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer()); + + } + + @Override + public void mouseClicked(MouseEvent e) { + } + + @Override + public void mousePressed(MouseEvent e) { + if (rowAtPoint(e.getPoint()) == -1) { + clearSelection(); + } + } + + @Override + public void mouseReleased(MouseEvent e) { + } + + @Override + public void mouseEntered(MouseEvent e) { + } + + @Override + public void mouseExited(MouseEvent e) { + } + + @Override + public void keyTyped(KeyEvent e) { + } + + /** + * for each action combination key are think + * for extend keyboard and laptop keyboard + */ + @Override + public void keyPressed(KeyEvent e) { + // clear row selection with the key: escape + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + if (!isEditing()) { + clearSelection(); + } + } + } + + @Override + public void keyReleased(KeyEvent e) { + } + +} Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java 2011-09-20 14:51:40 UTC (rev 3295) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java 2011-09-20 17:49:06 UTC (rev 3296) @@ -1,106 +1,106 @@ -/* - * #%L - * Lima :: Swing - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2011 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.balance; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer; -import org.jdesktop.swingx.JXTable; - -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.math.BigDecimal; - -public class BalanceTable extends JXTable implements KeyListener, MouseListener { - - /** serialVersionUID. */ - private static final long serialVersionUID = 6093850347322834480L; - - /** log. */ - private static final Log log = LogFactory - .getLog(BalanceTable.class); - - protected BalanceViewHandler handler; - - public BalanceTable(BalanceViewHandler handler) { - - this.handler = handler; - - addKeyListener(this); - addMouseListener(this); - - //Get new BigDecimal renderer - setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer()); - - } - - @Override - public void mouseClicked(MouseEvent e) { - } - - @Override - public void mousePressed(MouseEvent e) { - if (rowAtPoint(e.getPoint()) == -1) { - clearSelection(); - } - } - - @Override - public void mouseReleased(MouseEvent e) { - } - - @Override - public void mouseEntered(MouseEvent e) { - } - - @Override - public void mouseExited(MouseEvent e) { - } - - @Override - public void keyTyped(KeyEvent e) { - } - - /** - * for each action combination key are think - * for extend keyboard and laptop keyboard - */ - @Override - public void keyPressed(KeyEvent e) { - // clear row selection with the key: escape - if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { - if (!isEditing()) { - clearSelection(); - } - } - } - - @Override - public void keyReleased(KeyEvent e) { - } - -} +/* + * #%L + * Lima :: Swing + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2011 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.balance; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer; +import org.jdesktop.swingx.JXTable; + +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.math.BigDecimal; + +public class BalanceTable extends JXTable implements KeyListener, MouseListener { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6093850347322834480L; + + /** log. */ + private static final Log log = LogFactory + .getLog(BalanceTable.class); + + protected BalanceViewHandler handler; + + public BalanceTable(BalanceViewHandler handler) { + + this.handler = handler; + + addKeyListener(this); + addMouseListener(this); + + //Get new BigDecimal renderer + setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer()); + + } + + @Override + public void mouseClicked(MouseEvent e) { + } + + @Override + public void mousePressed(MouseEvent e) { + if (rowAtPoint(e.getPoint()) == -1) { + clearSelection(); + } + } + + @Override + public void mouseReleased(MouseEvent e) { + } + + @Override + public void mouseEntered(MouseEvent e) { + } + + @Override + public void mouseExited(MouseEvent e) { + } + + @Override + public void keyTyped(KeyEvent e) { + } + + /** + * for each action combination key are think + * for extend keyboard and laptop keyboard + */ + @Override + public void keyPressed(KeyEvent e) { + // clear row selection with the key: escape + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + if (!isEditing()) { + clearSelection(); + } + } + } + + @Override + public void keyReleased(KeyEvent e) { + } + +} Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTable.java ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2011-09-20 14:51:40 UTC (rev 3295) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2011-09-20 17:49:06 UTC (rev 3296) @@ -1,165 +1,165 @@ -/* - * #%L - * Lima :: Swing - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2011 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.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.LimaContext; - -import javax.swing.AbstractCellEditor; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.SwingConstants; -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.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; -import java.math.BigDecimal; -import java.util.EventObject; - -public class BigDecimalTableCellEditor extends AbstractCellEditor - implements TableCellEditor, FocusListener, AncestorListener, KeyListener { - - private static final Log log = LogFactory.getLog(BigDecimalTableCellEditor.class); - - private static final long serialVersionUID = 1L; - - protected final JTextField textField; - - private boolean keyPressed; - - /** constructor */ - public BigDecimalTableCellEditor() { - textField = new JTextField(); - textField.setEditable(true); - textField.setHorizontalAlignment(SwingConstants.RIGHT); - textField.addFocusListener(this); - textField.addAncestorListener(this); - textField.addKeyListener(this); - keyPressed = false; - } - - @Override - public Component getTableCellEditorComponent(JTable table, Object value, - boolean isSelected, int row, int column) { - textField.setText(value.toString()); - return textField; - } - - // the editor should return a BigDecimal - public Object getCellEditorValue() { - String textValue = textField.getText().trim(); - //replace all comma by full stop - textValue = textValue.replaceAll(",", "."); - if (textValue.equals("")) { - return BigDecimal.ZERO; - } else { - //set 0 in case the user type in a non number format - BigDecimal bdValue = BigDecimal.ZERO; - try { - bdValue = new BigDecimal(textValue); - } catch (NumberFormatException eee) { - if (log.isErrorEnabled()) { - log.error("Can't set " + textValue + " to a BigDecimal", eee); - } - } - //round half up the number using the scale given by the configuration - bdValue = bdValue.setScale(LimaContext.getContext().getConfig().getScale(), - BigDecimal.ROUND_HALF_UP); - return bdValue; - } - } - - @Override - public boolean isCellEditable(EventObject evt) { - return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2; - } - - /** Listeners */ - @Override - public void focusGained(FocusEvent e) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - textField.selectAll(); - } - }); - } - - @Override - public void focusLost(FocusEvent e) { - keyPressed = false; - } - - @Override - public void ancestorAdded(AncestorEvent e) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - textField.requestFocus(); - } - }); - } - - @Override - public void ancestorRemoved(AncestorEvent e) { - } - - @Override - public void ancestorMoved(AncestorEvent e) { - } - - @Override - public void keyTyped(KeyEvent e) { - - } - - @Override - public void keyPressed(KeyEvent e) { - } - - @Override - public void keyReleased(KeyEvent e) { - // replace all the cell content only if all the text has been selected - if (!keyPressed - && textField.getSelectionStart() == 0 - && textField.getSelectionEnd() == textField.getText().length()) { - // delete the the cell content - if (e.getKeyChar() == KeyEvent.VK_BACK_SPACE) { - textField.setText(""); - keyPressed = true; - // replace the content by the char typed in - } else if (String.valueOf(e.getKeyChar()).matches("[a-zA-z0-9]")) { - textField.setText(String.valueOf(e.getKeyChar())); - keyPressed = true; - } - } - } - -} +/* + * #%L + * Lima :: Swing + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2011 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.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaContext; + +import javax.swing.AbstractCellEditor; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.SwingConstants; +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.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.math.BigDecimal; +import java.util.EventObject; + +public class BigDecimalTableCellEditor extends AbstractCellEditor + implements TableCellEditor, FocusListener, AncestorListener, KeyListener { + + private static final Log log = LogFactory.getLog(BigDecimalTableCellEditor.class); + + private static final long serialVersionUID = 1L; + + protected final JTextField textField; + + private boolean keyPressed; + + /** constructor */ + public BigDecimalTableCellEditor() { + textField = new JTextField(); + textField.setEditable(true); + textField.setHorizontalAlignment(SwingConstants.RIGHT); + textField.addFocusListener(this); + textField.addAncestorListener(this); + textField.addKeyListener(this); + keyPressed = false; + } + + @Override + public Component getTableCellEditorComponent(JTable table, Object value, + boolean isSelected, int row, int column) { + textField.setText(value.toString()); + return textField; + } + + // the editor should return a BigDecimal + public Object getCellEditorValue() { + String textValue = textField.getText().trim(); + //replace all comma by full stop + textValue = textValue.replaceAll(",", "."); + if (textValue.equals("")) { + return BigDecimal.ZERO; + } else { + //set 0 in case the user type in a non number format + BigDecimal bdValue = BigDecimal.ZERO; + try { + bdValue = new BigDecimal(textValue); + } catch (NumberFormatException eee) { + if (log.isErrorEnabled()) { + log.error("Can't set " + textValue + " to a BigDecimal", eee); + } + } + //round half up the number using the scale given by the configuration + bdValue = bdValue.setScale(LimaContext.getContext().getConfig().getScale(), + BigDecimal.ROUND_HALF_UP); + return bdValue; + } + } + + @Override + public boolean isCellEditable(EventObject evt) { + return !(evt instanceof MouseEvent) || ((MouseEvent) evt).getClickCount() == 2; + } + + /** Listeners */ + @Override + public void focusGained(FocusEvent e) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + textField.selectAll(); + } + }); + } + + @Override + public void focusLost(FocusEvent e) { + keyPressed = false; + } + + @Override + public void ancestorAdded(AncestorEvent e) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + textField.requestFocus(); + } + }); + } + + @Override + public void ancestorRemoved(AncestorEvent e) { + } + + @Override + public void ancestorMoved(AncestorEvent e) { + } + + @Override + public void keyTyped(KeyEvent e) { + + } + + @Override + public void keyPressed(KeyEvent e) { + } + + @Override + public void keyReleased(KeyEvent e) { + // replace all the cell content only if all the text has been selected + if (!keyPressed + && textField.getSelectionStart() == 0 + && textField.getSelectionEnd() == textField.getText().length()) { + // delete the the cell content + if (e.getKeyChar() == KeyEvent.VK_BACK_SPACE) { + textField.setText(""); + keyPressed = true; + // replace the content by the char typed in + } else if (String.valueOf(e.getKeyChar()).matches("[a-zA-z0-9]")) { + textField.setText(String.valueOf(e.getKeyChar())); + keyPressed = true; + } + } + } + +} Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java 2011-09-20 14:51:40 UTC (rev 3295) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java 2011-09-20 17:49:06 UTC (rev 3296) @@ -1,78 +1,78 @@ -/* - * #%L - * Lima :: Swing - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2011 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.chorem.lima.LimaConfig; -import org.chorem.lima.LimaContext; - -import javax.swing.JTable; -import javax.swing.SwingConstants; -import javax.swing.table.DefaultTableCellRenderer; -import java.awt.Component; -import java.math.BigDecimal; -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; - -public class BigDecimalTableCellRenderer extends DefaultTableCellRenderer { - - private static final long serialVersionUID = -2499433026151065390L; - - public BigDecimalTableCellRenderer() { - // - } - - public Component getTableCellRendererComponent(JTable table, Object value, - boolean isSelected, boolean hasFocus, int row, int column) { - - super.getTableCellRendererComponent( - table, value, isSelected, hasFocus, row, column); - setHorizontalAlignment(SwingConstants.RIGHT); - setValue(value); - return this; - } - - public void setValue(Object aValue) { - Object result = aValue; - if (aValue != null && aValue instanceof BigDecimal) { - LimaConfig config = LimaContext.getContext().getConfig(); - String scale = ""; - for (int i = 0; i < config.getScale(); i++) { - scale += "0"; - } - DecimalFormat formatter = new DecimalFormat("##0." + scale); - DecimalFormatSymbols symbol = new DecimalFormatSymbols(); - //set decimalSeparator and thousandSeparator preferences - symbol.setDecimalSeparator(config.getDecimalSeparator()); - symbol.setGroupingSeparator(config.getThousandSeparator()); - formatter.setDecimalFormatSymbols(symbol); - //always set grouping - formatter.setGroupingUsed(true); - formatter.setGroupingSize(3); - result = formatter.format(result); - } - super.setValue(result); - } - -} +/* + * #%L + * Lima :: Swing + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2011 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.chorem.lima.LimaConfig; +import org.chorem.lima.LimaContext; + +import javax.swing.JTable; +import javax.swing.SwingConstants; +import javax.swing.table.DefaultTableCellRenderer; +import java.awt.Component; +import java.math.BigDecimal; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; + +public class BigDecimalTableCellRenderer extends DefaultTableCellRenderer { + + private static final long serialVersionUID = -2499433026151065390L; + + public BigDecimalTableCellRenderer() { + // + } + + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, boolean hasFocus, int row, int column) { + + super.getTableCellRendererComponent( + table, value, isSelected, hasFocus, row, column); + setHorizontalAlignment(SwingConstants.RIGHT); + setValue(value); + return this; + } + + public void setValue(Object aValue) { + Object result = aValue; + if (aValue != null && aValue instanceof BigDecimal) { + LimaConfig config = LimaContext.getContext().getConfig(); + String scale = ""; + for (int i = 0; i < config.getScale(); i++) { + scale += "0"; + } + DecimalFormat formatter = new DecimalFormat("##0." + scale); + DecimalFormatSymbols symbol = new DecimalFormatSymbols(); + //set decimalSeparator and thousandSeparator preferences + symbol.setDecimalSeparator(config.getDecimalSeparator()); + symbol.setGroupingSeparator(config.getThousandSeparator()); + formatter.setDecimalFormatSymbols(symbol); + //always set grouping + formatter.setGroupingUsed(true); + formatter.setGroupingSize(3); + result = formatter.format(result); + } + super.setValue(result); + } + +} Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellRenderer.java ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java 2011-09-20 14:51:40 UTC (rev 3295) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java 2011-09-20 17:49:06 UTC (rev 3296) @@ -1,85 +1,85 @@ -/* - * #%L - * Lima :: Swing - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2011 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 sun.swing.DefaultLookup; - -import javax.swing.JLabel; -import javax.swing.JTable; -import javax.swing.border.Border; -import javax.swing.border.EmptyBorder; -import javax.swing.table.DefaultTableCellRenderer; -import java.awt.Color; -import java.awt.Component; - -@SuppressWarnings("restriction") -public class EmptyCellRenderer extends DefaultTableCellRenderer { - - private static final long serialVersionUID = -7834417406160620726L; - - public Component getTableCellRendererComponent(JTable table, Object value, - boolean isSelected, boolean hasFocus, int row, int column) { - //Create a new JLabel to avoid colouring only when row is selected - JLabel mycell = new JLabel(); - mycell.setOpaque(true); - setBorder(new EmptyBorder(1, 1, 1, 1)); - setName("Table.cellRenderer"); - mycell.setBackground(Color.WHITE); - mycell.setForeground(Color.BLACK); - //Setting default foreGround and backGround colours when isSelected - if (isSelected) { - mycell.setForeground(table.getSelectionForeground()); - mycell.setBackground(table.getSelectionBackground()); - } - //Setting default foreGround and backGround colours when hasFocus - if (hasFocus) { - Border border = null; - if (isSelected) { - border = DefaultLookup.getBorder(this, ui, "Table.focusSelectedCellHighlightBorder"); - } - if (border == null) { - border = DefaultLookup.getBorder(this, ui, "Table.focusCellHighlightBorder"); - } - mycell.setBorder(border); - } - if (table.isCellEditable(row, column)) { - // true for voucher and description - // false for Account Class - // if empty or null, colour background in red - // else setText - if (value instanceof String) { - if (String.valueOf(value).isEmpty() || String.valueOf(value) == null) { - mycell.setBackground(new Color(255, 198, 209)); - } else { - mycell.setText(value.toString()); - } - } else { - mycell.setBackground(new Color(255, 198, 209)); - } - } - return mycell; - } - -} +/* + * #%L + * Lima :: Swing + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2011 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 sun.swing.DefaultLookup; + +import javax.swing.JLabel; +import javax.swing.JTable; +import javax.swing.border.Border; +import javax.swing.border.EmptyBorder; +import javax.swing.table.DefaultTableCellRenderer; +import java.awt.Color; +import java.awt.Component; + +@SuppressWarnings("restriction") +public class EmptyCellRenderer extends DefaultTableCellRenderer { + + private static final long serialVersionUID = -7834417406160620726L; + + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, boolean hasFocus, int row, int column) { + //Create a new JLabel to avoid colouring only when row is selected + JLabel mycell = new JLabel(); + mycell.setOpaque(true); + setBorder(new EmptyBorder(1, 1, 1, 1)); + setName("Table.cellRenderer"); + mycell.setBackground(Color.WHITE); + mycell.setForeground(Color.BLACK); + //Setting default foreGround and backGround colours when isSelected + if (isSelected) { + mycell.setForeground(table.getSelectionForeground()); + mycell.setBackground(table.getSelectionBackground()); + } + //Setting default foreGround and backGround colours when hasFocus + if (hasFocus) { + Border border = null; + if (isSelected) { + border = DefaultLookup.getBorder(this, ui, "Table.focusSelectedCellHighlightBorder"); + } + if (border == null) { + border = DefaultLookup.getBorder(this, ui, "Table.focusCellHighlightBorder"); + } + mycell.setBorder(border); + } + if (table.isCellEditable(row, column)) { + // true for voucher and description + // false for Account Class + // if empty or null, colour background in red + // else setText + if (value instanceof String) { + if (String.valueOf(value).isEmpty() || String.valueOf(value) == null) { + mycell.setBackground(new Color(255, 198, 209)); + } else { + mycell.setText(value.toString()); + } + } else { + mycell.setBackground(new Color(255, 198, 209)); + } + } + return mycell; + } + +} Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/EmptyCellRenderer.java ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java 2011-09-20 14:51:40 UTC (rev 3295) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java 2011-09-20 17:49:06 UTC (rev 3296) @@ -1,102 +1,102 @@ -/* - * #%L - * Lima :: Swing - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2011 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.entrybook; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.swingx.JXTable; - -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; - -public class EntryBookTable extends JXTable - implements KeyListener, MouseListener { - - /** serialVersionUID. */ - private static final long serialVersionUID = 6228396251512013262L; - - /** log. */ - private static final Log log = LogFactory - .getLog(EntryBookTable.class); - - protected EntryBookViewHandler handler; - - public EntryBookTable(EntryBookViewHandler handler) { - - this.handler = handler; - - addKeyListener(this); - addMouseListener(this); - - } - - @Override - public void mouseClicked(MouseEvent e) { - } - - @Override - public void mousePressed(MouseEvent e) { - if (rowAtPoint(e.getPoint()) == -1) { - clearSelection(); - } - } - - @Override - public void mouseReleased(MouseEvent e) { - } - - @Override - public void mouseEntered(MouseEvent e) { - } - - @Override - public void mouseExited(MouseEvent e) { - } - - @Override - public void keyTyped(KeyEvent e) { - } - - /** - * for each action combination key are think - * for extend keyboard and laptop keyboard - */ - @Override - public void keyPressed(KeyEvent e) { - // clear row selection with the key: escape - if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { - if (!isEditing()) { - clearSelection(); - } - } - } - - @Override - public void keyReleased(KeyEvent e) { - } - -} +/* + * #%L + * Lima :: Swing + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2011 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.entrybook; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.swingx.JXTable; + +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +public class EntryBookTable extends JXTable + implements KeyListener, MouseListener { + + /** serialVersionUID. */ + private static final long serialVersionUID = 6228396251512013262L; + + /** log. */ + private static final Log log = LogFactory + .getLog(EntryBookTable.class); + + protected EntryBookViewHandler handler; + + public EntryBookTable(EntryBookViewHandler handler) { + + this.handler = handler; + + addKeyListener(this); + addMouseListener(this); + + } + + @Override + public void mouseClicked(MouseEvent e) { + } + + @Override + public void mousePressed(MouseEvent e) { + if (rowAtPoint(e.getPoint()) == -1) { + clearSelection(); + } + } + + @Override + public void mouseReleased(MouseEvent e) { + } + + @Override + public void mouseEntered(MouseEvent e) { + } + + @Override + public void mouseExited(MouseEvent e) { + } + + @Override + public void keyTyped(KeyEvent e) { + } + + /** + * for each action combination key are think + * for extend keyboard and laptop keyboard + */ + @Override + public void keyPressed(KeyEvent e) { + // clear row selection with the key: escape + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + if (!isEditing()) { + clearSelection(); + } + } + } + + @Override + public void keyReleased(KeyEvent e) { + } + +} Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTable.java ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java 2011-09-20 14:51:40 UTC (rev 3295) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java 2011-09-20 17:49:06 UTC (rev 3296) @@ -1,101 +1,101 @@ -/* - * #%L - * Lima :: Swing - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2011 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.financialstatementchart; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.jdesktop.swingx.JXTreeTable; - -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; - -public class FinancialStatementChartTreeTable extends JXTreeTable - implements KeyListener, MouseListener { - - /** serialVersionUID. */ - private static final long serialVersionUID = 3221024449873737253L; - - /** log. */ - private static final Log log = LogFactory - .getLog(FinancialStatementChartTreeTable.class); - - protected FinancialStatementChartViewHandler handler; - - public FinancialStatementChartTreeTable(FinancialStatementChartViewHandler handler) { - this.handler = handler; - - addKeyListener(this); - addMouseListener(this); - - } - - @Override - public void mouseClicked(MouseEvent e) { - } - - @Override - public void mousePressed(MouseEvent e) { - if (rowAtPoint(e.getPoint()) == -1) { - clearSelection(); - } - } - - @Override - public void mouseReleased(MouseEvent e) { - } - - @Override - public void mouseEntered(MouseEvent e) { - } - - @Override - public void mouseExited(MouseEvent e) { - } - - @Override - public void keyTyped(KeyEvent e) { - } - - /** - * for each action combination key are think - * for extend keyboard and laptop keyboard - */ - @Override - public void keyPressed(KeyEvent e) { - // clear row selection with the key: escape - if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { - if (!isEditing()) { - clearSelection(); - } - } - } - - @Override - public void keyReleased(KeyEvent e) { - } - -} +/* + * #%L + * Lima :: Swing + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2011 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.financialstatementchart; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.jdesktop.swingx.JXTreeTable; + +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +public class FinancialStatementChartTreeTable extends JXTreeTable + implements KeyListener, MouseListener { + + /** serialVersionUID. */ + private static final long serialVersionUID = 3221024449873737253L; + + /** log. */ + private static final Log log = LogFactory + .getLog(FinancialStatementChartTreeTable.class); + + protected FinancialStatementChartViewHandler handler; + + public FinancialStatementChartTreeTable(FinancialStatementChartViewHandler handler) { + this.handler = handler; + + addKeyListener(this); + addMouseListener(this); + + } + + @Override + public void mouseClicked(MouseEvent e) { + } + + @Override + public void mousePressed(MouseEvent e) { + if (rowAtPoint(e.getPoint()) == -1) { + clearSelection(); + } + } + + @Override + public void mouseReleased(MouseEvent e) { + } + + @Override + public void mouseEntered(MouseEvent e) { + } + + @Override + public void mouseExited(MouseEvent e) { + } + + @Override + public void keyTyped(KeyEvent e) { + } + + /** + * for each action combination key are think + * for extend keyboard and laptop keyboard + */ + @Override + public void keyPressed(KeyEvent e) { + // clear row selection with the key: escape + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + if (!isEditing()) { + clearSelection(); + } + } + } + + @Override + public void keyReleased(KeyEvent e) { + } + +} Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTable.java ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx 2011-09-20 14:51:40 UTC (rev 3295) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx 2011-09-20 17:49:06 UTC (rev 3296) @@ -1,149 +1,149 @@ -<!-- - #%L - Lima :: Swing - - $Id$ - $HeadURL$ - %% - Copyright (C) 2008 - 2011 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% - --> -<JDialog modal="true" - defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}" - onWindowClosing="performCancel();"> - - <import> - javax.swing.text.Document - org.chorem.lima.entity.EntryBook - org.chorem.lima.ui.LimaRendererUtil - org.chorem.lima.ui.combobox.EntryBookComboBoxModel - </import> - <EntryBook id="entryBook" javaBean="null"/> - <Boolean id="addState" javaBean='true'/> - - <script> - <![CDATA[ - - getRootPane().setDefaultButton(okButton); - - /** - * Sets null to EntryBook and closes JDialog - */ - protected void performCancel() { - setEntryBook(null); - dispose(); - } - - /** - * Sets the right EntryBook to use and its values - */ - protected void performNew() { - if (selectedEntryBook.isSelected()) { - entryBookComboBox.setEnabled(true); - entryBookLabelField.setEditable(false); - entryBookCodeField.setEditable(false); - if (getEntryBookComboBox().getSelectedItem() != null) { - getEntryBook().setCode(((EntryBook)getEntryBookComboBox().getSelectedItem()).getCode().trim()); - getEntryBook().setLabel(((EntryBook)getEntryBookComboBox().getSelectedItem()).getLabel().trim()); - } else { - setEntryBook(null); - } - } else { - entryBookComboBox.setEnabled(false); - entryBookLabelField.setEditable(true); - entryBookCodeField.setEditable(true); - getEntryBook().setCode(getEntryBookCodeField().getText()); - getEntryBook().setLabel(getEntryBookLabelField().getText()); - } - } - - void $afterCompleteSetup() { - performNew(); - } - ]]> - </script> - - <Table> - <row> - <cell anchor="west"> - <JRadioButton - id="selectedEntryBook" - text="lima.common.entrybook" - selected="true" - buttonGroup="EntryBookGroup" - onActionPerformed="performNew()"/> - </cell> - </row> - <row> - <cell> - <JLabel id="entryBookSelectorLabel" text="lima.common.entrybook"/> - </cell> - <cell> - <EntryBookComboBoxModel id="modelEntryBookComboBox"/> - <JComboBox id="entryBookComboBox" - model="{getModelEntryBookComboBox()}" - renderer="{LimaRendererUtil.newDecoratorListCellRenderer(EntryBook.class)}" - editable="false" - onItemStateChanged="getEntryBook().setCode(((EntryBook)getEntryBookComboBox().getSelectedItem()).getCode()); getEntryBook().setLabel(((EntryBook)getEntryBookComboBox().getSelectedItem()).getLabel())"/> - </cell> - </row> - <row> - <cell anchor="west"> - <JRadioButton - id="newEntryBook" - text="lima.home.entrybooks.create" - selected="false" - buttonGroup="EntryBookGroup" - onActionPerformed="performNew()"/> - </cell> - </row> - <row> - <cell> - <JLabel text="lima.common.code"/> - </cell> - <cell> - <JTextField id="entryBookCodeField" text="{getEntryBook().getCode()}"/> - <Document javaBean="getEntryBookCodeField().getDocument()" - onInsertUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())' - onRemoveUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())'/> - </cell> - </row> - <row> - <cell> - <JLabel text="lima.common.label"/> - </cell> - <cell> - <JTextField id="entryBookLabelField" editable='{isAddState()}' - text="{getEntryBook().getLabel()}"/> - <Document javaBean="getEntryBookLabelField().getDocument()" - onInsertUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())' - onRemoveUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())'/> - </cell> - </row> - <row> - <cell> - <JButton id="cancelButton" text="lima.common.cancel" - onActionPerformed="performCancel()"/> - </cell> - <cell> - <JButton id="okButton" text="lima.common.ok" - onActionPerformed="dispose()"/> - </cell> - - </row> - </Table> +<!-- + #%L + Lima :: Swing + + $Id$ + $HeadURL$ + %% + Copyright (C) 2008 - 2011 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% + --> +<JDialog modal="true" + defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}" + onWindowClosing="performCancel();"> + + <import> + javax.swing.text.Document + org.chorem.lima.entity.EntryBook + org.chorem.lima.ui.LimaRendererUtil + org.chorem.lima.ui.combobox.EntryBookComboBoxModel + </import> + <EntryBook id="entryBook" javaBean="null"/> + <Boolean id="addState" javaBean='true'/> + + <script> + <![CDATA[ + + getRootPane().setDefaultButton(okButton); + + /** + * Sets null to EntryBook and closes JDialog + */ + protected void performCancel() { + setEntryBook(null); + dispose(); + } + + /** + * Sets the right EntryBook to use and its values + */ + protected void performNew() { + if (selectedEntryBook.isSelected()) { + entryBookComboBox.setEnabled(true); + entryBookLabelField.setEditable(false); + entryBookCodeField.setEditable(false); + if (getEntryBookComboBox().getSelectedItem() != null) { + getEntryBook().setCode(((EntryBook)getEntryBookComboBox().getSelectedItem()).getCode().trim()); + getEntryBook().setLabel(((EntryBook)getEntryBookComboBox().getSelectedItem()).getLabel().trim()); + } else { + setEntryBook(null); + } + } else { + entryBookComboBox.setEnabled(false); + entryBookLabelField.setEditable(true); + entryBookCodeField.setEditable(true); + getEntryBook().setCode(getEntryBookCodeField().getText()); + getEntryBook().setLabel(getEntryBookLabelField().getText()); + } + } + + void $afterCompleteSetup() { + performNew(); + } + ]]> + </script> + + <Table> + <row> + <cell anchor="west"> + <JRadioButton + id="selectedEntryBook" + text="lima.common.entrybook" + selected="true" + buttonGroup="EntryBookGroup" + onActionPerformed="performNew()"/> + </cell> + </row> + <row> + <cell> + <JLabel id="entryBookSelectorLabel" text="lima.common.entrybook"/> + </cell> + <cell> + <EntryBookComboBoxModel id="modelEntryBookComboBox"/> + <JComboBox id="entryBookComboBox" + model="{getModelEntryBookComboBox()}" + renderer="{LimaRendererUtil.newDecoratorListCellRenderer(EntryBook.class)}" + editable="false" + onItemStateChanged="getEntryBook().setCode(((EntryBook)getEntryBookComboBox().getSelectedItem()).getCode()); getEntryBook().setLabel(((EntryBook)getEntryBookComboBox().getSelectedItem()).getLabel())"/> + </cell> + </row> + <row> + <cell anchor="west"> + <JRadioButton + id="newEntryBook" + text="lima.home.entrybooks.create" + selected="false" + buttonGroup="EntryBookGroup" + onActionPerformed="performNew()"/> + </cell> + </row> + <row> + <cell> + <JLabel text="lima.common.code"/> + </cell> + <cell> + <JTextField id="entryBookCodeField" text="{getEntryBook().getCode()}"/> + <Document javaBean="getEntryBookCodeField().getDocument()" + onInsertUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())' + onRemoveUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())'/> + </cell> + </row> + <row> + <cell> + <JLabel text="lima.common.label"/> + </cell> + <cell> + <JTextField id="entryBookLabelField" editable='{isAddState()}' + text="{getEntryBook().getLabel()}"/> + <Document javaBean="getEntryBookLabelField().getDocument()" + onInsertUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())' + onRemoveUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())'/> + </cell> + </row> + <row> + <cell> + <JButton id="cancelButton" text="lima.common.cancel" + onActionPerformed="performCancel()"/> + </cell> + <cell> + <JButton id="okButton" text="lima.common.ok" + onActionPerformed="dispose()"/> + </cell> + + </row> + </Table> </JDialog> \ No newline at end of file Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java 2011-09-20 14:51:40 UTC (rev 3295) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java 2011-09-20 17:49:06 UTC (rev 3296) @@ -1,160 +1,160 @@ -/* - * #%L - * Lima :: Swing - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2011 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.lettering; - -import org.apache.commons.lang.time.DateUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.entity.FinancialPeriod; -import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.enums.ComboBoxDatesEnum; -import org.chorem.lima.ui.LimaRendererUtil; -import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel; -import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel; -import org.jdesktop.swingx.JXDatePicker; - -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.ListCellRenderer; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Calendar; -import java.util.Date; - -import static org.nuiton.i18n.I18n._; - -public class LetteringPeriodSearchPanel extends JPanel { - - private static final Log log = - LogFactory.getLog(LetteringPeriodSearchPanel.class); - - protected LetteringViewHandler handler; - - public LetteringPeriodSearchPanel(LetteringViewHandler handler) { - this.handler = handler; - - //init date - refresh(ComboBoxDatesEnum.FISCAL_PERIOD); - } - - public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum) { - - switch (comboBoxPeriodEnum) { - case PERIOD: - // get begin date - Calendar calendarBegin = Calendar.getInstance(); - // set begindate to JAN 1 - 0:00.000 of this years - Date beginDate = calendarBegin.getTime(); - beginDate = DateUtils.truncate(beginDate, Calendar.YEAR); - //handler().setBeginDate(beginDate); - - // get end date - Calendar calendarEnd = Calendar.getInstance(); - Date endDate = calendarEnd.getTime(); - //handler().setEndDate(endDate); - JLabel beginDateLabel = new JLabel(_("lima.common.begindate")); - final JXDatePicker beginDatePicker = new JXDatePicker(beginDate); - ActionListener beginDateActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - handler.setBeginDate(beginDatePicker.getDate()); - handler.refresh(); - } - }; - handler.setBeginDate(beginDatePicker.getDate()); - beginDatePicker.addActionListener(beginDateActionListener); - - JLabel endDateLabel = new JLabel(_("lima.common.enddate")); - final JXDatePicker endDatePicker = new JXDatePicker(endDate); - ActionListener endDateActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - handler.setEndDate(endDatePicker.getDate()); - handler.refresh(); - } - }; - handler.setEndDate(endDatePicker.getDate()); - endDatePicker.addActionListener(endDateActionListener); - handler.refresh(); - - removeAll(); - add(beginDateLabel); - add(beginDatePicker); - add(endDateLabel); - add(endDatePicker); - break; - - case FISCAL_PERIOD: - FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true); - ListCellRenderer renderer = - LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class); - final JComboBox fiscalPeriod = new JComboBox(fiscalModel); - fiscalPeriod.setRenderer(renderer); - fiscalPeriod.setEditable(false); - ActionListener fiscalPeriodActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem(); - if (fPeriod != null) { - handler.setBeginDate(fPeriod.getBeginDate()); - handler.setEndDate(fPeriod.getEndDate()); - handler.refresh(); - } - } - }; - fiscalPeriod.addActionListener(fiscalPeriodActionListener); - - removeAll(); - add(fiscalPeriod); - break; - - case FINANCIAL_PERIOD: - FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true); - renderer = - LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class); - final JComboBox financialPeriod = new JComboBox(financialModel); - financialPeriod.setRenderer(renderer); - financialPeriod.setEditable(false); - ActionListener financialPeriodActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem(); - if (fPeriod != null) { - handler.setBeginDate(fPeriod.getBeginDate()); - handler.setEndDate(fPeriod.getEndDate()); - handler.refresh(); - } - } - }; - financialPeriod.addActionListener(financialPeriodActionListener); - removeAll(); - add(financialPeriod); - break; - } - - } - -} +/* + * #%L + * Lima :: Swing + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2011 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.lettering; + +import org.apache.commons.lang.time.DateUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.entity.FinancialPeriod; +import org.chorem.lima.entity.FiscalPeriod; +import org.chorem.lima.enums.ComboBoxDatesEnum; +import org.chorem.lima.ui.LimaRendererUtil; +import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel; +import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel; +import org.jdesktop.swingx.JXDatePicker; + +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Calendar; +import java.util.Date; + +import static org.nuiton.i18n.I18n._; + +public class LetteringPeriodSearchPanel extends JPanel { + + private static final Log log = + LogFactory.getLog(LetteringPeriodSearchPanel.class); + + protected LetteringViewHandler handler; + + public LetteringPeriodSearchPanel(LetteringViewHandler handler) { + this.handler = handler; + + //init date + refresh(ComboBoxDatesEnum.FISCAL_PERIOD); + } + + public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum) { + + switch (comboBoxPeriodEnum) { + case PERIOD: + // get begin date + Calendar calendarBegin = Calendar.getInstance(); + // set begindate to JAN 1 - 0:00.000 of this years + Date beginDate = calendarBegin.getTime(); + beginDate = DateUtils.truncate(beginDate, Calendar.YEAR); + //handler().setBeginDate(beginDate); + + // get end date + Calendar calendarEnd = Calendar.getInstance(); + Date endDate = calendarEnd.getTime(); + //handler().setEndDate(endDate); + JLabel beginDateLabel = new JLabel(_("lima.common.begindate")); + final JXDatePicker beginDatePicker = new JXDatePicker(beginDate); + ActionListener beginDateActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + handler.setBeginDate(beginDatePicker.getDate()); + handler.refresh(); + } + }; + handler.setBeginDate(beginDatePicker.getDate()); + beginDatePicker.addActionListener(beginDateActionListener); + + JLabel endDateLabel = new JLabel(_("lima.common.enddate")); + final JXDatePicker endDatePicker = new JXDatePicker(endDate); + ActionListener endDateActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + handler.setEndDate(endDatePicker.getDate()); + handler.refresh(); + } + }; + handler.setEndDate(endDatePicker.getDate()); + endDatePicker.addActionListener(endDateActionListener); + handler.refresh(); + + removeAll(); + add(beginDateLabel); + add(beginDatePicker); + add(endDateLabel); + add(endDatePicker); + break; + + case FISCAL_PERIOD: + FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true); + ListCellRenderer renderer = + LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class); + final JComboBox fiscalPeriod = new JComboBox(fiscalModel); + fiscalPeriod.setRenderer(renderer); + fiscalPeriod.setEditable(false); + ActionListener fiscalPeriodActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem(); + if (fPeriod != null) { + handler.setBeginDate(fPeriod.getBeginDate()); + handler.setEndDate(fPeriod.getEndDate()); + handler.refresh(); + } + } + }; + fiscalPeriod.addActionListener(fiscalPeriodActionListener); + + removeAll(); + add(fiscalPeriod); + break; + + case FINANCIAL_PERIOD: + FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true); + renderer = + LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class); + final JComboBox financialPeriod = new JComboBox(financialModel); + financialPeriod.setRenderer(renderer); + financialPeriod.setEditable(false); + ActionListener financialPeriodActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem(); + if (fPeriod != null) { + handler.setBeginDate(fPeriod.getBeginDate()); + handler.setEndDate(fPeriod.getEndDate()); + handler.refresh(); + } + } + }; + financialPeriod.addActionListener(financialPeriodActionListener); + removeAll(); + add(financialPeriod); + break; + } + + } + +} Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java ___________________________________________________________________ Added: svn:eol-style + native Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollBasicComboPopup.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/widgets/ScrollMetalComboUI.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL
participants (1)
-
tchemit@users.chorem.org