Author: tchemit Date: 2009-11-08 13:04:50 +0100 (Sun, 08 Nov 2009) New Revision: 2734 Added: trunk/lima-main/src/main/java/org/chorem/lima/ui/MainViewHandler.java trunk/lima-main/src/main/resources/icons/action-about.png trunk/lima-main/src/main/resources/icons/action-account.png trunk/lima-main/src/main/resources/icons/action-closure-timespan.png trunk/lima-main/src/main/resources/icons/action-closure.png trunk/lima-main/src/main/resources/icons/action-config.png trunk/lima-main/src/main/resources/icons/action-export-element.png trunk/lima-main/src/main/resources/icons/action-help.png trunk/lima-main/src/main/resources/icons/action-i18n-fr.png trunk/lima-main/src/main/resources/icons/action-i18n-uk.png trunk/lima-main/src/main/resources/icons/action-import-element.png trunk/lima-main/src/main/resources/icons/action-journal.png trunk/lima-main/src/main/resources/icons/action-lettering.png trunk/lima-main/src/main/resources/icons/action-print.png trunk/lima-main/src/main/resources/icons/action-quit.png trunk/lima-main/src/main/resources/icons/action-rapport.png trunk/lima-main/src/main/resources/icons/action-search.png trunk/lima-main/src/main/resources/icons/action-site.png trunk/lima-main/src/main/resources/icons/action-transaction.png trunk/lima-main/src/main/resources/icons/action-translate.png trunk/lima-main/src/main/resources/icons/action-view.png Removed: trunk/lima-main/src/main/java/org/chorem/lima/listener/TransactionClicRight.java trunk/lima-main/src/main/resources/icons/account.png trunk/lima-main/src/main/resources/icons/action/about.png trunk/lima-main/src/main/resources/icons/action/export-element.png trunk/lima-main/src/main/resources/icons/action/help.png trunk/lima-main/src/main/resources/icons/action/i18n-en.png trunk/lima-main/src/main/resources/icons/action/i18n-fr.png trunk/lima-main/src/main/resources/icons/action/quit.png trunk/lima-main/src/main/resources/icons/action/search.png trunk/lima-main/src/main/resources/icons/action/site.png trunk/lima-main/src/main/resources/icons/action/translate.png trunk/lima-main/src/main/resources/icons/closure-timespan.png trunk/lima-main/src/main/resources/icons/closure.png trunk/lima-main/src/main/resources/icons/journal.png trunk/lima-main/src/main/resources/icons/lettering.png trunk/lima-main/src/main/resources/icons/print.png trunk/lima-main/src/main/resources/icons/rapport.png trunk/lima-main/src/main/resources/icons/transaction.png trunk/lima-main/src/main/resources/icons/view.png Modified: trunk/lima-main/pom.xml trunk/lima-main/src/main/java/org/chorem/lima/DataManager.java trunk/lima-main/src/main/java/org/chorem/lima/LimaAction.java trunk/lima-main/src/main/java/org/chorem/lima/LimaConfig.java trunk/lima-main/src/main/java/org/chorem/lima/LimaContext.java trunk/lima-main/src/main/java/org/chorem/lima/Main.java trunk/lima-main/src/main/java/org/chorem/lima/balance/Balance.java trunk/lima-main/src/main/java/org/chorem/lima/export/CSVExport.java trunk/lima-main/src/main/java/org/chorem/lima/export/XMLExport.java trunk/lima-main/src/main/java/org/chorem/lima/imports/CSVImport.java trunk/lima-main/src/main/java/org/chorem/lima/imports/CSVImportEBP.java trunk/lima-main/src/main/java/org/chorem/lima/imports/XMLImport.java trunk/lima-main/src/main/java/org/chorem/lima/listener/ClicRight.java trunk/lima-main/src/main/java/org/chorem/lima/listener/EmptyLineSelectionListener.java trunk/lima-main/src/main/java/org/chorem/lima/listener/TransactionHeaderListener.java trunk/lima-main/src/main/java/org/chorem/lima/listener/TransactionKeyListener.java trunk/lima-main/src/main/java/org/chorem/lima/table/editor/AccountTableCellEditor.java trunk/lima-main/src/main/java/org/chorem/lima/table/editor/DateTableCellEditor.java trunk/lima-main/src/main/java/org/chorem/lima/table/editor/JournalTableCellEditor.java trunk/lima-main/src/main/java/org/chorem/lima/table/editor/PeriodTableCellEditor.java trunk/lima-main/src/main/java/org/chorem/lima/table/model/TransactionDataTableModel.java trunk/lima-main/src/main/java/org/chorem/lima/table/model/TransactionFlattenTableModel.java trunk/lima-main/src/main/java/org/chorem/lima/table/model/TransactionSortedTableModel.java trunk/lima-main/src/main/java/org/chorem/lima/ui/AccountViewImpl.java trunk/lima-main/src/main/java/org/chorem/lima/ui/AccueilView.jaxx trunk/lima-main/src/main/java/org/chorem/lima/ui/BalanceViewImpl.java trunk/lima-main/src/main/java/org/chorem/lima/ui/BilanViewImpl.java trunk/lima-main/src/main/java/org/chorem/lima/ui/ClosureViewImpl.java trunk/lima-main/src/main/java/org/chorem/lima/ui/CriteriaWidgetImpl.java trunk/lima-main/src/main/java/org/chorem/lima/ui/ExportViewImpl.java trunk/lima-main/src/main/java/org/chorem/lima/ui/ImportViewImpl.java trunk/lima-main/src/main/java/org/chorem/lima/ui/JournalViewImpl.java trunk/lima-main/src/main/java/org/chorem/lima/ui/LetteringViewImpl.java trunk/lima-main/src/main/java/org/chorem/lima/ui/MainView.jaxx trunk/lima-main/src/main/java/org/chorem/lima/ui/MainViewImpl.java trunk/lima-main/src/main/java/org/chorem/lima/ui/ProgressBarImpl.java trunk/lima-main/src/main/java/org/chorem/lima/ui/ReportsViewImpl.java trunk/lima-main/src/main/java/org/chorem/lima/ui/ResultViewImpl.java trunk/lima-main/src/main/java/org/chorem/lima/ui/SearchTransactionViewImpl.java trunk/lima-main/src/main/java/org/chorem/lima/ui/TransactionView.jaxx trunk/lima-main/src/main/java/org/chorem/lima/ui/TransactionViewImpl.java trunk/lima-main/src/main/resources/i18n/lima-main-en_GB.properties trunk/lima-main/src/main/resources/i18n/lima-main-fr_FR.properties Log: - add default application actions (help, site, translate, about) - refactor icons in main ui (use actionIcon attribute) - introduce MainViewHandler (should use only it and remove hugly MainViewImpl) Modified: trunk/lima-main/pom.xml =================================================================== --- trunk/lima-main/pom.xml 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/pom.xml 2009-11-08 12:04:50 UTC (rev 2734) @@ -158,6 +158,9 @@ <plugin> <groupId>org.nuiton</groupId> <artifactId>maven-license-plugin</artifactId> + <configuration> + <copyToMETA_INF>true</copyToMETA_INF> + </configuration> <executions> <execution> <id>attach-licenses</id> Modified: trunk/lima-main/src/main/java/org/chorem/lima/DataManager.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/DataManager.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/DataManager.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -64,7 +64,7 @@ public JournalTableModel getJournalModel() { if (journalModel == null) { /** Services */ - List<JournalDTO> journals = Main.getContext().getNeogiaFactory().getJournalService().getAllJournal(); + List<JournalDTO> journals = LimaContext.getContext().getNeogiaFactory().getJournalService().getAllJournal(); journalModel = new JournalTableModel(journals); } return journalModel; @@ -98,7 +98,7 @@ public AccountTreeTableModel getAccountModel() { if (accountModel == null) { /** Services */ - AccountDTO account = Main.getContext().getNeogiaFactory().getAccountService().getAllAccount(); + AccountDTO account = LimaContext.getContext().getNeogiaFactory().getAccountService().getAllAccount(); accountModel = new AccountTreeTableModel(account); } return accountModel; @@ -106,7 +106,7 @@ public AccountTreeTableModel resetAccountModel() { /** Services */ - AccountDTO account = Main.getContext().getNeogiaFactory().getAccountService().getAllAccount(); + AccountDTO account = LimaContext.getContext().getNeogiaFactory().getAccountService().getAllAccount(); accountModel = new AccountTreeTableModel(account); return accountModel; } @@ -125,7 +125,7 @@ if (transactionModel == null) { /** Services */ - List<TransactionDTO> data = Main.getContext().getNeogiaFactory().getTransactionService().getAllTransaction( + List<TransactionDTO> data = LimaContext.getContext().getNeogiaFactory().getTransactionService().getAllTransaction( ServiceHelper.getAllFlatPeriod( getPeriodes()), getJournalModel().getData(), @@ -141,7 +141,7 @@ if (transactionModel == null) { /** Services */ - List<TransactionDTO> data = Main.getContext().getNeogiaFactory().getTransactionService().getAllTransaction( + List<TransactionDTO> data = LimaContext.getContext().getNeogiaFactory().getTransactionService().getAllTransaction( ServiceHelper.getAllFlatPeriod( getPeriodes()), getJournalModel().getData(), @@ -172,7 +172,7 @@ public List<PeriodDTO> getPeriodes() { if (periodes == null) { /** Services */ - periodes = Main.getContext().getNeogiaFactory().getPeriodService().getAllPeriod( + periodes = LimaContext.getContext().getNeogiaFactory().getPeriodService().getAllPeriod( getStatus()); } return periodes; @@ -180,7 +180,7 @@ public List<PeriodDTO> resetPeriodes() { periodes.clear(); - periodes = Main.getContext().getNeogiaFactory().getPeriodService().getAllPeriod( + periodes = LimaContext.getContext().getNeogiaFactory().getPeriodService().getAllPeriod( getStatus()); return periodes; } @@ -197,7 +197,7 @@ public List<StatusDTO> getStatus() { if (status == null) { /** Services */ - status = Main.getContext().getNeogiaFactory().getStatusService().getAllStatus(); + status = LimaContext.getContext().getNeogiaFactory().getStatusService().getAllStatus(); } return status; } Modified: trunk/lima-main/src/main/java/org/chorem/lima/LimaAction.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/LimaAction.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/LimaAction.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -56,7 +56,7 @@ protected LimaConfig getConfig() { if (config == null) { - LimaContext context = Main.getContext(); + LimaContext context = LimaContext.getContext(); config = context.getConfig(); } return config; Modified: trunk/lima-main/src/main/java/org/chorem/lima/LimaConfig.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/LimaConfig.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/LimaConfig.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -1,7 +1,9 @@ package org.chorem.lima; +import java.beans.PropertyChangeListener; import java.io.IOException; import java.io.InputStream; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import static org.nuiton.i18n.I18n._; @@ -11,24 +13,26 @@ import java.io.File; import java.util.Locale; import java.util.Properties; + import org.nuiton.util.ConverterUtil; import org.nuiton.util.VersionUtil; /** * La configuration de l'application. - * + * <p/> * Note : cette classe sera auto-instanciée par le contexte applicatif. - * + * <p/> * TODO ajouter d'autres propriete pour controler quel storage est utilise * et quel est son type (local ou pas). - * + * * @author chemit * @see jaxx.runtime.DefaultApplicationContext.AutoLoad */ -@jaxx.runtime.DefaultApplicationContext.AutoLoad public class LimaConfig extends org.nuiton.util.ApplicationConfig { - /** to use log facility, just put in your code: log.info(\"...\"); */ + /** + * to use log facility, just put in your code: log.info(\"...\"); + */ static private Log log = LogFactory.getLog(LimaConfig.class); /** * La version du logiciel constitue de l.d.r @@ -48,14 +52,18 @@ protected final Version version; public static final String APPLICATION_PROPERTIES = "/lima.properties"; public static final String USER_DIRECTORY_FILENAME = ".lima"; - /** le repertoire utilisateur principale */ + /** + * le repertoire utilisateur principale + */ protected static File observeUserDirectory; public String getCopyrightText() { return "Version " + getVersion() + " Codelutin @ 2008-2009"; } - /** @return le nombre global ex: 3.2.0.0 */ + /** + * @return le nombre global ex: 3.2.0.0 + */ public String getVersion() { return version.toString(); } @@ -66,26 +74,15 @@ } return observeUserDirectory; } -// /** -// * -// * @return l'url de la sauvegarde embarquée. -// */ -// public static URL getInitialDBDump() { -// URL url = ObserveConfig.class.getResource(INITIAL_DB_DUMP); -// return url; -// } + /** - * un drapeau pour savoir si on est en mode pleine écran - */ - protected boolean fullscreen; - /** * un drepeau pour savoir s'il faut lancer l'interface graphique. * Cette valeur peut être programmées lors des actions. */ private boolean displayMainUI = true; /** * drapeau pour savoir si on peut utiliser des ui dans l'environnement. - * + * <p/> * Par defaut, on suppose qu'on peut utiliser l'environnement graphique * et si on désactive explicitement si pas d'environnement graphique trouvé. */ @@ -175,6 +172,12 @@ } } + public void setLocale(Locale newLocale) { + setOption(Option.LOCALE.key, newLocale.toString()); + saveForUser(); + firePropertyChange("locale", null, newLocale); + } + /** * Save configuration, in user home directory using the * {@link #getConfigFileName}. Default, env and commande line note saved @@ -182,46 +185,85 @@ public void saveForUser() { super.saveForUser(); } + public static final String[] DEFAULT_JAXX_PCS = { - "fullScreen" + "fullScreen" }; -// public void removeJaxxPropertyChangeListener() { -// PropertyChangeListener[] toRemove = jaxx.runtime.Util.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners()); -// if (toRemove == null || toRemove.length == 0) { -// return; -// } -// if (log.isDebugEnabled()) { -// log.debug("before remove : " + getPropertyChangeListeners().length); -// log.debug("toRemove : " + toRemove.length); -// } -// for (PropertyChangeListener listener : toRemove) { -// removePropertyChangeListener(listener); -// } -// if (log.isDebugEnabled()) { -// log.debug("after remove : " + getPropertyChangeListeners().length); -// } -// } + public void removeJaxxPropertyChangeListener() { + PropertyChangeListener[] toRemove = jaxx.runtime.Util.findJaxxPropertyChangeListener(DEFAULT_JAXX_PCS, getPropertyChangeListeners()); + if (toRemove == null || toRemove.length == 0) { + return; + } + if (log.isDebugEnabled()) { + log.debug("before remove : " + getPropertyChangeListeners().length); + log.debug("toRemove : " + toRemove.length); + + } + for (PropertyChangeListener listener : toRemove) { + removePropertyChangeListener(listener); + } + if (log.isDebugEnabled()) { + log.debug("after remove : " + getPropertyChangeListeners().length); + } + } + ////////////////////////////////////////////////// // Toutes les options disponibles ////////////////////////////////////////////////// - protected static enum Option { + public static enum Option implements OptionDef { - CONFIG_FILE(CONFIG_FILE_NAME, _("observe.config.configFileName.description"), "observe-config"), + CONFIG_FILE(CONFIG_FILE_NAME, _("lima.config.configFileName.description"), "lima-config", String.class, true, true), // directories - LOCALE("locale", _("lima.config.locale.description"), "fr_FR"), + LOCALE("locale", _("lima.config.locale.description"), "fr_FR", Locale.class, false, false), // ui config - FULL_SCREEN("ui.fullscreen", _("lima.config.ui.fullscreen"), "false"); + FULL_SCREEN("ui.fullscreen", _("lima.config.ui.fullscreen"), "false", Boolean.class, false, false); public final String key; public final String description; public final String defaultValue; + public final Class<?> type; + public final boolean _transient; + public final boolean _final; - private Option(String key, String description, String defaultValue) { + private Option(String key, String description, String defaultValue, Class<?> type, boolean _transient, boolean _final) { this.key = key; this.description = description; this.defaultValue = defaultValue; + this.type = type; + this._final = _final; + this._transient = _transient; } + + @Override + public boolean isFinal() { + return _final; + } + + @Override + public boolean isTransient() { + return _transient; + } + + @Override + public String getDefaultValue() { + return defaultValue; + } + + @Override + public String getDescription() { + return description; + } + + @Override + public String getKey() { + return key; + } + + @Override + public Class<?> getType() { + return type; + } } public static enum Step { @@ -231,8 +273,8 @@ public static enum Action { - HELP(_("observe.action.commandline.help"), LimaAction.class.getName() + "#help", "-h", "--help"), - NO_MAIN_UI(_("observe.action.commandline.disable.main.ui"), LimaAction.class.getName() + "#disableMainUI", "-n", "--no-main"); + HELP(_("lima.action.commandline.help"), LimaAction.class.getName() + "#help", "-h", "--help"), + NO_MAIN_UI(_("lima.action.commandline.disable.main.ui"), LimaAction.class.getName() + "#disableMainUI", "-n", "--no-main"); public String description; public String action; public String[] aliases; Modified: trunk/lima-main/src/main/java/org/chorem/lima/LimaContext.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/LimaContext.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/LimaContext.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -32,32 +32,37 @@ */ package org.chorem.lima; -import org.nuiton.i18n.I18n; +import jaxx.runtime.JAXXContextEntryDef; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.chorem.lima.dto.util.DTOHelper; import org.chorem.lima.service.ServiceFactory; +import org.chorem.lima.ui.MainView; +import org.chorem.lima.ui.MainViewHandler; import org.chorem.lima.ui.MainViewImpl; -//import org.chorem.lima.ui.actions.LimaBaseAction; +import org.nuiton.i18n.I18n; import java.util.Locale; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * @author chemit */ public class LimaContext extends jaxx.runtime.DefaultApplicationContext { - /** to use log facility, just put in your code: log.info(\"...\"); */ + /** + * to use log facility, just put in your code: log.info(\"...\"); + */ static private Log log = LogFactory.getLog(LimaContext.class); /** * l'intance partagée accessible après un appel à la méthode - * {@link #init(ObserveConfig)} + * {@link #init()} */ protected static LimaContext instance; + public static JAXXContextEntryDef<MainView> MAIN_UI_ENTRY_DEF = JAXXContextEntryDef.newDef("mainUI", MainView.class); /** * @return <code>true</code> si le context a été initialisé via la méthode - * {@link #init(ObserveConfig)}, <ocde>false</code> autrement. + * {@link #init()}, <ocde>false</code> autrement. */ public static boolean isInit() { return instance != null; @@ -68,6 +73,7 @@ * l'instance partagée. * <p/> * Note : Cette méthode ne peut être appelée qu'une seule fois. + * * @return l'instance partagée * @throws IllegalStateException si un contexte applicatif a déja été positionné. */ @@ -76,10 +82,9 @@ throw new IllegalStateException("there is already a application context registred."); } instance = new LimaContext(); - // init decorator service - //instance.getContextValue(DecoratorProvider.class); + instance.setContextValue(new LimaConfig()); + instance.setContextValue(new MainViewHandler()); - return instance; } @@ -88,7 +93,7 @@ * * @return l'instance partagé du contexte. * @throws IllegalStateException si le contexte n'a pas été initialisé via - * la méthode {@link #init(ObserveConfig)} + * la méthode {@link #init()} */ public static LimaContext get() throws IllegalStateException { if (!isInit()) { @@ -96,85 +101,39 @@ } return instance; } - protected final Object lock = new Object(); - public void lock() throws InterruptedException { - synchronized (lock) { - lock.wait(); - } - } - - public void releaseLock() { - synchronized (lock) { - lock.notify(); - } - } /** - * flag to say if user is actually remote connected - */ - protected boolean connected; - /** * neogia factory */ protected ServiceFactory neogiaFactory; + /** - * main UI - */ - protected MainViewImpl mainUI; - /** - * action factory - */ -// protected ActionFactory<LimaBaseAction> actionFactory; - /** * Data manager* */ protected DataManager dataManager; - public LimaContext() { - super(); - } - public LimaConfig getConfig() { return getContextValue(LimaConfig.class); } public void initI18n() { - //TODO Load system locale - Locale locale = Locale.FRENCH; + Locale locale = getConfig().getLocale(); I18n.init(locale); /** Default Locale for DatePicker **/ Locale.setDefault(locale); DTOHelper.setLocale(locale); } - public void dispose(boolean reload) { +// public void dispose(boolean reload) { +// +// disposeUI(); +// +// if (reload) { +// Main.launch(this); +// } +// } -// getActionFactory().dispose(); - - disposeUI(); - - //ErrorDialog.disposeUI(); - //Main.getUI().disposeUI(); - - if (reload) { - Main.launch(); - } - } - - public boolean isConnected() { - return connected; - } - - public void setConnected(boolean connected) { - this.connected = connected; - } - - public void loginUser(boolean b, String login, String password) { - //Fixme :) - connected = true; - } - public ServiceFactory getNeogiaFactory() { if (neogiaFactory == null) { neogiaFactory = ServiceFactory.getServiceFactory(); @@ -182,18 +141,13 @@ return neogiaFactory; } -// public ActionFactory<LimaBaseAction> getActionFactory() { -// if (actionFactory == null) { -// actionFactory = ActionFactoryFromProvider.newInstance(LimaBaseAction.class); -// } -// return actionFactory; -// } public MainViewImpl getMainUI() { - if (mainUI == null) { - log.debug("getMainUI"); - mainUI = new MainViewImpl(); - } - return mainUI; + return (MainViewImpl) MAIN_UI_ENTRY_DEF.getContextValue(this); +// if (mainUI == null) { +// log.debug("getMainUI"); +// mainUI = new MainViewImpl(); +// } +// return mainUI; } public DataManager getDataManager() { @@ -203,12 +157,12 @@ return dataManager; } - public void disposeUI() { - if (mainUI != null) { - mainUI.dispose(); - mainUI = null; - } - } +// public void disposeUI() { +// MainView mainUI = getMainUI(); +// if (mainUI != null) { +// mainUI.dispose(); +// } +// } /** * close the application's context. @@ -221,10 +175,18 @@ } // fermeture du context principal - disposeUI(); + MainView mainUI = getMainUI(); + if (mainUI != null) { + mainUI.dispose(); + } if (log.isDebugEnabled()) { log.debug("context closed" + this); } + System.exit(0); } + + public static LimaContext getContext() { + return get(); + } } Modified: trunk/lima-main/src/main/java/org/chorem/lima/Main.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/Main.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/Main.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -21,32 +21,62 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.ui.MainView; +import org.chorem.lima.ui.MainViewHandler; import org.chorem.lima.ui.ProgressBarImpl; import org.chorem.lima.service.ServiceFactory; import static org.nuiton.i18n.I18n._; + import java.util.Locale; import javax.swing.SwingUtilities; + import jaxx.runtime.SwingUtil; import jaxx.runtime.swing.ErrorDialogUI; import org.apache.commons.beanutils.ConvertUtils; import org.apache.commons.beanutils.Converter; import org.apache.commons.beanutils.converters.DateConverter; import org.chorem.lima.tree.model.AccountTreeTableModel; -import org.chorem.lima.ui.MainViewImpl; import org.nuiton.i18n.I18n; import org.nuiton.util.ConverterUtil; import org.nuiton.util.StringUtil; -/** @author ore */ +/** + * @author ore + */ public class Main { private static final Log log = LogFactory.getLog(Main.class); - private static long startingTime = System.nanoTime(); - private static ProgressBarImpl b; - public static LimaContext getContext() { - return LimaContext.get(); + /** + * @param args les arguments passes au programme + */ + public static void main(String[] args) { + + long startingTime = System.nanoTime(); + log.info("Lima start at " + new java.util.Date() + " args: " + java.util.Arrays.toString(args)); + + try { + + // init root context + final LimaContext context = init(args); + + log.info(_("lima.init.context.done", StringUtil.convertTime(startingTime, System.nanoTime()))); + + LimaConfig config = context.getContextValue(LimaConfig.class); + + config.doAction(LimaConfig.Step.AfterInit.ordinal()); + + if (config.isDisplayMainUI()) { + // on affiche l'ui principale + + launch(context); + } + } catch (Exception e) { + ErrorDialogUI.showError(e); + log.error(e.getMessage(), e); + System.exit(1); + } } /** @@ -84,6 +114,8 @@ config.parse(args); + context.initI18n(); + // prepare ui look&feel and load ui properties try { SwingUtil.initNimbusLoookAndFeel(); @@ -119,82 +151,53 @@ return context; } - /** @param args les arguments passes au programme */ - public static void main(String[] args) { + public static void launch(final LimaContext context) { - startingTime = System.nanoTime(); - log.info("Lima start at " + new java.util.Date() + " args: " + java.util.Arrays.toString(args)); + MainViewHandler uiHandler = context.getContextValue(MainViewHandler.class); - try { + // do init ui + final MainView ui = uiHandler.initUI(context, context.getConfig().isFullScreen()); - // init root context - final LimaContext context = init(args); - - log.info(_("lima.init.context.done", StringUtil.convertTime(startingTime, System.nanoTime()))); - - LimaConfig config = context.getContextValue(LimaConfig.class); - - config.doAction(LimaConfig.Step.AfterInit.ordinal()); - - if (config.isDisplayMainUI()) { - // on affiche l'ui principale - - launch(); - } - } catch (Exception e) { - ErrorDialogUI.showError(e); - log.error(e.getMessage(), e); - System.exit(1); - } - -// // launch ui -// launch(); - } - - public static void launch() { - final MainViewImpl ui = getContext().getMainUI(); - log.info(_("lima.init.ui.done")); /** * Lancement de la barre de chargement * L'application va charger en mémoire les données */ - new Thread() - { + new Thread() { @Override - public void run(){ - - if ( b == null) - { - b = new ProgressBarImpl(); - // Chargement des journaux - b.getProgressBar().setString("5% : "+_("lima.progressBar.load.etape1")); - b.getProgressBar().setValue(0); - Main.getContext().getDataManager().getJournalModel(); - // Chargement des comptes - b.getProgressBar().setString("30% : "+_("lima.progressBar.load.etape2")); - b.getProgressBar().setValue(30); - AccountTreeTableModel accountModel = Main.getContext().getDataManager().getAccountModel(); - b.loadDefaultAccount(accountModel.getData()); + public void run() { - // Chargement des status - b.getProgressBar().setString("50% : "+_("lima.progressBar.load.etape3")); - b.getProgressBar().setValue(50); - Main.getContext().getDataManager().getStatus(); - // Chargement des periodes - b.getProgressBar().setString("60% : "+_("lima.progressBar.load.etape4")); - b.getProgressBar().setValue(60); - Main.getContext().getDataManager().getPeriodes(); - // Chargement des transactions - b.getProgressBar().setString("70% : "+_("lima.progressBar.load.etape5")); - b.getProgressBar().setValue(70); - Main.getContext().getDataManager().getTransactionModel(b.getProgressBar()); - b.getProgressBarFrame().dispose(); - } + ProgressBarImpl b = new ProgressBarImpl(); + b.setModal(true); + // Chargement des journaux + b.getProgressBar().setString("5% : " + _("lima.progressBar.load.etape1")); + b.getProgressBar().setValue(0); + DataManager dataManager = context.getDataManager(); + dataManager.getJournalModel(); + // Chargement des comptes + b.getProgressBar().setString("30% : " + _("lima.progressBar.load.etape2")); + b.getProgressBar().setValue(30); + AccountTreeTableModel accountModel = dataManager.getAccountModel(); + b.loadDefaultAccount(accountModel.getData()); + + // Chargement des status + b.getProgressBar().setString("50% : " + _("lima.progressBar.load.etape3")); + b.getProgressBar().setValue(50); + dataManager.getStatus(); + // Chargement des periodes + b.getProgressBar().setString("60% : " + _("lima.progressBar.load.etape4")); + b.getProgressBar().setValue(60); + dataManager.getPeriodes(); + // Chargement des transactions + b.getProgressBar().setString("70% : " + _("lima.progressBar.load.etape5")); + b.getProgressBar().setValue(70); + dataManager.getTransactionModel(b.getProgressBar()); + b.getProgressBarFrame().dispose(); } }.start(); + // show ui SwingUtilities.invokeLater(new Runnable() { @Override @@ -214,6 +217,7 @@ public void run() { try { super.run(); + LimaContext.get().close(); // force to kill main thread Modified: trunk/lima-main/src/main/java/org/chorem/lima/balance/Balance.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/balance/Balance.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/balance/Balance.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -19,15 +19,14 @@ package org.chorem.lima.balance; +import org.chorem.lima.LimaContext; import org.chorem.lima.dto.AccountDTO; import org.chorem.lima.dto.BalanceDTO; import org.chorem.lima.dto.EntryDTO; import org.chorem.lima.dto.PeriodDTO; import org.chorem.lima.dto.TransactionDTO; import org.chorem.lima.dto.util.DTOHelper; -import org.chorem.lima.Main; import org.chorem.lima.service.util.ServiceHelper; -import org.chorem.lima.util.Util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -60,7 +59,7 @@ public ArrayList<BalanceDTO> createBalance (PeriodDTO period) { // Récupère toutes les transactions comptables - List<TransactionDTO> listAllTransaction = Main.getContext().getDataManager().getTransactionModel().getData(); + List<TransactionDTO> listAllTransaction = LimaContext.getContext().getDataManager().getTransactionModel().getData(); // Récupère toutes les transactions de la période List<TransactionDTO> listTransaction = ServiceHelper.findTransactionByPeriod(period, listAllTransaction); // Création tableau associatif Modified: trunk/lima-main/src/main/java/org/chorem/lima/export/CSVExport.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/export/CSVExport.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/export/CSVExport.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -22,7 +22,7 @@ import au.com.bytecode.opencsv.CSVWriter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.Main; +import org.chorem.lima.LimaContext; import org.chorem.lima.dto.AccountDTO; import org.chorem.lima.dto.EntryDTO; import org.chorem.lima.dto.JournalDTO; @@ -85,7 +85,7 @@ String[] nextLine = new String[1]; // Début période // Sélection la période utilisée actuellement - PeriodDTO period = Main.getContext().getDataManager().getCurrentPeriod(); + PeriodDTO period = LimaContext.getContext().getDataManager().getCurrentPeriod(); // Si la période courante est une période mensuelle, on récupère la période annuelle if ( period.getParent() != null ) { @@ -118,7 +118,7 @@ { String[] nextLine = new String[5]; // Récupère tous les comptes - List<AccountDTO> listAccount = ServiceHelper.getAllFlatAccount(Main.getContext().getDataManager().getAccountModel().getData()); + List<AccountDTO> listAccount = ServiceHelper.getAllFlatAccount(LimaContext.getContext().getDataManager().getAccountModel().getData()); // Pour tous les comptes for (AccountDTO account : listAccount) { @@ -139,7 +139,7 @@ { String[] nextLine = new String[5]; // Récupère tous les journaux - List<JournalDTO> listJournal = Main.getContext().getDataManager().getJournalModel().getData(); + List<JournalDTO> listJournal = LimaContext.getContext().getDataManager().getJournalModel().getData(); // Pour tous les journaux for (JournalDTO journal : listJournal) { @@ -161,7 +161,7 @@ String[] nextLineTrans = new String[8]; String[] nextLineEntry = new String[7]; // Récupère toutes les transactions - List<TransactionDTO> listTransaction = Main.getContext().getDataManager().getTransactionModel().getData(); + List<TransactionDTO> listTransaction = LimaContext.getContext().getDataManager().getTransactionModel().getData(); // Pour toutes les transactions for (TransactionDTO transaction : listTransaction) { Modified: trunk/lima-main/src/main/java/org/chorem/lima/export/XMLExport.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/export/XMLExport.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/export/XMLExport.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -26,6 +26,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaContext; import org.jdom.*; import org.jdom.output.*; import org.chorem.lima.dto.AccountDTO; @@ -33,7 +34,6 @@ import org.chorem.lima.dto.JournalDTO; import org.chorem.lima.dto.PeriodDTO; import org.chorem.lima.dto.TransactionDTO; -import org.chorem.lima.Main; import org.chorem.lima.service.util.ServiceHelper; import org.chorem.lima.ui.ProgressBarImpl; import org.chorem.lima.util.Util; @@ -60,10 +60,10 @@ // Déclaration variables pour chargement des données - private static List<PeriodDTO> listPeriodDTO = Main.getContext().getDataManager().getPeriodes(); - private static List<JournalDTO> listJournalDTO = Main.getContext().getDataManager().getJournalModel().getData(); - private static AccountDTO AccountMasterDTO = Main.getContext().getDataManager().getAccountModel().getData(); - private static List<TransactionDTO> listTransactionDTO = Main.getContext().getDataManager().getTransactionModel().getData(); + private static List<PeriodDTO> listPeriodDTO = LimaContext.getContext().getDataManager().getPeriodes(); + private static List<JournalDTO> listJournalDTO = LimaContext.getContext().getDataManager().getJournalModel().getData(); + private static AccountDTO AccountMasterDTO = LimaContext.getContext().getDataManager().getAccountModel().getData(); + private static List<TransactionDTO> listTransactionDTO = LimaContext.getContext().getDataManager().getTransactionModel().getData(); Modified: trunk/lima-main/src/main/java/org/chorem/lima/imports/CSVImport.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/imports/CSVImport.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/imports/CSVImport.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -22,7 +22,7 @@ import au.com.bytecode.opencsv.CSVReader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.Main; +import org.chorem.lima.LimaContext; import org.chorem.lima.dto.AccountDTO; import org.chorem.lima.dto.EntryDTO; import org.chorem.lima.dto.JournalDTO; @@ -122,7 +122,7 @@ Date begin = Util.InitDateFirstDayMonth(beginPeriod); Date end = Util.InitDateEndDayMonth(endPeriod); PeriodDTO period = new PeriodDTO("",Integer.toString(begin.getYear()+1900),begin,end,null,null, - ServiceHelper.findStatusByType(Main.getContext().getDataManager().getStatus(), "PE_OPEN")); + ServiceHelper.findStatusByType(LimaContext.getContext().getDataManager().getStatus(), "PE_OPEN")); // Création des 12 mois List<PeriodDTO> listPeriodChild = new LinkedList<PeriodDTO>(); // Pour chaque mois @@ -132,7 +132,7 @@ Date endTimeSpan = Util.InitDateEndDayMonth(new Date(begin.getYear(),begin.getMonth()+i,begin.getDate())); // Création période PeriodDTO periodChild = new PeriodDTO("",ServiceHelper.dateToMonth(beginTimeSpan)+" "+(beginTimeSpan.getYear()+1900),beginTimeSpan,endTimeSpan,null,period, - ServiceHelper.findStatusByType(Main.getContext().getDataManager().getStatus(), "PE_OPEN")); + ServiceHelper.findStatusByType(LimaContext.getContext().getDataManager().getStatus(), "PE_OPEN")); listPeriodChild.add(periodChild); } // On ajoute les 12 mois à l'exercice @@ -141,9 +141,9 @@ LinkedList<PeriodDTO> listPeriod= new LinkedList<PeriodDTO>(); listPeriod.add(period); // Ajoute la période dans le service des Périodes - periodService.createPeriod(period, Main.getContext().getDataManager().getStatus()); + periodService.createPeriod(period, LimaContext.getContext().getDataManager().getStatus()); // Réinitialise les périodes - Main.getContext().getDataManager().resetPeriodes(listPeriod); + LimaContext.getContext().getDataManager().resetPeriodes(listPeriod); /** * Lecture de chaque ligne @@ -170,7 +170,7 @@ // Tous les comtes ont été chargés, on relance pour les charger if (!endReadAccount) { - Main.getContext().getDataManager().resetAccountModel(accountRac); + LimaContext.getContext().getDataManager().resetAccountModel(accountRac); endReadAccount = true; } log.debug("Ajout journal "+nextLine[1]); @@ -198,7 +198,7 @@ } // Reset transactions - Main.getContext().getDataManager().resetTransactionModel(listTransactions); + LimaContext.getContext().getDataManager().resetTransactionModel(listTransactions); return result; } @@ -242,7 +242,7 @@ } // Création du compte AccountDTO account = new AccountDTO("",numberAccount,label,type,new LinkedList<AccountDTO>(),accountMaster); - String result = Main.getContext().getDataManager().getAccountModel().addAccount(account); + String result = LimaContext.getContext().getDataManager().getAccountModel().addAccount(account); return result; } @@ -272,7 +272,7 @@ // journal String journal = line[5]; JournalDTO journalDTO = ServiceHelper.findJournalById( - Main.getContext().getDataManager().getJournalModel().getData(), + LimaContext.getContext().getDataManager().getJournalModel().getData(), journal); if (journalDTO == null) { log.warn("Import : Journal " + journal + " does not exist."); @@ -281,17 +281,17 @@ Date period = Util.stringToDate(line[6], "dd/MM/yyyy"); // Recherche la période correspondante PeriodDTO periodDTO = ServiceHelper.findPeriodByDate( - ServiceHelper.getAllFlatPeriod(Main.getContext().getDataManager().getPeriodes()), period); + ServiceHelper.getAllFlatPeriod(LimaContext.getContext().getDataManager().getPeriodes()), period); /** * Création de la transaction */ TransactionDTO transaction = new TransactionDTO(null, name, date, voucherRef, description, journalDTO, new LinkedList<EntryDTO>(), periodDTO, - ServiceHelper.findStatusByType(Main.getContext().getDataManager().getStatus(), "TR_WIP")); + ServiceHelper.findStatusByType(LimaContext.getContext().getDataManager().getStatus(), "TR_WIP")); transactionLast = transaction; // Ajoute la transaction dans le service //result = Main.getContext().getDataManager().getTransactionModel().addTransaction(transaction); - result = transactionService.addTransaction(transaction, Main.getContext().getDataManager().getStatus()); + result = transactionService.addTransaction(transaction, LimaContext.getContext().getDataManager().getStatus()); // Ajoute la transaction dans la liste des transactions listTransactions.add(transaction); return result; @@ -311,7 +311,7 @@ */ String accountId = line[1]; AccountDTO accountDTO = ServiceHelper.findAccountById( - ServiceHelper.getAllFlatAccount(Main.getContext().getDataManager().getAccountModel().getData()), + ServiceHelper.getAllFlatAccount(LimaContext.getContext().getDataManager().getAccountModel().getData()), accountId); if (accountDTO == null) { log.warn("Import : Account " + accountId + " does not exist."); @@ -335,7 +335,7 @@ // Création de l'entrée comptable EntryDTO entry = new EntryDTO("",description,DTOHelper.format(amount),debit,lettrage,accountDTO,transactionLast,null); // Ajout de l'entrée comptable dans le service - result = entryService.addEntry(Main.getContext().getDataManager().getStatus(), entry); + result = entryService.addEntry(LimaContext.getContext().getDataManager().getStatus(), entry); // Ajout l'entrée à la transaction transactionLast.addChild(entry); return result; @@ -354,7 +354,7 @@ // Création du journal JournalDTO journalDTO = new JournalDTO("",name,description,prefixe); // Ajout du journal dans le modèle de Lima - String result = Main.getContext().getDataManager().getJournalModel().addJournal(journalDTO); + String result = LimaContext.getContext().getDataManager().getJournalModel().addJournal(journalDTO); return result; } Modified: trunk/lima-main/src/main/java/org/chorem/lima/imports/CSVImportEBP.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/imports/CSVImportEBP.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/imports/CSVImportEBP.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -22,6 +22,7 @@ import au.com.bytecode.opencsv.CSVReader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaContext; import org.chorem.lima.balance.Category; import org.chorem.lima.dto.AccountDTO; import org.chorem.lima.dto.EntryDTO; @@ -29,7 +30,6 @@ import org.chorem.lima.dto.PeriodDTO; import org.chorem.lima.dto.TransactionDTO; import org.chorem.lima.dto.util.DTOHelper; -import org.chorem.lima.Main; import org.chorem.lima.util.Util; import org.chorem.lima.service.*; import org.chorem.lima.service.util.ServiceHelper; @@ -133,7 +133,7 @@ Date begin = Util.InitDateFirstDayMonth(beginPeriod); Date end = Util.InitDateEndDayMonth(endPeriod); PeriodDTO period = new PeriodDTO("",Integer.toString(begin.getYear()+1900),begin,end,null,null, - ServiceHelper.findStatusByType(Main.getContext().getDataManager().getStatus(), "PE_OPEN")); + ServiceHelper.findStatusByType(LimaContext.getContext().getDataManager().getStatus(), "PE_OPEN")); // Création des 12 mois List<PeriodDTO> listPeriodChild = new LinkedList<PeriodDTO>(); // Pour chaque mois @@ -143,7 +143,7 @@ Date endTimeSpan = Util.InitDateEndDayMonth(new Date(begin.getYear(),begin.getMonth()+i,begin.getDate())); // Création période PeriodDTO periodChild = new PeriodDTO("",ServiceHelper.dateToMonth(beginTimeSpan)+" "+(beginTimeSpan.getYear()+1900),beginTimeSpan,endTimeSpan,null,period, - ServiceHelper.findStatusByType(Main.getContext().getDataManager().getStatus(), "PE_OPEN")); + ServiceHelper.findStatusByType(LimaContext.getContext().getDataManager().getStatus(), "PE_OPEN")); listPeriodChild.add(periodChild); } // On ajoute les 12 mois à l'exercice @@ -152,9 +152,9 @@ LinkedList<PeriodDTO> listPeriod= new LinkedList<PeriodDTO>(); listPeriod.add(period); // Ajoute la période dans le service des Périodes - periodService.createPeriod(period, Main.getContext().getDataManager().getStatus()); + periodService.createPeriod(period, LimaContext.getContext().getDataManager().getStatus()); // Réinitialise les périodes - Main.getContext().getDataManager().resetPeriodes(listPeriod); + LimaContext.getContext().getDataManager().resetPeriodes(listPeriod); /** * Lecture de chaque ligne @@ -182,7 +182,7 @@ // Tous les comtes ont été chargés, on relance pour les charger if (!endReadAccount) { - Main.getContext().getDataManager().resetAccountModel(accountRac); + LimaContext.getContext().getDataManager().resetAccountModel(accountRac); endReadAccount = true; } log.debug("Ajout journal "+nextLine[1]); @@ -203,7 +203,7 @@ } // Reset transactions - Main.getContext().getDataManager().resetTransactionModel(listTransactions); + LimaContext.getContext().getDataManager().resetTransactionModel(listTransactions); return result; } @@ -247,7 +247,7 @@ String category = Category.findCategory(numberAccount); // Création du compte AccountDTO account = new AccountDTO("",numberAccount,label,category,new LinkedList<AccountDTO>(),accountMaster); - String result = Main.getContext().getDataManager().getAccountModel().addAccount(account); + String result = LimaContext.getContext().getDataManager().getAccountModel().addAccount(account); return result; } @@ -274,7 +274,7 @@ */ String accountId = line[1]; AccountDTO accountDTO = ServiceHelper.findAccountById( - ServiceHelper.getAllFlatAccount(Main.getContext().getDataManager().getAccountModel().getData()), + ServiceHelper.getAllFlatAccount(LimaContext.getContext().getDataManager().getAccountModel().getData()), accountId); if (accountDTO == null) { log.warn("Import : Account " + accountId + " does not exist."); @@ -288,7 +288,7 @@ */ String journalId = line[3]; JournalDTO journalDTO = ServiceHelper.findJournalById( - Main.getContext().getDataManager().getJournalModel().getData(), + LimaContext.getContext().getDataManager().getJournalModel().getData(), journalId); if (journalDTO == null) { log.warn("Import : Journal " + journalId + " does not exist."); @@ -317,21 +317,21 @@ { // Recherche la période correspondante PeriodDTO period = ServiceHelper.findPeriodByDate( - ServiceHelper.getAllFlatPeriod(Main.getContext().getDataManager().getPeriodes()), dateTransac); + ServiceHelper.getAllFlatPeriod(LimaContext.getContext().getDataManager().getPeriodes()), dateTransac); // Création de la transaction TransactionDTO transaction = new TransactionDTO(null, "", dateTransac, numTransac, descTransac, journalDTO, new LinkedList<EntryDTO>(), period, - ServiceHelper.findStatusByType(Main.getContext().getDataManager().getStatus(), "TR_WIP")); + ServiceHelper.findStatusByType(LimaContext.getContext().getDataManager().getStatus(), "TR_WIP")); transactionWithSamePrefix = transaction; // Ajoute la transaction dans le service - result = transactionService.addTransaction(transaction, Main.getContext().getDataManager().getStatus()); + result = transactionService.addTransaction(transaction, LimaContext.getContext().getDataManager().getStatus()); // Ajoute la transaction dans la liste des transactions listTransactions.add(transaction); } // Création de l'entrée comptable EntryDTO entry = new EntryDTO("","",DTOHelper.format(amount),debit,lettrage,accountDTO,transactionWithSamePrefix,null); // Ajout de l'entrée comptable dans le service - result = entryService.addEntry(Main.getContext().getDataManager().getStatus(), entry); + result = entryService.addEntry(LimaContext.getContext().getDataManager().getStatus(), entry); // Ajout l'entrée à la transaction transactionWithSamePrefix.addChild(entry); return result; @@ -355,7 +355,7 @@ // Création du journal JournalDTO journalDTO = new JournalDTO("",description,description,prefixe); // Ajout du journal dans le modèle de Lima - String result = Main.getContext().getDataManager().getJournalModel().addJournal(journalDTO); + String result = LimaContext.getContext().getDataManager().getJournalModel().addJournal(journalDTO); return result; } Modified: trunk/lima-main/src/main/java/org/chorem/lima/imports/XMLImport.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/imports/XMLImport.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/imports/XMLImport.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -22,10 +22,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaContext; import org.jdom.*; import org.chorem.lima.dto.AccountDTO; import org.chorem.lima.dto.JournalDTO; -import org.chorem.lima.Main; import org.chorem.lima.service.util.ServiceHelper; import org.jdom.input.SAXBuilder; @@ -69,7 +69,7 @@ log.debug("Load Journal XML "); } // Variables - journalServ = Main.getContext().getDataManager().getJournalModel(); + journalServ = LimaContext.getContext().getDataManager().getJournalModel(); String result = ServiceHelper.RESPOND_ERROR; boolean existError = false; // Chargement du fichier @@ -136,7 +136,7 @@ private String importAccount() { // Variables - accountServ = Main.getContext().getDataManager().getAccountModel(); + accountServ = LimaContext.getContext().getDataManager().getAccountModel(); String result = ServiceHelper.RESPOND_ERROR; boolean existError = false; try { @@ -192,7 +192,7 @@ result = ServiceHelper.RESPOND_SUCCESS; } // Reset pour le chargement des comptes - Main.getContext().getDataManager().resetAccountModel(); + LimaContext.getContext().getDataManager().resetAccountModel(); return result; } Modified: trunk/lima-main/src/main/java/org/chorem/lima/listener/ClicRight.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/listener/ClicRight.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/listener/ClicRight.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -19,11 +19,9 @@ package org.chorem.lima.listener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import javax.swing.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import javax.swing.JPopupMenu; /** * Cette classe permet l'affichage d'un menu lors d'un clic droit. @@ -32,15 +30,10 @@ */ public class ClicRight extends MouseAdapter { - /** - * log - */ - private static final Log log = LogFactory.getLog(ClicRight.class); + JPopupMenu popup; - JPopupMenu MenuClicDroit; - public ClicRight(JPopupMenu popupMenu) { - MenuClicDroit = popupMenu; + popup = popupMenu; } @Override @@ -55,8 +48,7 @@ private void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { - MenuClicDroit.show(e.getComponent(), - e.getX(), e.getY()); + popup.show(e.getComponent(), e.getX(), e.getY()); } } } \ No newline at end of file Modified: trunk/lima-main/src/main/java/org/chorem/lima/listener/EmptyLineSelectionListener.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/listener/EmptyLineSelectionListener.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/listener/EmptyLineSelectionListener.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -19,8 +19,6 @@ package org.chorem.lima.listener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.lima.dto.EntryDTO; import org.chorem.lima.dto.TransactionDTO; import org.chorem.lima.dto.util.DTOHelper; @@ -41,11 +39,6 @@ */ public class EmptyLineSelectionListener extends MouseAdapter { - /** - * log - */ - private static final Log log = LogFactory.getLog(EmptyLineSelectionListener.class); - @Override public void mouseClicked(MouseEvent e) { TransactionJXTable table = (TransactionJXTable) e.getSource(); Deleted: trunk/lima-main/src/main/java/org/chorem/lima/listener/TransactionClicRight.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/listener/TransactionClicRight.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/listener/TransactionClicRight.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -1,61 +0,0 @@ -/** - * *##% Lima-Callao TransactionClicRight - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* - */ - -package org.chorem.lima.listener; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import javax.swing.JPopupMenu; - -/** - * - * @author Rémi Chapelet - */ -public class TransactionClicRight extends MouseAdapter { - - /** - * log - */ - private static final Log log = LogFactory.getLog(ClicRight.class); - - JPopupMenu MenuClicDroit; - - public TransactionClicRight(JPopupMenu popupMenu) { - MenuClicDroit = popupMenu; - } - - @Override - public void mousePressed(MouseEvent e) { - maybeShowPopup(e); - } - - @Override - public void mouseReleased(MouseEvent e) { - maybeShowPopup(e); - } - - private void maybeShowPopup(MouseEvent e) { - if (e.isPopupTrigger()) { - MenuClicDroit.show(e.getComponent(), - e.getX(), e.getY()); - } - } -} \ No newline at end of file Modified: trunk/lima-main/src/main/java/org/chorem/lima/listener/TransactionHeaderListener.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/listener/TransactionHeaderListener.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/listener/TransactionHeaderListener.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -19,8 +19,6 @@ package org.chorem.lima.listener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.lima.table.TransactionJXTable; import org.chorem.lima.table.model.TransactionFlattenTableModel; @@ -32,10 +30,6 @@ */ public class TransactionHeaderListener extends MouseAdapter { - /** - * log - */ - private static final Log log = LogFactory.getLog(TransactionHeaderListener.class); private final TransactionJXTable table; /** Modified: trunk/lima-main/src/main/java/org/chorem/lima/listener/TransactionKeyListener.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/listener/TransactionKeyListener.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/listener/TransactionKeyListener.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -19,9 +19,6 @@ package org.chorem.lima.listener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import static org.nuiton.i18n.I18n._; import org.chorem.lima.dto.EntryDTO; import org.chorem.lima.dto.TransactionDTO; import org.chorem.lima.dto.util.DTOHelper; @@ -31,6 +28,7 @@ import org.chorem.lima.table.model.TransactionTableModel; import org.chorem.lima.ui.ErrorMessage; import org.chorem.lima.util.Util; +import static org.nuiton.i18n.I18n._; import javax.swing.*; import java.awt.event.KeyEvent; @@ -43,11 +41,6 @@ */ public class TransactionKeyListener extends java.awt.event.KeyAdapter { - /** - * log - */ - private static final Log log = LogFactory.getLog(TransactionKeyListener.class); - @Override public void keyPressed(KeyEvent e) { TransactionJXTable table = (TransactionJXTable) e.getSource(); @@ -133,7 +126,8 @@ /** * Permet d'ajouter une nouvelle ligne : transaction ou entrée - * @param table + * @param table la table + * @return */ private boolean addLine (TransactionJXTable table) { Modified: trunk/lima-main/src/main/java/org/chorem/lima/table/editor/AccountTableCellEditor.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/table/editor/AccountTableCellEditor.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/table/editor/AccountTableCellEditor.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -21,7 +21,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.Main; +import org.chorem.lima.LimaContext; import org.chorem.lima.combobox.JWideComboBox; import org.chorem.lima.combobox.model.AccountComboBoxModel; import org.chorem.lima.combobox.renderer.AccountComboBoxRenderer; @@ -72,11 +72,11 @@ */ // Get data from services List<AccountDTO> accounts = ServiceHelper.getAllFlatAccount( - Main.getContext().getDataManager().getAccountModel().getData()); + LimaContext.getContext().getDataManager().getAccountModel().getData()); Vector<AccountDTO> v = new Vector<AccountDTO>(accounts); AccountComboBoxModel model = new AccountComboBoxModel(v); comboBox.setModel(model); - Main.getContext().getDataManager().getAccountModel().addPropertyChangeListener(model); + LimaContext.getContext().getDataManager().getAccountModel().addPropertyChangeListener(model); comboBox.setRenderer(AccountComboBoxRenderer.getInstance()); // AutoCompletion Modified: trunk/lima-main/src/main/java/org/chorem/lima/table/editor/DateTableCellEditor.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/table/editor/DateTableCellEditor.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/table/editor/DateTableCellEditor.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -19,7 +19,7 @@ package org.chorem.lima.table.editor; -import org.chorem.lima.Main; +import org.chorem.lima.LimaContext; import org.jdesktop.swingx.JXDatePicker; import javax.swing.*; @@ -42,7 +42,7 @@ * */ public DateTableCellEditor() { - datePicker = new JXDatePicker(Main.getContext().getConfig().getLocale()); + datePicker = new JXDatePicker(LimaContext.getContext().getConfig().getLocale()); } @Override Modified: trunk/lima-main/src/main/java/org/chorem/lima/table/editor/JournalTableCellEditor.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/table/editor/JournalTableCellEditor.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/table/editor/JournalTableCellEditor.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -21,7 +21,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.Main; +import org.chorem.lima.LimaContext; import org.chorem.lima.combobox.JWideComboBox; import org.chorem.lima.combobox.model.JournalComboBoxModel; import org.chorem.lima.combobox.renderer.JournalComboBoxRenderer; @@ -58,13 +58,13 @@ comboBox = new JWideComboBox(); /** Getting data from journal model **/ - List<JournalDTO> journals = Main.getContext().getDataManager().getJournalModel().getData(); + List<JournalDTO> journals = LimaContext.getContext().getDataManager().getJournalModel().getData(); /** Creating combobox model */ Vector<JournalDTO> v = new Vector<JournalDTO>(journals); JournalComboBoxModel comboBoxModel = new JournalComboBoxModel(v); /** Property Change Listener */ - Main.getContext().getDataManager().getJournalModel().addPropertyChangeListener(comboBoxModel); + LimaContext.getContext().getDataManager().getJournalModel().addPropertyChangeListener(comboBoxModel); comboBox.setModel(comboBoxModel); /** Renderer */ comboBox.setRenderer(JournalComboBoxRenderer.getInstance()); Modified: trunk/lima-main/src/main/java/org/chorem/lima/table/editor/PeriodTableCellEditor.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/table/editor/PeriodTableCellEditor.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/table/editor/PeriodTableCellEditor.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -21,7 +21,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.Main; +import org.chorem.lima.LimaContext; import org.chorem.lima.combobox.JWideComboBox; import org.chorem.lima.combobox.renderer.PeriodComboBoxRenderer; import org.chorem.lima.dto.PeriodDTO; @@ -56,7 +56,7 @@ comboBox = new JWideComboBox(); /** Getting data from period list **/ - List<PeriodDTO> periods = Main.getContext().getDataManager().getPeriodes(); + List<PeriodDTO> periods = LimaContext.getContext().getDataManager().getPeriodes(); /** Creating combobox model */ Vector<PeriodDTO> v = new Vector<PeriodDTO>(ServiceHelper.getAllFlatPeriod(periods)); Modified: trunk/lima-main/src/main/java/org/chorem/lima/table/model/TransactionDataTableModel.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/table/model/TransactionDataTableModel.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/table/model/TransactionDataTableModel.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -21,8 +21,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaContext; import static org.nuiton.i18n.I18n._; -import org.chorem.lima.Main; import org.chorem.lima.dto.*; import org.chorem.lima.dto.util.DTOHelper; import org.chorem.lima.enumeration.FilterEnum; @@ -253,13 +253,13 @@ new Date(), null, null, - Main.getContext().getDataManager().getCurrentJournal(), + LimaContext.getContext().getDataManager().getCurrentJournal(), new LinkedList<EntryDTO>(), - Main.getContext().getDataManager().getCurrentPeriod(), + LimaContext.getContext().getDataManager().getCurrentPeriod(), ServiceHelper.findStatusByType( - Main.getContext().getDataManager().getStatus(), ServiceHelper.TR_WIP)); + LimaContext.getContext().getDataManager().getStatus(), ServiceHelper.TR_WIP)); // Chargement des status pour la transaction - List<StatusDTO> status = Main.getContext().getDataManager().getStatus(); + List<StatusDTO> status = LimaContext.getContext().getDataManager().getStatus(); // Ajout de la transaction avec son service String response = transServ.addTransaction(trans,status); // Si la transaction a été ajoutée avec succès @@ -275,7 +275,7 @@ public String addTransaction(TransactionDTO trans) { // Chargement des status pour la transaction - List<StatusDTO> status = Main.getContext().getDataManager().getStatus(); + List<StatusDTO> status = LimaContext.getContext().getDataManager().getStatus(); // Ajout de la transaction avec son service String response = transServ.addTransaction(trans,status); // Si la transaction a été ajoutée avec succès @@ -292,7 +292,7 @@ @Override public String removeTransaction(TransactionDTO trans) { - List<StatusDTO> status = Main.getContext().getDataManager().getStatus(); + List<StatusDTO> status = LimaContext.getContext().getDataManager().getStatus(); String response = transServ.removeTransaction(trans,status); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { data.remove(trans); Modified: trunk/lima-main/src/main/java/org/chorem/lima/table/model/TransactionFlattenTableModel.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/table/model/TransactionFlattenTableModel.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/table/model/TransactionFlattenTableModel.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -21,8 +21,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaContext; import static org.nuiton.i18n.I18n._; -import org.chorem.lima.Main; import org.chorem.lima.dto.*; import org.chorem.lima.dto.util.DTOHelper; import org.chorem.lima.enumeration.FilterEnum; @@ -240,7 +240,7 @@ case PERIOD: cloneTrans.setPeriod((PeriodDTO) value); response = transactionServ.updateTransaction( - Main.getContext().getDataManager().getStatus(), + LimaContext.getContext().getDataManager().getStatus(), trans, cloneTrans); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { @@ -251,7 +251,7 @@ case JOURNAL: cloneTrans.setJournal((JournalDTO) value); response = transactionServ.updateTransaction( - Main.getContext().getDataManager().getStatus(), + LimaContext.getContext().getDataManager().getStatus(), trans, cloneTrans); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { @@ -262,7 +262,7 @@ case DATE: cloneTrans.setEntryDate((Date) value); response = transactionServ.updateTransaction( - Main.getContext().getDataManager().getStatus(), + LimaContext.getContext().getDataManager().getStatus(), trans, cloneTrans); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { @@ -273,7 +273,7 @@ case DOCUMENT: cloneTrans.setVoucherRef((String) value); response = transactionServ.updateTransaction( - Main.getContext().getDataManager().getStatus(), + LimaContext.getContext().getDataManager().getStatus(), trans, cloneTrans); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { @@ -284,7 +284,7 @@ case DESCRIPTION: cloneTrans.setDescription((String) value); response = transactionServ.updateTransaction( - Main.getContext().getDataManager().getStatus(), + LimaContext.getContext().getDataManager().getStatus(), trans, cloneTrans); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { @@ -308,7 +308,7 @@ // Remote cloneEntry.setDescription((String) value); response = entryServ.updateEntry( - Main.getContext().getDataManager().getStatus(), + LimaContext.getContext().getDataManager().getStatus(), cloneEntry); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { entry.setDescription(cloneEntry.getDescription()); @@ -330,7 +330,7 @@ cloneEntry.setAmount((String) value); DTOHelper.setDebit(cloneEntry); response = entryServ.updateEntry( - Main.getContext().getDataManager().getStatus(), + LimaContext.getContext().getDataManager().getStatus(), cloneEntry); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { entry.setAmount(cloneEntry.getAmount()); @@ -353,7 +353,7 @@ cloneEntry.setAmount((String) value); DTOHelper.setCredit(cloneEntry); response = entryServ.updateEntry( - Main.getContext().getDataManager().getStatus(), + LimaContext.getContext().getDataManager().getStatus(), cloneEntry); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { entry.setAmount(cloneEntry.getAmount()); @@ -400,7 +400,7 @@ cloneEntry.setDescription(account.getDescription()); } response = entryServ.updateEntry( - Main.getContext().getDataManager().getStatus(), + LimaContext.getContext().getDataManager().getStatus(), cloneEntry); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { entry.setAccount(cloneEntry.getAccount()); @@ -555,7 +555,7 @@ public void saveRemoteEmpyLine(EntryDTO entry) { if (isEmptyLineValid()) { String response = entryServ.addEntry( - Main.getContext().getDataManager().getStatus(), + LimaContext.getContext().getDataManager().getStatus(), entry); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { saveLocalEmptyLine(); @@ -595,7 +595,7 @@ * Remove entry */ String response = entryServ.removeEntry( - Main.getContext().getDataManager().getStatus(), + LimaContext.getContext().getDataManager().getStatus(), entry); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { entry.getTransaction().removeChild(entry); Modified: trunk/lima-main/src/main/java/org/chorem/lima/table/model/TransactionSortedTableModel.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/table/model/TransactionSortedTableModel.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/table/model/TransactionSortedTableModel.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -21,7 +21,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.Main; +import org.chorem.lima.LimaContext; import org.chorem.lima.comparator.JournalComparator; import org.chorem.lima.comparator.PeriodComparator; import org.chorem.lima.comparator.StatusComparator; @@ -162,7 +162,7 @@ case PERIOD: cloneTrans.setPeriod((PeriodDTO) value); response = transactionServ.updateTransaction( - Main.getContext().getDataManager().getStatus(), + LimaContext.getContext().getDataManager().getStatus(), trans, cloneTrans); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { @@ -173,7 +173,7 @@ case JOURNAL: cloneTrans.setJournal((JournalDTO) value); response = transactionServ.updateTransaction( - Main.getContext().getDataManager().getStatus(), + LimaContext.getContext().getDataManager().getStatus(), trans, cloneTrans); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { @@ -184,7 +184,7 @@ case DATE: cloneTrans.setEntryDate((Date) value); response = transactionServ.updateTransaction( - Main.getContext().getDataManager().getStatus(), + LimaContext.getContext().getDataManager().getStatus(), trans, cloneTrans); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { @@ -195,7 +195,7 @@ case DOCUMENT: cloneTrans.setVoucherRef((String) value); response = transactionServ.updateTransaction( - Main.getContext().getDataManager().getStatus(), + LimaContext.getContext().getDataManager().getStatus(), trans, cloneTrans); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { @@ -206,7 +206,7 @@ case DESCRIPTION: cloneTrans.setDescription((String) value); response = transactionServ.updateTransaction( - Main.getContext().getDataManager().getStatus(), + LimaContext.getContext().getDataManager().getStatus(), trans, cloneTrans); if (ServiceHelper.RESPOND_SUCCESS.equals(response)) { Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/AccountViewImpl.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/AccountViewImpl.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/AccountViewImpl.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -21,8 +21,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaContext; import static org.nuiton.i18n.I18n._; -import org.chorem.lima.Main; import org.chorem.lima.dto.AccountDTO; import org.chorem.lima.dto.util.DTOHelper; import org.chorem.lima.tree.model.AccountTreeTableModel; @@ -55,12 +55,12 @@ */ public AccountViewImpl() { // TreeTable - model = Main.getContext().getDataManager().getAccountModel(); + model = LimaContext.getContext().getDataManager().getAccountModel(); table = new JXTreeTable(model); table.setColumnControlVisible(true); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); accountScrollPane.setViewportView(table); - form = Main.getContext().getMainUI().getAccountForm(); + form = LimaContext.getContext().getMainUI().getAccountForm(); form.getOkButton().addActionListener(new ActionListener() { @Override @@ -79,7 +79,7 @@ // Coloration table.setBackground(Color.WHITE); table.setHighlighters(HighlighterFactory.createAlternateStriping()); - //,new Color(250,250,250) createAlternateStriping(Color.GRAY,Color.WHITE) + //,new Color(250,250,250) createAlternateStriping(Color.GRAY,Color.WHITE) } /** @@ -230,8 +230,7 @@ } } - public JXTreeTable getTable() - { + public JXTreeTable getTable() { return table; } } Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/AccueilView.jaxx =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/AccueilView.jaxx 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/AccueilView.jaxx 2009-11-08 12:04:50 UTC (rev 2734) @@ -2,7 +2,7 @@ <row> <cell> <style source="css/lima.css" /> - <JLabel text="Page d'accueil - TODO"/> + <JLabel text="lima.home"/> </cell> </row> </Table> \ No newline at end of file Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/BalanceViewImpl.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/BalanceViewImpl.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/BalanceViewImpl.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -20,12 +20,12 @@ package org.chorem.lima.ui; +import org.chorem.lima.LimaContext; import org.chorem.lima.combobox.renderer.PeriodComboBoxRenderer; import org.chorem.lima.balance.Balance; import org.chorem.lima.dto.BalanceDTO; import org.chorem.lima.dto.PeriodDTO; import org.chorem.lima.dto.util.DTOHelper; -import org.chorem.lima.Main; import org.chorem.lima.table.model.BalanceTableModel; import org.chorem.lima.table.renderer.BalanceTableCellRenderer; import static org.nuiton.i18n.I18n._; @@ -46,7 +46,7 @@ */ public class BalanceViewImpl extends BalanceView { - private JComboBox comboBoxPeriod = new JComboBox (); + private JComboBox comboBoxPeriod = new JComboBox(); private JXTable table; private JXTable tableRes; private Balance balance = new Balance(); @@ -77,7 +77,7 @@ table.setColumnControlVisible(true); // On associe pour chaque colonne l'affichage des cellules (centré, alignement, etc) for (int i = 0; i < table.getModel().getColumnCount(); i++) { - table.getColumnModel().getColumn(i).setCellRenderer(new BalanceTableCellRenderer()); + table.getColumnModel().getColumn(i).setCellRenderer(new BalanceTableCellRenderer()); } // Affichage de la table @@ -87,15 +87,15 @@ * Calcul pour le total des soldes */ model = new DefaultTableModel(); - String[] columnNames = {"1","2","3","4","5","6"}; + String[] columnNames = {"1", "2", "3", "4", "5", "6"}; model.setColumnIdentifiers(columnNames); - tableRes = new JXTable (model); + tableRes = new JXTable(model); // On cache le header des colonnes tableRes.setColumnControlVisible(false); tableRes.getTableHeader().setVisible(false); // On associe pour chaque colonne l'affichage des cellules (centré, alignement, etc) for (int i = 0; i < tableRes.getModel().getColumnCount(); i++) { - tableRes.getColumnModel().getColumn(i).setCellRenderer(new BalanceTableCellRenderer()); + tableRes.getColumnModel().getColumn(i).setCellRenderer(new BalanceTableCellRenderer()); } // Initialise les valeurs pour le résultat total initTableBalanceRes(listBalance); @@ -105,36 +105,34 @@ * Ajout d'un listener lorsque l'utilisateur change de période. */ comboBoxPeriod.addItemListener(new ItemListener() { - @Override + @Override public void itemStateChanged(ItemEvent e) { - // Recherche la balance - updateBalance(); - } + // Recherche la balance + updateBalance(); + } }); } /** * Permet de initialiser la table de résultat à chaque appel de cette * méthode. + * * @param listBalance */ - private void initTableBalanceRes(List<BalanceDTO> listBalance) - { + private void initTableBalanceRes(List<BalanceDTO> listBalance) { // Déclaration des variables String TotalMoveDebit = "0"; String TotalMoveCredit = "0"; String TotalBalanceDebit = "0"; String TotalBalanceCredit = "0"; // Pour chaque ligne de la balance - for (BalanceDTO balanceDTO : listBalance) - { + for (BalanceDTO balanceDTO : listBalance) { /** Calcul des mouvements */ - TotalMoveDebit = DTOHelper.AddNumbersString(TotalMoveDebit,balanceDTO.getDebit()); - TotalMoveCredit = DTOHelper.AddNumbersString(TotalMoveCredit,balanceDTO.getCredit()); + TotalMoveDebit = DTOHelper.AddNumbersString(TotalMoveDebit, balanceDTO.getDebit()); + TotalMoveCredit = DTOHelper.AddNumbersString(TotalMoveCredit, balanceDTO.getCredit()); /** Calcul des soldes */ - if ( balanceDTO.getType().equalsIgnoreCase("Actif")|| - balanceDTO.getType().equalsIgnoreCase("Charge") ) - { + if (balanceDTO.getType().equalsIgnoreCase("Actif") || + balanceDTO.getType().equalsIgnoreCase("Charge")) { String solde = DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()); TotalBalanceDebit = DTOHelper.AddNumbersString(solde, TotalBalanceDebit); } else { @@ -143,17 +141,16 @@ } } // Définition des données - Object[] data = - {"", _("lima.balance.total"),TotalMoveDebit,TotalMoveCredit,TotalBalanceDebit,TotalBalanceCredit}; + Object[] data = + {"", _("lima.balance.total"), TotalMoveDebit, TotalMoveCredit, TotalBalanceDebit, TotalBalanceCredit}; // Si il existe déja une ligne - if ( model.getRowCount() > 0 ) - { + if (model.getRowCount() > 0) { model.removeRow(0); } // Ajout de la ligne model.addRow(data); - tableRes.setModel(model); - tableBalanceRes.setViewportView(tableRes); + tableRes.setModel(model); + tableBalanceRes.setViewportView(tableRes); } /** @@ -161,7 +158,7 @@ */ private void initComboBoxPeriod() { // Recherche la liste de toutes les périodes - List<PeriodDTO> periodes = Main.getContext().getDataManager().getPeriodes(); + List<PeriodDTO> periodes = LimaContext.getContext().getDataManager().getPeriodes(); // Model pour les périodes Vector<PeriodDTO> v = new Vector<PeriodDTO>(); // On ajoute un élément null pour permettre d'afficher toutes les périodes @@ -183,8 +180,7 @@ * la balance. */ @Override - protected void updateBalance () - { + protected void updateBalance() { // Récupère la liste de la balance List<BalanceDTO> listBalance = balance.createBalance((PeriodDTO) comboBoxPeriod.getSelectedItem()); modelBalance.setData(listBalance); @@ -193,5 +189,4 @@ } - } \ No newline at end of file Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/BilanViewImpl.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/BilanViewImpl.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/BilanViewImpl.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -19,6 +19,7 @@ package org.chorem.lima.ui; +import org.chorem.lima.LimaContext; import org.chorem.lima.combobox.renderer.PeriodComboBoxRenderer; import org.chorem.lima.dto.BalanceDTO; import org.chorem.lima.bilan.Bilan; @@ -26,7 +27,6 @@ import org.chorem.lima.dto.util.DTOHelper; import org.chorem.lima.balance.Balance; import org.chorem.lima.balance.Category; -import org.chorem.lima.Main; import org.chorem.lima.table.BilanActifJXTable; import org.chorem.lima.table.BilanPassifJXTable; import org.chorem.lima.table.model.BilanActifTableModel; @@ -41,23 +41,23 @@ /** * Cette classe permet de calculer le bilan. Elle utilise la balance et - * le compte de résultat. + * le compte de résultat. * * @author Rémi Chapelet */ public class BilanViewImpl extends BilanView { - private JComboBox comboBoxPeriod = new JComboBox (); + private JComboBox comboBoxPeriod = new JComboBox(); private BilanActifJXTable tableActif; private BilanPassifJXTable tablePassif; private BilanActifTableModel modelBilanActif; private BilanPassifTableModel modelBilanPassif; - Hashtable<String,Bilan> actifTab = new Hashtable<String,Bilan>(); - Hashtable<String,Bilan> passifTab = new Hashtable<String,Bilan>(); - Hashtable<String,List<BalanceDTO>> provisionMap; + Hashtable<String, Bilan> actifTab = new Hashtable<String, Bilan>(); + Hashtable<String, Bilan> passifTab = new Hashtable<String, Bilan>(); + Hashtable<String, List<BalanceDTO>> provisionMap; private Balance balance = new Balance(); private ProgressBarImpl progressBar; - + /** * Constructor */ @@ -75,7 +75,7 @@ //updateBilan(); /** ACTIF */ - tableActif = new BilanActifJXTable(modelBilanActif); + tableActif = new BilanActifJXTable(modelBilanActif); // Ajout du tableau tabActif.setViewportView(tableActif); @@ -90,8 +90,8 @@ comboBoxPeriod.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - updateBilan(); - } + updateBilan(); + } }); } @@ -99,65 +99,64 @@ /** * Cette partie consiste à créer les catégories du bilan */ - public void createCategory() - { + public void createCategory() { /** ACTIF */ - - actifTab.put("ACTIF", new Bilan("TOTAL (1) + (2)","total",null)); - actifTab.put("ACTIF_IMMOBILISE", new Bilan("ACTIF IMMOBILISE","title",null)); - actifTab.put("ACTIF_IMMOBILISE_INCORPOREL", new Bilan("Immobilisé incorporel","",null)); + + actifTab.put("ACTIF", new Bilan("TOTAL (1) + (2)", "total", null)); + actifTab.put("ACTIF_IMMOBILISE", new Bilan("ACTIF IMMOBILISE", "title", null)); + actifTab.put("ACTIF_IMMOBILISE_INCORPOREL", new Bilan("Immobilisé incorporel", "", null)); actifTab.get("ACTIF_IMMOBILISE").add(actifTab.get("ACTIF_IMMOBILISE_INCORPOREL")); - actifTab.put("ACTIF_IMMOBILISE_CORPOREL", new Bilan("Immobilisé corporel","",null)); + actifTab.put("ACTIF_IMMOBILISE_CORPOREL", new Bilan("Immobilisé corporel", "", null)); actifTab.get("ACTIF_IMMOBILISE").add(actifTab.get("ACTIF_IMMOBILISE_CORPOREL")); - actifTab.put("ACTIF_IMMOBILISE_FINANCIER", new Bilan("Immobilisé financier","",null)); + actifTab.put("ACTIF_IMMOBILISE_FINANCIER", new Bilan("Immobilisé financier", "", null)); actifTab.get("ACTIF_IMMOBILISE").add(actifTab.get("ACTIF_IMMOBILISE_FINANCIER")); - actifTab.put("ACTIF_CIRCULANT", new Bilan("ACTIF CIRCULANT","title",null)); - actifTab.put("ACTIF_CIRCULANT_STOCK", new Bilan("stocks et en-cours","",null)); + actifTab.put("ACTIF_CIRCULANT", new Bilan("ACTIF CIRCULANT", "title", null)); + actifTab.put("ACTIF_CIRCULANT_STOCK", new Bilan("stocks et en-cours", "", null)); actifTab.get("ACTIF_CIRCULANT").add(actifTab.get("ACTIF_CIRCULANT_STOCK")); - actifTab.put("ACTIF_CIRCULANT_AVANCES", new Bilan("av. et ac. versés","",null)); + actifTab.put("ACTIF_CIRCULANT_AVANCES", new Bilan("av. et ac. versés", "", null)); actifTab.get("ACTIF_CIRCULANT").add(actifTab.get("ACTIF_CIRCULANT_AVANCES")); - actifTab.put("ACTIF_CIRCULANT_CREANCES", new Bilan("Créances","",null)); + actifTab.put("ACTIF_CIRCULANT_CREANCES", new Bilan("Créances", "", null)); actifTab.get("ACTIF_CIRCULANT").add(actifTab.get("ACTIF_CIRCULANT_CREANCES")); - actifTab.put("ACTIF_CIRCULANT_VMP", new Bilan("VMP","",null)); + actifTab.put("ACTIF_CIRCULANT_VMP", new Bilan("VMP", "", null)); actifTab.get("ACTIF_CIRCULANT").add(actifTab.get("ACTIF_CIRCULANT_VMP")); - actifTab.put("ACTIF_CIRCULANT_DISPONIBILITE", new Bilan("Disponibilités","",null)); + actifTab.put("ACTIF_CIRCULANT_DISPONIBILITE", new Bilan("Disponibilités", "", null)); actifTab.get("ACTIF_CIRCULANT").add(actifTab.get("ACTIF_CIRCULANT_DISPONIBILITE")); - actifTab.put("ACTIF_CIRCULANT_CCA", new Bilan("CCA","",null)); + actifTab.put("ACTIF_CIRCULANT_CCA", new Bilan("CCA", "", null)); actifTab.get("ACTIF_CIRCULANT").add(actifTab.get("ACTIF_CIRCULANT_CCA")); actifTab.get("ACTIF").add(actifTab.get("ACTIF_IMMOBILISE")); actifTab.get("ACTIF").add(actifTab.get("ACTIF_CIRCULANT")); /** PASSIF */ - passifTab.put("PASSIF", new Bilan("TOTAL (1) + (2) + (3)","total",null)); - passifTab.put("PASSIF_CAPITAUX", new Bilan("CAPITAUX PROPRES","title",null)); - passifTab.put("PASSIF_CP_CAPITAL", new Bilan("Capital","",null)); + passifTab.put("PASSIF", new Bilan("TOTAL (1) + (2) + (3)", "total", null)); + passifTab.put("PASSIF_CAPITAUX", new Bilan("CAPITAUX PROPRES", "title", null)); + passifTab.put("PASSIF_CP_CAPITAL", new Bilan("Capital", "", null)); passifTab.get("PASSIF_CAPITAUX").add(passifTab.get("PASSIF_CP_CAPITAL")); - passifTab.put("PASSIF_CP_RESERVES", new Bilan("Réserves","",null)); + passifTab.put("PASSIF_CP_RESERVES", new Bilan("Réserves", "", null)); passifTab.get("PASSIF_CAPITAUX").add(passifTab.get("PASSIF_CP_RESERVES")); - passifTab.put("PASSIF_CP_RAN", new Bilan("RAN","",null)); + passifTab.put("PASSIF_CP_RAN", new Bilan("RAN", "", null)); passifTab.get("PASSIF_CAPITAUX").add(passifTab.get("PASSIF_CP_RAN")); - passifTab.put("PASSIF_CP_RESULTAT", new Bilan("Résultat","",null)); + passifTab.put("PASSIF_CP_RESULTAT", new Bilan("Résultat", "", null)); passifTab.get("PASSIF_CAPITAUX").add(passifTab.get("PASSIF_CP_RESULTAT")); - passifTab.put("PASSIF_CP_SUBVENTION", new Bilan("Subventions d'investissement","",null)); + passifTab.put("PASSIF_CP_SUBVENTION", new Bilan("Subventions d'investissement", "", null)); passifTab.get("PASSIF_CAPITAUX").add(passifTab.get("PASSIF_CP_SUBVENTION")); - passifTab.put("PASSIF_CP_PROVISION", new Bilan("Provisions réglementées","",null)); + passifTab.put("PASSIF_CP_PROVISION", new Bilan("Provisions réglementées", "", null)); passifTab.get("PASSIF_CAPITAUX").add(passifTab.get("PASSIF_CP_PROVISION")); - passifTab.put("PASSIF_PR_PROVISIONS", new Bilan("PROVISIONS","title",null)); - passifTab.put("PASSIF_PROVISIONS", new Bilan("Provisions","",null)); + passifTab.put("PASSIF_PR_PROVISIONS", new Bilan("PROVISIONS", "title", null)); + passifTab.put("PASSIF_PROVISIONS", new Bilan("Provisions", "", null)); passifTab.get("PASSIF_PR_PROVISIONS").add(passifTab.get("PASSIF_PROVISIONS")); - passifTab.put("PASSIF_DETTES", new Bilan("DETTES","title",null)); - passifTab.put("PASSIF_DETTES_EMPRUNTS", new Bilan("Emprunts","",null)); + passifTab.put("PASSIF_DETTES", new Bilan("DETTES", "title", null)); + passifTab.put("PASSIF_DETTES_EMPRUNTS", new Bilan("Emprunts", "", null)); passifTab.get("PASSIF_DETTES").add(passifTab.get("PASSIF_DETTES_EMPRUNTS")); - passifTab.put("PASSIF_DETTES_AVANCES", new Bilan("av. et ac. reçus","",null)); + passifTab.put("PASSIF_DETTES_AVANCES", new Bilan("av. et ac. reçus", "", null)); passifTab.get("PASSIF_DETTES").add(passifTab.get("PASSIF_DETTES_AVANCES")); - passifTab.put("PASSIF_DETTES_FOURNISSEURS", new Bilan("Fournisseurs","",null)); + passifTab.put("PASSIF_DETTES_FOURNISSEURS", new Bilan("Fournisseurs", "", null)); passifTab.get("PASSIF_DETTES").add(passifTab.get("PASSIF_DETTES_FOURNISSEURS")); - passifTab.put("PASSIF_DETTES_FISCALES", new Bilan("Fiscales/sociales","",null)); + passifTab.put("PASSIF_DETTES_FISCALES", new Bilan("Fiscales/sociales", "", null)); passifTab.get("PASSIF_DETTES").add(passifTab.get("PASSIF_DETTES_FISCALES")); - passifTab.put("PASSIF_DETTES_IMMOBILISATIONS", new Bilan("Immobilisations","",null)); + passifTab.put("PASSIF_DETTES_IMMOBILISATIONS", new Bilan("Immobilisations", "", null)); passifTab.get("PASSIF_DETTES").add(passifTab.get("PASSIF_DETTES_IMMOBILISATIONS")); - passifTab.put("PASSIF_DETTES_AUTRES_DETTES", new Bilan("Autres dettes","",null)); + passifTab.put("PASSIF_DETTES_AUTRES_DETTES", new Bilan("Autres dettes", "", null)); passifTab.get("PASSIF_DETTES").add(passifTab.get("PASSIF_DETTES_AUTRES_DETTES")); - passifTab.put("PASSIF_DETTES_PCA", new Bilan("PCA","",null)); + passifTab.put("PASSIF_DETTES_PCA", new Bilan("PCA", "", null)); passifTab.get("PASSIF_DETTES").add(passifTab.get("PASSIF_DETTES_PCA")); passifTab.get("PASSIF").add(passifTab.get("PASSIF_CAPITAUX")); passifTab.get("PASSIF").add(passifTab.get("PASSIF_CP_PROVISION")); @@ -165,327 +164,282 @@ } - - /** * Permet de calculer le bilan */ - public void updateBilan () - { + public void updateBilan() { log.debug("Update bilan :"); - new Thread() - { + new Thread() { @Override - public void run() - { - progressBar = new ProgressBarImpl(); - progressBar.setTitle("Chargement du bilan"); - progressBar.getProgressBar().setString("0% : Préparation des données"); - progressBar.getProgressBar().setValue(0); + public void run() { + progressBar = new ProgressBarImpl(); + progressBar.setTitle("Chargement du bilan"); + progressBar.getProgressBar().setString("0% : Préparation des données"); + progressBar.getProgressBar().setValue(0); - // Chargement de la balance - List<BalanceDTO> ListbalanceDTO = balance.createBalance((PeriodDTO) comboBoxPeriod.getSelectedItem()); + // Chargement de la balance + List<BalanceDTO> ListbalanceDTO = balance.createBalance((PeriodDTO) comboBoxPeriod.getSelectedItem()); - progressBar.getProgressBar().setString("10% : Balance chargée"); - progressBar.getProgressBar().setValue(10); - /** - * Vérifie chaque numéro de compte (balance) pour déterminer sa position - * dans le bilan. - * Chaque catégorie est un objet bilan, et possède à son tour des bilans - * correspondants aux comptes. - * Cette boucle ne prend pas en compte les amortissement et provisions. - * Ces comptes sont mis dans une liste à part, pour être traités une seconde fois. - */ + progressBar.getProgressBar().setString("10% : Balance chargée"); + progressBar.getProgressBar().setValue(10); + /** + * Vérifie chaque numéro de compte (balance) pour déterminer sa position + * dans le bilan. + * Chaque catégorie est un objet bilan, et possède à son tour des bilans + * correspondants aux comptes. + * Cette boucle ne prend pas en compte les amortissement et provisions. + * Ces comptes sont mis dans une liste à part, pour être traités une seconde fois. + */ - progressBar.getProgressBar().setString("15% : Création catégorie"); - progressBar.getProgressBar().setValue(15); - createCategory(); - // Liste amort/prov à traiter apres - provisionMap = new Hashtable<String,List<BalanceDTO>>(); + progressBar.getProgressBar().setString("15% : Création catégorie"); + progressBar.getProgressBar().setValue(15); + createCategory(); + // Liste amort/prov à traiter apres + provisionMap = new Hashtable<String, List<BalanceDTO>>(); - progressBar.getProgressBar().setString("20% : Chargement des comptes"); - progressBar.getProgressBar().setValue(20); - // Récupère le nombre de balances - float nbBalances = ListbalanceDTO.size(); - float incremente = 40 / nbBalances; - float value = 20; - // Pour chaque balance - for ( BalanceDTO balanceDTO : ListbalanceDTO) - { - /** - * ACTIF - */ - /** IMMOBILISATION */ - if ( Category.accountNumberCategory("20", balanceDTO.getAccount().getIdNumber()) ) - { - actifTab.get("ACTIF_IMMOBILISE_INCORPOREL").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); - } - if ( Category.accountNumberCategory("21", balanceDTO.getAccount().getIdNumber()) ) - { - actifTab.get("ACTIF_IMMOBILISE_CORPOREL").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); - } - if ( Category.accountNumberCategory("22", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("23", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("25", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("26", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("27", balanceDTO.getAccount().getIdNumber()) ) - { - actifTab.get("ACTIF_IMMOBILISE_FINANCIER").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); - } - /** ACTIF CIRCULANT */ - if ( Category.accountNumberCategory("31", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("32", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("33", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("34", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("35", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("36", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("37", balanceDTO.getAccount().getIdNumber()) ) - { - actifTab.get("ACTIF_CIRCULANT_STOCK").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); - } - if ( Category.accountNumberCategory("99", balanceDTO.getAccount().getIdNumber()) ) - { - // TODO - //actifTab.get("ACTIF_CIRCULANT_AVANCES").add(balanceDTO,Util.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); - } - if ( Category.accountNumberCategory("41", balanceDTO.getAccount().getIdNumber()) ) - { - actifTab.get("ACTIF_CIRCULANT_CREANCES").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); - } - if ( Category.accountNumberCategory("50", balanceDTO.getAccount().getIdNumber()) ) - { - actifTab.get("ACTIF_CIRCULANT_VMP").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); - } - if ( Category.accountNumberCategory("51", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("52", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("53", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("54", balanceDTO.getAccount().getIdNumber()) ) - { - actifTab.get("ACTIF_CIRCULANT_DISPONIBILITE").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); - } - if ( Category.accountNumberCategory("486", balanceDTO.getAccount().getIdNumber()) ) - { - actifTab.get("ACTIF_CIRCULANT_CCA").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); - } - /** AMORT. & PROV. */ - if ( Category.accountNumberCategory("280", balanceDTO.getAccount().getIdNumber()) ) - { - if ( provisionMap.get("ACTIF_IMMOBILISE_INCORPOREL") == null ) - { - LinkedList<BalanceDTO> listBalance = new LinkedList<BalanceDTO>(); - provisionMap.put("ACTIF_IMMOBILISE_INCORPOREL", listBalance); - } - provisionMap.get("ACTIF_IMMOBILISE_INCORPOREL").add(balanceDTO); - } - if ( Category.accountNumberCategory("281", balanceDTO.getAccount().getIdNumber()) ) - { - if ( provisionMap.get("ACTIF_IMMOBILISE_CORPOREL") == null ) - { - LinkedList<BalanceDTO> listBalance = new LinkedList<BalanceDTO>(); - provisionMap.put("ACTIF_IMMOBILISE_CORPOREL", listBalance); - } - provisionMap.get("ACTIF_IMMOBILISE_CORPOREL").add(balanceDTO); - } - if ( Category.accountNumberCategory("282", balanceDTO.getAccount().getIdNumber()) ) - { - if ( provisionMap.get("ACTIF_IMMOBILISE_FINANCIER") == null ) - { - LinkedList<BalanceDTO> listBalance = new LinkedList<BalanceDTO>(); - provisionMap.put("ACTIF_IMMOBILISE_FINANCIER", listBalance); - } - provisionMap.get("ACTIF_IMMOBILISE_FINANCIER").add(balanceDTO); - } - if ( Category.accountNumberCategory("491", balanceDTO.getAccount().getIdNumber()) ) - { - if ( provisionMap.get("ACTIF_CIRCULANT_CREANCES") == null ) - { - LinkedList<BalanceDTO> listBalance = new LinkedList<BalanceDTO>(); - provisionMap.put("ACTIF_CIRCULANT_CREANCES", listBalance); - } - provisionMap.get("ACTIF_CIRCULANT_CREANCES").add(balanceDTO); - } - /** - * PASSIF - */ - /** CAPITAUX PROPRES */ - if ( Category.accountNumberCategory("101", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("104", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("105", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("107", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("108", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("109", balanceDTO.getAccount().getIdNumber()) ) - { - passifTab.get("PASSIF_CP_CAPITAL").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); - } - if ( Category.accountNumberCategory("106", balanceDTO.getAccount().getIdNumber()) ) - { - passifTab.get("PASSIF_CP_RESERVES").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); - } - if ( Category.accountNumberCategory("11", balanceDTO.getAccount().getIdNumber()) ) - { - passifTab.get("PASSIF_CP_RAN").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); - } - if ( Category.accountNumberCategory("12", balanceDTO.getAccount().getIdNumber()) ) - { - passifTab.get("PASSIF_CP_RESULTAT").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); - } - if ( Category.accountNumberCategory("13", balanceDTO.getAccount().getIdNumber()) ) - { - passifTab.get("PASSIF_CP_SUBVENTION").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); - } - if ( Category.accountNumberCategory("14", balanceDTO.getAccount().getIdNumber()) ) - { - passifTab.get("PASSIF_CP_PROVISION").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); - } - /** PROVISIONS */ - if ( Category.accountNumberCategory("15", balanceDTO.getAccount().getIdNumber()) ) - { - passifTab.get("PASSIF_PROVISIONS").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); - } - /** DETTES */ - if ( Category.accountNumberCategory("16", balanceDTO.getAccount().getIdNumber()) ) - { - passifTab.get("PASSIF_DETTES_EMPRUNTS").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); - } - if ( Category.accountNumberCategory("15", balanceDTO.getAccount().getIdNumber()) ) - { - passifTab.get("PASSIF_DETTES_AVANCES").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); - } - if ( Category.accountNumberCategory("40", balanceDTO.getAccount().getIdNumber()) ) - { - passifTab.get("PASSIF_DETTES_FOURNISSEURS").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); - } - if ( Category.accountNumberCategory("43", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("44", balanceDTO.getAccount().getIdNumber()) ) - { - passifTab.get("PASSIF_DETTES_FISCALES").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); - } - if ( Category.accountNumberCategory("999", balanceDTO.getAccount().getIdNumber()) ) - { - passifTab.get("PASSIF_DETTES_IMMOBILISATIONS").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); - } - if ( Category.accountNumberCategory("9999", balanceDTO.getAccount().getIdNumber()) ) - { - passifTab.get("PASSIF_DETTES_AUTRES_DETTES").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); - } - if ( Category.accountNumberCategory("487", balanceDTO.getAccount().getIdNumber()) ) - { - passifTab.get("PASSIF_DETTES_PCA").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); - } - // Incrémente la barre de chargement - value = value + incremente; - progressBar.getProgressBar().setValue((int)value); - progressBar.getProgressBar().setString((int)value+"% : Compte : "+balanceDTO.getName()); - } - - progressBar.getProgressBar().setString("60% : Mise en place des amortissements et provisions"); - progressBar.getProgressBar().setValue(60); + progressBar.getProgressBar().setString("20% : Chargement des comptes"); + progressBar.getProgressBar().setValue(20); + // Récupère le nombre de balances + float nbBalances = ListbalanceDTO.size(); + float incremente = 40 / nbBalances; + float value = 20; + // Pour chaque balance + for (BalanceDTO balanceDTO : ListbalanceDTO) { /** - * Mise en place des provisions et amortissements + * ACTIF */ - if ( provisionMap.get("ACTIF_IMMOBILISE_INCORPOREL") != null ) - { - List<BalanceDTO> listBalance = provisionMap.get("ACTIF_IMMOBILISE_INCORPOREL"); - for ( BalanceDTO balanceDTO : listBalance ) - { - actifTab.get("ACTIF_IMMOBILISE_INCORPOREL").addDepreciation(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + /** IMMOBILISATION */ + if (Category.accountNumberCategory("20", balanceDTO.getAccount().getIdNumber())) { + actifTab.get("ACTIF_IMMOBILISE_INCORPOREL").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); + } + if (Category.accountNumberCategory("21", balanceDTO.getAccount().getIdNumber())) { + actifTab.get("ACTIF_IMMOBILISE_CORPOREL").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); + } + if (Category.accountNumberCategory("22", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("23", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("25", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("26", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("27", balanceDTO.getAccount().getIdNumber())) { + actifTab.get("ACTIF_IMMOBILISE_FINANCIER").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); + } + /** ACTIF CIRCULANT */ + if (Category.accountNumberCategory("31", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("32", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("33", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("34", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("35", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("36", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("37", balanceDTO.getAccount().getIdNumber())) { + actifTab.get("ACTIF_CIRCULANT_STOCK").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); + } + if (Category.accountNumberCategory("99", balanceDTO.getAccount().getIdNumber())) { + // TODO + //actifTab.get("ACTIF_CIRCULANT_AVANCES").add(balanceDTO,Util.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); + } + if (Category.accountNumberCategory("41", balanceDTO.getAccount().getIdNumber())) { + actifTab.get("ACTIF_CIRCULANT_CREANCES").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); + } + if (Category.accountNumberCategory("50", balanceDTO.getAccount().getIdNumber())) { + actifTab.get("ACTIF_CIRCULANT_VMP").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); + } + if (Category.accountNumberCategory("51", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("52", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("53", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("54", balanceDTO.getAccount().getIdNumber())) { + actifTab.get("ACTIF_CIRCULANT_DISPONIBILITE").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); + } + if (Category.accountNumberCategory("486", balanceDTO.getAccount().getIdNumber())) { + actifTab.get("ACTIF_CIRCULANT_CCA").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); + } + /** AMORT. & PROV. */ + if (Category.accountNumberCategory("280", balanceDTO.getAccount().getIdNumber())) { + if (provisionMap.get("ACTIF_IMMOBILISE_INCORPOREL") == null) { + LinkedList<BalanceDTO> listBalance = new LinkedList<BalanceDTO>(); + provisionMap.put("ACTIF_IMMOBILISE_INCORPOREL", listBalance); } + provisionMap.get("ACTIF_IMMOBILISE_INCORPOREL").add(balanceDTO); } - if ( provisionMap.get("ACTIF_IMMOBILISE_CORPOREL") != null ) - { - List<BalanceDTO> listBalance = provisionMap.get("ACTIF_IMMOBILISE_CORPOREL"); - for ( BalanceDTO balanceDTO : listBalance ) - { - actifTab.get("ACTIF_IMMOBILISE_CORPOREL").addDepreciation(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + if (Category.accountNumberCategory("281", balanceDTO.getAccount().getIdNumber())) { + if (provisionMap.get("ACTIF_IMMOBILISE_CORPOREL") == null) { + LinkedList<BalanceDTO> listBalance = new LinkedList<BalanceDTO>(); + provisionMap.put("ACTIF_IMMOBILISE_CORPOREL", listBalance); } + provisionMap.get("ACTIF_IMMOBILISE_CORPOREL").add(balanceDTO); } - if ( provisionMap.get("ACTIF_IMMOBILISE_FINANCIER") != null ) - { - List<BalanceDTO> listBalance = provisionMap.get("ACTIF_IMMOBILISE_FINANCIER"); - for ( BalanceDTO balanceDTO : listBalance ) - { - actifTab.get("ACTIF_IMMOBILISE_FINANCIER").addDepreciation(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + if (Category.accountNumberCategory("282", balanceDTO.getAccount().getIdNumber())) { + if (provisionMap.get("ACTIF_IMMOBILISE_FINANCIER") == null) { + LinkedList<BalanceDTO> listBalance = new LinkedList<BalanceDTO>(); + provisionMap.put("ACTIF_IMMOBILISE_FINANCIER", listBalance); } + provisionMap.get("ACTIF_IMMOBILISE_FINANCIER").add(balanceDTO); } - if ( provisionMap.get("ACTIF_CIRCULANT_CREANCES") != null ) - { - List<BalanceDTO> listBalance = provisionMap.get("ACTIF_CIRCULANT_CREANCES"); - for ( BalanceDTO balanceDTO : listBalance ) - { - actifTab.get("ACTIF_CIRCULANT_CREANCES").addDepreciation(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + if (Category.accountNumberCategory("491", balanceDTO.getAccount().getIdNumber())) { + if (provisionMap.get("ACTIF_CIRCULANT_CREANCES") == null) { + LinkedList<BalanceDTO> listBalance = new LinkedList<BalanceDTO>(); + provisionMap.put("ACTIF_CIRCULANT_CREANCES", listBalance); } + provisionMap.get("ACTIF_CIRCULANT_CREANCES").add(balanceDTO); } - - progressBar.getProgressBar().setString("70% : Calcul du résultat"); - progressBar.getProgressBar().setValue(70); /** - * Appel de la méthode du calcul du compte de résultat pour avoir le - * résultat + * PASSIF */ - ResultViewImpl resultViewImpl = new ResultViewImpl (); - resultViewImpl.updateResult((PeriodDTO) comboBoxPeriod.getSelectedItem()); - passifTab.get("PASSIF_CP_RESULTAT").add(new Bilan("Résultat","",resultViewImpl.getResult(),"0"), resultViewImpl.getResult()); + /** CAPITAUX PROPRES */ + if (Category.accountNumberCategory("101", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("104", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("105", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("107", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("108", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("109", balanceDTO.getAccount().getIdNumber())) { + passifTab.get("PASSIF_CP_CAPITAL").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + if (Category.accountNumberCategory("106", balanceDTO.getAccount().getIdNumber())) { + passifTab.get("PASSIF_CP_RESERVES").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + if (Category.accountNumberCategory("11", balanceDTO.getAccount().getIdNumber())) { + passifTab.get("PASSIF_CP_RAN").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + if (Category.accountNumberCategory("12", balanceDTO.getAccount().getIdNumber())) { + passifTab.get("PASSIF_CP_RESULTAT").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + if (Category.accountNumberCategory("13", balanceDTO.getAccount().getIdNumber())) { + passifTab.get("PASSIF_CP_SUBVENTION").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + if (Category.accountNumberCategory("14", balanceDTO.getAccount().getIdNumber())) { + passifTab.get("PASSIF_CP_PROVISION").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + /** PROVISIONS */ + if (Category.accountNumberCategory("15", balanceDTO.getAccount().getIdNumber())) { + passifTab.get("PASSIF_PROVISIONS").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + /** DETTES */ + if (Category.accountNumberCategory("16", balanceDTO.getAccount().getIdNumber())) { + passifTab.get("PASSIF_DETTES_EMPRUNTS").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + if (Category.accountNumberCategory("15", balanceDTO.getAccount().getIdNumber())) { + passifTab.get("PASSIF_DETTES_AVANCES").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + if (Category.accountNumberCategory("40", balanceDTO.getAccount().getIdNumber())) { + passifTab.get("PASSIF_DETTES_FOURNISSEURS").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + if (Category.accountNumberCategory("43", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("44", balanceDTO.getAccount().getIdNumber())) { + passifTab.get("PASSIF_DETTES_FISCALES").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + if (Category.accountNumberCategory("999", balanceDTO.getAccount().getIdNumber())) { + passifTab.get("PASSIF_DETTES_IMMOBILISATIONS").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + if (Category.accountNumberCategory("9999", balanceDTO.getAccount().getIdNumber())) { + passifTab.get("PASSIF_DETTES_AUTRES_DETTES").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + if (Category.accountNumberCategory("487", balanceDTO.getAccount().getIdNumber())) { + passifTab.get("PASSIF_DETTES_PCA").add(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + // Incrémente la barre de chargement + value = value + incremente; + progressBar.getProgressBar().setValue((int) value); + progressBar.getProgressBar().setString((int) value + "% : Compte : " + balanceDTO.getName()); + } - progressBar.getProgressBar().setString("90% : Création des tableaux"); - progressBar.getProgressBar().setValue(90); - /** - * Ajout des données dans le model - */ - /** ACTIF */ - List<Bilan> listActif = new LinkedList<Bilan>(); - listActif.add(actifTab.get("ACTIF_IMMOBILISE")); - listActif.add(actifTab.get("ACTIF_IMMOBILISE_INCORPOREL")); - listActif.add(actifTab.get("ACTIF_IMMOBILISE_CORPOREL")); - listActif.add(actifTab.get("ACTIF_IMMOBILISE_FINANCIER")); - listActif.add(new Bilan("SOUS-TOTAL (1)","soustotal",actifTab.get("ACTIF_IMMOBILISE").getTotal(),actifTab.get("ACTIF_IMMOBILISE").getDepreciation())); - listActif.add(actifTab.get("ACTIF_CIRCULANT")); - listActif.add(actifTab.get("ACTIF_CIRCULANT_STOCK")); - listActif.add(actifTab.get("ACTIF_CIRCULANT_AVANCES")); - listActif.add(actifTab.get("ACTIF_CIRCULANT_CREANCES")); - listActif.add(actifTab.get("ACTIF_CIRCULANT_VMP")); - listActif.add(actifTab.get("ACTIF_CIRCULANT_DISPONIBILITE")); - listActif.add(actifTab.get("ACTIF_CIRCULANT_CCA")); - listActif.add(new Bilan("SOUS-TOTAL (2)","soustotal",actifTab.get("ACTIF_CIRCULANT").getTotal(),actifTab.get("ACTIF_CIRCULANT").getDepreciation())); - listActif.add(actifTab.get("ACTIF")); + progressBar.getProgressBar().setString("60% : Mise en place des amortissements et provisions"); + progressBar.getProgressBar().setValue(60); + /** + * Mise en place des provisions et amortissements + */ + if (provisionMap.get("ACTIF_IMMOBILISE_INCORPOREL") != null) { + List<BalanceDTO> listBalance = provisionMap.get("ACTIF_IMMOBILISE_INCORPOREL"); + for (BalanceDTO balanceDTO : listBalance) { + actifTab.get("ACTIF_IMMOBILISE_INCORPOREL").addDepreciation(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + } + if (provisionMap.get("ACTIF_IMMOBILISE_CORPOREL") != null) { + List<BalanceDTO> listBalance = provisionMap.get("ACTIF_IMMOBILISE_CORPOREL"); + for (BalanceDTO balanceDTO : listBalance) { + actifTab.get("ACTIF_IMMOBILISE_CORPOREL").addDepreciation(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + } + if (provisionMap.get("ACTIF_IMMOBILISE_FINANCIER") != null) { + List<BalanceDTO> listBalance = provisionMap.get("ACTIF_IMMOBILISE_FINANCIER"); + for (BalanceDTO balanceDTO : listBalance) { + actifTab.get("ACTIF_IMMOBILISE_FINANCIER").addDepreciation(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + } + if (provisionMap.get("ACTIF_CIRCULANT_CREANCES") != null) { + List<BalanceDTO> listBalance = provisionMap.get("ACTIF_CIRCULANT_CREANCES"); + for (BalanceDTO balanceDTO : listBalance) { + actifTab.get("ACTIF_CIRCULANT_CREANCES").addDepreciation(balanceDTO, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); + } + } - // Création du modèle à partir de la liste précédement créée - modelBilanActif.setData(listActif); - modelBilanActif.fireTableDataChanged(); + progressBar.getProgressBar().setString("70% : Calcul du résultat"); + progressBar.getProgressBar().setValue(70); + /** + * Appel de la méthode du calcul du compte de résultat pour avoir le + * résultat + */ + ResultViewImpl resultViewImpl = new ResultViewImpl(); + resultViewImpl.updateResult((PeriodDTO) comboBoxPeriod.getSelectedItem()); + passifTab.get("PASSIF_CP_RESULTAT").add(new Bilan("Résultat", "", resultViewImpl.getResult(), "0"), resultViewImpl.getResult()); - /** PASSIF */ - List<Bilan> listPassif = new LinkedList<Bilan>(); - listPassif.add(passifTab.get("PASSIF_CAPITAUX")); - listPassif.add(passifTab.get("PASSIF_CP_CAPITAL")); - listPassif.add(passifTab.get("PASSIF_CP_RESULTAT")); - listPassif.add(passifTab.get("PASSIF_CP_RESERVES")); - listPassif.add(passifTab.get("PASSIF_CP_RAN")); - listPassif.add(passifTab.get("PASSIF_CP_SUBVENTION")); - listPassif.add(passifTab.get("PASSIF_CP_PROVISION")); - listPassif.add(new Bilan("SOUS-TOTAL (1)","soustotal",passifTab.get("PASSIF_CAPITAUX").getTotal(),"0")); - listPassif.add(passifTab.get("PASSIF_PR_PROVISIONS")); - listPassif.add(passifTab.get("PASSIF_PROVISIONS")); - listPassif.add(new Bilan("SOUS-TOTAL (2)","soustotal",passifTab.get("PASSIF_PR_PROVISIONS").getTotal(),"0")); - listPassif.add(passifTab.get("PASSIF_DETTES")); - listPassif.add(passifTab.get("PASSIF_DETTES_EMPRUNTS")); - listPassif.add(passifTab.get("PASSIF_DETTES_AVANCES")); - listPassif.add(passifTab.get("PASSIF_DETTES_FOURNISSEURS")); - listPassif.add(passifTab.get("PASSIF_DETTES_FISCALES")); - listPassif.add(passifTab.get("PASSIF_DETTES_IMMOBILISATIONS")); - listPassif.add(passifTab.get("PASSIF_DETTES_AUTRES_DETTES")); - listPassif.add(passifTab.get("PASSIF_DETTES_PCA")); - listPassif.add(new Bilan("SOUS-TOTAL (3)","soustotal",passifTab.get("PASSIF_DETTES").getTotal(),"0")); - listPassif.add(passifTab.get("PASSIF")); + progressBar.getProgressBar().setString("90% : Création des tableaux"); + progressBar.getProgressBar().setValue(90); + /** + * Ajout des données dans le model + */ + /** ACTIF */ + List<Bilan> listActif = new LinkedList<Bilan>(); + listActif.add(actifTab.get("ACTIF_IMMOBILISE")); + listActif.add(actifTab.get("ACTIF_IMMOBILISE_INCORPOREL")); + listActif.add(actifTab.get("ACTIF_IMMOBILISE_CORPOREL")); + listActif.add(actifTab.get("ACTIF_IMMOBILISE_FINANCIER")); + listActif.add(new Bilan("SOUS-TOTAL (1)", "soustotal", actifTab.get("ACTIF_IMMOBILISE").getTotal(), actifTab.get("ACTIF_IMMOBILISE").getDepreciation())); + listActif.add(actifTab.get("ACTIF_CIRCULANT")); + listActif.add(actifTab.get("ACTIF_CIRCULANT_STOCK")); + listActif.add(actifTab.get("ACTIF_CIRCULANT_AVANCES")); + listActif.add(actifTab.get("ACTIF_CIRCULANT_CREANCES")); + listActif.add(actifTab.get("ACTIF_CIRCULANT_VMP")); + listActif.add(actifTab.get("ACTIF_CIRCULANT_DISPONIBILITE")); + listActif.add(actifTab.get("ACTIF_CIRCULANT_CCA")); + listActif.add(new Bilan("SOUS-TOTAL (2)", "soustotal", actifTab.get("ACTIF_CIRCULANT").getTotal(), actifTab.get("ACTIF_CIRCULANT").getDepreciation())); + listActif.add(actifTab.get("ACTIF")); - progressBar.getProgressBar().setString("90% : Opération terminée"); - progressBar.getProgressBar().setValue(90); - // Création du modèle à partir de la liste précédement créée - modelBilanPassif.setData(listPassif); - progressBar.getProgressBar().setValue(95); - modelBilanPassif.fireTableDataChanged(); - progressBar.getProgressBar().setValue(100); - progressBar.getProgressBarFrame().dispose(); + // Création du modèle à partir de la liste précédement créée + modelBilanActif.setData(listActif); + modelBilanActif.fireTableDataChanged(); + + /** PASSIF */ + List<Bilan> listPassif = new LinkedList<Bilan>(); + listPassif.add(passifTab.get("PASSIF_CAPITAUX")); + listPassif.add(passifTab.get("PASSIF_CP_CAPITAL")); + listPassif.add(passifTab.get("PASSIF_CP_RESULTAT")); + listPassif.add(passifTab.get("PASSIF_CP_RESERVES")); + listPassif.add(passifTab.get("PASSIF_CP_RAN")); + listPassif.add(passifTab.get("PASSIF_CP_SUBVENTION")); + listPassif.add(passifTab.get("PASSIF_CP_PROVISION")); + listPassif.add(new Bilan("SOUS-TOTAL (1)", "soustotal", passifTab.get("PASSIF_CAPITAUX").getTotal(), "0")); + listPassif.add(passifTab.get("PASSIF_PR_PROVISIONS")); + listPassif.add(passifTab.get("PASSIF_PROVISIONS")); + listPassif.add(new Bilan("SOUS-TOTAL (2)", "soustotal", passifTab.get("PASSIF_PR_PROVISIONS").getTotal(), "0")); + listPassif.add(passifTab.get("PASSIF_DETTES")); + listPassif.add(passifTab.get("PASSIF_DETTES_EMPRUNTS")); + listPassif.add(passifTab.get("PASSIF_DETTES_AVANCES")); + listPassif.add(passifTab.get("PASSIF_DETTES_FOURNISSEURS")); + listPassif.add(passifTab.get("PASSIF_DETTES_FISCALES")); + listPassif.add(passifTab.get("PASSIF_DETTES_IMMOBILISATIONS")); + listPassif.add(passifTab.get("PASSIF_DETTES_AUTRES_DETTES")); + listPassif.add(passifTab.get("PASSIF_DETTES_PCA")); + listPassif.add(new Bilan("SOUS-TOTAL (3)", "soustotal", passifTab.get("PASSIF_DETTES").getTotal(), "0")); + listPassif.add(passifTab.get("PASSIF")); + + progressBar.getProgressBar().setString("90% : Opération terminée"); + progressBar.getProgressBar().setValue(90); + // Création du modèle à partir de la liste précédement créée + modelBilanPassif.setData(listPassif); + progressBar.getProgressBar().setValue(95); + modelBilanPassif.fireTableDataChanged(); + progressBar.getProgressBar().setValue(100); + progressBar.getProgressBarFrame().dispose(); } }.start(); @@ -497,7 +451,7 @@ */ private void initComboBoxPeriod() { // Recherche la liste de toutes les périodes - List<PeriodDTO> periodes = Main.getContext().getDataManager().getPeriodes(); + List<PeriodDTO> periodes = LimaContext.getContext().getDataManager().getPeriodes(); // Model pour les périodes Vector<PeriodDTO> v = new Vector<PeriodDTO>(); // On ajoute un élément null pour permettre d'afficher toutes les périodes @@ -507,15 +461,12 @@ v.addElement(period); //v.addAll(period.getChildren()); } - + comboBoxPeriod.setModel(new DefaultComboBoxModel(v)); comboBoxPeriod.setRenderer(PeriodComboBoxRenderer.getInstance()); periodPanel.add(comboBoxPeriod); periodPanel.validate(); } - - - } \ No newline at end of file Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/ClosureViewImpl.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/ClosureViewImpl.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/ClosureViewImpl.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -21,6 +21,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaContext; import static org.nuiton.i18n.I18n._; import org.chorem.lima.combobox.renderer.PeriodClosureComboBoxRenderer; import org.chorem.lima.dto.PeriodDTO; @@ -28,7 +29,6 @@ import org.chorem.lima.dto.TransactionDTO; import org.chorem.lima.dto.util.TriPeriodAsc; import org.chorem.lima.dto.util.TriPeriodDesc; -import org.chorem.lima.Main; import org.chorem.lima.table.model.ClosureTableModel; import org.chorem.lima.util.Util; import org.jdesktop.swingx.JXTable; @@ -42,8 +42,8 @@ import java.util.Vector; import org.jdesktop.swingx.decorator.*; - + /** * Permet l'affichage du tableau avec les périodes mensuelles. * @@ -56,66 +56,64 @@ */ private static final Log log = LogFactory.getLog(ClosureViewImpl.class); private final JXTable table; - private JComboBox comboBoxPeriod = new JComboBox (); + private JComboBox comboBoxPeriod = new JComboBox(); private final ClosureTimeSpanForm form; private final AddPeriod addPeriodForm; private static boolean blockPeriod; - private JComboBox comboBoxBeginPeriod = new JComboBox (); - private JComboBox comboBoxEndPeriod = new JComboBox (); + private JComboBox comboBoxBeginPeriod = new JComboBox(); + private JComboBox comboBoxEndPeriod = new JComboBox(); /** * Constructor */ - public ClosureViewImpl () { + public ClosureViewImpl() { // Initialisation du choix pour les périodes initComboBoxPeriod(); /** Set Period model */ // Création du model pour le tableau - table = new JXTable(Main.getContext().getDataManager().getClosureModel()); + table = new JXTable(LimaContext.getContext().getDataManager().getClosureModel()); table.setRowHeight(24); // Permet d'alterner les couleurs des lignes pour le tableau table.setHighlighters(HighlighterFactory.createAlternateStriping()); // Definition de la selection possible sur les lignes table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); table.setColumnControlVisible(true); - + /** * Ajout d'un listener lorsque l'utilisateur change de période. */ - comboBoxPeriod.addItemListener(new ItemListener() - { + comboBoxPeriod.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { // Récupère la période master PeriodDTO periodMaster = (PeriodDTO) comboBoxPeriod.getSelectedItem(); - Filter[] filterArray = { new PatternFilter("(.*"+(periodMaster.getBegin().getYear()+1900)+".*)|(.*Final.*)", 0, 0) }; + Filter[] filterArray = {new PatternFilter("(.*" + (periodMaster.getBegin().getYear() + 1900) + ".*)|(.*Final.*)", 0, 0)}; FilterPipeline filters = new FilterPipeline(filterArray); table.setFilters(filters); } }); // Récupère la période master (celle de l'exercice) /** - PeriodDTO periodMaster = (PeriodDTO) comboBoxPeriod.getSelectedItem(); - // Définition du tri avec une expression régulière - Filter[] filterArray = { new PatternFilter("(.*"+(periodMaster.getBegin().getYear()+1900)+".*)|(.*Final.*)", 0, 0) }; - FilterPipeline filters = new FilterPipeline(filterArray); - // Applique le tri - table.setFilters(filters); - */ + PeriodDTO periodMaster = (PeriodDTO) comboBoxPeriod.getSelectedItem(); + // Définition du tri avec une expression régulière + Filter[] filterArray = { new PatternFilter("(.*"+(periodMaster.getBegin().getYear()+1900)+".*)|(.*Final.*)", 0, 0) }; + FilterPipeline filters = new FilterPipeline(filterArray); + // Applique le tri + table.setFilters(filters); + */ // Ajout du tableau dans l'UI getClosureScrollPane().setViewportView(table); /** * Initialisation du formulaire pour bloquer ou débloquer une période. */ - form = Main.getContext().getMainUI().getClosureTimeSpanForm(); + form = LimaContext.getContext().getMainUI().getClosureTimeSpanForm(); form.getOkButton().addActionListener(new ActionListener() { @Override - public void actionPerformed(ActionEvent e) - { + public void actionPerformed(ActionEvent e) { updatePeriod(); } }); @@ -123,11 +121,10 @@ /** * Initialisation du formulaire pour ajouter un exercice */ - addPeriodForm = Main.getContext().getMainUI().getAddPeriod(); + addPeriodForm = LimaContext.getContext().getMainUI().getAddPeriod(); addPeriodForm.getOkButton().addActionListener(new ActionListener() { @Override - public void actionPerformed(ActionEvent e) - { + public void actionPerformed(ActionEvent e) { addPeriod(); } }); @@ -139,12 +136,12 @@ * Cette méthode permet de charger les périodes (annuelles) pour choisir * les périodes mensuelles à afficher dans le tableau. */ - public void initComboBoxPeriod () { + public void initComboBoxPeriod() { /** * Charge pour le JComboBox le choix des périodes (exercices) à afficher. */ // Récupère les périodes - List<PeriodDTO> periodes = Main.getContext().getDataManager().getPeriodes(); + List<PeriodDTO> periodes = LimaContext.getContext().getDataManager().getPeriodes(); // Pour chaque période Vector<PeriodDTO> v = new Vector<PeriodDTO>(); for (PeriodDTO period : periodes) { @@ -163,8 +160,7 @@ * plusieurs périodes. */ @Override - public void initBlockForm () - { + public void initBlockForm() { blockPeriod = true; form.setTitle(_("lima.ui.block.timespan")); initComboBoxForm(); @@ -176,8 +172,7 @@ * Initialise le formulaire pour débloquer des périodes mensuelles. */ @Override - public void initUnblockForm () - { + public void initUnblockForm() { blockPeriod = false; form.setTitle(_("lima.ui.unblock.timespan")); initComboBoxForm(); @@ -194,7 +189,7 @@ * Charge pour les JComboBox le choix des périodes mensuelles à bloquer. */ // Récupère les périodes - List<PeriodDTO> periodes = Main.getContext().getDataManager().getPeriodes(); + List<PeriodDTO> periodes = LimaContext.getContext().getDataManager().getPeriodes(); Vector<PeriodDTO> v = new Vector<PeriodDTO>(); // Récupère la période annuelle sélectionnée dans la comboBox @@ -202,9 +197,8 @@ // Parcours de toutes les périodes pour trouver la période master for (PeriodDTO period : periodes) { - if ( period.equals(periodMaster) ) - { - v.addAll(period.getChildren()); + if (period.equals(periodMaster)) { + v.addAll(period.getChildren()); } } @@ -228,8 +222,8 @@ List<PeriodDTO> listPeriod = getSelectedPeriod(); // Parcours du vecteur comboBoxBeginPeriod.setSelectedItem(listPeriod.get(0)); - comboBoxEndPeriod.setSelectedItem(listPeriod.get((listPeriod.size()-1))); - } + comboBoxEndPeriod.setSelectedItem(listPeriod.get((listPeriod.size() - 1))); + } } @@ -241,23 +235,22 @@ log.debug("addPeriod : "); //Get form data } - PeriodDTO periodCurrent = Main.getContext().getDataManager().getCurrentPeriod(); - List<StatusDTO> status = Main.getContext().getDataManager().getStatus(); - Date begin = Util.InitDateFirstDayMonth(new Date(periodCurrent.getBegin().getYear()+1,0,1)); - Date end = Util.InitDateEndDayMonth(new Date(periodCurrent.getBegin().getYear()+1,11,1)); - PeriodDTO period = new PeriodDTO("","",begin,end,null,null,status.get(3)); + PeriodDTO periodCurrent = LimaContext.getContext().getDataManager().getCurrentPeriod(); + List<StatusDTO> status = LimaContext.getContext().getDataManager().getStatus(); + Date begin = Util.InitDateFirstDayMonth(new Date(periodCurrent.getBegin().getYear() + 1, 0, 1)); + Date end = Util.InitDateEndDayMonth(new Date(periodCurrent.getBegin().getYear() + 1, 11, 1)); + PeriodDTO period = new PeriodDTO("", "", begin, end, null, null, status.get(3)); // Création des enfants periodes List<PeriodDTO> listPeriodChild = new LinkedList<PeriodDTO>(); - for (int i=0 ; i<12 ; i++) - { - begin = Util.InitDateFirstDayMonth(new Date(periodCurrent.getBegin().getYear()+1,i,1)); - end = Util.InitDateEndDayMonth(new Date(periodCurrent.getBegin().getYear()+1,i,1)); - PeriodDTO periodChild = new PeriodDTO("",Integer.toString(begin.getYear()),begin,end,null,period,status.get(3)); + for (int i = 0; i < 12; i++) { + begin = Util.InitDateFirstDayMonth(new Date(periodCurrent.getBegin().getYear() + 1, i, 1)); + end = Util.InitDateEndDayMonth(new Date(periodCurrent.getBegin().getYear() + 1, i, 1)); + PeriodDTO periodChild = new PeriodDTO("", Integer.toString(begin.getYear()), begin, end, null, period, status.get(3)); listPeriodChild.add(periodChild); } period.setChildren(listPeriodChild); ClosureTableModel closureModel = (ClosureTableModel) table.getModel(); - closureModel.addPeriod(period,status); + closureModel.addPeriod(period, status); } /** @@ -272,50 +265,46 @@ */ protected void updatePeriod() { // Liste des status - List<StatusDTO> status = Main.getContext().getDataManager().getStatus(); + List<StatusDTO> status = LimaContext.getContext().getDataManager().getStatus(); // Liste des transactions - List<TransactionDTO> transactions = Main.getContext().getDataManager().getTransactionModel().getData(); + List<TransactionDTO> transactions = LimaContext.getContext().getDataManager().getTransactionModel().getData(); // Chargement du model ClosureTableModel closureModel = (ClosureTableModel) table.getModel(); /** * Récupère l'intervalle des périodes sélectionnées */ - PeriodDTO periodBegin = (PeriodDTO)comboBoxBeginPeriod.getSelectedItem(); - PeriodDTO periodEnd = (PeriodDTO)comboBoxEndPeriod.getSelectedItem(); + PeriodDTO periodBegin = (PeriodDTO) comboBoxBeginPeriod.getSelectedItem(); + PeriodDTO periodEnd = (PeriodDTO) comboBoxEndPeriod.getSelectedItem(); // Exercice - PeriodDTO periodMaster = (PeriodDTO)comboBoxPeriod.getSelectedItem(); + PeriodDTO periodMaster = (PeriodDTO) comboBoxPeriod.getSelectedItem(); // Si block période, on trie la liste en croissant ou bien décroissant List<PeriodDTO> listPeriod = periodMaster.getChildren(); - if ( blockPeriod ) - { + if (blockPeriod) { Collections.sort(listPeriod, new TriPeriodAsc()); } else { Collections.sort(listPeriod, new TriPeriodDesc()); - } + } // Pour toutes les périodes mensuelles - for (PeriodDTO period : listPeriod) - { - if ( ( (period.getBegin().after(periodBegin.getBegin())) + for (PeriodDTO period : listPeriod) { + if (((period.getBegin().after(periodBegin.getBegin())) && (period.getBegin().before(periodEnd.getBegin()))) || (period.equals(periodBegin)) - || (period.equals(periodEnd))) - { - if (log.isDebugEnabled()) { - log.debug("updatePeriod : "+period.getIdName()+" : " - +blockPeriod); + || (period.equals(periodEnd))) { + if (log.isDebugEnabled()) { + log.debug("updatePeriod : " + period.getIdName() + " : " + + blockPeriod); } /** * Détection des messages d'erreur */ - String message = closureModel.updatePeriod(period,blockPeriod,status,transactions); + String message = closureModel.updatePeriod(period, blockPeriod, status, transactions); ErrorMessage.showMessage(message); } } // On trie par ordre croissant si c'était en décroissant, sinon l'affichage // dans les vues est bouleversé. (les périodes seront affichées dans l'ordre // décroissant). - if ( !blockPeriod ) - { + if (!blockPeriod) { Collections.sort(listPeriod, new TriPeriodAsc()); } form.setVisible(false); @@ -328,16 +317,14 @@ * * @return liste des périodes sélectionnées */ - protected List<PeriodDTO> getSelectedPeriod() - { + protected List<PeriodDTO> getSelectedPeriod() { // récupère les lignes sélectionnées int viewIndex[] = table.getSelectedRows(); // chargement du model (tableau des périodes) ClosureTableModel closureModel = (ClosureTableModel) table.getModel(); LinkedList<PeriodDTO> listPeriod = new LinkedList<PeriodDTO>(); // Pour chaque ligne sélectionnée - for (int i : viewIndex) - { + for (int i : viewIndex) { int modelIndex = table.convertRowIndexToModel(i); listPeriod.add(closureModel.getRow(modelIndex)); } @@ -345,8 +332,7 @@ } - public void initAddPeriod () - { + public void initAddPeriod() { addPeriodForm.setTitle(_("lima.menubar.closure.addPeriod")); addPeriodForm.setVisible(true); } Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/CriteriaWidgetImpl.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/CriteriaWidgetImpl.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/CriteriaWidgetImpl.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -21,8 +21,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaContext; import static org.nuiton.i18n.I18n._; -import org.chorem.lima.Main; import org.chorem.lima.combobox.JWideComboBox; import org.chorem.lima.combobox.model.AccountComboBoxModel; import org.chorem.lima.combobox.renderer.AccountComboBoxRenderer; @@ -162,7 +162,7 @@ @Override protected void removeCriteriaWidget() { - Main.getContext().getMainUI().getSearchView().removeCriteriaWidget(this); + LimaContext.getContext().getMainUI().getSearchView().removeCriteriaWidget(this); } /** @@ -180,7 +180,7 @@ */ public JXDatePicker getDatePicker() { if (datePicker == null) { - datePicker = new JXDatePicker(new Date(), Main.getContext().getConfig().getLocale()); + datePicker = new JXDatePicker(new Date(), LimaContext.getContext().getConfig().getLocale()); } return datePicker; } @@ -199,7 +199,7 @@ public JComboBox getAccountCombo() { if (accountCombo == null) { List<AccountDTO> accounts = ServiceHelper.getAllFlatAccount( - Main.getContext().getDataManager().getAccountModel().getData()); + LimaContext.getContext().getDataManager().getAccountModel().getData()); Vector<AccountDTO> v = new Vector<AccountDTO>(accounts); AccountComboBoxModel model = new AccountComboBoxModel(v); accountCombo = new JWideComboBox(model); Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/ExportViewImpl.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/ExportViewImpl.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/ExportViewImpl.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -46,34 +46,29 @@ private static XMLExport xmlExport = new XMLExport(); private static CSVExport cvsExport; - /** - * Constructor - */ public ExportViewImpl(String type) { // chooser est le JFileChooser // Ouverture de la boite de dialogue chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - if (chooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ + if (chooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { // Récupère le nom du fichier String fichier = chooser.getSelectedFile().getName(); // Récupère l'adresse du fichier String cheminFichier = chooser.getSelectedFile().getAbsolutePath(); if (log.isDebugEnabled()) { - log.debug("Save file : "+fichier+" ("+cheminFichier+")"); + log.debug("Save file : " + fichier + " (" + cheminFichier + ")"); } String result = ""; /** * Action à appeler suivant le choix */ - if (type.equals("account")) - { + if (type.equals("account")) { // Exporter les comptes au format Xml result = xmlExport.exportAccount(cheminFichier); } else { - if (type.equals("all_csv")) - { + if (type.equals("all_csv")) { // Exporter toutes les données au format csv cvsExport = new CSVExport(cheminFichier); result = cvsExport.exportDatas(); @@ -86,16 +81,15 @@ /** * Message de sortie : succès ou erreur */ - if ( result.equals(ServiceHelper.RESPOND_SUCCESS)) - { + if (result.equals(ServiceHelper.RESPOND_SUCCESS)) { Util.showMessageDialog(_("lima.import.success"), _("lima.success"), JOptionPane.INFORMATION_MESSAGE); } else { Util.showMessageDialog(_("lima.import.error"), _("lima.error"), JOptionPane.ERROR_MESSAGE); } - + if (log.isDebugEnabled()) { - log.debug("File saved : "+fichier+" ("+cheminFichier+")"); + log.debug("File saved : " + fichier + " (" + cheminFichier + ")"); } // Si il y a eu une erreur Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/ImportViewImpl.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/ImportViewImpl.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/ImportViewImpl.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -21,7 +21,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.Main; +import org.chorem.lima.LimaContext; import org.chorem.lima.imports.CSVImport; import org.chorem.lima.imports.CSVImportEBP; import org.chorem.lima.imports.XMLImport; @@ -31,6 +31,7 @@ import org.chorem.lima.service.util.ServiceHelper; import static org.nuiton.i18n.I18n._; + import javax.swing.*; /** @@ -45,56 +46,45 @@ */ private static final Log log = LogFactory.getLog(ImportViewImpl.class); - private final FileService fileService = ServiceFactory.getServiceFactory().getFileService(); - - private final XMLImport xmlImport = new XMLImport(); - - - /** - * Constructor - */ - public ImportViewImpl(String type) - { + public ImportViewImpl(String type) { // chooser est le JFileChooser // Ouverture de la boite de dialogue chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION){ + if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { String fichier = chooser.getSelectedFile().getName(); String cheminFichier = chooser.getSelectedFile().getAbsolutePath(); if (log.isDebugEnabled()) { - log.debug("Open file : "+fichier+" ("+cheminFichier+")"); + log.debug("Open file : " + fichier + " (" + cheminFichier + ")"); } String result = ""; /** * Action à appeler suivant le choix */ - - if (type.equals("account")) - { + + XMLImport xmlImport = new XMLImport(); + if (type.equals("account")) { // Importer les comptes au format Xml result = xmlImport.importAccount(cheminFichier); } else { - if (type.equals("journal")) - { + if (type.equals("journal")) { // Importer les journaux au format Xml result = xmlImport.importJournal(cheminFichier); } else { - if (type.equals("all_csv")) - { + if (type.equals("all_csv")) { // Importer les données au format csv CSVImport cvsimport = new CSVImport(cheminFichier); result = cvsimport.importDatas(); } else { - if (type.equals("all_csv_ebp")) - { + if (type.equals("all_csv_ebp")) { // Importer les données au format csv CSVImportEBP cvsimport = new CSVImportEBP(cheminFichier); result = cvsimport.importDatas(); } else { // Importer les données au format Xml + FileService fileService = ServiceFactory.getServiceFactory().getFileService(); result = fileService.importFile(cheminFichier); - Main.getContext().getDataManager().reset(); + LimaContext.getContext().getDataManager().reset(); } } } @@ -103,16 +93,15 @@ /** * Message de sortie : succès ou erreur */ - if ( result.equals(ServiceHelper.RESPOND_SUCCESS)) - { + if (result.equals(ServiceHelper.RESPOND_SUCCESS)) { Util.showMessageDialog(_("lima.import.success"), _("lima.success"), JOptionPane.INFORMATION_MESSAGE); } else { Util.showMessageDialog(_("lima.import.error"), _("lima.error"), JOptionPane.ERROR_MESSAGE); } if (log.isDebugEnabled()) { - log.debug("File opened : "+fichier+" ("+cheminFichier+")"); - } + log.debug("File opened : " + fichier + " (" + cheminFichier + ")"); + } } } Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/JournalViewImpl.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/JournalViewImpl.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/JournalViewImpl.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -21,8 +21,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaContext; import static org.nuiton.i18n.I18n._; -import org.chorem.lima.Main; import org.chorem.lima.dto.JournalDTO; import org.chorem.lima.dto.util.DTOHelper; import org.chorem.lima.table.model.JournalTableModel; @@ -46,18 +46,15 @@ private final JXTable table; private boolean isAddForm; - /** - * Constructor - */ public JournalViewImpl() { /** Set Journal model */ - table = new JXTable(Main.getContext().getDataManager().getJournalModel()); + table = new JXTable(LimaContext.getContext().getDataManager().getJournalModel()); table.setRowHeight(24); table.setHighlighters(HighlighterFactory.createAlternateStriping()); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setColumnControlVisible(true); getJournalScrollPane().setViewportView(table); - form = Main.getContext().getMainUI().getJournalForm(); + form = LimaContext.getContext().getMainUI().getJournalForm(); form.getOkButton().addActionListener(new ActionListener() { @Override Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/LetteringViewImpl.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/LetteringViewImpl.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/LetteringViewImpl.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -21,7 +21,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.Main; +import org.chorem.lima.LimaContext; import org.chorem.lima.combobox.JWideComboBox; import org.chorem.lima.combobox.model.AccountComboBoxModel; import org.chorem.lima.combobox.renderer.AccountComboBoxRenderer; @@ -49,24 +49,18 @@ */ private static final Log log = LogFactory.getLog(LetteringViewImpl.class); private final JWideComboBox accountComboBox; - private final JWideComboBox sinceComboBox; - private final JWideComboBox toComboBox; - private final JXTable table; - /** - * - */ public LetteringViewImpl() { /** Calling services */ List<AccountDTO> accounts = ServiceHelper.getAllFlatAccount( - Main.getContext().getDataManager().getAccountModel().getData()); + LimaContext.getContext().getDataManager().getAccountModel().getData()); /** Creating accounting model */ Vector<AccountDTO> v1 = new Vector<AccountDTO>(accounts); AccountComboBoxModel model = new AccountComboBoxModel(v1); accountComboBox = new JWideComboBox(); accountComboBox.setPreferredSize(new Dimension(200, 25)); accountComboBox.setModel(model); - Main.getContext().getDataManager().getAccountModel().addPropertyChangeListener(model); + LimaContext.getContext().getDataManager().getAccountModel().addPropertyChangeListener(model); accountComboBox.setRenderer(AccountComboBoxRenderer.getInstance()); accountPanel.add(accountComboBox); @@ -79,25 +73,25 @@ precedentButton.setIcon(backIcon); /** Creating period model */ - List<PeriodDTO> periodes = Main.getContext().getNeogiaFactory().getPeriodService().getAllPeriod( - Main.getContext().getNeogiaFactory().getStatusService().getAllStatus() + List<PeriodDTO> periodes = LimaContext.getContext().getNeogiaFactory().getPeriodService().getAllPeriod( + LimaContext.getContext().getNeogiaFactory().getStatusService().getAllStatus() ); Vector<PeriodDTO> v2 = new Vector<PeriodDTO>(); for (PeriodDTO period : periodes) { v2.addElement(period); v2.addAll(period.getChildren()); } - sinceComboBox = new JWideComboBox(v2); + JWideComboBox sinceComboBox = new JWideComboBox(v2); sinceComboBox.setRenderer(PeriodComboBoxRenderer.getInstance()); sinceComboBox.setPreferredSize(new Dimension(200, 25)); sincePanel.add(sinceComboBox); - toComboBox = new JWideComboBox(v2); + JWideComboBox toComboBox = new JWideComboBox(v2); toComboBox.setRenderer(PeriodComboBoxRenderer.getInstance()); toComboBox.setPreferredSize(new Dimension(200, 25)); toPanel.add(toComboBox); - table = new JXTable(); + JXTable table = new JXTable(); tablePanel.setViewportView(table); } Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/MainView.jaxx =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/MainView.jaxx 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/MainView.jaxx 2009-11-08 12:04:50 UTC (rev 2734) @@ -1,108 +1,159 @@ -<Application title="lima.title" onWindowClosing="windowClosing()" - defaultCloseOperation="do_nothing_on_close" resizable="true" width="800" height="600" - extendedState='{this.MAXIMIZED_BOTH}' > - <style source="css/lima.css" /> - <script> - protected void onChangeView() {}; - protected void showAccountView() {}; - protected void showAccueilView() {}; - protected void showAddPeriod() {}; - protected void showBalanceView() {}; - protected void showBilanView() {}; - protected void showClosurePeriodView() {}; - protected void showClosureTimeSpanView() {}; - protected void showClosureView() {}; - protected void showExportView(String type) {}; - protected void showImportView(String type) {}; - protected void showJournalView() {}; - protected void showLetteringView() {}; - protected void showReportsView() {}; - protected void showResultView() {}; - protected void showSearchView() {}; - protected void showTransactionView() {}; - protected void windowClosing() {}; +<JFrame title="lima.title" onWindowClosing="getHandler().close(this)" + defaultCloseOperation="do_nothing_on_close" resizable="true" width="800" height="600" + extendedState='{this.MAXIMIZED_BOTH}'> + <style source="css/lima.css"/> + <script><![CDATA[ +import java.util.Locale; +import org.chorem.lima.LimaConfig; + +public LimaConfig getConfig() { + return getContextValue(LimaConfig.class); +} + +public MainViewHandler getHandler() { + return getContextValue(MainViewHandler.class); +} + +public boolean acceptLocale(Locale l, String expected) { + return l != null && l.toString().equals(expected); +} + +protected void onChangeView() {} +protected void showAccountView() {} +protected void showAccueilView() {} +protected void showAddPeriod() {} +protected void showBalanceView() {} +protected void showBilanView() {} +protected void showClosurePeriodView() {} +protected void showClosureTimeSpanView() {} +protected void showClosureView() {} +protected void showExportView(String type) {} +protected void showImportView(String type) {} +protected void showJournalView() {} +protected void showLetteringView() {} +protected void showReportsView() {} +protected void showResultView() {} +protected void showSearchView() {} +protected void showTransactionView() {} + ]]> </script> <JMenuBar> + <JMenu text="lima.menu.file"> - <JMenu text="lima.import" icon='{createImageIcon("action/import-element.png")}'> + + <JMenu text="lima.import" actionIcon='import-element'> <JMenuItem text="lima.import.all" onActionPerformed='showImportView("all")'/> <JMenuItem text="lima.import.all.csv" onActionPerformed='showImportView("all_csv")'/> <JMenuItem text="lima.import.all.csv.ebp" onActionPerformed='showImportView("all_csv_ebp")'/> <JMenuItem text="lima.import.account" onActionPerformed='showImportView("account")'/> <JMenuItem text="lima.import.journal" onActionPerformed='showImportView("journal")'/> - </JMenu> - <JMenu text="lima.export" icon='{createImageIcon("action/import-element.png")}'> + </JMenu> + + <JMenu text="lima.export" actionIcon='export-element'> <JMenuItem text="lima.export.all" onActionPerformed='showExportView("all")'/> <JMenuItem text="lima.export.all.csv" onActionPerformed='showExportView("all_csv")'/> <JMenuItem text="lima.export.account" onActionPerformed='showExportView("account")'/> - </JMenu> + </JMenu> <JSeparator/> + <JMenuItem text="lima.print" - icon='{createImageIcon("print.png")}'/> + actionIcon='print'/> <JSeparator/> + <JMenuItem mnemonic="{'Q'}" - icon='{createImageIcon("action/quit.png")}' - text="lima.quit" onActionPerformed='windowClosing()'/> + actionIcon='quit' + text="lima.quit" onActionPerformed='getHandler().close(this)'/> </JMenu> + <JMenu text="lima.edit"> <JMenuItem text="lima.journal" onActionPerformed='showJournalView()' - icon='{createImageIcon("journal.png")}'/> + actionIcon='journal'/> <JMenuItem text="lima.account" onActionPerformed='showAccountView()' - icon='{createImageIcon("account.png")}'/> + actionIcon='account'/> <JMenuItem text="lima.find.transaction" onActionPerformed='showSearchView()' - icon='{createImageIcon("search.png")}'/> - <JMenuItem id="config"/> + actionIcon='search'/> + <JMenuItem text="lima.preferences" + actionIcon="config" onActionPerformed="getHandler().showConfig(this)"/> </JMenu> + <JMenu text="lima.daily"> <JMenuItem text="lima.edit.transaction" onActionPerformed='showTransactionView()' - icon='{createImageIcon("transaction.png")}'/> + actionIcon='transaction'/> <JMenuItem text="lima.lettering" onActionPerformed='showLetteringView()' - icon='{createImageIcon("lettering.png")}'/> + actionIcon='lettering'/> </JMenu> + <JMenu text="lima.view"> <JCheckBoxMenuItem id="viewFlatten" text="lima.view.flatten" onItemStateChanged='onChangeView()' selected="false" - icon='{createImageIcon("view.png")}'/> + actionIcon='view'/> </JMenu> + <JMenu text="lima.reports"> - <JMenuItem text="lima.reports" onActionPerformed='showReportsView()' - icon='{createImageIcon("rapport.png")}'/> + <JMenuItem text="lima.reports" onActionPerformed='showReportsView()' actionIcon='rapport'/> <JMenuItem text="lima.balance" onActionPerformed='showBalanceView()'/> <JMenuItem text="lima.bilan" onActionPerformed='showBilanView()'/> <JMenuItem text="lima.result" onActionPerformed='showResultView()'/> </JMenu> + <JMenu text="lima.menubar.closure"> + <JMenuItem text="lima.menubar.closure.addPeriod" onActionPerformed='showAddPeriod()'/> + <JMenuItem text="lima.menubar.closure.timespan" onActionPerformed='showClosureTimeSpanView()' - icon='{createImageIcon("closure-timespan.png")}'/> + actionIcon='closure-timespan'/> + <JMenuItem text="lima.menubar.closure.period" onActionPerformed='showClosurePeriodView()'/> + <JMenuItem text="lima.menubar.closure.listperiod" onActionPerformed='showClosureView()' - icon='{createImageIcon("closure.png")}'/> + actionIcon='closure'/> </JMenu> <JMenu text="lima.menu.help" mnemonic="{'H'}"> - <JMenuItem id="help"/> - <JMenuItem id="site"/> - <JMenuItem id="about"/> - <JMenu id='i18nMenu'/> - <!--JMenu text='lima.menu.help.i18n' mnemonic="{'L'}" - icon='{createImageIcon("action/translate.png")}'> - <JMenuItem id="i18n_fr"/> - <JMenuItem id="i18n_en"/> - </JMenu--> + + <JMenuItem id="help" text='lima.menu.help.help' actionIcon="help" + onActionPerformed="getHandler().showHelp(this, null)"/> + + <JMenuItem id="site" text='lima.menu.help.site' actionIcon="site" + onActionPerformed="getHandler().gotoSite(this)"/> + + <JMenuItem id="about" text='lima.menu.help.about' actionIcon="about" + onActionPerformed="getHandler().showAbout(this)"/> + + <JMenu text='lima.menu.help.i18n' mnemonic="{'L'}" actionIcon="translate"> + + <JMenuItem id="i18n_fr" actionIcon="i18n-fr" text='lima.menu.help.i18n.fr' + enabled='{!acceptLocale(getConfig().getLocale(), "fr_FR")}' + onActionPerformed="getHandler().changeLanguage(this, Locale.FRANCE)"/> + + <JMenuItem id="i18n_en" actionIcon="i18n-uk" text='lima.menu.help.i18n.uk' + enabled='{!acceptLocale(getConfig().getLocale(), "en_GB")}' + onActionPerformed="getHandler().changeLanguage(this, Locale.UK)"/> + + </JMenu> </JMenu> </JMenuBar> - <Table insets='0,0,0,0'> - <!-- le panel principal à surcharger selon le context --> - <row fill="both" weightx="1" weighty="1"> - <cell> - <JTabbedPane id="contentTabbedPane"/> - </cell> - </row> - <!-- la barre de status --> - <row> - <cell fill="both"> - <org.nuiton.widget.StatusBar id='statusBar'/> - </cell> - </row> - </Table> -</Application> + <JPanel layout='{new BorderLayout()}'> + + <JTabbedPane id="contentTabbedPane" constraints="BorderLayout.CENTER"/> + + <jaxx.runtime.swing.StatusMessagePanel id='statusBar' + _help='"ui.main.statusBar"' + constraints="BorderLayout.SOUTH"/> + </JPanel> + + <!--<Table insets='0,0,0,0'>--> + <!--<!– le panel principal à surcharger selon le context –>--> + <!--<row fill="both" weightx="1" weighty="1">--> + <!--<cell>--> + <!--<JTabbedPane id="contentTabbedPane"/>--> + <!--</cell>--> + <!--</row>--> + <!--<!– la barre de status –>--> + <!--<row>--> + <!--<cell fill="both">--> + <!--<org.nuiton.widget.StatusBar id='statusBar'/>--> + <!--</cell>--> + <!--</row>--> + <!--</Table>--> + +</JFrame> Added: trunk/lima-main/src/main/java/org/chorem/lima/ui/MainViewHandler.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/MainViewHandler.java (rev 0) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -0,0 +1,264 @@ +package org.chorem.lima.ui; + +import jaxx.runtime.JAXXContext; +import jaxx.runtime.swing.AboutPanel; +import jaxx.runtime.swing.ErrorDialogUI; +import jaxx.runtime.swing.editor.config.ConfigUI; +import jaxx.runtime.swing.editor.config.ConfigUIBuilder; +import jaxx.runtime.swing.editor.config.model.ConfigUIModel; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaConfig; +import org.chorem.lima.LimaContext; +import org.chorem.lima.Main; +import static org.nuiton.i18n.I18n._; +import static org.nuiton.i18n.I18n.n_; + +import java.awt.*; +import java.net.URL; +import java.util.Locale; + +/** + * User: chemit + * Date: 8 nov. 2009 + * Time: 09:59:54 + */ +public class MainViewHandler { //implements JAXXHelp { + + /** + * to use log facility, just put in your code: log.info(\"...\"); + */ + static private Log log = LogFactory.getLog(MainViewHandler.class); + + /** + * Methode pour initialiser l'ui principale sans l'afficher. + * + * @param rootContext le context applicatif + * @param fullscreen flag pour indiquer si on doit ouvrir l'ui en model console (pleine ecran). + * @return l'ui instancie et initialisee mais non visible encore + */ + public MainView initUI(LimaContext rootContext, boolean fullscreen) { + + // show main ui + final MainView ui = new MainViewImpl(rootContext); + + LimaContext.MAIN_UI_ENTRY_DEF.setContextValue(rootContext, ui); + + ErrorDialogUI.init(ui); + + // set fullscreen propery on main ui + ui.getGraphicsConfiguration().getDevice().setFullScreenWindow(fullscreen ? ui : null); + + return ui; + } + + public void changeLanguage(MainView mainUI, Locale newLocale) { + LimaConfig config = mainUI.getConfig(); + + // sauvegarde de la nouvelle locale + config.setLocale(newLocale); + + // rechargement i18n + LimaContext.get().initI18n(); + + // on recharge l'ui + reloadUI(LimaContext.get(), config.isFullScreen()); + } + + /** + * Ferme l'application. + * + * @param ui l'ui principale de l'application + */ + public void close(MainView ui) { + log.info("Vradi quitting..."); + boolean canContinue = ensureModification(ui); + if (!canContinue) { + return; + } + try { + ui.dispose(); + + Main.ShutdownHook.interrupted(); + //LimaContext.get().close(); + Runtime.getRuntime().halt(0); + + } catch (Exception ex) { + log.error("error while closing " + ex.getMessage(), ex); + Runtime.getRuntime().halt(1); + } + } + + /** + * Méthode pour changer de mode d'affichage. + * <p/> + * Si <code>fullscreen</code> est à <code>true</code> alors on passe en + * mode console (c'est à dire en mode plein écran exclusif), sinon on + * passe en mode fenetré normal. + * + * @param ui l'ui principale de l'application + * @param fullscreen le nouvel état requis. + */ + public void changeScreen(MainView ui, final boolean fullscreen) { + boolean canContinue = ensureModification(ui); + if (!canContinue) { + return; + } + + ui.getConfig().setFullscreen(fullscreen); + + reloadUI(LimaContext.get(), fullscreen); + } + + public void showConfig(JAXXContext context) { + MainView ui = getUI(context); + LimaConfig config = context.getContextValue(LimaConfig.class); + ConfigUIModel model = new ConfigUIModel(config); + + // categorie repertoires + model.addCategory( + n_("lima.config.category.directories"), + n_("lima.config.category.directories.description"), + LimaConfig.Option.CONFIG_FILE); + + // others + model.addCategory( + n_("lima.config.category.other"), + n_("lima.config.category.other.description"), + LimaConfig.Option.FULL_SCREEN, + LimaConfig.Option.LOCALE); + + ConfigUI configUI = ConfigUIBuilder.newConfigUI(context, model, "lima.config.category.directories"); + + ConfigUIBuilder.showConfigUI(configUI, ui, false); + } + + // @Override + public void showHelp(JAXXContext context, String helpId) { +// MainView mainUI = getUI(context); +// +// ObserveHelpBroker helpBroker = context.getContextValue(ObserveHelpBroker.class); +// +// if (helpId == null) { +// helpId = helpBroker.getDefaultID(); +// } +// log.debug("show help " + helpId); +// mainUI.getHelp().setCurrentID(helpId); +// +// mainUI.setContextValue(mainUI.getMode(), "oldMode"); +// mainUI.setMode(ObserveUIMode.HELP); + } + + public void closeHelp(JAXXContext context) { +// MainView mainUI = getUI(context); +// ObserveUIMode oldMode = mainUI.getContextValue(ObserveUIMode.class, "oldMode"); +// if (oldMode == null) { +// // on regarde si une base est chargee +// ObserveDataContext dataContext = context.getContextValue(ObserveDataContext.class); +// StorageService<?> mainStorage = dataContext.getStorage(); +// +// if (mainStorage == null) { +// oldMode = ObserveUIMode.NO_DB; +// } else { +// oldMode = ObserveUIMode.DB; +// } +// } +// mainUI.setMode(oldMode); + } + + public void gotoSite(JAXXContext rootContext) { + + LimaConfig config = rootContext.getContextValue(LimaConfig.class); + + URL siteURL = config.getOptionAsURL("application.site.url"); + + log.info("goto " + siteURL); + if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { + try { + Desktop.getDesktop().browse(siteURL.toURI()); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + ErrorDialogUI.showError(ex); + } + } + } + + public void showAbout(MainView ui) { + + AboutPanel about = new AboutPanel() { + @Override + public void buildTopPanel() { + setIconPath("/icons/lima.png"); + super.buildTopPanel(); + } + }; + about.setTitle(_("lima.title.about")); + about.setAboutText(_("lima.about.message")); + about.setBottomText(ui.getConfig().getCopyrightText()); +// about.setIconPath("/icons/lima.png"); + about.setLicenseFile("META-INF/lima-main-LICENSE.txt"); + about.setThirdpartyFile("META-INF/lima-main-THIRD-PARTY.txt"); + about.init(); + about.showInDialog(ui, true); + } + + /** + * Permet de recharger l'ui principale et de changer de le mode d'affichage. + * + * @param rootContext le contexte applicatif + * @param fullscreen le type de fenetre à reouvrir + */ + protected void reloadUI(LimaContext rootContext, boolean fullscreen) { + + // must remove all properties listener on config + rootContext.getContextValue(LimaConfig.class).removeJaxxPropertyChangeListener(); + + // scan main ui + MainView ui = getUI(rootContext); + + if (ui != null) { + + ErrorDialogUI.init(null); + + LimaContext.MAIN_UI_ENTRY_DEF.removeContextValue(rootContext); + + ui.dispose(); + + ui.setVisible(false); + } + + ui = initUI(rootContext, fullscreen); + + // show ui + ui.setVisible(true); + } + + /** + * Test if there is some modification on screen, + * + * @param rootContext the context + * @return <code>true</code> if no more modification is detected + * @throws IllegalArgumentException if rootContext is null + */ + protected boolean ensureModification(JAXXContext rootContext) throws IllegalArgumentException { + if (rootContext == null) { + throw new IllegalArgumentException("rootContext can not be null"); + } + MainView ui = getUI(rootContext); + if (ui == null) { + // no ui, so no modification + return true; + } + // check ui is not modified + return true; + } + + MainView getUI(JAXXContext context) { + if (context instanceof MainView) { + return (MainView) context; + } + MainView ui = LimaContext.MAIN_UI_ENTRY_DEF.getContextValue(context); + return ui; + } + +} Property changes on: trunk/lima-main/src/main/java/org/chorem/lima/ui/MainViewHandler.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/MainViewImpl.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/MainViewImpl.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/MainViewImpl.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -18,13 +18,12 @@ */ package org.chorem.lima.ui; +import jaxx.runtime.JAXXContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import static org.nuiton.i18n.I18n._; -import org.chorem.lima.LimaContext; -import org.chorem.lima.Main; import org.chorem.lima.table.TransactionJXTable; import org.chorem.lima.table.model.TransactionFlattenTableModel; +import static org.nuiton.i18n.I18n._; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -43,8 +42,6 @@ private static final Log log = LogFactory.getLog(MainViewImpl.class); private AccueilViewImpl accueilView; private ClosureViewImpl closureView; - private ImportViewImpl importView; - private ExportViewImpl exportView; private TransactionViewImpl transactionView; private TransactionViewImpl searchResultView; private JournalViewImpl journalView; @@ -60,10 +57,6 @@ private BalanceViewImpl balanceView; private AddPeriod addPeriod; - /** - * Ajax - */ - public AccueilViewImpl getAccueilView() { if (accueilView == null) { accueilView = new AccueilViewImpl(); @@ -121,12 +114,12 @@ } public ExportViewImpl getExportView(String type) { - exportView = new ExportViewImpl(type); + ExportViewImpl exportView = new ExportViewImpl(type); return exportView; } public ImportViewImpl getImportView(String type) { - importView = new ImportViewImpl(type); + ImportViewImpl importView = new ImportViewImpl(type); return importView; } @@ -136,7 +129,7 @@ } return journalForm; } - + public JournalView getJournalView() { if (journalView == null) { journalView = new JournalViewImpl(); @@ -187,8 +180,8 @@ } /** - * @param name - * @param container + * @param name name of tab to show + * @param container the tab container */ private void showTab(String name, Component container) { // if contentTabbedPane doesnot yet contains tab @@ -245,14 +238,14 @@ protected void showImportView(String type) { if (!getImportView(type).isEnabled()) { getImportView(type).setEnabled(true); - } + } } @Override protected void showExportView(String type) { if (!getExportView(type).isEnabled()) { getExportView(type).setEnabled(true); - } + } } @Override @@ -301,34 +294,32 @@ showTab(_("lima.tab.result"), getResultView()); } - @Override - protected void windowClosing() { - if (log.isDebugEnabled()) { - log.debug("Shutdown called"); - } - //Main.getActionFactory().fireAction("quit", this); - try { - dispose(); - Main.ShutdownHook.interrupted(); - //Main.getContext().close(); - Runtime.getRuntime().halt(0); - System.exit(0); - } catch (Exception ex) { - log.error("error while closing " + ex.getMessage(), ex); - Runtime.getRuntime().halt(1); - } - } +// @Override +// protected void windowClosing() { +// if (log.isDebugEnabled()) { +// log.debug("Shutdown called"); +// } +// //Main.getActionFactory().fireAction("quit", this); +// try { +// dispose(); +// Main.ShutdownHook.interrupted(); +// //Main.getContext().close(); +// Runtime.getRuntime().halt(0); +// System.exit(0); +// } catch (Exception ex) { +// log.error("error while closing " + ex.getMessage(), ex); +// Runtime.getRuntime().halt(1); +// } +// } - /** - * Constructor - */ - public MainViewImpl() { + public MainViewImpl(JAXXContext c) { + super(c); // ContextProvider.checkContextInit(); - + showAccueilView(); - + // Register a change listener contentTabbedPane.addChangeListener(new ChangeListener() { // This method is called whenever the selected tab changes @@ -353,22 +344,9 @@ } } }); - finalizeInit(Main.getContext()); } - protected void finalizeInit(LimaContext context) { - // create i18n entries in menu with id 'i18nMenu' - //ActionHelper.createI18nMenu(this); - // chargement dans l'ui des actions - //ActionFactory<LimaBaseAction> factory = context.getActionFactory(); - //factory.loadActions(this); - //getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_MASK), "quit"); - //getRootPane().getActionMap().put("quit", factory.newAction("quit", null)); - // repaint i18n actions - //ActionHelper.refreshI18nActions(context, factory, this); - } - @Override public void dispose() { // Disposing other windows before main view @@ -380,7 +358,7 @@ } /** - * @param window + * @param window the windows to dispose */ public void disposeWindow(JFrame window) { if (window != null) { @@ -396,8 +374,8 @@ if (log.isDebugEnabled()) { log.debug("onChangeView : "); } - transactionView = Main.getContext().getMainUI().getTransactionView(); - searchResultView = Main.getContext().getMainUI().getSearchResultView(); + transactionView = getTransactionView(); + searchResultView = getSearchResultView(); if (viewFlatten.getState()) { // View not flatten if (log.isDebugEnabled()) { Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/ProgressBarImpl.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/ProgressBarImpl.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/ProgressBarImpl.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -22,10 +22,11 @@ import java.io.IOException; import java.net.URL; import javax.swing.JOptionPane; + +import org.chorem.lima.LimaContext; import static org.nuiton.i18n.I18n._; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.Main; import org.chorem.lima.dto.AccountDTO; import org.chorem.lima.imports.XMLImport; @@ -41,10 +42,6 @@ */ private static final Log log = LogFactory.getLog(ProgressBarImpl.class); - - /** - * Constructor - */ public ProgressBarImpl() { //progressBar.setVisible(true); if (log.isDebugEnabled()) { @@ -85,11 +82,10 @@ log.error("Erreur chargement du fichier 'default_pcg.xml'", eee); } } else { - Main.getContext().getDataManager().resetAccountModel(); + LimaContext.getContext().getDataManager().resetAccountModel(); } - } + } } - } Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/ReportsViewImpl.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/ReportsViewImpl.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/ReportsViewImpl.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -20,8 +20,6 @@ package org.chorem.lima.ui; -import org.chorem.lima.ui.*; - /** * @author ore */ Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/ResultViewImpl.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/ResultViewImpl.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/ResultViewImpl.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -19,13 +19,13 @@ package org.chorem.lima.ui; +import org.chorem.lima.LimaContext; import org.chorem.lima.combobox.renderer.PeriodComboBoxRenderer; import org.chorem.lima.balance.Balance; import org.chorem.lima.balance.Category; import org.chorem.lima.dto.BalanceDTO; import org.chorem.lima.dto.PeriodDTO; import org.chorem.lima.dto.util.DTOHelper; -import org.chorem.lima.Main; import org.chorem.lima.table.ResultChargesJXTable; import org.chorem.lima.table.ResultProduitsJXTable; import org.chorem.lima.table.model.ResultChargesTableModel; @@ -36,6 +36,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jdesktop.swingx.JXTable; + import javax.swing.table.DefaultTableModel; import javax.swing.*; @@ -51,7 +52,7 @@ * _ pour produit (identifié par tabProduit) * _ pour charge (identifié par tabCharge) * _ pour les totaux (identifié par tabChargeRes et tabProduitRes) - * + * <p/> * Elle va dans un premier temps déterminer les deux tableaux charges et produits. * Ensuite, elle va calculer le résultat pour charges et produits. * Enfin elle détermine le résultat final suivant le bénéfice ou perte, il sera @@ -62,10 +63,8 @@ public class ResultViewImpl extends ResultView { private static final Log log = LogFactory.getLog(ResultViewImpl.class); - private JComboBox comboBoxPeriod = new JComboBox (); - private Balance balance = new Balance (); - private JXTable tableCharge; - private JXTable tableProduit; + private JComboBox comboBoxPeriod = new JComboBox(); + private Balance balance = new Balance(); private JXTable tableChargeRes; private JXTable tableProduitRes; private String resultat; @@ -74,9 +73,6 @@ private DefaultTableModel modelChargeRes; private DefaultTableModel modelProduitRes; - /** - * Constructor - */ public ResultViewImpl() { // Initialise la combobox pour les périodes @@ -90,18 +86,18 @@ * Initialise les tableaux pour afficher les résultats de produits * et charges */ - String[] columnNames = {"1","2"}; + String[] columnNames = {"1", "2"}; // Résultat charges modelChargeRes = new DefaultTableModel(); modelChargeRes.setColumnIdentifiers(columnNames); - tableChargeRes = new JXTable (modelChargeRes); + tableChargeRes = new JXTable(modelChargeRes); // On cache le header des colonnes tableChargeRes.setColumnControlVisible(false); tableChargeRes.getTableHeader().setVisible(false); // Résultat produits modelProduitRes = new DefaultTableModel(); modelProduitRes.setColumnIdentifiers(columnNames); - tableProduitRes = new JXTable (modelProduitRes); + tableProduitRes = new JXTable(modelProduitRes); // On cache le header des colonnes tableProduitRes.setColumnControlVisible(false); tableProduitRes.getTableHeader().setVisible(false); @@ -114,7 +110,7 @@ * CHARGES */ // Création du tableau avec le modèle - tableCharge = new ResultChargesJXTable(modelResultCharges); + JXTable tableCharge = new ResultChargesJXTable(modelResultCharges); // Ajout du tableau tabCharge.setViewportView(tableCharge); @@ -122,7 +118,7 @@ * PRODUITS */ // Création du tableau avec le modèle - tableProduit = new ResultProduitsJXTable(modelResultProduits); + JXTable tableProduit = new ResultProduitsJXTable(modelResultProduits); // Ajout du tableau tabProduit.setViewportView(tableProduit); @@ -132,32 +128,30 @@ comboBoxPeriod.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - // Actualise le compte de résultat - updateResult((PeriodDTO) comboBoxPeriod.getSelectedItem()); - } + // Actualise le compte de résultat + updateResult((PeriodDTO) comboBoxPeriod.getSelectedItem()); + } }); - + } @Override - public void update () - { + public void update() { updateResult((PeriodDTO) comboBoxPeriod.getSelectedItem()); } /** * Permet d'initialiser le résultat des charges + * * @param totalCharges */ - private void initTabChargeRes(String totalCharges) - { + private void initTabChargeRes(String totalCharges) { // Définition des données Object[] data = - {_("lima.result.total.charge"),totalCharges}; + {_("lima.result.total.charge"), totalCharges}; // Si il existe déja une ligne - if ( modelChargeRes.getRowCount() > 0 ) - { + if (modelChargeRes.getRowCount() > 0) { modelChargeRes.removeRow(0); } // Ajout de la ligne @@ -168,16 +162,15 @@ /** * Permet d'initialiser le résultat des produits + * * @param totalProduits */ - private void initTabProduitRes(String totalProduits) - { + private void initTabProduitRes(String totalProduits) { // Définition des données Object[] data = - {_("lima.result.total.produit"),totalProduits}; + {_("lima.result.total.produit"), totalProduits}; // Si il existe déja une ligne - if ( modelProduitRes.getRowCount() > 0 ) - { + if (modelProduitRes.getRowCount() > 0) { modelProduitRes.removeRow(0); } // Ajout de la ligne @@ -195,22 +188,22 @@ * (produits et charges, financier, exceptionnelles, etc). * Enfin, il associe les données aux modèles, et lance le calcul des * résultats. + * @param period */ - protected void updateResult (PeriodDTO period) - { + protected void updateResult(PeriodDTO period) { // Chargement de la balance List<BalanceDTO> ListbalanceDTO = balance.createBalance(period); /** * Création tableau associatif pour produits et charges */ // charges - Hashtable<String,List<BalanceDTO>> chargeTab = new Hashtable<String,List<BalanceDTO>>(); + Hashtable<String, List<BalanceDTO>> chargeTab = new Hashtable<String, List<BalanceDTO>>(); chargeTab.put("exploitation", new LinkedList<BalanceDTO>()); chargeTab.put("financier", new LinkedList<BalanceDTO>()); chargeTab.put("exceptionnel", new LinkedList<BalanceDTO>()); chargeTab.put("autres", new LinkedList<BalanceDTO>()); // Produits - Hashtable<String,List<BalanceDTO>> produitTab = new Hashtable<String,List<BalanceDTO>>(); + Hashtable<String, List<BalanceDTO>> produitTab = new Hashtable<String, List<BalanceDTO>>(); produitTab.put("exploitation", new LinkedList<BalanceDTO>()); produitTab.put("financier", new LinkedList<BalanceDTO>()); produitTab.put("exceptionnel", new LinkedList<BalanceDTO>()); @@ -225,79 +218,71 @@ * catégorie 64, donc à mettre dans Charges-Exploitation */ String totalCharges = "0"; - String totalProduits = "0"; + String totalProduits = "0"; // Parcours tous les comptes de la balance pour rechercher les comptes 6 et 7 - for ( BalanceDTO balanceDTO : ListbalanceDTO) - { + for (BalanceDTO balanceDTO : ListbalanceDTO) { /** * CHARGES */ // Exploitation - if ( Category.accountNumberCategory("60", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("61", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("62", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("63", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("64", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("65", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("681", balanceDTO.getAccount().getIdNumber()) - ) - { + if (Category.accountNumberCategory("60", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("61", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("62", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("63", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("64", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("65", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("681", balanceDTO.getAccount().getIdNumber()) + ) { chargeTab.get("exploitation").add(balanceDTO); - totalCharges = DTOHelper.AddNumbersString(totalCharges, DTOHelper.SubNumbersString(balanceDTO.getDebit(),balanceDTO.getCredit())); + totalCharges = DTOHelper.AddNumbersString(totalCharges, DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); } // Financières - if ( Category.accountNumberCategory("66", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("686", balanceDTO.getAccount().getIdNumber()) ) - { + if (Category.accountNumberCategory("66", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("686", balanceDTO.getAccount().getIdNumber())) { chargeTab.get("financier").add(balanceDTO); - totalCharges = DTOHelper.AddNumbersString(totalCharges, DTOHelper.SubNumbersString(balanceDTO.getDebit(),balanceDTO.getCredit())); + totalCharges = DTOHelper.AddNumbersString(totalCharges, DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); } // Exceptionnelles - if ( Category.accountNumberCategory("67", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("687", balanceDTO.getAccount().getIdNumber()) ) - { + if (Category.accountNumberCategory("67", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("687", balanceDTO.getAccount().getIdNumber())) { chargeTab.get("exceptionnel").add(balanceDTO); - totalCharges = DTOHelper.AddNumbersString(totalCharges, DTOHelper.SubNumbersString(balanceDTO.getDebit(),balanceDTO.getCredit())); + totalCharges = DTOHelper.AddNumbersString(totalCharges, DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); } // Autres - if ( Category.accountNumberCategory("691", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("695", balanceDTO.getAccount().getIdNumber()) ) - { + if (Category.accountNumberCategory("691", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("695", balanceDTO.getAccount().getIdNumber())) { chargeTab.get("autres").add(balanceDTO); - totalCharges = DTOHelper.AddNumbersString(totalCharges, DTOHelper.SubNumbersString(balanceDTO.getDebit(),balanceDTO.getCredit())); + totalCharges = DTOHelper.AddNumbersString(totalCharges, DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit())); } /** * PRODUIT */ // Exploitation - if ( Category.accountNumberCategory("70", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("71", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("72", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("73", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("74", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("75", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("781", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("791", balanceDTO.getAccount().getIdNumber()) - ) - { + if (Category.accountNumberCategory("70", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("71", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("72", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("73", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("74", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("75", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("781", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("791", balanceDTO.getAccount().getIdNumber()) + ) { produitTab.get("exploitation").add(balanceDTO); - totalProduits = DTOHelper.AddNumbersString(totalProduits, DTOHelper.SubNumbersString(balanceDTO.getCredit(),balanceDTO.getDebit())); + totalProduits = DTOHelper.AddNumbersString(totalProduits, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); } // Financières - if ( Category.accountNumberCategory("76", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("786", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("796", balanceDTO.getAccount().getIdNumber()) ) - { + if (Category.accountNumberCategory("76", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("786", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("796", balanceDTO.getAccount().getIdNumber())) { produitTab.get("financier").add(balanceDTO); - totalProduits = DTOHelper.AddNumbersString(totalProduits, DTOHelper.SubNumbersString(balanceDTO.getCredit(),balanceDTO.getDebit())); + totalProduits = DTOHelper.AddNumbersString(totalProduits, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); } // Exceptionnelles - if ( Category.accountNumberCategory("77", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("787", balanceDTO.getAccount().getIdNumber()) || - Category.accountNumberCategory("797", balanceDTO.getAccount().getIdNumber()) ) - { + if (Category.accountNumberCategory("77", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("787", balanceDTO.getAccount().getIdNumber()) || + Category.accountNumberCategory("797", balanceDTO.getAccount().getIdNumber())) { produitTab.get("exceptionnel").add(balanceDTO); - totalProduits = DTOHelper.AddNumbersString(totalProduits, DTOHelper.SubNumbersString(balanceDTO.getCredit(),balanceDTO.getDebit())); + totalProduits = DTOHelper.AddNumbersString(totalProduits, DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit())); } } @@ -306,16 +291,16 @@ */ // CHARGES List<BalanceDTO> listCharges = new LinkedList<BalanceDTO>(); - BalanceDTO titleExploitation = new BalanceDTO("Exploitation","title","0","0","title",null); + BalanceDTO titleExploitation = new BalanceDTO("Exploitation", "title", "0", "0", "title", null); listCharges.add(titleExploitation); listCharges.addAll(chargeTab.get("exploitation")); - BalanceDTO titleFinancier = new BalanceDTO("Financiers","title","0","0","title",null); + BalanceDTO titleFinancier = new BalanceDTO("Financiers", "title", "0", "0", "title", null); listCharges.add(titleFinancier); listCharges.addAll(chargeTab.get("financier")); - BalanceDTO titleExceptionnel = new BalanceDTO("Exceptionnelles","title","0","0","title",null); + BalanceDTO titleExceptionnel = new BalanceDTO("Exceptionnelles", "title", "0", "0", "title", null); listCharges.add(titleExceptionnel); listCharges.addAll(chargeTab.get("exceptionnel")); - BalanceDTO titleAutre = new BalanceDTO("Autres","title","0","0","title",null); + BalanceDTO titleAutre = new BalanceDTO("Autres", "title", "0", "0", "title", null); listCharges.add(titleAutre); listCharges.addAll(chargeTab.get("autres")); // Création du modèle à partir de la liste précédement créée @@ -324,13 +309,13 @@ // PRODUITS List<BalanceDTO> listProduits = new LinkedList<BalanceDTO>(); - titleExploitation = new BalanceDTO("Exploitation","title","0","0","title",null); + titleExploitation = new BalanceDTO("Exploitation", "title", "0", "0", "title", null); listProduits.add(titleExploitation); listProduits.addAll(produitTab.get("exploitation")); - titleFinancier = new BalanceDTO("Financiers","title","0","0","title",null); + titleFinancier = new BalanceDTO("Financiers", "title", "0", "0", "title", null); listProduits.add(titleFinancier); listProduits.addAll(produitTab.get("financier")); - titleExceptionnel = new BalanceDTO("Exceptionnelles","title","0","0","title",null); + titleExceptionnel = new BalanceDTO("Exceptionnelles", "title", "0", "0", "title", null); listProduits.add(titleExceptionnel); listProduits.addAll(produitTab.get("exceptionnel")); // Création du modèle à partir de la liste précédement créée @@ -340,45 +325,40 @@ /** * Actualise les résultats */ - initTabChargeRes(totalCharges); + initTabChargeRes(totalCharges); initTabProduitRes(totalProduits); // Affiche le résultat en produit OU en charge suivant le bénéfice ou perte resultat = "0"; // On efface les résultats (ligne bénéfice ou perte) - if ( modelChargeRes.getRowCount() > 1 ) - { + if (modelChargeRes.getRowCount() > 1) { modelChargeRes.removeRow(0); } - if ( modelProduitRes.getRowCount() > 1 ) - { + if (modelProduitRes.getRowCount() > 1) { modelProduitRes.removeRow(0); } // Si les charges sont plus grandes que les produits : pertes - if (Util.compareTo(totalCharges, totalProduits) == 1 ) - { + if (Util.compareTo(totalCharges, totalProduits) == 1) { resultat = DTOHelper.SubNumbersString(totalProduits, totalCharges); - Object[] data = - {_("lima.result.loss"),resultat}; + Object[] data ={_("lima.result.loss"), resultat}; modelChargeRes.addRow(data); modelChargeRes.fireTableDataChanged(); } else { // Sinon profit resultat = DTOHelper.SubNumbersString(totalProduits, totalCharges); - Object[] data = - {_("lima.result.profit"),resultat}; - + Object[] data ={_("lima.result.profit"), resultat}; + modelProduitRes.addRow(data); modelProduitRes.fireTableDataChanged(); - } + } } - + /** * Initialise la combobox contenant les périodes */ private void initComboBoxPeriod() { // Recherche la liste de toutes les périodes - List<PeriodDTO> periodes = Main.getContext().getDataManager().getPeriodes(); + List<PeriodDTO> periodes = LimaContext.getContext().getDataManager().getPeriodes(); // Model pour les périodes Vector<PeriodDTO> v = new Vector<PeriodDTO>(); // On ajoute un élément null pour permettre d'afficher toutes les périodes @@ -394,8 +374,7 @@ periodPanel.validate(); } - public String getResult() - { + public String getResult() { return resultat; } Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/SearchTransactionViewImpl.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/SearchTransactionViewImpl.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/SearchTransactionViewImpl.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -21,8 +21,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaContext; import static org.nuiton.i18n.I18n._; -import org.chorem.lima.Main; import org.chorem.lima.dto.util.DTOHelper; import org.chorem.lima.enumeration.FilterEnum; import org.chorem.lima.table.TransactionJXTable; @@ -41,9 +41,6 @@ private static final Log log = LogFactory.getLog(SearchTransactionViewImpl.class); private final TransactionJXTable table; - /** - * Constructor - */ public SearchTransactionViewImpl() { // At Least one criteria CriteriaWidgetImpl widget = new CriteriaWidgetImpl(); @@ -51,7 +48,7 @@ criteriaWidgetPanel.add(widget); this.validate(); - TransactionViewImpl searchResult = Main.getContext().getMainUI().getSearchResultView(); + TransactionViewImpl searchResult = LimaContext.getContext().getMainUI().getSearchResultView(); searchResult.setFiltreEnabled(false); table = searchResult.getTransactionTable(); getRootPane().setDefaultButton(okButton); @@ -68,11 +65,8 @@ this.validate(); } - /** - * - */ protected void showTransactionView() { - Main.getContext().getMainUI().showSearchResultView(); + LimaContext.getContext().getMainUI().showSearchResultView(); } @Override Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/TransactionView.jaxx =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/TransactionView.jaxx 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/TransactionView.jaxx 2009-11-08 12:04:50 UTC (rev 2734) @@ -5,11 +5,11 @@ protected void addEmptyEntry() {}; </script> <JPopupMenu id="MenuRightPanel"> - <JMenuItem text="Ajouter une transaction" onActionPerformed='addEmptyTransaction()'/> + <JMenuItem text="lima.add.transaction" onActionPerformed='addEmptyTransaction()'/> <JMenuItem text="lima.print"/> </JPopupMenu> <JPopupMenu id="MenuRightTransaction"> - <JMenuItem text="Ajouter" onActionPerformed='addEmptyTransaction()'/> + <JMenuItem text="lima.add" onActionPerformed='addEmptyTransaction()'/> <JMenuItem text="lima.print"/> </JPopupMenu> <row fill="horizontal" weightx="0.75" weighty="0" anchor="center" insets='5,5,5,5'> Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/TransactionViewImpl.java =================================================================== --- trunk/lima-main/src/main/java/org/chorem/lima/ui/TransactionViewImpl.java 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/java/org/chorem/lima/ui/TransactionViewImpl.java 2009-11-08 12:04:50 UTC (rev 2734) @@ -27,6 +27,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaContext; import org.chorem.lima.combobox.model.JournalComboBoxModel; import org.chorem.lima.combobox.renderer.JournalComboBoxRenderer; import org.chorem.lima.combobox.renderer.PeriodComboBoxRenderer; @@ -37,7 +38,6 @@ import org.chorem.lima.dto.util.DTOHelper; import org.chorem.lima.enumeration.FilterEnum; import org.chorem.lima.listener.ClicRight; -import org.chorem.lima.Main; import org.chorem.lima.service.util.ServiceHelper; import org.chorem.lima.table.model.*; import org.chorem.lima.table.TransactionJXTable; @@ -45,7 +45,6 @@ import static org.nuiton.i18n.I18n._; - /** * @author ore * @author Rémi Chapelet @@ -65,12 +64,9 @@ private TransactionSortedTableColumnModel columnModel; private TransactionFlattenTableModel flattenModel; - /** - * MODELS - */ public TransactionDataTableModel getModel() { if (model == null) { - model = Main.getContext().getDataManager().getTransactionModel(); + model = LimaContext.getContext().getDataManager().getTransactionModel(); } return model; } @@ -137,7 +133,7 @@ getTransactionTable().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); transactionScrollPane.setViewportView(getTransactionTable()); - + /** * Property change listeners */ @@ -156,7 +152,7 @@ JComboBox comboBox = (JComboBox) e.getSource(); JournalDTO item = (JournalDTO) comboBox.getSelectedItem(); getFlattenModel().filter(FilterEnum.Journal, item, true); - Main.getContext().getDataManager().setCurrentJournal(item); + LimaContext.getContext().getDataManager().setCurrentJournal(item); } if (!(getComboPeriod().getSelectedIndex() == -1 || getComboPeriod().getSelectedIndex() == 0)) { @@ -174,7 +170,7 @@ JComboBox comboBox = (JComboBox) e.getSource(); PeriodDTO item = (PeriodDTO) comboBox.getSelectedItem(); getFlattenModel().filter(FilterEnum.Period, item, true); - Main.getContext().getDataManager().setCurrentPeriod(item); + LimaContext.getContext().getDataManager().setCurrentPeriod(item); } if (!(getComboJournal().getSelectedIndex() == -1 || getComboJournal().getSelectedIndex() == 0)) { @@ -189,14 +185,11 @@ int index = 0; // Récupère la date actuelle Date d = new Date(); - String dateToday = ServiceHelper.dateToMonth(d)+" "+(d.getYear()+1900); - for (int i=0;i<= getComboPeriod().getItemCount();i++) - { + String dateToday = ServiceHelper.dateToMonth(d) + " " + (d.getYear() + 1900); + for (int i = 0; i <= getComboPeriod().getItemCount(); i++) { Object o = getComboPeriod().getItemAt(i); - if (o != null) - { - if ( dateToday.equals(((PeriodDTO) o).getIdName())) - { + if (o != null) { + if (dateToday.equals(((PeriodDTO) o).getIdName())) { index = i; } } @@ -210,13 +203,13 @@ getTransactionTable().addMouseListener(popupListeneTransr); } - + /** * Initialise la combobox contenant les journaux */ private void initJournalComboBox() { /** Getting data from journal model **/ - List<JournalDTO> journals = Main.getContext().getDataManager().getJournalModel().getData(); + List<JournalDTO> journals = LimaContext.getContext().getDataManager().getJournalModel().getData(); /** Creating combobox model */ Vector<JournalDTO> v = new Vector<JournalDTO>(journals.size()); /** null item */ @@ -224,7 +217,7 @@ v.addAll(journals); JournalComboBoxModel comboBoxModel = new JournalComboBoxModel(v); /** Property Change Listener */ - Main.getContext().getDataManager().getJournalModel().addPropertyChangeListener(comboBoxModel); + LimaContext.getContext().getDataManager().getJournalModel().addPropertyChangeListener(comboBoxModel); getComboJournal().setModel(comboBoxModel); getComboJournal().setRenderer(JournalComboBoxRenderer.getInstance()); @@ -239,7 +232,7 @@ */ private void initPeriodComboBox() { // Recherche la liste de toutes les périodes - List<PeriodDTO> periodes = Main.getContext().getDataManager().getPeriodes(); + List<PeriodDTO> periodes = LimaContext.getContext().getDataManager().getPeriodes(); // Model pour les périodes Vector<PeriodDTO> v = new Vector<PeriodDTO>(); // On ajoute un élément null pour permettre d'afficher toutes les périodes @@ -247,20 +240,20 @@ // Pour chaque période (annuelle et NON mensuelle !) for (PeriodDTO period : periodes) { v.addElement(period); - v.addAll(period.getChildren()); + v.addAll(period.getChildren()); } getComboPeriod().setModel(new DefaultComboBoxModel(v)); getComboPeriod().setRenderer(PeriodComboBoxRenderer.getInstance()); // AutoCompletion // AutoCompleteDecorator.decorate(comboPeriod, PeriodToStringConverter.getInstance()); - + periodPanel.add(getComboPeriod()); periodPanel.validate(); } /** - * @param enabled + * @param enabled new value */ public void setFiltreEnabled(boolean enabled) { getComboPeriod().setEnabled(enabled); @@ -271,7 +264,7 @@ * ajout de transaction vide avec le bouton */ @Override - protected void addEmptyTransaction(){ + protected void addEmptyTransaction() { String result = transactionTable.getModel().addEmptyTransaction(); /** * Si il n'y pas de message success, alors il existe une erreur. @@ -283,59 +276,56 @@ /** * suppression de transaction avec le bouton */ - @Override + @Override protected void removeTransaction() { // Any row selected Integer indexSelectedRow = transactionTable.getSelectedRow(); if (indexSelectedRow != -1) { String message = DTOHelper.isTransaction( - transactionTable.getModel().getElementAt(indexSelectedRow)) - ? _("lima.question.remove.transaction") - : _("lima.question.remove.entry"); - int n = Util.showConfirmDialog(message); - if (n == JOptionPane.YES_OPTION) { - TransactionTableModel model = transactionTable.getModel(); - // Message de retour - String result=""; - if (TransactionFlattenTableModel.isFlattenModel(model)) - { - // Flatten - TransactionFlattenTableModel flattenModel = (TransactionFlattenTableModel) transactionTable.getModel(); - flattenModel.removeEmptyLine(); - /** - * Supprime la ligne sélectionnée : transaction ou entry - */ - if (DTOHelper.isTransaction(model.getElementAt(indexSelectedRow))) { - // Transaction - result = model.removeTransaction((TransactionDTO) model.getElementAt(indexSelectedRow)); - } else { - // Entry - result = flattenModel.removeEntry((EntryDTO) model.getElementAt(indexSelectedRow)); - } - transactionTable.addColorEmptyLine(); - } else { - // Not Flatten - result = model.removeTransaction((TransactionDTO) model.getElementAt(indexSelectedRow)); - } + transactionTable.getModel().getElementAt(indexSelectedRow)) + ? _("lima.question.remove.transaction") + : _("lima.question.remove.entry"); + int n = Util.showConfirmDialog(message); + if (n == JOptionPane.YES_OPTION) { + TransactionTableModel model = transactionTable.getModel(); + // Message de retour + String result = ""; + if (TransactionFlattenTableModel.isFlattenModel(model)) { + // Flatten + TransactionFlattenTableModel flattenModel = (TransactionFlattenTableModel) transactionTable.getModel(); + flattenModel.removeEmptyLine(); /** - * Messages erreurs + * Supprime la ligne sélectionnée : transaction ou entry */ - if ( !result.equals(ServiceHelper.RESPOND_SUCCESS) ) - { - ErrorMessage.showMessage(message); + if (DTOHelper.isTransaction(model.getElementAt(indexSelectedRow))) { + // Transaction + result = model.removeTransaction((TransactionDTO) model.getElementAt(indexSelectedRow)); + } else { + // Entry + result = flattenModel.removeEntry((EntryDTO) model.getElementAt(indexSelectedRow)); } + transactionTable.addColorEmptyLine(); + } else { + // Not Flatten + result = model.removeTransaction((TransactionDTO) model.getElementAt(indexSelectedRow)); } + /** + * Messages erreurs + */ + if (!result.equals(ServiceHelper.RESPOND_SUCCESS)) { + ErrorMessage.showMessage(message); + } + } } } - /** - * Implémente le bouton ajout d'une entrée. - * Permet d'ajouter une ligne comptable sur la transaction sélectionnée. - */ + /** + * Implémente le bouton ajout d'une entrée. + * Permet d'ajouter une ligne comptable sur la transaction sélectionnée. + */ @Override - protected void addEmptyEntry(){ - if (transactionTable.getSelectionModel().isSelectionEmpty()) - { + protected void addEmptyEntry() { + if (transactionTable.getSelectionModel().isSelectionEmpty()) { // Not line selected } else { // Line selected @@ -348,13 +338,13 @@ if (DTOHelper.isTransaction(o)) { // Transaction n'est pas éditable if (!ServiceHelper.isEditable((TransactionDTO) o)) { - Util.showMessageDialog(_("lima.error.transaction.period.not.blocked")+".",_("lima.error"),JOptionPane.WARNING_MESSAGE); + Util.showMessageDialog(_("lima.error.transaction.period.not.blocked") + ".", _("lima.error"), JOptionPane.WARNING_MESSAGE); return; } } else { //Entry n'est pas éditable if (!ServiceHelper.isEditable((EntryDTO) o)) { - Util.showMessageDialog(_("lima.error.transaction.period.not.blocked")+".",_("lima.error"),JOptionPane.WARNING_MESSAGE); + Util.showMessageDialog(_("lima.error.transaction.period.not.blocked") + ".", _("lima.error"), JOptionPane.WARNING_MESSAGE); return; } } Modified: trunk/lima-main/src/main/resources/i18n/lima-main-en_GB.properties =================================================================== --- trunk/lima-main/src/main/resources/i18n/lima-main-en_GB.properties 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/resources/i18n/lima-main-en_GB.properties 2009-11-08 12:04:50 UTC (rev 2734) @@ -1,18 +1,10 @@ -Ajouter= -Ajouter\ une\ transaction= -Page\ d'accueil\ -\ TODO= -bilan= +lima.about.message= lima.account=Account lima.account.type=Account type lima.actif=Asset -lima.action.connect= -lima.action.connect.help= -lima.action.connect.tooltip= -lima.action.unconnect= -lima.action.unconnect.help= -lima.action.unconnect.tooltip= +lima.action.commandline.disable.main.ui=Do not launch main ui +lima.action.commandline.help=Show help in console lima.add=Add -lima.add.account=Add an account lima.add.entry=Add an entry lima.add.lettering=Add a letter lima.add.transaction=Add a transaction @@ -38,34 +30,15 @@ lima.block=block lima.cancel=Cancel lima.charge=Expense -lima.closure=Closure lima.closure.period.begin=Period -lima.closure.period.end= lima.closure.timespan.warning=Warning\: when the period is blocked, it is possible to add, edit and delete entries on the accounting period. +lima.config.category.directories= +lima.config.category.directories.description= +lima.config.category.other= +lima.config.category.other.description= +lima.config.configFileName.description= lima.config.locale.description= -lima.config.main.configFileName.description=Absolute path to configuration file -lima.config.main.copyright.description= -lima.config.main.debugMode.description=Flag to have or not debug mode -lima.config.main.description=Main configuration of Application -lima.config.main.encoding.description=User's encoding to be used in application -lima.config.main.locale.description=User's locale to be used in application -lima.config.main.organisationName.description= -lima.config.main.organisationURL.description= -lima.config.main.projectName.description=Name of the project -lima.config.main.projectURL.description= -lima.config.main.userFirstName.description=First name of user -lima.config.main.userLastName.description=Last name of user -lima.config.main.userMail.description=Email of user -lima.config.main.version.description=Version of application -lima.config.remote.URI.description=URI of remote server -lima.config.remote.description=Configuration of remote server -lima.config.remote.login.description=Login of user on remote server -lima.config.remote.password.description=Password of user on remote server -lima.config.remote.proxyLogin.description=Login of user on proxy server -lima.config.remote.proxyPassword.description=Password of user on proxy server -lima.config.remote.useProxy.description=Flag to indicate if a proxy is used to acces remote server lima.config.ui.fullscreen= -lima.configuration=Configuration lima.credit=Credit lima.daily=Daily lima.date=Date @@ -91,24 +64,18 @@ lima.error.account.not.exist=This account doesn't exist lima.error.account.not.master=This account has not an account master lima.error.account.with.entries=This account has some entries -lima.error.at.least.one.criteria=A criteria must lima.error.entry.not.exist= lima.error.entry.not.remove= lima.error.journal.double=A journal exist with this name lima.error.journal.not.exist=This journal doesn't exist lima.error.journal.with.transactions=This journal has some transactions -lima.error.login.failed=Login failed lima.error.period.all.timespan= lima.error.period.create.timespan= -lima.error.period.next.blocked=It exists periods blocked lima.error.period.next.not.blocked= lima.error.period.not.exist= -lima.error.period.not.selected=Please choose a period lima.error.period.prec.not.blocked=It exists periods not blocked lima.error.period.timespan.block= lima.error.period.timespan.not.blocked= -lima.error.service.failed=Service failed -lima.error.transaction.balance=The transaction is not balanced lima.error.transaction.exist.not.balanced=It exists transactions not balanced lima.error.transaction.not.create=This transaction has not been created lima.error.transaction.not.exist=This transaction doesn't exist @@ -133,6 +100,7 @@ lima.filter.starts.with=Starts with lima.find.transaction=Find transaction lima.grand.livre=General Ledger +lima.home=Home - TODO lima.import=Import lima.import.account=Import PCG lima.import.all=Import all datas @@ -141,25 +109,27 @@ lima.import.error=Your datas had't not been loaded lima.import.journal=Import journal lima.import.success=Your datas had been loaded -lima.information=Information lima.init.closed= -lima.init.context.done= -lima.init.ui.done= +lima.init.context.done=Context was initialized in %1$s +lima.init.ui.done=UI initialized lima.journal=Journal -lima.language=Language lima.lettered=Lettered lima.lettering=Lettering lima.loading=Loading -lima.login.retry=Account lima.menu.file=File lima.menu.help=Help -lima.menu.help.i18n= +lima.menu.help.about=About +lima.menu.help.help=Help +lima.menu.help.i18n=Language +lima.menu.help.i18n.fr=French +lima.menu.help.i18n.uk=English +lima.menu.help.site=WebSite lima.menubar.closure=Closure lima.menubar.closure.addPeriod=Add a period lima.menubar.closure.listperiod=See all periods lima.menubar.closure.period=close a period (annual) lima.menubar.closure.timespan=close a period (monthly) -lima.message.config.loaded= +lima.message.config.loaded=Config was loaded lima.message.error.empty.line=Please choose an account lima.model.account=Account lima.model.balance=Balance @@ -178,17 +148,8 @@ lima.name=Name lima.non.valids.transactions=No valids transactions lima.not.lettered=Not lettered -lima.numbe= lima.number=Number lima.ok=OK -lima.option.description.changeConfig=Change some properties of configuration -lima.option.description.changeFileConfig=Change the configuration's file -lima.option.description.editConfig=Edit the configuration -lima.option.description.help=Show the help screen -lima.option.description.helpConfig=Show the detail of properties of configuration -lima.option.description.resetConfig=Reset configuration -lima.option.description.showConfig=Show the detail of current configuration -lima.option.description.ui=Flag to indicate to see or not UI lima.passif=Liability lima.period=Period lima.period.close=Close @@ -210,9 +171,7 @@ lima.progressBar.load.etape3=Loading status lima.progressBar.load.etape4=Loading periods lima.progressBar.load.etape5=Loading transactions -lima.progressBar.load.title=Loading datas lima.question=Question -lima.question.close=Do you want to close Lima ? lima.question.load.accounts=There is no existing accounts in Lima. Do you want to load default accounts ? lima.question.remove.account=Do you want to remove this account ? lima.question.remove.entry=Do you want to remove this entry ? @@ -252,6 +211,7 @@ lima.tab.search.result=Search result lima.tab.transaction=Transaction lima.title=Lutin Invoice Monitoring and Accounting +lima.title.about=About Lima... lima.to=To lima.ui.add.account=Add account lima.ui.add.journal=Add journal @@ -264,8 +224,5 @@ lima.view=View lima.view.flatten=Flatten view lima.voucher=Voucher -lima.warning.nimbus.landf= -lima.warning.no.ui= -observe.action.commandline.disable.main.ui= -observe.action.commandline.help= -observe.config.configFileName.description= +lima.warning.nimbus.landf=Could not find Numbus Look&Feel +lima.warning.no.ui=No ui display detected Modified: trunk/lima-main/src/main/resources/i18n/lima-main-fr_FR.properties =================================================================== --- trunk/lima-main/src/main/resources/i18n/lima-main-fr_FR.properties 2009-11-04 17:24:33 UTC (rev 2733) +++ trunk/lima-main/src/main/resources/i18n/lima-main-fr_FR.properties 2009-11-08 12:04:50 UTC (rev 2734) @@ -1,22 +1,13 @@ -Ajouter= -Ajouter\ une\ transaction= -Page\ d'accueil\ -\ TODO= -bilan= -lima=Lutin Invoice Monitoring and Accounting +lima.about.message= lima.account=Compte lima.account.type=Type de compte lima.actif=Actif -lima.action.connect=Se connecter -lima.action.connect.help=Aide -lima.action.connect.tooltip=tooltip -lima.action.unconnect=D\u00E9connecter -lima.action.unconnect.help=Aide -lima.action.unconnect.tooltip=tooltip +lima.action.commandline.disable.main.ui=Ne pas lancer l'ui +lima.action.commandline.help=Afficher l'aide en console lima.add=Ajout -lima.add.account=Ajouter un compte lima.add.entry=Ajouter une entr\u00E9e lima.add.lettering=Ajouter une lettre -lima.add.transaction= +lima.add.transaction=Ajouter une transaction lima.all=Tous lima.all.criteria=Tous les crit\u00E8res correspondent lima.amount=Montant @@ -39,34 +30,15 @@ lima.block=Bloquer lima.cancel=Annuler lima.charge=Charge -lima.closure=Cl\u00F4ture lima.closure.period.begin=P\u00E9riode du -lima.closure.period.end= lima.closure.timespan.warning=Attention \: lorsque la p\u00E9riode est bloqu\u00E9e, il n'est plus possible d'ajouter, modifier et supprimer les entr\u00E9es comptables sur cette p\u00E9riode. -lima.config.locale.description= -lima.config.main.configFileName.description=Nom du fichier de configuration -lima.config.main.copyright.description= -lima.config.main.debugMode.description=flag pour activer le mode debug -lima.config.main.description=Configuration principale de l'application -lima.config.main.encoding.description=Encoding des fichiers de l'application -lima.config.main.locale.description=Locale utilis\u00E9e par l'application -lima.config.main.organisationName.description= -lima.config.main.organisationURL.description= -lima.config.main.projectName.description=Nom du projet -lima.config.main.projectURL.description= -lima.config.main.userFirstName.description=Nom de l'utilisateur -lima.config.main.userLastName.description=Pr\u00E9nom de l'utilisateur -lima.config.main.userMail.description=Courriel de l'utilisateur -lima.config.main.version.description=Version de l'application -lima.config.remote.URI.description=URL d'acces au serveur distant -lima.config.remote.description=Configuration d'acc\u00E8s au serveur distant -lima.config.remote.login.description=Login au serveur distant -lima.config.remote.password.description=Mot de passe d'acc\u00E8s au serveur distant -lima.config.remote.proxyLogin.description=Login du proxy -lima.config.remote.proxyPassword.description=Mot de passe du proxy -lima.config.remote.useProxy.description=Pour indiquer l'utilisation ou non d'un proxy pour atteindre le serveur distant -lima.config.ui.fullscreen= -lima.configuration=Configuration +lima.config.category.directories=R\u00E9pertoires +lima.config.category.directories.description=R\u00E9pertoires utilis\u00E9s par Lima +lima.config.category.other=Autre +lima.config.category.other.description=Autre propri\u00E9t\u00E9s de configuration +lima.config.configFileName.description= +lima.config.locale.description=Locale utilis\u00E9e par l'application +lima.config.ui.fullscreen=Drapeau pour utiliser le mode plein \u00E9cran lima.credit=Credit lima.daily=Quotidien lima.date=Date @@ -92,24 +64,18 @@ lima.error.account.not.exist=Ce num\u00E9ro de compte n'existe pas lima.error.account.not.master=Ce compte ne poss\u00E8de pas de compte principal lima.error.account.with.entries=Ce compte poss\u00E8de des entr\u00E9es comptables -lima.error.at.least.one.criteria=Au moins un crit\u00E8re doit lima.error.entry.not.exist= lima.error.entry.not.remove= lima.error.journal.double=Un journal poss\u00E8de d\u00E9j\u00E0 ce nom lima.error.journal.not.exist=Ce journal n'existe pas lima.error.journal.with.transactions=Ce journal poss\u00E8de des transactions comptables -lima.error.login.failed=Echec d'authentification lima.error.period.all.timespan= lima.error.period.create.timespan= -lima.error.period.next.blocked=Il existe des p\u00E9riodes suivantes bloqu\u00E9es lima.error.period.next.not.blocked= lima.error.period.not.exist= -lima.error.period.not.selected=La p\u00E9riode doit \u00EAtre selectionn\u00E9e lima.error.period.prec.not.blocked=Il existe des p\u00E9riodes pr\u00E9c\u00E9dentes non bloqu\u00E9es lima.error.period.timespan.block= lima.error.period.timespan.not.blocked= -lima.error.service.failed=Service failed -lima.error.transaction.balance=La transaction n'est pas \u00E9quilibr\u00E9e lima.error.transaction.exist.not.balanced=Il existe des transactions non \u00E9quilibr\u00E9es lima.error.transaction.not.create=La transaction n'a pu \u00EAtre cr\u00E9\u00E9e lima.error.transaction.not.exist=La transaction n'existe pas @@ -134,6 +100,7 @@ lima.filter.starts.with=Commence par lima.find.transaction=Rechercher transaction lima.grand.livre=Grand-Livre +lima.home=Page d'accueil - TODO lima.import=Import lima.import.account=Importer le PCG lima.import.all=Importer une nouvelle base (XML) @@ -142,19 +109,21 @@ lima.import.error=Vos donn\u00E9es n'ont pu \u00EAtre charg\u00E9es lima.import.journal=Importer le journal lima.import.success=Vos donn\u00E9es ont bien \u00E9t\u00E9 charg\u00E9es -lima.information=Information lima.init.closed= -lima.init.context.done= -lima.init.ui.done= +lima.init.context.done=Initialisation du context termin\u00E9 en %1$s +lima.init.ui.done=Initialisation des interface graphiques termin\u00E9e lima.journal=Journal -lima.language=Langue lima.lettered=Lettr\u00E9 lima.lettering=Lettrage lima.loading=Chargement -lima.login.retry=R\u00E9essayer lima.menu.file=Fichier lima.menu.help=Aide -lima.menu.help.i18n= +lima.menu.help.about=Afficher l'A Propos +lima.menu.help.help=Afficher l'aide +lima.menu.help.i18n=Langue +lima.menu.help.i18n.fr=Fran\u00E7ais +lima.menu.help.i18n.uk=Anglais +lima.menu.help.site=Acc\u00E9der au site de Lima lima.menubar.closure=Cl\u00F4ture lima.menubar.closure.addPeriod=Ajouter une p\u00E9riode lima.menubar.closure.listperiod=Voir toutes les cl\u00F4tures @@ -179,17 +148,8 @@ lima.name=Nom lima.non.valids.transactions=Ecritures non valides lima.not.lettered=Non lettr\u00E9 -lima.numbe= lima.number=Num\u00E9ro lima.ok=OK -lima.option.description.changeConfig=Changer une propri\u00E9t\u00E9 de la configuration -lima.option.description.changeFileConfig=Change de fichier de configuration -lima.option.description.editConfig=Editer la configuration -lima.option.description.help=Afficher l'aide -lima.option.description.helpConfig=Afficher les d\u00E9tail de la configuration -lima.option.description.resetConfig=R\u00E9initialiser la configuration -lima.option.description.showConfig=Afficher la configuration -lima.option.description.ui=Permettre ou non l'utilisation des UI lima.passif=Passif lima.period=P\u00E9riode lima.period.close=Ferm\u00E9 @@ -211,9 +171,7 @@ lima.progressBar.load.etape3=Chargement des status lima.progressBar.load.etape4=Chargement des p\u00E9riodes lima.progressBar.load.etape5=Chargement des transactions -lima.progressBar.load.title=Chargement des donn\u00E9es lima.question=Question -lima.question.close=Voulez vous quitter Lima? lima.question.load.accounts=Il n'y a aucun plan comptable existant dans Lima. Voulez-vous en charger un par d\u00E9faut ? lima.question.remove.account=Voulez-vous supprimer ce compte? lima.question.remove.entry=Voulez-vous supprimer cette ligne de transaction? @@ -253,6 +211,7 @@ lima.tab.search.result=Recherche lima.tab.transaction=Ecriture lima.title=Lutin Invoice Monitoring and Accounting +lima.title.about=A propos de Lima... lima.to=A lima.ui.add.account=Ajouter un compte lima.ui.add.journal=Ajouter un journal @@ -265,8 +224,5 @@ lima.view=Vue lima.view.flatten=Vue aplatie lima.voucher=Document -lima.warning.nimbus.landf= -lima.warning.no.ui= -observe.action.commandline.disable.main.ui= -observe.action.commandline.help= -observe.config.configFileName.description= +lima.warning.nimbus.landf=Le look and feel nymbus n'a pas \u00E9t\u00E9 trouv\u00E9 +lima.warning.no.ui=Aucun environnement graphique d\u00E9tect\u00E9. Deleted: trunk/lima-main/src/main/resources/icons/account.png =================================================================== (Binary files differ) Deleted: trunk/lima-main/src/main/resources/icons/action/about.png =================================================================== (Binary files differ) Deleted: trunk/lima-main/src/main/resources/icons/action/export-element.png =================================================================== (Binary files differ) Deleted: trunk/lima-main/src/main/resources/icons/action/help.png =================================================================== (Binary files differ) Deleted: trunk/lima-main/src/main/resources/icons/action/i18n-en.png =================================================================== (Binary files differ) Deleted: trunk/lima-main/src/main/resources/icons/action/i18n-fr.png =================================================================== (Binary files differ) Deleted: trunk/lima-main/src/main/resources/icons/action/quit.png =================================================================== (Binary files differ) Deleted: trunk/lima-main/src/main/resources/icons/action/search.png =================================================================== (Binary files differ) Deleted: trunk/lima-main/src/main/resources/icons/action/site.png =================================================================== (Binary files differ) Deleted: trunk/lima-main/src/main/resources/icons/action/translate.png =================================================================== (Binary files differ) Copied: trunk/lima-main/src/main/resources/icons/action-about.png (from rev 2733, trunk/lima-main/src/main/resources/icons/action/about.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-about.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-account.png (from rev 2733, trunk/lima-main/src/main/resources/icons/account.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-account.png ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-closure-timespan.png (from rev 2733, trunk/lima-main/src/main/resources/icons/closure-timespan.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-closure-timespan.png ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-closure.png (from rev 2733, trunk/lima-main/src/main/resources/icons/closure.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-closure.png ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-config.png (from rev 2733, trunk/lima-main/src/main/resources/icons/action/config.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-config.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-export-element.png (from rev 2733, trunk/lima-main/src/main/resources/icons/action/export-element.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-export-element.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-help.png (from rev 2733, trunk/lima-main/src/main/resources/icons/action/help.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-help.png ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-i18n-fr.png (from rev 2733, trunk/lima-main/src/main/resources/icons/action/i18n-fr.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-i18n-fr.png ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-i18n-uk.png (from rev 2733, trunk/lima-main/src/main/resources/icons/action/i18n-en.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-i18n-uk.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/lima-main/src/main/resources/icons/action-import-element.png =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-import-element.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-journal.png (from rev 2733, trunk/lima-main/src/main/resources/icons/journal.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-journal.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-lettering.png (from rev 2733, trunk/lima-main/src/main/resources/icons/lettering.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-lettering.png ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-print.png (from rev 2733, trunk/lima-main/src/main/resources/icons/print.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-print.png ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-quit.png (from rev 2733, trunk/lima-main/src/main/resources/icons/action/quit.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-quit.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-rapport.png (from rev 2733, trunk/lima-main/src/main/resources/icons/rapport.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-rapport.png ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-search.png (from rev 2733, trunk/lima-main/src/main/resources/icons/action/search.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-search.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-site.png (from rev 2733, trunk/lima-main/src/main/resources/icons/action/site.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-site.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-transaction.png (from rev 2733, trunk/lima-main/src/main/resources/icons/transaction.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-transaction.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-translate.png (from rev 2733, trunk/lima-main/src/main/resources/icons/action/translate.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-translate.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Copied: trunk/lima-main/src/main/resources/icons/action-view.png (from rev 2733, trunk/lima-main/src/main/resources/icons/view.png) =================================================================== (Binary files differ) Property changes on: trunk/lima-main/src/main/resources/icons/action-view.png ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Deleted: trunk/lima-main/src/main/resources/icons/closure-timespan.png =================================================================== (Binary files differ) Deleted: trunk/lima-main/src/main/resources/icons/closure.png =================================================================== (Binary files differ) Deleted: trunk/lima-main/src/main/resources/icons/journal.png =================================================================== (Binary files differ) Deleted: trunk/lima-main/src/main/resources/icons/lettering.png =================================================================== (Binary files differ) Deleted: trunk/lima-main/src/main/resources/icons/print.png =================================================================== (Binary files differ) Deleted: trunk/lima-main/src/main/resources/icons/rapport.png =================================================================== (Binary files differ) Deleted: trunk/lima-main/src/main/resources/icons/transaction.png =================================================================== (Binary files differ) Deleted: trunk/lima-main/src/main/resources/icons/view.png =================================================================== (Binary files differ)