Dépôt officiel du code source de l'ERP OpenConcerto
/trunk/OpenConcerto/.classpath |
---|
13,7 → 13,6 |
<classpathentry exported="true" kind="lib" path="lib/jdom-1.1.1.jar"/> |
<classpathentry exported="true" kind="lib" path="lib/jgrapht-0.7.3.jar"/> |
<classpathentry exported="true" kind="lib" path="lib/jpos111.jar"/> |
<classpathentry exported="true" kind="lib" path="lib/ognl-2.6.5.jar"/> |
<classpathentry exported="true" kind="lib" path="lib/resolver.jar"/> |
<classpathentry exported="true" kind="lib" path="lib/RXTXcomm.jar"/> |
<classpathentry kind="lib" path="lib/jcip-annotations.jar"/> |
35,8 → 34,8 |
<classpathentry kind="lib" path="lib/accessors-smart-1.1.jar"/> |
<classpathentry kind="lib" path="lib/gson-2.8.1.jar"/> |
<classpathentry kind="lib" path="lib/icudata_56.jar"/> |
<classpathentry kind="lib" path="lib/javax.mail-1.6.0.jar"/> |
<classpathentry kind="lib" path="lib/json-smart-2.2.1.jar"/> |
<classpathentry exported="true" kind="lib" path="lib/javax.mail-1.6.0.jar"/> |
<classpathentry exported="true" kind="lib" path="lib/json-smart-2.2.1.jar"/> |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> |
<classpathentry kind="lib" path="lib/piccolo-1.04.jar"/> |
<classpathentry kind="lib" path="lib/javax.activation-1.1.1.jar"/> |
48,5 → 47,6 |
<classpathentry kind="lib" path="lib/flatlaf-1.2.jar"/> |
<classpathentry kind="lib" path="lib/fontbox-2.0.22.jar"/> |
<classpathentry kind="lib" path="lib/pdfbox-2.0.22.jar"/> |
<classpathentry kind="lib" path="lib/OGNL-3.3.2.ILM.jar"/> |
<classpathentry kind="output" path="bin"/> |
</classpath> |
/trunk/OpenConcerto/jpackage.properties |
---|
New file |
0,0 → 1,9 |
# jdk11 is 500 MB, jdk > 14 doesn't have jdk.scripting.nashorn |
jreVersion=14 |
# first stable version of jpackage |
jpackageVersion=16 |
jpackageType.mac=dmg |
modules=java.base,java.compiler,java.datatransfer,java.desktop,java.instrument,java.logging,java.management,java.prefs,\ |
java.scripting,java.security.jgss,java.security.sasl,java.sql,java.xml,\ |
jdk.jdwp.agent,jdk.crypto.ec,jdk.scripting.nashorn,jdk.localedata |
javaOptions=-DredirectToFile=true -Dfwk_sql.debug.undefined_id=true -Dfile.encoding=UTF-8 -Xms100M -Xmx768M |
/trunk/OpenConcerto/lib/OGNL-3.3.2.ILM.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/OGNL-3.3.2.ILM.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/lib/jOpenDocument-1.4rc2.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Labels/57x32.zpl |
---|
New file |
0,0 → 1,36 |
^XA |
^CI28 |
^FX HT |
^CF0,24 |
^FO490,20,1^FD${product.price}^FS |
^CF0,20 |
^FO490,45,1^FD€ HT^FS |
^FX TTC |
^CF0,24 |
^FO490,70,1^FD${product.pricewithtax}^FS |
^CF0,20 |
^FO490,95,1^FD€ TTC^FS |
^FX Code |
^CF0,28 |
^FO20,126^FB 380,3,0,L,0^FD${product.code}^FS |
^FX Designation |
^CF0,24 |
^FO20,155^FB480,1,0,L,0^FD${product.name}^FS |
^FX Couleur |
^CF0,18 |
^FO20,185^FDCouleur : ${product.color}^FS |
^FX Taille |
^CF0,18 |
^FO310,185^FDTaille : ${product.size}^FS |
^FX EAN |
^BY3,2,75 |
^FO54,15^BEN,75,Y,N^FD${product.ean13}^FS |
^XZ |
/trunk/OpenConcerto/Configuration/Template/Labels/50x50.zpl |
---|
New file |
0,0 → 1,24 |
^XA |
^CI28 |
^FX Designation |
^CF0,24 |
^FO20,50^FB 380,3,0,L,0^FD${product.name}^FS |
^FX Traitement |
^CF0,22 |
^FO20,140^FDTraitement : ${product.treatment}^FS |
^FX Origine |
^CF0,22 |
^FO20,170^FDOrigine : ${product.origin}^FS |
^FX Numero de lot |
^CF0,22 |
^FO20,200^FDN° de lot : ${product.batch}^FS |
^FX EAN |
^BY3,2,90 |
^FO60,250^BEN,80,Y,N^FD${product.ean13}^FS |
^XZ |
/trunk/OpenConcerto/Configuration/Template/Default/LivrePaye.odsp |
---|
2,8 → 2,8 |
<spliteveryrow> |
<sheet number="0">67</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
<offset x="0" y ="0"/> |
<resize percent="100"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/EtatStockInventaire.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/FichePayeSimplifiee.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatRapprochement.xml |
---|
New file |
0,0 → 1,45 |
<?xml version="1.0" encoding="UTF-8" ?> |
<contentDocument> |
<element0 location="A1" type="Value" ValueName="SOCIETE"> |
</element0> |
<element0 location="F1" type="Value" ValueName="DATE_EDITION"> |
</element0> |
<element0 location="A3" type="Value" ValueName="TITRE"> |
</element0> |
<table0 firstLine="6" endLine="60" endPageLine="60" lastColumn="G" base="Societe" table="ECRITURE" pageRef="F3"> |
<element location="A" type="fill" > |
<field base="Societe" name="DATE"/> |
</element> |
<element location="B" type="fill" > |
<field base="Societe" name="CODE_JOURNAL"/> |
</element> |
<element location="C" type="fill" > |
<field base="Societe" name="PIECE"/> |
</element> |
<element location="D" type="fill" maxChar="60" > |
<field base="Societe" name="NOM"/> |
</element> |
<element location="E" type="fill"> |
<field base="Societe" name="DEBIT"/> |
</element> |
<element location="F" type="fill"> |
<field base="Societe" name="CREDIT"/> |
</element> |
<element location="G" type="fill"> |
<field base="Societe" name="SOLDE"/> |
</element> |
</table0> |
</contentDocument> |
/trunk/OpenConcerto/Configuration/Template/Default/RepartitionAnalytique.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatStockInventaire.xml |
---|
3,7 → 3,7 |
<!-- <element location="A3" type="Value" ValueName="DATE"> |
</element> |
--> |
<table firstLine="2" endLine="17000" endPageLine="25000" lastColumn="E" table="SAISIE_VENTE_FACTURE"> |
<table firstLine="2" endLine="-1" endPageLine="25000" lastColumn="E" table="SAISIE_VENTE_FACTURE"> |
<element location="A" type="fill"> |
<field name="FAMILLE" /> |
28,6 → 28,10 |
<element location="F" type="fill"> |
<field name="QTE" /> |
</element> |
<element location="H" type="fill"> |
<field name="DEPOT" /> |
</element> |
</table> |
</contentDocument> |
/trunk/OpenConcerto/Configuration/Template/Default/RepartitionAnalytique.odsp |
---|
1,9 → 1,7 |
<odsp> |
<spliteveryrow> |
<sheet number="0">68</sheet> |
<sheet number="0">69</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
<offset x="0" y ="0"/> |
<resize percent="100"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/FichePayeSimplifiee.xml |
---|
13,11 → 13,11 |
</field> |
</element> |
<element location="D7" type="fill"> |
<element location="C7" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUMERO_URSSAF" /> |
</element> |
<element location="G7" type="fill"> |
<element location="F7" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" /> |
</element> |
114,10 → 114,10 |
<field name="DETAILS_CONGES" /> |
</element> |
<element location="H52" type="fill"> |
<element location="G52" type="fill"> |
<field name="COT_SAL" /> |
</element> |
<element location="I52" type="fill"> |
<element location="H52" type="fill"> |
<field name="COT_PAT" /> |
</element> |
/trunk/OpenConcerto/Configuration/Template/Default/EtatVentes.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/LivrePaye.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatChargesPaye.odsp |
---|
New file |
0,0 → 1,9 |
<odsp> |
<spliteveryrow> |
<sheet number="0">68</sheet> |
</spliteveryrow> |
<offset x="0" y ="0"/> |
<resize percent="100"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/EtatRapprochement.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatRapprochement.ods |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/Configuration/Template/Default/EtatRapprochement.odsp |
---|
New file |
0,0 → 1,9 |
<odsp> |
<spliteveryrow> |
<sheet number="0">60</sheet> |
</spliteveryrow> |
<offset x="0" y ="0"/> |
<resize percent="100"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/RepartitionAnalytique.xml |
---|
27,6 → 27,10 |
<element location="C" type="fill"> |
<field name="POSTE_NOM" /> |
</element> |
<element location="D" type="fill"> |
<field name="CLASSE" /> |
</element> |
<element location="E" type="fill"> |
/trunk/OpenConcerto/src/org/jopendocument/link/OOConnexion.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
27,6 → 27,7 |
import java.net.URLClassLoader; |
import java.security.CodeSource; |
import java.security.PermissionCollection; |
import java.util.Collections; |
import java.util.List; |
import java.util.Map; |
import java.util.PropertyPermission; |
54,7 → 55,8 |
} |
static private final URL[] getURLs(final OOInstallation ooInstall) { |
final List<URL> res = ooInstall.getURLs(CollectionUtils.createSet("ridl.jar", "jurt.jar", "juh.jar", "unoil.jar")); |
final List<URL> from_v7 = ooInstall.getURLs(Collections.singleton("libreoffice.jar")); |
final List<URL> res = from_v7.isEmpty() ? ooInstall.getURLs(CollectionUtils.createSet("ridl.jar", "jurt.jar", "juh.jar", "unoil.jar")) : from_v7; |
return res.toArray(new URL[res.size()]); |
} |
/trunk/OpenConcerto/src/org/jopendocument/link/OOInstallation.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/jopendocument/link/Component.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/map/ui/VilleListModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
16,6 → 16,7 |
import org.openconcerto.map.model.Ville; |
import org.openconcerto.utils.model.IMutableListModel; |
import java.util.Collection; |
import java.util.List; |
import javax.swing.AbstractListModel; |
61,6 → 62,11 |
} |
@Override |
public void addAll(Collection<? extends Ville> items) { |
Ville.addVilles(items); |
} |
@Override |
public void remove(Ville v) { |
Ville.removeVille(v); |
} |
/trunk/OpenConcerto/src/org/openconcerto/map/ui/VilleEditorPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
113,4 → 113,13 |
((Window) c).dispose(); |
} |
} |
public JTextField getTextCodePostal() { |
return textCodePostal; |
} |
public JTextField getTextVille() { |
return textVille; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/map/model/Ville.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
26,6 → 26,7 |
import java.io.IOException; |
import java.io.InputStreamReader; |
import java.util.ArrayList; |
import java.util.Collection; |
import java.util.Collections; |
import java.util.Comparator; |
import java.util.HashMap; |
136,14 → 137,22 |
map.put(villeEtCode, v); |
} |
public static synchronized void addVille(final Ville v) { |
final String villeEtCode = v.getVilleEtCode(); |
if (map.containsKey(villeEtCode)) { |
return; |
public static void addVille(final Ville v) { |
addVilles(Collections.singleton(v)); |
} |
public static synchronized void addVilles(final Collection<? extends Ville> items) { |
boolean modified = false; |
for (final Ville v : items) { |
final String villeEtCode = v.getVilleEtCode(); |
if (!map.containsKey(villeEtCode)) { |
addVilleSilently(v); |
accessor.store(v); |
modified = true; |
} |
} |
addVilleSilently(v); |
accessor.store(v); |
fireListModified(); |
if (modified) |
fireListModified(); |
} |
public static synchronized void removeVille(final Ville v) { |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ODPackageEntry.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ImmutableDocStyledNode.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ODDocument.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/FixTimeZone.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ChildCreator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/Library.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/OOHandGeneratedXMLDocument.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/FixXML.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/StyledNode.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/StatusHelper.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/GenerationCommon.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/OOGenerator.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/DocumentGenerator.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/TaskStatus.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/ReportGeneration.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/StatusListener.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/GenerationTask.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/generator/ExtractGenerator.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/generator/ManualGenerator.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/view/GenerationTaskView.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/view/BaseGenerationRapport.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/desc/ReportType.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/desc/XMLItem.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/desc/ReportTypes.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/desc/ReportPart.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/desc/ParamsHelper.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/desc/ReportDefine.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/desc/part/ForkReportPart.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/desc/part/InsertReportPart.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/desc/part/GeneratorReportPart.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/desc/part/ConditionalPart.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/desc/part/SubReportPart.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/desc/part/CaseReportPart.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ODFrame.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/StyleProperties.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/StyleStyleDesc.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ODEpoch.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/LengthUnit.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/StyleStyle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/EventListener.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/Range.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/Column.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/CellStyle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/SheetTableModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/TableGroup.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/Axis.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/RepeatedRange.java |
---|
New file |
0,0 → 1,102 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.openoffice.spreadsheet; |
import org.openconcerto.openoffice.ODNode; |
import java.util.List; |
import java.util.Objects; |
import org.jdom.Element; |
public final class RepeatedRange { |
static RepeatedRange create(final List<? extends ODNode> children, final int col, final String attrName) { |
final ODNode c = children.get(col); |
final Element element = c.getElement(); |
final String repeatedS = element.getAttributeValue(attrName, element.getNamespace()); |
final int firstIndex, lastIndex; |
if (repeatedS == null) { |
firstIndex = col; |
lastIndex = col; |
} else { |
final int repeated = Integer.parseInt(repeatedS); |
// since for repeated elements, the same instance is at multiple index |
firstIndex = children.indexOf(c); |
lastIndex = firstIndex + repeated - 1; |
assert children.get(lastIndex) == c; |
} |
final int indexOfElement = element.getParent().indexOf(element); |
return new RepeatedRange(indexOfElement, firstIndex, lastIndex); |
} |
static public final RepeatedRange createSingle(final int indexOfElement, final int logicalIndex) { |
return new RepeatedRange(indexOfElement, logicalIndex, logicalIndex); |
} |
private final int firstIndex, lastIndex; |
// not the same as firstIndex as they're can be repeated elements before |
private final int indexOfElement; |
public RepeatedRange(int indexOfElement, int firstIndex, int lastIndex) { |
super(); |
if (firstIndex < 0 || lastIndex < 0 || indexOfElement < 0) |
throw new IllegalArgumentException("Negative index"); |
if (firstIndex > lastIndex) |
throw new IllegalArgumentException("Invalid indexes : " + firstIndex + " > " + lastIndex); |
this.firstIndex = firstIndex; |
this.lastIndex = lastIndex; |
this.indexOfElement = indexOfElement; |
} |
public final int getFirstIndex() { |
return this.firstIndex; |
} |
public final int getLastIndex() { |
return this.lastIndex; |
} |
public final int getRepeated() { |
return this.getLastIndex() - this.getFirstIndex() + 1; |
} |
public final int getIndexOfElement() { |
return this.indexOfElement; |
} |
@Override |
public int hashCode() { |
return Objects.hash(this.firstIndex, this.indexOfElement, this.lastIndex); |
} |
@Override |
public boolean equals(Object obj) { |
if (this == obj) |
return true; |
if (obj == null) |
return false; |
if (getClass() != obj.getClass()) |
return false; |
final RepeatedRange other = (RepeatedRange) obj; |
return this.firstIndex == other.firstIndex && this.indexOfElement == other.indexOfElement && this.lastIndex == other.lastIndex; |
} |
@Override |
public String toString() { |
return this.getClass().getSimpleName() + " XML #" + this.getIndexOfElement() + " [" + this.getFirstIndex() + ',' + this.getLastIndex() + "]"; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/SpreadSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/Row.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
17,13 → 17,17 |
package org.openconcerto.openoffice.spreadsheet; |
import org.openconcerto.openoffice.ODDocument; |
import org.openconcerto.openoffice.ODNode; |
import org.openconcerto.openoffice.StyleDesc; |
import org.openconcerto.openoffice.StyleProperties; |
import org.openconcerto.openoffice.StyleStyleDesc; |
import org.openconcerto.openoffice.XMLVersion; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.List; |
import java.util.function.Consumer; |
import java.util.function.IntFunction; |
import java.util.function.ToIntFunction; |
import org.jdom.Element; |
105,9 → 109,8 |
} |
private void addCellElem(final Element cellElem, StyleDesc<CellStyle> cellStyleDesc) { |
final Cell<D> cell = new Cell<D>(this, cellElem, cellStyleDesc); |
final String repeatedS = cellElem.getAttributeValue("number-columns-repeated", this.getTABLE()); |
final int toRepeat = StyleProperties.parseInt(repeatedS, 1); |
final int toRepeat = RepeatedBreaker.getCellBreaker().getRepeated(cellElem); |
final Cell<D> cell = this.createCell(cellElem, cellStyleDesc, toRepeat == 1); |
final int stop = this.cellCount + toRepeat; |
for (int i = this.cellCount; i < stop; i++) { |
this.cells[i] = cell; |
115,6 → 118,10 |
this.cellCount = stop; |
} |
final Cell<D> createCell(final Element cellElem, StyleDesc<CellStyle> cellStyleDesc, final boolean single) { |
return single ? new MutableCell<>(this, cellElem, cellStyleDesc) : new Cell<>(this, cellElem, cellStyleDesc); |
} |
/** |
* All cells of this row. |
* |
134,6 → 141,24 |
return Arrays.asList(this.cells); |
} |
protected final List<RepeatedRange> getCellRepeatedRanges() { |
return getRepeatedRanges(this.getCellElements(), RepeatedBreaker.getCellBreaker()::getRepeated, this.getCellCount()); |
} |
static protected final <E> List<RepeatedRange> getRepeatedRanges(final List<E> cellElements, final ToIntFunction<E> getRepeated, final int expectedLogicalCount) { |
final int elemCount = cellElements.size(); |
final List<RepeatedRange> res = new ArrayList<>(elemCount); |
int logicalIndex = 0; |
for (int i = 0; i < elemCount; i++) { |
final E cellElem = cellElements.get(i); |
final int repeated = getRepeated.applyAsInt(cellElem); |
res.add(new RepeatedRange(i, logicalIndex, logicalIndex + repeated - 1)); |
logicalIndex += repeated; |
} |
assert res.get(res.size() - 1).getLastIndex() + 1 == expectedLogicalCount : "Expected " + expectedLogicalCount; |
return res; |
} |
protected final Cell<D> getCellAt(int col) { |
return this.cells[col]; |
} |
145,12 → 170,43 |
return c; |
} |
public final MutableCell<D> getMutableCellAt(final int col) { |
final MutableCell<D> getMutableCellAt(final int col) { |
return this.getMutableCellsAt(1, col).get(0); |
} |
final MutableCell<D> getExistingMutableCell(int col) { |
final Cell<D> c = this.getValidCellAt(col); |
if (!(c instanceof MutableCell)) { |
RepeatedBreaker.<D> getCellBreaker().breakRepeated(this, getCellsAsList(), col); |
return c instanceof MutableCell ? (MutableCell<D>) c : null; |
} |
// not public because it doesn't check if this row is repeated |
final List<MutableCell<D>> getMutableCellsAt(final int count, final int col) { |
return Row.getMutableChildrenAt(count, col, this::getExistingMutableCell, RepeatedBreaker.<D> getCellBreaker(), this, this.getCellsAsList(), null); |
} |
static protected final <P, C extends ODNode, M extends C> List<M> getMutableChildrenAt(final int count, final int col, final IntFunction<M> asMutable, final RepeatedBreaker<P, C> breaker, |
final P parent, final List<C> children, final Consumer<? super C> elementModifier) { |
final List<M> res = new ArrayList<>(count); |
for (int i = 0; i < count;) { |
final M c = asMutable.apply(col + i); |
if (c != null) { |
if (elementModifier != null) |
elementModifier.accept(c); |
res.add(c); |
i++; |
} else { |
final int broken = breaker.breakRepeated(parent, children, col + i, false, count - i, elementModifier); |
for (int j = 0; j < broken; j++) { |
final M mutableChild = asMutable.apply(col + i + j); |
if (mutableChild == null) |
throw new IllegalArgumentException("Break repeated failed"); |
res.add(mutableChild); |
} |
i += broken; |
} |
} |
return (MutableCell<D>) this.getValidCellAt(col); |
assert res.size() == count; |
return res; |
} |
// rempli cette ligne avec autant de cellules vides qu'il faut |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/TableStyle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/Sheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/Lines.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/ColumnStyle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/Cell.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/TableCalcNode.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/RepeatedBreaker.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
15,8 → 15,11 |
import org.openconcerto.openoffice.ODDocument; |
import org.openconcerto.openoffice.ODNode; |
import org.openconcerto.openoffice.StyleProperties; |
import org.openconcerto.utils.ExceptionUtils; |
import java.util.List; |
import java.util.function.Consumer; |
import org.jdom.Element; |
39,7 → 42,7 |
} |
<D extends ODDocument> Cell<D> createD(Element elem, Row<D> parent, int index, boolean single) { |
return single ? new MutableCell<D>(parent, elem, parent.getSheet().getCellStyleDesc()) : new Cell<D>(parent, elem, parent.getSheet().getCellStyleDesc()); |
return parent.createCell(elem, parent.getSheet().getCellStyleDesc(), single); |
} |
}; |
71,42 → 74,82 |
this.attrName = attrName; |
} |
public final String getAttributeName() { |
return this.attrName; |
} |
public final int getRepeated(final Element elem) { |
final String repeatedS = elem.getAttributeValue(this.getAttributeName(), elem.getNamespace()); |
return StyleProperties.parseInt(repeatedS, 1); |
} |
abstract C create(final Element elem, final P parent, final int index, final boolean single); |
public final void breakRepeated(final P parent, final List<C> children, final int col) { |
this.breakRepeated(parent, children, col, true, 1, null); |
} |
public final int breakRepeated(final P parent, final List<C> children, final int col, final boolean absoluteOrMax, int count, final Consumer<? super C> elementModifier) { |
if (count == 0) |
throw new IllegalArgumentException("Zero count : " + count); |
final C c = children.get(col); |
final Element element = c.getElement(); |
final String repeatedS = element.getAttributeValue(this.attrName, element.getNamespace()); |
if (repeatedS != null) { |
final int repeated = Integer.parseInt(repeatedS); |
// since for repeated elements, the same instance is at multiple index |
final int firstIndex = children.indexOf(c); |
final int lastIndex = firstIndex + repeated - 1; |
assert children.get(lastIndex) == c; |
// not the same as firstIndex as they're can be repeated elements before |
final int indexOfElement = element.getParent().indexOf(element); |
final RepeatedRange repState = RepeatedRange.create(children, col, this.getAttributeName()); |
final int preRepeated = col - firstIndex; |
final int postRepeated = lastIndex - col; |
final int firstIndex = repState.getFirstIndex(); |
final int lastIndex = repState.getLastIndex(); |
int indexOfElement = repState.getIndexOfElement(); |
// start from the end to avoid changing indexOfElement |
breakRepeated(parent, children, element, indexOfElement, col + 1, postRepeated, false); |
element.removeAttribute(this.attrName, element.getNamespace()); |
breakRepeated(parent, children, element, indexOfElement, firstIndex, preRepeated, true); |
final int initialCountFromCol = lastIndex - col + 1; |
if (count < 0) |
count = initialCountFromCol; |
else if (!absoluteOrMax) |
count = Math.min(count, initialCountFromCol); |
else if (count > initialCountFromCol) |
throw new IllegalArgumentException("Not enough repeated to break : " + count + " > " + initialCountFromCol); |
assert count >= 1; |
final int lastCol = col + count - 1; |
ExceptionUtils.requireSame(c, children.get(lastCol), "Not same repeated cell"); |
final int preRepeated = col - firstIndex; |
final int postRepeated = lastIndex - lastCol; |
// start from the end to avoid changing indexOfElement |
breakRepeated(parent, children, element, indexOfElement, lastCol + 1, postRepeated, false); |
// clone element for preRepeated before changing it |
if (breakRepeated(parent, children, element, indexOfElement, firstIndex, preRepeated, true)) |
indexOfElement++; |
assert element.getParent().getContent(indexOfElement) == element; |
element.removeAttribute(this.getAttributeName(), element.getNamespace()); |
// modify element then call this.create() to create new ODNode |
if (elementModifier != null) |
elementModifier.accept(c); |
children.set(col, this.create(element, parent, col, true)); |
for (int i = 1; i < count; i++) { |
final int index = col + i; |
children.set(index, this.create(cloneChild(element, indexOfElement + i), parent, index, true)); |
} |
children.set(col, this.create(element, parent, col, true)); |
return count; |
} |
private final void breakRepeated(final P parent, final List<C> children, Element element, final int indexOfElement, int firstIndex, int repeat, boolean before) { |
if (repeat > 0) { |
final Element newElem = (Element) element.clone(); |
private final boolean breakRepeated(final P parent, final List<C> children, Element element, final int indexOfElement, int firstIndex, int repeat, boolean before) { |
final boolean res = repeat > 0; |
if (res) { |
assert element.getParent().getContent(indexOfElement) == element; |
element.getParentElement().addContent(indexOfElement + (before ? 0 : 1), newElem); |
setRepeated(newElem, this.attrName, repeat); |
final Element newElem = cloneChild(element, indexOfElement + (before ? 0 : 1)); |
setRepeated(newElem, this.getAttributeName(), repeat); |
final C preCell = this.create(newElem, parent, firstIndex, false); |
for (int i = 0; i < repeat; i++) { |
children.set(firstIndex + i, preCell); |
} |
} |
return res; |
} |
private Element cloneChild(final Element element, final int addIndex) { |
final Element newElem = (Element) element.clone(); |
element.getParentElement().addContent(addIndex, newElem); |
return newElem; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/Table.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
30,11 → 30,13 |
import java.awt.Point; |
import java.util.ArrayList; |
import java.util.Collections; |
import java.util.HashMap; |
import java.util.HashSet; |
import java.util.List; |
import java.util.Map; |
import java.util.Set; |
import java.util.function.Consumer; |
import java.util.regex.Matcher; |
import javax.swing.table.TableModel; |
392,9 → 394,7 |
private synchronized void addRow(Element child, StyleDesc<RowStyle> styleDesc, StyleDesc<CellStyle> cellStyleDesc) { |
final Row<D> row = new Row<D>(this, child, this.rows.size(), styleDesc, cellStyleDesc); |
final int toRepeat = row.getRepeated(); |
for (int i = 0; i < toRepeat; i++) { |
this.rows.add(row); |
} |
this.rows.addAll(Collections.nCopies(toRepeat, row)); |
} |
public final Point resolveHint(String ref) { |
407,6 → 407,10 |
// *** set cell |
public final List<RepeatedRange> getCellRepeatedRanges(int y) { |
return this.getRow(y).getCellRepeatedRanges(); |
} |
public final boolean isCellValid(int x, int y) { |
if (x > this.getColumnCount()) |
return false; |
419,19 → 423,36 |
/** |
* Return a modifiable cell at the passed coordinates. This is slower than |
* {@link #getImmutableCellAt(int, int)} since this method may modify the underlying XML (e.g. |
* break up repeated cells to allow for modification of only the returned cell). |
* break up repeated cells to allow for modification of only the returned cell). If multiple |
* cells needs to be changed, {@link #getCellsAt(int, int, int)} is faster. |
* |
* @param x the column. |
* @param y the row. |
* @return the cell. |
* @see #getImmutableCellAt(int, int) |
* @see #getCellsAt(int, int, int) |
*/ |
public final MutableCell<D> getCellAt(int x, int y) { |
final Row<D> r = this.getMutableRow(y); |
return this.getCellsAt(1, x, y).get(0); |
} |
/** |
* Return modifiable cells at the passed coordinates. This is slower than |
* {@link #getImmutableCellAt(int, int)} since this method may modify the underlying XML (e.g. |
* break up repeated cells to allow for modification of only the returned cells). |
* |
* @param count number of mutable cells to return. |
* @param x the column. |
* @param y the row. |
* @return the cells. |
*/ |
public final List<MutableCell<D>> getCellsAt(int count, int x, int y) { |
try { |
return r.getMutableCellAt(x); |
// It's more efficient to break both row and cells here |
final Row<D> r = this.getMutableRowsAt(1, y, count, x).get(0); |
// Just cast |
return r.getMutableCellsAt(count, x); |
} catch (Exception e) { |
throw new IllegalArgumentException("Couldn't get mutable cell at " + getAddress(x, y), e); |
throw new IllegalArgumentException("Couldn't get " + count + " mutable cell(s) at " + getAddress(x, y), e); |
} |
} |
439,7 → 460,7 |
return this.getCellAt(resolveHint(ref)); |
} |
final MutableCell<D> getCellAt(Point p) { |
public final MutableCell<D> getCellAt(Point p) { |
return this.getCellAt(p.x, p.y); |
} |
636,6 → 657,21 |
// *** get count |
protected final void foreachPhysicalRow(final Consumer<Row<D>> cons) { |
final int rowCount = this.getRowCount(); |
for (int i = 0; i < rowCount;) { |
final Row<D> row = this.getRow(i); |
cons.accept(row); |
i += row.getRepeated(); |
} |
} |
protected final List<RepeatedRange> getRowRepeatedRanges() { |
final List<Row<D>> distinctRows = new ArrayList<>(); |
this.foreachPhysicalRow(distinctRows::add); |
return Row.getRepeatedRanges(distinctRows, Row::getRepeated, this.getRowCount()); |
} |
// not public since Row represent the physical (XML) row, i.e. it can represent many logical |
// rows. Ideally two classes should be created (as Cell/MutableCell), but this would only be |
// useful for changing style (e.g. setHeight()). |
645,15 → 681,33 |
} |
final Row<D> getMutableRow(int y) { |
return this.getMutableRowsAt(1, y).get(0); |
} |
final Row<D> getExistingMutableRow(int y) { |
final Row<D> c = this.getRow(y); |
if (c.getRepeated() > 1) { |
RepeatedBreaker.<D> getRowBreaker().breakRepeated(this, this.rows, y); |
return this.getRow(y); |
} else { |
return c; |
} |
return c.getRepeated() > 1 ? null : c; |
} |
final List<Row<D>> getMutableRowsAt(int count, int y) { |
return this.getMutableRowsAt(count, y, -1, -1); |
} |
/** |
* Break repeated rows and cells if needed. |
* |
* @param count the number of mutable rows desired. |
* @param y the first row index to return. |
* @param cellsCount the number of mutable cells desired. |
* @param x the first cell index to break, negative to ignore. |
* @return the list of mutable rows, optionally with mutable cells. |
*/ |
final List<Row<D>> getMutableRowsAt(int count, int y, final int cellsCount, final int x) { |
return Row.getMutableChildrenAt(count, y, this::getExistingMutableRow, RepeatedBreaker.<D> getRowBreaker(), this, this.rows, x < 0 ? null : (row) -> { |
row.getMutableCellsAt(cellsCount, x); |
}); |
} |
// OK to use immutable row since for now RowStyle has no setter (except for raw methods in super |
// classes) |
public final RowStyle getRowStyle(int index) { |
984,6 → 1038,13 |
* @param rowIndex the index of the row to be copied, -1 for empty row (i.e. default style). |
*/ |
public final void setRowCount(int newSize, int rowIndex) { |
// Usually if one calls setRowCount() it is because more rows are needed, i.e. cells will be |
// filled. So don't useRowsRepeated by default, because though this method will quite quick |
// the subsequent getMutableRow() will be slow. |
this.setRowCount(newSize, rowIndex, false); |
} |
public final void setRowCount(int newSize, int rowIndex, final boolean useRowsRepeated) { |
final int toGrow = newSize - this.getRowCount(); |
if (toGrow < 0) { |
setCount(Axis.ROW, newSize); |
996,10 → 1057,22 |
} else { |
elemToClone = (Element) getRow(rowIndex).getElement().clone(); |
} |
Axis.ROW.setRepeated(elemToClone, toGrow); |
// as per section 8.1.1 rows are the last elements inside a table |
this.getElement().addContent(elemToClone); |
addRow(elemToClone, getRowStyleDesc(), getCellStyleDesc()); |
final StyleStyleDesc<RowStyle> rowStyleDesc = getRowStyleDesc(); |
final StyleStyleDesc<CellStyle> cellStyleDesc = getCellStyleDesc(); |
if (useRowsRepeated) { |
Axis.ROW.setRepeated(elemToClone, toGrow); |
// as per section 8.1.1 rows are the last elements inside a table |
this.getElement().addContent(elemToClone); |
addRow(elemToClone, rowStyleDesc, cellStyleDesc); |
} else { |
Axis.ROW.setRepeated(elemToClone, 1); |
for (int i = 0; i < toGrow; i++) { |
final Element newElem = (Element) elemToClone.clone(); |
// as per section 8.1.1 rows are the last elements inside a table |
this.getElement().addContent(newElem); |
addRow(newElem, rowStyleDesc, cellStyleDesc); |
} |
} |
} |
} |
1092,7 → 1165,16 |
return new SheetTableModel<D>(this, row, column, lastRow, lastCol); |
} |
// don't break as the caller might only change a few cells |
private static final boolean DEFAULT_TABLEMODEL_BREAK_REPEATED = false; |
public final MutableTableModel<D> getMutableTableModel(final int column, final int row) { |
return this.getMutableTableModel(column, row, DEFAULT_TABLEMODEL_BREAK_REPEATED); |
} |
public final MutableTableModel<D> getMutableTableModel(final int column, final int row, final boolean breakRowRepeated) { |
if (breakRowRepeated) |
this.getMutableRowsAt(this.getRowCount() - row, row, this.getColumnCount() - column, column); |
return new MutableTableModel<D>(this, row, column); |
} |
1104,7 → 1186,13 |
* @return the table. |
*/ |
public final MutableTableModel<D> getMutableTableModel(final Point start, final Point end) { |
return this.getMutableTableModel(start, end, DEFAULT_TABLEMODEL_BREAK_REPEATED); |
} |
public final MutableTableModel<D> getMutableTableModel(final Point start, final Point end, final boolean breakRowRepeated) { |
// +1 since exclusive |
if (breakRowRepeated) |
this.getMutableRowsAt(end.y - start.y + 1, start.y, end.x - start.x + 1, start.x); |
return new MutableTableModel<D>(this, start.y, start.x, end.y + 1, end.x + 1); |
} |
1121,11 → 1209,16 |
* @param includeColNames if <code>true</code> the column names of t will also be merged. |
*/ |
public final void merge(TableModel t, final int column, final int row, final boolean includeColNames) { |
final int endColumn = column + t.getColumnCount(); |
final int offset = (includeColNames ? 1 : 0); |
final int endRow = row + offset + t.getRowCount(); |
if (column == endColumn || row == endRow) |
return; |
// the columns must be first, see section 8.1.1 of v1.1 |
this.ensureColumnCount(column + t.getColumnCount()); |
this.ensureRowCount(row + t.getRowCount() + offset); |
final TableModel thisModel = this.getMutableTableModel(column, row); |
this.ensureColumnCount(endColumn); |
this.ensureRowCount(endRow); |
// -1 since inclusive |
final TableModel thisModel = this.getMutableTableModel(new Point(column, row), new Point(endColumn - 1, endRow - 1), true); |
if (includeColNames) { |
for (int x = 0; x < t.getColumnCount(); x++) { |
thisModel.setValueAt(t.getColumnName(x), 0, x); |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/RowStyle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/MutableCell.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/spreadsheet/BytesProducer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/Grep.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/GraphicStyle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/OOUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/OOXML.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/StyleDesc.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ODNodeDescRegistry.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/Style.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ODValueType.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/DateConfig.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/text/TextDocument.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/text/Paragraph.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/text/TextStyle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/text/ParagraphStyle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/text/TextNodeDesc.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/text/TextNode.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/text/Heading.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/text/Span.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/Manifest.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ODNodeDesc.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/GrepFrame.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/Diff.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ODNode.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ODMeta.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ContentType.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ODPackage.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/XMLFormatVersion.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/style/SideStyleProperties.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/style/RelationalOperator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/style/data/TextStyle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/style/data/NumberStyle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/style/data/CurrencyStyle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
57,7 → 57,7 |
} else if (elem.getName().equals("number")) { |
// ATTN OpenOffice Fix (it generates <text>-</text>, so we have to use the |
// absolute value) |
final int multiplier = n.doubleValue() > 0 ? 1 : -1; |
final int multiplier = n.doubleValue() >= 0D ? 1 : -1; |
sb.append(formatNumberOrScientificNumber(elem, n, multiplier, defaultStyle, lenient)); |
} else if (elem.getName().equals("currency-symbol")) { |
if (elem.getTextTrim().length() > 0) { |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/style/data/DateStyle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
18,6 → 18,7 |
import org.openconcerto.openoffice.StyleProperties; |
import org.openconcerto.openoffice.XMLVersion; |
import org.openconcerto.openoffice.spreadsheet.CellStyle; |
import org.openconcerto.utils.CollectionUtils; |
import org.openconcerto.utils.convertor.NumberConvertor; |
import java.math.BigDecimal; |
24,19 → 25,31 |
import java.text.DecimalFormat; |
import java.text.DecimalFormatSymbols; |
import java.text.SimpleDateFormat; |
import java.util.ArrayList; |
import java.util.Calendar; |
import java.util.Date; |
import java.util.GregorianCalendar; |
import java.util.List; |
import java.util.Locale; |
import java.util.SortedMap; |
import java.util.TreeMap; |
import java.util.function.Consumer; |
import org.jdom.Attribute; |
import org.jdom.Element; |
import org.jdom.Namespace; |
import com.ibm.icu.text.DateTimePatternGenerator; |
// from section 16.27.10 in v1.2-cs01-part1 |
public class DateStyle extends DataStyle { |
private static final String AUTOMATIC_ORDER_ATTRNAME = "automatic-order"; |
private static final String FORMAT_SOURCE_ATTRNAME = "format-source"; |
private static final String FORMAT_SOURCE_FIXED = "fixed"; |
private static final String FORMAT_SOURCE_LANG = "language"; |
// see http://download.oracle.com/javase/6/docs/technotes/guides/intl/calendar.doc.html |
private static final Calendar BUDDHIST_CAL = Calendar.getInstance(new Locale("th", "TH")); |
private static final Calendar JAPANESE_CAL = Calendar.getInstance(new Locale("ja", "JP", "JP")); |
54,6 → 67,14 |
return !"long".equals(elem.getAttributeValue("style", elem.getNamespace("number"))); |
} |
// with LO 6.4 only year,month,day,day-of-week have variable length |
static final boolean isShort(final Element elem, final boolean fixed, final Locale locale) { |
if (fixed) |
return isShort(elem); |
else |
return Locale.US.equals(locale); |
} |
private static final Calendar getCalendar(final Element elem, Calendar defaultCal) { |
final Calendar res; |
final String cal = elem.getAttributeValue("calendar", elem.getNamespace()); |
98,8 → 119,70 |
return null; |
} |
private final void format(final StringBuilder res, final StringBuilder pattern, final Locale styleLocale, final Calendar currentCalendar, final Date d) { |
public final boolean isFormatSourceFixed() { |
return this.getElement().getAttributeValue(FORMAT_SOURCE_ATTRNAME, this.getElement().getNamespace(), FORMAT_SOURCE_FIXED).equals(FORMAT_SOURCE_FIXED); |
} |
final void setFormatSourceFixed(final boolean b) { |
if (b) { |
this.getElement().removeAttribute(FORMAT_SOURCE_ATTRNAME, this.getElement().getNamespace()); |
} else { |
this.getElement().setAttribute(FORMAT_SOURCE_ATTRNAME, FORMAT_SOURCE_LANG, this.getElement().getNamespace()); |
} |
} |
public final boolean isAutomaticOrder() { |
return StyleProperties.parseBoolean(this.getElement().getAttributeValue(AUTOMATIC_ORDER_ATTRNAME, this.getElement().getNamespace()), false); |
} |
final void setAutomaticOrder(final boolean b) { |
if (b) { |
this.getElement().setAttribute(AUTOMATIC_ORDER_ATTRNAME, Boolean.toString(b), this.getElement().getNamespace()); |
} else { |
this.getElement().removeAttribute(AUTOMATIC_ORDER_ATTRNAME, this.getElement().getNamespace()); |
} |
} |
private final void format(final StringBuilder res, final List<String> skeleton, final StringBuilder pattern, final Locale styleLocale, final boolean automaticOrder, final Calendar currentCalendar, |
final Date d) { |
if (pattern.length() > 0) { |
if (automaticOrder) { |
// ask ICU the preferred order for our skeleton, |
// then change order of components in our pattern (thus keeping literals) |
// e.g. [EEEE, dd, MM, yyyy] => "EEEE, MM dd yyyy" |
final String bestPattern = DateTimePatternGenerator.getInstance(styleLocale).getBestPattern(CollectionUtils.join(skeleton, ""), DateTimePatternGenerator.MATCH_ALL_FIELDS_LENGTH); |
final SortedMap<Integer, String> bestOrder = new TreeMap<>(); |
for (final String comp : skeleton) { |
final int indexOf = bestPattern.indexOf(comp); |
if (indexOf < 0) |
throw new IllegalStateException("Missing " + comp + " in best pattern : " + bestPattern); |
final String prev = bestOrder.put(indexOf, comp); |
if (prev != null) |
throw new IllegalStateException("Duplicate " + comp + " in best pattern : " + bestPattern); |
} |
assert bestOrder.size() == skeleton.size(); |
// e.g. [EEEE, MM, dd, yyyy] |
final List<String> reorderedSkeleton = new ArrayList<>(bestOrder.values()); |
int indexOfStart = 0; |
for (int i = 0; i < skeleton.size(); i++) { |
// e.g. "dd" |
final String comp = skeleton.get(i); |
final int reorderedIndex = reorderedSkeleton.indexOf(comp); |
assert reorderedIndex >= 0; |
if (i != reorderedIndex) { |
// e.g. "MM" |
final String compToSwap = reorderedSkeleton.get(i); |
// replace "dd" by "MM" |
final int indexOfComp = pattern.indexOf(comp, indexOfStart); |
pattern.replace(indexOfComp, indexOfComp + comp.length(), compToSwap); |
// avoid swapping back |
indexOfStart = indexOfComp + compToSwap.length(); |
} |
} |
} |
final SimpleDateFormat fmt = new SimpleDateFormat(pattern.toString(), styleLocale); |
pattern.setLength(0); |
fmt.setCalendar((Calendar) currentCalendar.clone()); |
111,13 → 194,22 |
public String format(Object o, CellStyle defaultStyle, boolean lenient) { |
final Date d = o instanceof Calendar ? ((Calendar) o).getTime() : (Date) o; |
final Namespace numberNS = this.getElement().getNamespace(); |
final boolean automaticOrder = this.isAutomaticOrder(); |
final boolean fixedLength = this.isFormatSourceFixed(); |
final Locale styleLocale = this.getLocale(); |
final Calendar styleCalendar = Calendar.getInstance(styleLocale); |
final StringBuilder res = new StringBuilder(); |
Calendar currentCalendar = styleCalendar; |
final List<String> skeleton = automaticOrder ? new ArrayList<>() : null; |
final StringBuilder sb = new StringBuilder(); |
final Consumer<String> addComp = (s) -> { |
sb.append(s); |
if (skeleton != null) |
skeleton.add(s); |
}; |
@SuppressWarnings("unchecked") |
final List<Element> children = this.getElement().getChildren(); |
for (final Element elem : children) { |
124,7 → 216,7 |
if (elem.getNamespace().equals(numberNS)) { |
final Calendar calendarLocaleElem = getCalendar(elem, styleCalendar); |
if (!calendarLocaleElem.equals(currentCalendar)) { |
format(res, sb, styleLocale, currentCalendar, d); |
format(res, skeleton, sb, styleLocale, automaticOrder, currentCalendar, d); |
currentCalendar = calendarLocaleElem; |
} |
131,9 → 223,9 |
if (elem.getName().equals("text")) { |
DataStyle.addStringLiteral(sb, elem.getText()); |
} else if (elem.getName().equals("era")) { |
sb.append(isShort(elem) ? "G" : "GGGG"); |
addComp.accept(isShort(elem) ? "G" : "GGGG"); |
} else if (elem.getName().equals("year")) { |
sb.append(isShort(elem) ? "yy" : "yyyy"); |
addComp.accept(isShort(elem, fixedLength, styleLocale) ? "yy" : "yyyy"); |
} else if (elem.getName().equals("quarter")) { |
final Calendar cal = (Calendar) currentCalendar.clone(); |
cal.setTime(d); |
148,28 → 240,28 |
if (possessive != null) |
reportError("Ignoring " + possessive, lenient); |
if (!StyleProperties.parseBoolean(elem.getAttributeValue("textual", numberNS), false)) |
sb.append(isShort(elem) ? "M" : "MM"); |
addComp.accept(isShort(elem, fixedLength, styleLocale) ? "M" : "MM"); |
else |
sb.append(isShort(elem) ? "MMM" : "MMMM"); |
addComp.accept(isShort(elem) ? "MMM" : "MMMM"); |
} else if (elem.getName().equals("week-of-year")) { |
sb.append("w"); |
addComp.accept("w"); |
} else if (elem.getName().equals("day")) { |
sb.append(isShort(elem) ? "d" : "dd"); |
addComp.accept(isShort(elem, fixedLength, styleLocale) ? "d" : "dd"); |
} else if (elem.getName().equals("day-of-week")) { |
sb.append(isShort(elem) ? "E" : "EEEE"); |
addComp.accept(isShort(elem, fixedLength, styleLocale) ? "E" : "EEEE"); |
} else if (elem.getName().equals("am-pm")) { |
sb.append("a"); |
addComp.accept("a"); |
} else if (elem.getName().equals("hours")) { |
// see 16.27.22 : If a <number:am-pm> element is contained in a date or time |
// style, hours are displayed using values from 1 to 12 only. |
if (getElement().getChild("am-pm", numberNS) == null) |
sb.append(isShort(elem) ? "H" : "HH"); |
addComp.accept(isShort(elem) ? "H" : "HH"); |
else |
sb.append(isShort(elem) ? "h" : "hh"); |
addComp.accept(isShort(elem) ? "h" : "hh"); |
} else if (elem.getName().equals("minutes")) { |
sb.append(isShort(elem) ? "m" : "mm"); |
addComp.accept(isShort(elem) ? "m" : "mm"); |
} else if (elem.getName().equals("seconds")) { |
sb.append(isShort(elem) ? "s" : "ss"); |
addComp.accept(isShort(elem) ? "s" : "ss"); |
final int decPlaces = StyleProperties.parseInt(elem.getAttributeValue("decimal-places", numberNS), 0); |
if (decPlaces > 0) { |
// use styleLocale since <seconds> hasn't @calendar |
183,7 → 275,7 |
} |
} |
} |
format(res, sb, styleLocale, currentCalendar, d); |
format(res, skeleton, sb, styleLocale, automaticOrder, currentCalendar, d); |
return res.toString(); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/style/data/TimeStyle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/style/data/BooleanStyle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/style/data/PercentStyle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/style/data/cellFormat.fods |
---|
1,20 → 1,20 |
<?xml version="1.0" encoding="UTF-8"?> |
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.spreadsheet"> |
<office:meta><meta:creation-date>2011-08-18T14:24:40.28</meta:creation-date><dc:date>2019-03-18T16:35:20.347078479</dc:date><meta:editing-duration>PT12H49M11S</meta:editing-duration><meta:editing-cycles>46</meta:editing-cycles><meta:generator>LibreOffice/6.0.7.3$Linux_X86_64 LibreOffice_project/00m0$Build-3</meta:generator><dc:description>20120330: changed locale of A1 to german</dc:description><meta:document-statistic meta:table-count="1" meta:cell-count="38" meta:object-count="0"/></office:meta> |
<office:document xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:ooo="http://openoffice.org/2004/office" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.spreadsheet"> |
<office:meta><meta:creation-date>2011-08-18T14:24:40.28</meta:creation-date><dc:date>2022-05-18T09:40:06.465556743</dc:date><meta:editing-duration>PT13H25M59S</meta:editing-duration><meta:editing-cycles>50</meta:editing-cycles><meta:generator>LibreOffice/6.4.7.2$Linux_X86_64 LibreOffice_project/40$Build-2</meta:generator><dc:description>20120330: changed locale of A1 to german</dc:description><meta:document-statistic meta:table-count="1" meta:cell-count="40" meta:object-count="0"/></office:meta> |
<office:settings> |
<config:config-item-set config:name="ooo:view-settings"> |
<config:config-item config:name="VisibleAreaTop" config:type="int">0</config:config-item> |
<config:config-item config:name="VisibleAreaLeft" config:type="int">0</config:config-item> |
<config:config-item config:name="VisibleAreaWidth" config:type="int">12671</config:config-item> |
<config:config-item config:name="VisibleAreaHeight" config:type="int">9203</config:config-item> |
<config:config-item config:name="VisibleAreaHeight" config:type="int">9556</config:config-item> |
<config:config-item-map-indexed config:name="Views"> |
<config:config-item-map-entry> |
<config:config-item config:name="ViewId" config:type="string">view1</config:config-item> |
<config:config-item-map-named config:name="Tables"> |
<config:config-item-map-entry config:name="Feuille1"> |
<config:config-item config:name="CursorPositionX" config:type="int">1</config:config-item> |
<config:config-item config:name="CursorPositionY" config:type="int">22</config:config-item> |
<config:config-item config:name="CursorPositionX" config:type="int">5</config:config-item> |
<config:config-item config:name="CursorPositionY" config:type="int">28</config:config-item> |
<config:config-item config:name="HorizontalSplitMode" config:type="short">0</config:config-item> |
<config:config-item config:name="VerticalSplitMode" config:type="short">0</config:config-item> |
<config:config-item config:name="HorizontalSplitPosition" config:type="int">0</config:config-item> |
32,7 → 32,7 |
</config:config-item-map-entry> |
</config:config-item-map-named> |
<config:config-item config:name="ActiveTable" config:type="string">Feuille1</config:config-item> |
<config:config-item config:name="HorizontalScrollbarWidth" config:type="int">1216</config:config-item> |
<config:config-item config:name="HorizontalScrollbarWidth" config:type="int">1218</config:config-item> |
<config:config-item config:name="ZoomType" config:type="short">0</config:config-item> |
<config:config-item config:name="ZoomValue" config:type="int">100</config:config-item> |
<config:config-item config:name="PageViewZoomValue" config:type="int">60</config:config-item> |
40,7 → 40,7 |
<config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item> |
<config:config-item config:name="ShowNotes" config:type="boolean">true</config:config-item> |
<config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item> |
<config:config-item config:name="GridColor" config:type="long">12632256</config:config-item> |
<config:config-item config:name="GridColor" config:type="int">12632256</config:config-item> |
<config:config-item config:name="ShowPageBreaks" config:type="boolean">true</config:config-item> |
<config:config-item config:name="HasColumnRowHeaders" config:type="boolean">true</config:config-item> |
<config:config-item config:name="HasSheetTabs" config:type="boolean">true</config:config-item> |
57,37 → 57,6 |
</config:config-item-map-entry> |
</config:config-item-map-indexed> |
</config:config-item-set> |
<config:config-item-set config:name="ooo:configuration-settings"> |
<config:config-item config:name="SyntaxStringRef" config:type="short">7</config:config-item> |
<config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item> |
<config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item> |
<config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item> |
<config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item> |
<config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item> |
<config:config-item config:name="PrinterSetup" config:type="base64Binary">kQH+/0dlbmVyaWMgUHJpbnRlcgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU0dFTlBSVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWAAMAsgAAAAAAAAAEAAhSAAAEdAAASm9iRGF0YSAxCnByaW50ZXI9R2VuZXJpYyBQcmludGVyCm9yaWVudGF0aW9uPVBvcnRyYWl0CmNvcGllcz0xCm1hcmdpbmRhanVzdG1lbnQ9MCwwLDAsMApjb2xvcmRlcHRoPTI0CnBzbGV2ZWw9MApwZGZkZXZpY2U9MApjb2xvcmRldmljZT0wClBQRENvbnRleERhdGEKUGFnZVNpemU6QTQARHVwbGV4Ok5vbmUAABIAQ09NUEFUX0RVUExFWF9NT0RFDwBEdXBsZXhNb2RlOjpPZmY=</config:config-item> |
<config:config-item config:name="PrinterName" config:type="string">Generic Printer</config:config-item> |
<config:config-item config:name="AutoCalculate" config:type="boolean">true</config:config-item> |
<config:config-item config:name="LinkUpdateMode" config:type="short">3</config:config-item> |
<config:config-item config:name="HasColumnRowHeaders" config:type="boolean">true</config:config-item> |
<config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item> |
<config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item> |
<config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item> |
<config:config-item config:name="GridColor" config:type="long">12632256</config:config-item> |
<config:config-item config:name="ShowPageBreaks" config:type="boolean">true</config:config-item> |
<config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item> |
<config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">true</config:config-item> |
<config:config-item config:name="IsDocumentShared" config:type="boolean">false</config:config-item> |
<config:config-item config:name="ShowNotes" config:type="boolean">true</config:config-item> |
<config:config-item config:name="EmbedFonts" config:type="boolean">false</config:config-item> |
<config:config-item config:name="HasSheetTabs" config:type="boolean">true</config:config-item> |
<config:config-item config:name="RasterSubdivisionY" config:type="int">1</config:config-item> |
<config:config-item config:name="RasterIsVisible" config:type="boolean">false</config:config-item> |
<config:config-item config:name="RasterResolutionX" config:type="int">1000</config:config-item> |
<config:config-item config:name="RasterResolutionY" config:type="int">1000</config:config-item> |
<config:config-item config:name="IsSnapToRaster" config:type="boolean">false</config:config-item> |
<config:config-item config:name="RasterSubdivisionX" config:type="int">1</config:config-item> |
<config:config-item config:name="IsRasterAxisSynchronized" config:type="boolean">true</config:config-item> |
</config:config-item-set> |
</office:settings> |
<office:scripts> |
<office:script script:language="ooo:Basic"> |
97,15 → 66,16 |
<office:font-face-decls> |
<style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="swiss" style:font-pitch="variable"/> |
<style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/> |
<style:font-face style:name="DejaVu Sans" svg:font-family="'DejaVu Sans'" style:font-family-generic="system" style:font-pitch="variable"/> |
<style:font-face style:name="Lohit Devanagari" svg:font-family="'Lohit Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/> |
<style:font-face style:name="Lucida Sans Unicode" svg:font-family="'Lucida Sans Unicode'" style:font-family-generic="system" style:font-pitch="variable"/> |
<style:font-face style:name="Mangal" svg:font-family="Mangal" style:font-family-generic="system" style:font-pitch="variable"/> |
<style:font-face style:name="Noto Sans CJK SC" svg:font-family="'Noto Sans CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/> |
<style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable"/> |
</office:font-face-decls> |
<office:styles> |
<style:default-style style:family="table-cell"> |
<style:table-cell-properties style:decimal-places="7"/> |
<style:paragraph-properties style:tab-stop-distance="12.5mm"/> |
<style:paragraph-properties style:tab-stop-distance="1.25cm"/> |
<style:text-properties style:font-name="Arial" fo:language="fr" fo:country="FR" style:font-name-asian="Lucida Sans Unicode" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Tahoma" style:language-complex="hi" style:country-complex="IN"/> |
</style:default-style> |
<number:number-style style:name="N0"> |
241,7 → 211,7 |
<number:number-style style:name="N10107" number:language="de" number:country="DE"> |
<number:number number:decimal-places="0" loext:min-decimal-places="0" number:min-integer-digits="2"/> |
</number:number-style> |
<number:number-style style:name="N30111" number:language="en" number:country="GB"> |
<number:number-style style:name="N20111" number:language="en" number:country="GB"> |
<number:number number:decimal-places="3" loext:min-decimal-places="3" number:min-integer-digits="1"/> |
</number:number-style> |
<style:style style:name="Default" style:family="table-cell"> |
301,6 → 271,9 |
<style:style style:name="Accent_20_3" style:display-name="Accent 3" style:family="table-cell" style:parent-style-name="Accent"> |
<style:table-cell-properties fo:background-color="#dddddd"/> |
</style:style> |
<style:style style:name="Result_20__28_user_29_" style:display-name="Result (user)" style:family="table-cell" style:parent-style-name="Default"> |
<style:text-properties fo:color="#000000" fo:font-size="10pt" fo:font-style="italic" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="#000000" fo:font-weight="bold"/> |
</style:style> |
<style:style style:name="Result" style:family="table-cell" style:parent-style-name="Default"> |
<style:text-properties fo:font-style="italic" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" fo:font-weight="bold"/> |
</style:style> |
316,35 → 289,39 |
</office:styles> |
<office:automatic-styles> |
<style:style style:name="co1" style:family="table-column"> |
<style:table-column-properties fo:break-before="auto" style:column-width="69.37mm"/> |
<style:table-column-properties fo:break-before="auto" style:column-width="6.937cm"/> |
</style:style> |
<style:style style:name="co2" style:family="table-column"> |
<style:table-column-properties fo:break-before="auto" style:column-width="34.68mm"/> |
<style:table-column-properties fo:break-before="auto" style:column-width="3.468cm"/> |
</style:style> |
<style:style style:name="co3" style:family="table-column"> |
<style:table-column-properties fo:break-before="auto" style:column-width="22.67mm"/> |
<style:table-column-properties fo:break-before="auto" style:column-width="2.267cm"/> |
</style:style> |
<style:style style:name="co4" style:family="table-column"> |
<style:table-column-properties fo:break-before="auto" style:column-width="22.58mm"/> |
<style:table-column-properties fo:break-before="auto" style:column-width="2.258cm"/> |
</style:style> |
<style:style style:name="ro1" style:family="table-row"> |
<style:table-row-properties style:row-height="4.78mm" fo:break-before="auto" style:use-optimal-row-height="true"/> |
<style:table-row-properties style:row-height="0.452cm" fo:break-before="auto" style:use-optimal-row-height="true"/> |
</style:style> |
<style:style style:name="ro2" style:family="table-row"> |
<style:table-row-properties style:row-height="4.52mm" fo:break-before="auto" style:use-optimal-row-height="true"/> |
<style:table-row-properties style:row-height="0.526cm" fo:break-before="auto" style:use-optimal-row-height="true"/> |
</style:style> |
<style:style style:name="ro3" style:family="table-row"> |
<style:table-row-properties style:row-height="6.58mm" fo:break-before="auto" style:use-optimal-row-height="true"/> |
</style:style> |
<style:style style:name="ro4" style:family="table-row"> |
<style:table-row-properties style:row-height="4.73mm" fo:break-before="auto" style:use-optimal-row-height="true"/> |
</style:style> |
<style:style style:name="ta1" style:family="table" style:master-page-name="Default"> |
<style:table-properties table:display="true" style:writing-mode="lr-tb"/> |
</style:style> |
<number:number-style style:name="N2"> |
<number:number number:decimal-places="2" loext:min-decimal-places="2" number:min-integer-digits="1"/> |
</number:number-style> |
<number:number-style style:name="N5"> |
<number:number number:decimal-places="2" loext:min-decimal-places="2" number:grouping="true"/> |
</number:number-style> |
<number:date-style style:name="N30" number:automatic-order="true" number:format-source="language"> |
<number:day/> |
<number:text>/</number:text> |
<number:month/> |
<number:text>/</number:text> |
<number:year/> |
</number:date-style> |
<number:time-style style:name="N41"> |
<number:hours number:style="long"/> |
<number:text>:</number:text> |
358,14 → 335,7 |
<number:number-style style:name="N61"> |
<number:scientific-number number:decimal-places="2" loext:min-decimal-places="2" number:min-integer-digits="1" number:min-exponent-digits="2" loext:exponent-interval="1" loext:forced-exponent-sign="true"/> |
</number:number-style> |
<number:date-style style:name="N20076" number:language="th" number:country="TH"> |
<number:day number:calendar="buddhist"/> |
<number:text> </number:text> |
<number:month number:calendar="buddhist" number:style="long" number:textual="true"/> |
<number:text> </number:text> |
<number:year number:calendar="buddhist" number:style="long"/> |
</number:date-style> |
<number:date-style style:name="N30079" number:language="en" number:country="GB" number:automatic-order="true"> |
<number:date-style style:name="N20079" number:language="en" number:country="GB" number:automatic-order="true"> |
<number:day-of-week number:style="long"/> |
<number:text> </number:text> |
<number:day/> |
374,6 → 344,13 |
<number:text> </number:text> |
<number:year number:style="long"/> |
</number:date-style> |
<number:date-style style:name="N30076" number:language="th" number:country="TH"> |
<number:day number:calendar="buddhist"/> |
<number:text> </number:text> |
<number:month number:calendar="buddhist" number:style="long" number:textual="true"/> |
<number:text> </number:text> |
<number:year number:calendar="buddhist" number:style="long"/> |
</number:date-style> |
<number:boolean-style style:name="N40099" number:language="pt" number:country="PT"> |
<number:boolean/> |
</number:boolean-style> |
388,31 → 365,32 |
<style:style style:name="ce9" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N115"/> |
<style:style style:name="ce10" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N117"/> |
<style:style style:name="ce11" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N118"/> |
<style:style style:name="ce12" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N20076"/> |
<style:style style:name="ce13" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N30079"/> |
<style:style style:name="ce12" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N30076"/> |
<style:style style:name="ce13" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N20079"/> |
<style:style style:name="ce14" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N119"/> |
<style:style style:name="ce15" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N41"/> |
<style:style style:name="ce16" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N123"/> |
<style:style style:name="ce17" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N40099"/> |
<style:style style:name="ce35" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N30111"/> |
<style:style style:name="ce35" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N20111"/> |
<style:style style:name="ce37" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N30"/> |
<style:page-layout style:name="pm1"> |
<style:page-layout-properties style:writing-mode="lr-tb"/> |
<style:header-style> |
<style:header-footer-properties fo:min-height="7.51mm" fo:margin-left="0mm" fo:margin-right="0mm" fo:margin-bottom="2.5mm"/> |
<style:header-footer-properties fo:min-height="0.751cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-bottom="0.25cm"/> |
</style:header-style> |
<style:footer-style> |
<style:header-footer-properties fo:min-height="7.51mm" fo:margin-left="0mm" fo:margin-right="0mm" fo:margin-top="2.5mm"/> |
<style:header-footer-properties fo:min-height="0.751cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.25cm"/> |
</style:footer-style> |
</style:page-layout> |
<style:page-layout style:name="pm2"> |
<style:page-layout-properties style:writing-mode="lr-tb"/> |
<style:header-style> |
<style:header-footer-properties fo:min-height="7.51mm" fo:margin-left="0mm" fo:margin-right="0mm" fo:margin-bottom="2.5mm" fo:border="2.49pt solid #000000" fo:padding="0.18mm" fo:background-color="#c0c0c0"> |
<style:header-footer-properties fo:min-height="0.751cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-bottom="0.25cm" fo:border="2.49pt solid #000000" fo:padding="0.018cm" fo:background-color="#c0c0c0"> |
<style:background-image/> |
</style:header-footer-properties> |
</style:header-style> |
<style:footer-style> |
<style:header-footer-properties fo:min-height="7.51mm" fo:margin-left="0mm" fo:margin-right="0mm" fo:margin-top="2.5mm" fo:border="2.49pt solid #000000" fo:padding="0.18mm" fo:background-color="#c0c0c0"> |
<style:header-footer-properties fo:min-height="0.751cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.25cm" fo:border="2.49pt solid #000000" fo:padding="0.018cm" fo:background-color="#c0c0c0"> |
<style:background-image/> |
</style:header-footer-properties> |
</style:footer-style> |
435,7 → 413,7 |
<text:p><text:sheet-name>???</text:sheet-name><text:s/>(<text:title>???</text:title>)</text:p> |
</style:region-left> |
<style:region-right> |
<text:p><text:date style:data-style-name="N2" text:date-value="2019-03-18">00/00/0000</text:date>, <text:time style:data-style-name="N2" text:time-value="16:34:33.840313473">00:00:00</text:time></text:p> |
<text:p><text:date style:data-style-name="N2" text:date-value="2022-05-18">00/00/0000</text:date>, <text:time style:data-style-name="N2" text:time-value="09:03:15.463297125">00:00:00</text:time></text:p> |
</style:region-right> |
</style:header> |
<style:header-left style:display="false"/> |
448,11 → 426,11 |
<office:body> |
<office:spreadsheet> |
<table:table table:name="Feuille1" table:style-name="ta1" table:print="false"> |
<table:table-column table:style-name="co1" table:default-cell-style-name="ce1"/> |
<table:table-column table:style-name="co1" table:default-cell-style-name="Default"/> |
<table:table-column table:style-name="co2" table:default-cell-style-name="Default"/> |
<table:table-column table:style-name="co3" table:default-cell-style-name="Default"/> |
<table:table-row table:style-name="ro1"> |
<table:table-cell office:value-type="float" office:value="0.5" calcext:value-type="float"> |
<table:table-cell table:style-name="ce1" office:value-type="float" office:value="0.5" calcext:value-type="float"> |
<text:p>01</text:p> |
</table:table-cell> |
<table:table-cell office:value-type="string" calcext:value-type="string"> |
460,7 → 438,7 |
</table:table-cell> |
<table:table-cell/> |
</table:table-row> |
<table:table-row table:style-name="ro2"> |
<table:table-row table:style-name="ro1"> |
<table:table-cell table:style-name="ce2" office:value-type="float" office:value="0.5" calcext:value-type="float"> |
<text:p>0,500</text:p> |
</table:table-cell> |
470,7 → 448,7 |
<table:table-cell/> |
</table:table-row> |
<table:table-row table:style-name="ro1"> |
<table:table-cell table:style-name="Default" table:formula="of:=1/3" office:value-type="float" office:value="0.333333333333333" calcext:value-type="float"> |
<table:table-cell table:formula="of:=1/3" office:value-type="float" office:value="0.333333333333333" calcext:value-type="float"> |
<text:p>0,3333333</text:p> |
</table:table-cell> |
<table:table-cell office:value-type="string" calcext:value-type="string"> |
553,8 → 531,8 |
</table:table-cell> |
</table:table-row> |
<table:table-row table:style-name="ro1"> |
<table:table-cell table:style-name="ce11" table:formula="of:=NOW()" office:value-type="date" office:date-value="2019-03-18T16:35:19.075105" calcext:value-type="date"> |
<text:p>18/03/2019 16:35:19,08</text:p> |
<table:table-cell table:style-name="ce11" table:formula="of:=NOW()" office:value-type="date" office:date-value="2022-05-18T09:39:59.52" calcext:value-type="date"> |
<text:p>18/05/2022 09:39:59,52</text:p> |
</table:table-cell> |
<table:table-cell office:value-type="string" calcext:value-type="string"> |
<text:p>date time</text:p> |
561,9 → 539,9 |
</table:table-cell> |
<table:table-cell/> |
</table:table-row> |
<table:table-row table:style-name="ro3"> |
<table:table-cell table:style-name="ce12" table:formula="of:=NOW()" office:value-type="date" office:date-value="2019-03-18T16:35:19.075117" calcext:value-type="date"> |
<text:p>18 มีนาคม 2562</text:p> |
<table:table-row table:style-name="ro2"> |
<table:table-cell table:style-name="ce12" table:formula="of:=NOW()" office:value-type="date" office:date-value="2022-05-18T09:39:59.52" calcext:value-type="date"> |
<text:p>18 พฤษภาคม 2565</text:p> |
</table:table-cell> |
<table:table-cell office:value-type="string" calcext:value-type="string"> |
<text:p>Thai date</text:p> |
571,8 → 549,8 |
<table:table-cell/> |
</table:table-row> |
<table:table-row table:style-name="ro1"> |
<table:table-cell table:style-name="ce13" table:formula="of:=NOW()" office:value-type="date" office:date-value="2019-03-18T16:35:19.07512" calcext:value-type="date"> |
<text:p>Monday 18 March 2019</text:p> |
<table:table-cell table:style-name="ce13" table:formula="of:=NOW()" office:value-type="date" office:date-value="2022-05-18T09:39:59.52" calcext:value-type="date"> |
<text:p>Wednesday 18 May 2022</text:p> |
</table:table-cell> |
<table:table-cell office:value-type="string" calcext:value-type="string"> |
<text:p>Gregorian calendar</text:p> |
595,7 → 573,7 |
</table:table-cell> |
<table:table-cell/> |
</table:table-row> |
<table:table-row table:style-name="ro4"> |
<table:table-row table:style-name="ro1"> |
<table:table-cell table:style-name="ce16" office:value-type="float" office:value="12.34321" calcext:value-type="float"> |
<text:p>12,34</text:p> |
</table:table-cell> |
613,7 → 591,7 |
</table:table-cell> |
<table:table-cell/> |
</table:table-row> |
<table:table-row table:style-name="ro2"> |
<table:table-row table:style-name="ro1"> |
<table:table-cell table:style-name="ce35" office:value-type="float" office:value="0.5" calcext:value-type="float"> |
<text:p>0.500</text:p> |
</table:table-cell> |
622,6 → 600,21 |
</table:table-cell> |
<table:table-cell/> |
</table:table-row> |
<table:table-row table:style-name="ro1"> |
<table:table-cell table:number-columns-repeated="3"/> |
</table:table-row> |
<table:table-row table:style-name="ro1"> |
<table:table-cell table:style-name="ce37" office:value-type="date" office:date-value="2022-05-18" calcext:value-type="date"> |
<text:p>18/05/2022</text:p> |
</table:table-cell> |
<table:table-cell office:value-type="string" calcext:value-type="string"> |
<text:p>automatic order</text:p> |
</table:table-cell> |
<table:table-cell/> |
</table:table-row> |
<table:named-expressions> |
<table:named-range table:name="autoorder" table:base-cell-address="$Feuille1.$A$21" table:cell-range-address="$Feuille1.$A$21"/> |
</table:named-expressions> |
</table:table> |
<table:named-expressions/> |
</office:spreadsheet> |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/style/PageLayoutStyle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/Length.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/Log.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ODXMLDocument.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ODSingleXMLDocument.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ODUserDefinedMeta.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/ContentTypeVersioned.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/openoffice/product.properties |
---|
1,3 → 1,3 |
#Tue, 22 Jul 2014 14:25:37 +0200 |
#Mon, 04 Apr 2022 09:25:51 +0200 |
VERSION=15434 |
VERSION=32359 |
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUITable.java |
---|
177,8 → 177,6 |
final Row row = this.getRow(i); |
if (NumberUtils.areNumericallyEqual(row.getId(), rowId)) { |
return row; |
} else { |
System.err.println("LightUITable.getSelectedRows() - Null selectedRow"); |
} |
} |
return null; |
398,6 → 396,7 |
} |
public final void addSelectionListener(final ActionListener selectionListener) { |
this.setAllowSelection(true); |
this.selectionListeners.add(selectionListener); |
} |
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUIElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUIAutoCompleteComboBox.java |
---|
15,6 → 15,7 |
import org.openconcerto.utils.io.JSONConverter; |
import java.util.ArrayList; |
import java.util.List; |
import java.util.Optional; |
27,6 → 28,8 |
private LightUIComboRequest request; |
private List<LightUIComboBoxElement> cacheValues = new ArrayList<>(); |
public LightUIAutoCompleteComboBox() { |
} |
54,27 → 57,47 |
this.applyFilter(); |
} |
@Override |
public void addValue(LightUIComboBoxElement values) { |
this.cacheValues.add(values); |
} |
@Override |
public void addValues(List<LightUIComboBoxElement> values) { |
this.cacheValues.addAll(values); |
} |
private void applyFilter() { |
if (this.request != null) { |
Integer selectedId = null; |
if (this.hasSelectedValue()) { |
selectedId = this.getSelectedValue().getId(); |
} |
this.clearValues(); |
if (this.hasNotSpecifedLine()) { |
this.addValue(LightUIComboBox.getDefaultValue()); |
} |
Integer selectedId = null; |
if (this.hasSelectedValue()) { |
selectedId = this.getSelectedValue().getId(); |
} |
final Optional<LightUIComboBoxElement> sel = Optional.ofNullable(this.hasSelectedValue() ? this.getSelectedValue() : null); |
this.clearValues(); |
if (this.hasNotSpecifedLine()) { |
this.addValue(LightUIComboBox.getDefaultValue()); |
} |
final Optional<LightUIComboBoxElement> sel = Optional.ofNullable(this.hasSelectedValue() ? this.getSelectedValue() : null); |
if (this.request != null) { |
final List<LightUIComboBoxElement> items = this.request.getItems(this.filter, sel); |
for (final LightUIComboBoxElement item : items) { |
this.addValue(item); |
super.addValue(item); |
} |
} else { |
if (this.filter.trim().length() > 2) { |
final String txt = this.filter.toLowerCase(); |
for (final LightUIComboBoxElement item : this.cacheValues) { |
if ((item.getValue1() != null && item.getValue1().toLowerCase().contains(txt)) || (item.getValue2() != null && item.getValue2().toLowerCase().contains(txt))) { |
super.addValue(item); |
} |
} |
} |
} |
this.setSelectedId(selectedId); |
} |
this.setSelectedId(selectedId); |
} |
@Override |
91,4 → 114,3 |
this.filter = JSONConverter.getParameterFromJSON(json, FILTER, String.class); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/ui/light/LightUIComboBox.java |
---|
27,7 → 27,7 |
public class LightUIComboBox extends LightUserControl { |
private static final String KEY_HAS_NOT_SPECIFIED_LINE = "has-not-specified-line"; |
private static final String KEY_VALUES = "values"; |
protected static final String KEY_VALUES = "values"; |
private static final String KEY_SELECTED_VALUE = "selected-value"; |
private static final String KEY_ALREADY_FILLED = "already-filled"; |
/trunk/OpenConcerto/src/org/openconcerto/ui/TimestampEditorPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
57,6 → 57,8 |
private List<ActionListener> listeners = new ArrayList<>(); |
private Calendar calendar = Calendar.getInstance(); |
private JDate dateEditor; |
private boolean allowNull = false; |
final JButton buttonClear; |
public TimestampEditorPanel() { |
this(false); |
67,8 → 69,8 |
} |
public TimestampEditorPanel(boolean useSpinner, final ActionListener validateListener) { |
calendar.set(Calendar.SECOND, 0); |
calendar.set(Calendar.MILLISECOND, 0); |
this.calendar.set(Calendar.SECOND, 0); |
this.calendar.set(Calendar.MILLISECOND, 0); |
setLayout(new GridBagLayout()); |
GridBagConstraints c = new GridBagConstraints(); |
c.insets = new Insets(2, 3, 0, 2); |
89,7 → 91,7 |
c.gridx++; |
if (useSpinner) { |
this.timeSpinner = new TimeSpinField(); |
this.timeSpinner.setMinimumSize(new Dimension(timeSpinner.getPreferredSize())); |
this.timeSpinner.setMinimumSize(new Dimension(this.timeSpinner.getPreferredSize())); |
this.panelHour.add(this.timeSpinner, c); |
} else { |
this.timeText = new TimeTextField(); |
98,6 → 100,27 |
} |
c.gridx++; |
this.buttonClear = new JButton(new ImageIcon(TimestampEditorPanel.class.getResource("close_popup_gray.png"))); |
this.buttonClear.setVisible(false); |
this.buttonClear.addActionListener(new ActionListener() { |
@Override |
public void actionPerformed(ActionEvent e) { |
TimestampEditorPanel.this.calendar = null; |
fireTimeChangedPerformed(); |
if (validateListener != null) { |
validateListener.actionPerformed(e); |
} |
} |
}); |
this.buttonClear.setBorderPainted(false); |
this.buttonClear.setOpaque(false); |
this.buttonClear.setFocusPainted(false); |
this.buttonClear.setContentAreaFilled(false); |
this.buttonClear.setMargin(new Insets(1, 1, 1, 1)); |
this.buttonClear.setFocusable(false); |
final JButton buttonClose = new JButton(new ImageIcon(TimestampEditorPanel.class.getResource("validate_popup.png"))); |
if (validateListener != null) |
buttonClose.addActionListener(validateListener); |
113,13 → 136,13 |
this.panelHour.add(new JLabelBold("Date "), c); |
c.gridx++; |
c.gridwidth = 2; |
dateEditor = new JDate(true, true); |
dateEditor.getTextComp().addFocusListener(new FocusAdapter() { |
this.dateEditor = new JDate(true, true); |
this.dateEditor.getTextComp().addFocusListener(new FocusAdapter() { |
@Override |
public void focusGained(FocusEvent e) { |
final JTextComponent textComp = dateEditor.getTextComp(); |
final JTextComponent textComp = TimestampEditorPanel.this.dateEditor.getTextComp(); |
SwingUtilities.invokeLater(new Runnable() { |
@Override |
131,25 → 154,25 |
} |
}); |
dateEditor.setButtonVisible(false); |
dateEditor.addValueListener(new PropertyChangeListener() { |
this.dateEditor.setButtonVisible(false); |
this.dateEditor.addValueListener(new PropertyChangeListener() { |
@Override |
public void propertyChange(PropertyChangeEvent evt) { |
final Calendar c = Calendar.getInstance(); |
final Date date = dateEditor.getDate(); |
final Date date = TimestampEditorPanel.this.dateEditor.getDate(); |
if (date != null) { |
c.setTimeInMillis(date.getTime()); |
pickerPanel.setSelectedDate(c); |
calendar.set(Calendar.YEAR, c.get(Calendar.YEAR)); |
calendar.set(Calendar.MONTH, c.get(Calendar.MONTH)); |
calendar.set(Calendar.DAY_OF_MONTH, c.get(Calendar.DAY_OF_MONTH)); |
TimestampEditorPanel.this.pickerPanel.setSelectedDate(c); |
TimestampEditorPanel.this.calendar.set(Calendar.YEAR, c.get(Calendar.YEAR)); |
TimestampEditorPanel.this.calendar.set(Calendar.MONTH, c.get(Calendar.MONTH)); |
TimestampEditorPanel.this.calendar.set(Calendar.DAY_OF_MONTH, c.get(Calendar.DAY_OF_MONTH)); |
dateOrTimeChanged(); |
} |
} |
}); |
this.panelHour.add(dateEditor, c); |
this.panelHour.add(this.dateEditor, c); |
c.gridwidth = 1; |
this.add(this.panelHour, c); |
157,10 → 180,12 |
c.anchor = GridBagConstraints.NORTHEAST; |
c.weightx = 1; |
c.gridx++; |
this.add(this.buttonClear, c); |
c.gridx++; |
this.add(buttonClose, c); |
c.gridy++; |
c.gridx = 0; |
c.gridwidth = 3; |
c.gridwidth = 4; |
c.insets = new Insets(4, 0, 0, 0); |
c.fill = GridBagConstraints.HORIZONTAL; |
this.add(new JSeparator(JSeparator.HORIZONTAL), c); |
217,27 → 242,43 |
} |
public void setTime(Date time) { |
calendar.setTimeInMillis(time.getTime()); |
if (time == null && !this.allowNull) { |
throw new IllegalArgumentException("null is not allowed, use setAllowNull() if needed"); |
} |
Calendar c = Calendar.getInstance(); |
if (time == null) { |
this.calendar = null; |
} else { |
c.setTimeInMillis(time.getTime()); |
this.calendar = c; |
} |
// update UI |
final int hour = calendar.get(Calendar.HOUR_OF_DAY); |
final int minute = calendar.get(Calendar.MINUTE); |
this.pickerPanel.setSelectedDate(calendar); |
if (timeSpinner != null) { |
final int hour = c.get(Calendar.HOUR_OF_DAY); |
final int minute = c.get(Calendar.MINUTE); |
this.pickerPanel.setSelectedDate(c); |
if (this.timeSpinner != null) { |
this.timeSpinner.setTime(hour, minute); |
} else { |
timeText.setTime(hour, minute); |
this.timeText.setTime(hour, minute); |
} |
} |
public final Timestamp getTimestamp() { |
if (this.calendar == null) |
return null; |
return new Timestamp(this.calendar.getTimeInMillis()); |
} |
public final Time getTime() { |
if (this.calendar == null) |
return null; |
return Time.valueOf(this.calendar.get(Calendar.HOUR_OF_DAY) + ":" + this.calendar.get(Calendar.MINUTE) + ":00"); |
} |
public final java.sql.Date getDate() { |
if (this.calendar == null) |
return null; |
return java.sql.Date.valueOf(this.calendar.get(Calendar.YEAR) + "-" + (this.calendar.get(Calendar.MONTH) + 1) + "-" + this.calendar.get(Calendar.DAY_OF_MONTH)); |
} |
251,14 → 292,17 |
} |
public void stateChanged() { |
calendar.setTime(pickerPanel.getSelectedDate()); |
dateEditor.setDate(pickerPanel.getSelectedDate()); |
if (timeSpinner != null) { |
calendar.set(Calendar.HOUR_OF_DAY, timeSpinner.getHours()); |
calendar.set(Calendar.MINUTE, timeSpinner.getMinutes()); |
if (this.calendar == null) { |
this.calendar = Calendar.getInstance(); |
} |
this.calendar.setTime(this.pickerPanel.getSelectedDate()); |
this.dateEditor.setDate(this.pickerPanel.getSelectedDate()); |
if (this.timeSpinner != null) { |
this.calendar.set(Calendar.HOUR_OF_DAY, this.timeSpinner.getHours()); |
this.calendar.set(Calendar.MINUTE, this.timeSpinner.getMinutes()); |
} else { |
calendar.set(Calendar.HOUR_OF_DAY, timeText.getHours()); |
calendar.set(Calendar.MINUTE, timeText.getMinutes()); |
this.calendar.set(Calendar.HOUR_OF_DAY, this.timeText.getHours()); |
this.calendar.set(Calendar.MINUTE, this.timeText.getMinutes()); |
} |
} |
285,8 → 329,8 |
@Override |
public void requestFocus() { |
timeText.requestFocus(); |
timeText.setCaretPosition(0); |
this.timeText.requestFocus(); |
this.timeText.setCaretPosition(0); |
} |
public static void main(String[] args) throws Exception { |
302,6 → 346,8 |
c.set(Calendar.MINUTE, 14); |
t.setTime(c.getTime()); |
t.setAllowNull(true); |
t.setTime(null); |
t.addActionListener(new ActionListener() { |
@Override |
316,4 → 362,9 |
f.setLocationRelativeTo(null); |
f.setVisible(true); |
} |
public void setAllowNull(boolean b) { |
this.allowNull = b; |
this.buttonClear.setVisible(b); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/ui/grid/GridItem.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
23,6 → 23,7 |
private Color color = new Color(50, 200, 160, 150); |
private Color borderColor = new Color(25, 100, 80, 150); |
private Object cookie; |
private float markerLocation = -1; |
public GridItem(int x, int y, int w, int h) { |
this.x = x; |
87,6 → 88,21 |
this.cookie = cookie; |
} |
public float getMarkerLocation() { |
return this.markerLocation; |
} |
/** |
* Define the location of the marker |
* |
* @param markerLocation : x location in percent |
* |
* if markerLocation < 0 => no marker is shown |
*/ |
public void setMarkerLocation(float markerLocation) { |
this.markerLocation = markerLocation; |
} |
@Override |
public String toString() { |
return this.x + "," + this.y + " [" + this.w + "," + this.h + "]"; |
/trunk/OpenConcerto/src/org/openconcerto/ui/grid/GridPanel.java |
---|
19,6 → 19,7 |
import java.awt.Graphics; |
import java.awt.Graphics2D; |
import java.awt.Rectangle; |
import java.awt.RenderingHints; |
import java.awt.event.MouseAdapter; |
import java.awt.event.MouseEvent; |
import java.awt.event.MouseMotionListener; |
208,6 → 209,7 |
int x = 0; |
final int h = this.getHeight(); |
Graphics2D g2 = (Graphics2D) g; |
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
g2.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 4 }, 0)); |
// Vertical lines |
g.setColor(this.gridVerticalColor); |
252,6 → 254,18 |
} |
g.drawRect(itemX + 1, itemY + 1, width - 2, height - 2); |
g.drawRect(itemX, itemY, width, height); |
if (item.getMarkerLocation() >= 0 && item.getMarkerLocation() <= 1) { |
int pos = (int) (itemX + width * item.getMarkerLocation()); |
int size = (Math.min(this.cellWidth, this.cellHeight)) / 4 - 1; |
int[] xPoints = new int[] { pos, pos + size - 2, pos }; |
int[] yPoints = new int[] { itemY, itemY, itemY + size }; |
g.fillPolygon(xPoints, yPoints, 3); |
xPoints = new int[] { pos, pos, pos + size - 2 }; |
yPoints = new int[] { itemY + height, itemY + height - size, itemY + height }; |
g.fillPolygon(xPoints, yPoints, 3); |
} |
} |
public static void main(String[] args) { |
267,8 → 281,12 |
JFrame f = new JFrame(); |
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
final GridPanel contentPane = new GridPanel(24, 4); |
contentPane.add(new GridItem(0, 0, 1, 1)); |
contentPane.add(new GridItem(4, 0, 3, 1)); |
final GridItem item = new GridItem(0, 0, 1, 1); |
item.setMarkerLocation(0.66f); |
contentPane.add(item); |
final GridItem item2 = new GridItem(4, 0, 3, 1); |
item2.setMarkerLocation(0.01f); |
contentPane.add(item2); |
contentPane.add(new GridItem(1, 1, 2, 2)); |
f.setContentPane(contentPane); |
f.pack(); |
/trunk/OpenConcerto/src/org/openconcerto/ui/grid/TwoYearsHeaderPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,70 → 13,10 |
package org.openconcerto.ui.grid; |
import java.awt.Color; |
import java.awt.Dimension; |
import java.awt.Font; |
import java.awt.Graphics; |
public class TwoYearsHeaderPanel extends YearsHeaderPanel { |
import javax.swing.JPanel; |
public class TwoYearsHeaderPanel extends JPanel { |
private int year; |
private String[] months = new String[] { "Janv.", "Fév.", "Mars", "Avr.", "Mai", "Juin", "Juil.", "Août", "Sept.", "Oct.", "Nov.", "Déc." }; |
public TwoYearsHeaderPanel(int year) { |
this.year = year; |
this.setBackground(Color.white); |
super(year, 2); |
} |
@Override |
protected void paintComponent(Graphics g) { |
super.paintComponent(g); |
g.setFont(g.getFont().deriveFont(Font.BOLD)); |
int x1 = this.getWidth() / 4; |
int x2 = (3 * this.getWidth()) / 4; |
String str1 = String.valueOf(this.year); |
int w1 = g.getFontMetrics().stringWidth(str1); |
g.drawString(str1, x1 - w1 / 2, 16); |
String str2 = String.valueOf(this.year + 1); |
int w2 = g.getFontMetrics().stringWidth(str2); |
g.drawString(str2, x2 - w2 / 2, 16); |
int gw = (this.getWidth()) / 24; |
g.setColor(Color.LIGHT_GRAY); |
for (int x = 0; x < this.getWidth(); x += gw * 3) { |
g.drawLine(x, 36, x, this.getHeight()); |
} |
g.setColor(Color.GRAY); |
for (int x = 0; x < this.getWidth(); x += gw * 6) { |
g.drawLine(x, 24, x, this.getHeight()); |
} |
g.setColor(Color.BLACK); |
for (int x = 0; x < this.getWidth(); x += gw * 12) { |
g.drawLine(x, 0, x, this.getHeight()); |
} |
g.setFont(g.getFont().deriveFont(Font.PLAIN)); |
int delta = this.getWidth() / 2; |
for (int i = 0; i < 12; i++) { |
final String str = this.months[i]; |
int w = g.getFontMetrics().stringWidth(str2); |
int x = i * gw + gw / 2 - w / 2; |
g.drawString(str, x, 40); |
x = x + delta; |
g.drawString(str, x, 40); |
} |
} |
@Override |
public Dimension getMinimumSize() { |
return new Dimension(getPreferredSize().width, 48); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/ui/grid/YearsHeaderPanel.java |
---|
New file |
0,0 → 1,93 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.ui.grid; |
import java.awt.Color; |
import java.awt.Dimension; |
import java.awt.Font; |
import java.awt.Graphics; |
import javax.swing.JPanel; |
public class YearsHeaderPanel extends JPanel { |
private final int year; |
private String[] months = new String[] { "Janv.", "Fév.", "Mars", "Avr.", "Mai", "Juin", "Juil.", "Août", "Sept.", "Oct.", "Nov.", "Déc." }; |
private final int yearCount; |
public YearsHeaderPanel(int year, int yearCount) { |
this.year = year; |
this.yearCount = yearCount; |
if (yearCount < 1) { |
throw new IllegalArgumentException("year count must be >= 1"); |
} |
this.setBackground(Color.white); |
} |
@Override |
protected void paintComponent(Graphics g) { |
super.paintComponent(g); |
g.setFont(g.getFont().deriveFont(Font.BOLD)); |
final int componentWidth = this.getWidth(); |
final int componentHeight = this.getHeight(); |
int yearWidth = componentWidth / this.yearCount; |
// Years |
for (int i = 0; i < this.yearCount; i++) { |
int x1 = yearWidth / 2 + yearWidth * i; |
String str1 = String.valueOf(this.year + i); |
int w1 = g.getFontMetrics().stringWidth(str1); |
g.drawString(str1, x1 - w1 / 2, 16); |
} |
// Separator every 3 months |
int gw = componentWidth / (12 * this.yearCount); |
g.setColor(Color.LIGHT_GRAY); |
final int space3 = gw * 3; |
for (int x = 0; x < componentWidth; x += space3) { |
g.drawLine(x, 36, x, componentHeight); |
} |
// Separator every 6 months |
g.setColor(Color.GRAY); |
final int space6 = gw * 6; |
for (int x = 0; x < componentWidth; x += space6) { |
g.drawLine(x, 24, x, componentHeight); |
} |
// Separator every 3 year |
g.setColor(Color.BLACK); |
final int space12 = gw * 12; |
for (int x = 0; x < componentWidth; x += space12) { |
g.drawLine(x, 0, x, componentHeight); |
} |
g.setFont(g.getFont().deriveFont(Font.PLAIN)); |
for (int i = 0; i < 12; i++) { |
final String str = this.months[i]; |
int w = g.getFontMetrics().stringWidth(str); |
int x = i * gw + gw / 2 - w / 2; |
for (int j = 0; j < this.yearCount; j++) { |
g.drawString(str, x, 40); |
x = x + yearWidth; |
} |
} |
} |
@Override |
public Dimension getMinimumSize() { |
return new Dimension(getPreferredSize().width, 48); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/ui/grid/DecoratedGridPanel.java |
---|
18,8 → 18,7 |
import java.awt.Color; |
import java.awt.Component; |
import java.awt.Dimension; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.awt.GridLayout; |
import java.util.ArrayList; |
import java.util.List; |
28,17 → 27,21 |
import javax.swing.JFrame; |
import javax.swing.JPanel; |
import javax.swing.JScrollPane; |
import javax.swing.JViewport; |
import javax.swing.SwingUtilities; |
import javax.swing.UIManager; |
import javax.swing.UnsupportedLookAndFeelException; |
import javax.swing.event.ChangeEvent; |
import javax.swing.event.ChangeListener; |
public class DecoratedGridPanel extends JPanel { |
private GridPanel grid; |
final JScrollPane scroll; |
public DecoratedGridPanel(JComponent header, int columnCount, int rowHeight, List<JComponent> rowHeader) { |
this.setBackground(Color.WHITE); |
this.setLayout(new GridBagLayout()); |
this.setLayout(new GridLayout(1, 1)); |
JPanel topLeft = new JPanel(); |
topLeft.setMinimumSize(new Dimension(0, 0)); |
46,69 → 49,38 |
header.setPreferredSize(new Dimension(this.grid.getPreferredSize().width, header.getMinimumSize().height)); |
header.setMaximumSize(new Dimension(this.grid.getPreferredSize().width, header.getMinimumSize().height)); |
header.setMinimumSize(new Dimension(this.grid.getPreferredSize().width, header.getMinimumSize().height)); |
GridBagConstraints c = new GridBagConstraints(); |
c.gridx = 0; |
c.gridy = 0; |
c.weightx = 1; |
c.gridwidth = 1; |
c.fill = GridBagConstraints.BOTH; |
this.add(topLeft, c); |
c.gridx++; |
c.weightx = 0; |
this.add(header, c); |
c.gridx++; |
c.weightx = 0; |
JPanel spacerScroll = new JPanel(); |
Object width = UIManager.get("ScrollBar.width"); |
if (width == null) { |
// Nimbus |
width = Integer.valueOf(20); |
} |
int wScroll = ((Integer) width).intValue(); |
spacerScroll.setMinimumSize(new Dimension(wScroll, header.getHeight())); |
spacerScroll.setPreferredSize(new Dimension(wScroll, header.getHeight())); |
spacerScroll.setMaximumSize(new Dimension(wScroll, header.getHeight())); |
spacerScroll.setSize(new Dimension(wScroll, header.getHeight())); |
this.add(spacerScroll, c); |
// |
c.gridwidth = 3; |
c.weightx = 1; |
c.weighty = 1; |
c.gridx = 0; |
c.gridy++; |
JPanel panel = new ScrollablePanel() { |
final Component left = createLeft(rowHeader, this.grid.getCellHeight()); |
this.scroll = new JScrollPane(this.grid); |
this.scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
this.scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
this.scroll.setBorder(null); |
this.add(this.scroll); |
this.scroll.setRowHeaderView(left); |
this.scroll.setColumnHeaderView(header); |
this.scroll.getRowHeader().addChangeListener(new ChangeListener() { |
@Override |
public boolean getScrollableTracksViewportWidth() { |
return true; |
} |
public void stateChanged(ChangeEvent e) { |
// Sync the scroll pane scrollbar with the row header |
JViewport viewport = (JViewport) e.getSource(); |
DecoratedGridPanel.this.scroll.getVerticalScrollBar().setValue(viewport.getViewPosition().y); |
@Override |
public boolean getScrollableTracksViewportHeight() { |
return false; |
} |
}; |
panel.setLayout(new GridBagLayout()); |
GridBagConstraints c2 = new GridBagConstraints(); |
c2.gridx = 0; |
c2.gridy = 0; |
c2.weightx = 1; |
c2.anchor = GridBagConstraints.NORTH; |
c2.fill = GridBagConstraints.BOTH; |
panel.add(createLeft(rowHeader, this.grid.getCellHeight()), c2); |
c2.gridx++; |
c2.weightx = 0; |
c2.weighty = 1; |
panel.add(this.grid, c2); |
}); |
} |
final JScrollPane scroll = new JScrollPane(panel); |
scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
scroll.setBorder(null); |
this.add(scroll, c); |
public int getYScrollLocation() { |
return this.scroll.getVerticalScrollBar().getValue(); |
} |
public void setYScrollLocation(int location) { |
this.scroll.getVerticalScrollBar().setValue(location); |
} |
private Component createLeft(List<JComponent> rowHeader, int h) { |
private JComponent createLeft(List<JComponent> rowHeader, int h) { |
JPanel p = new JPanel(); |
p.setLayout(new VFlowLayout(VFlowLayout.TOP, 1, 1, true)); |
136,7 → 108,7 |
TwoYearsHeaderPanel b = new TwoYearsHeaderPanel(2018); |
List<JComponent> panels = new ArrayList<>(); |
for (int i = 0; i < 5; i++) { |
for (int i = 0; i < 8; i++) { |
panels.add(new JButton("line " + i)); |
} |
146,6 → 118,7 |
contentPane.add(new GridItem(1, 1, 2, 1)); |
f.setContentPane(contentPane); |
f.pack(); |
f.setSize(400, 286); |
f.setLocationRelativeTo(null); |
f.setVisible(true); |
} |
/trunk/OpenConcerto/src/org/openconcerto/ui/table/MultiLineHeaderRenderer.java |
---|
New file |
0,0 → 1,58 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.ui.table; |
import java.awt.Component; |
import java.io.BufferedReader; |
import java.io.IOException; |
import java.io.StringReader; |
import java.util.Vector; |
import javax.swing.JLabel; |
import javax.swing.JList; |
import javax.swing.JTable; |
import javax.swing.ListCellRenderer; |
import javax.swing.UIManager; |
import javax.swing.table.TableCellRenderer; |
public class MultiLineHeaderRenderer extends JList implements TableCellRenderer { |
public MultiLineHeaderRenderer() { |
setOpaque(true); |
setForeground(UIManager.getColor("TableHeader.foreground")); |
setBackground(UIManager.getColor("TableHeader.background")); |
setBorder(UIManager.getBorder("TableHeader.cellBorder")); |
ListCellRenderer renderer = getCellRenderer(); |
((JLabel) renderer).setHorizontalAlignment(JLabel.CENTER); |
setCellRenderer(renderer); |
} |
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { |
setFont(table.getFont()); |
String str = (value == null) ? "" : value.toString(); |
BufferedReader br = new BufferedReader(new StringReader(str)); |
String line; |
Vector v = new Vector(); |
try { |
while ((line = br.readLine()) != null) { |
v.addElement(line); |
} |
} catch (IOException ex) { |
ex.printStackTrace(); |
} |
setListData(v); |
return this; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/ui/table/JTreeTable.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
39,7 → 39,7 |
// Create the tree. It will be used as a renderer and editor. |
tree = new TreeTableCellRenderer(treeTableModel); |
tree.setRootVisible(false); |
// Install a tableModel representing the visible rows in the tree. |
super.setModel(new TreeTableModelAdapter(treeTableModel, tree)); |
46,7 → 46,7 |
// Force the JTable and JTree to share their row selection models. |
tree.setSelectionModel(new DefaultTreeSelectionModel() { |
// Extend the implementation of the constructor, as if: |
/* public this() */{ |
/* public this() */ { |
setSelectionModel(listSelectionModel); |
} |
}); |
71,7 → 71,7 |
return (getColumnClass(editingColumn) == TreeTableModel.class) ? -1 : editingRow; |
} |
// |
// |
// The renderer used to display the tree nodes, a JTree. |
// |
103,7 → 103,7 |
} |
} |
// |
// |
// The editor used to interact with tree nodes, a JTree. |
// |
/trunk/OpenConcerto/src/org/openconcerto/ui/table/TimestampTableCellEditor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
51,7 → 51,7 |
private Calendar calendar; |
private JPopupMenu aPopup; |
private boolean popupOpen = false; |
private final TimestampEditorPanel content = new TimestampEditorPanel(false, new ActionListener() { |
private final TimestampEditorPanel editorPanel = new TimestampEditorPanel(false, new ActionListener() { |
@Override |
public void actionPerformed(ActionEvent e) { |
stopCellEditing(); |
61,17 → 61,18 |
public TimestampTableCellEditor(boolean showHour) { |
this(); |
this.content.setHourVisible(showHour); |
this.editorPanel.setHourVisible(showHour); |
} |
public TimestampTableCellEditor() { |
super(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT)); |
this.calendar = Calendar.getInstance(); |
this.content.setBorder(null); |
this.editorPanel.setBorder(null); |
} |
public void setAllowNull(boolean b) { |
this.allowNull = b; |
this.editorPanel.setAllowNull(b); |
} |
@Override |
81,27 → 82,27 |
if (time == null) { |
time = new Timestamp(System.currentTimeMillis()); |
} |
this.content.setTime(time); |
this.editorPanel.setTime(time); |
this.calendar.setTime(time); |
final Point p = new Point(0, 0 + table.getRowHeight(row)); |
if (this.aPopup != null) { |
this.content.removeActionListener(this); |
this.editorPanel.removeActionListener(this); |
this.aPopup.setVisible(false); |
this.aPopup = null; |
} |
JTextField t = (JTextField) c; |
JTextField textField = (JTextField) c; |
this.aPopup = new JPopupMenu(); |
this.aPopup.add(this.content); |
this.aPopup.add(this.editorPanel); |
// JPopupMenu is hidden by Swing if the user clicks outside of it, but we still need to |
// commit the value |
this.aPopup.addPropertyChangeListener(new PropertyChangeListener() { |
@Override |
public void propertyChange(PropertyChangeEvent evt) { |
if (!allowNull) { |
if (!TimestampTableCellEditor.this.allowNull) { |
if (evt.getPropertyName().equals("visible") && Boolean.FALSE.equals(evt.getNewValue())) { |
stopCellEditing(); |
} |
110,7 → 111,7 |
}); |
this.popupOpen = true; |
t.addMouseListener(new MouseAdapter() { |
textField.addMouseListener(new MouseAdapter() { |
@Override |
public void mousePressed(MouseEvent e) { |
// Invoke later to avoid paint issue |
122,7 → 123,7 |
}); |
} |
}); |
t.addKeyListener(new KeyAdapter() { |
textField.addKeyListener(new KeyAdapter() { |
@Override |
public void keyPressed(KeyEvent e) { |
141,7 → 142,7 |
} |
}); |
this.content.addActionListener(this); |
this.editorPanel.addActionListener(this); |
return c; |
} |
159,7 → 160,7 |
public void hidePopup() { |
this.popupOpen = false; |
this.content.removeActionListener(this); |
this.editorPanel.removeActionListener(this); |
if (this.aPopup != null) { |
this.aPopup.setVisible(false); |
} |
167,7 → 168,7 |
public void showPopup(Component c, Point p) { |
this.popupOpen = true; |
if (aPopup != null) { |
if (this.aPopup != null) { |
try { |
this.aPopup.show(c, p.x, p.y); |
// if the user dismisses the popup (e.g. escape), revert the value |
189,13 → 190,13 |
@Override |
public void run() { |
content.requestFocus(); |
TimestampTableCellEditor.this.editorPanel.requestFocus(); |
} |
}); |
} |
public boolean isPopupOpen() { |
return popupOpen; |
return this.popupOpen; |
} |
@Override |
221,7 → 222,7 |
} |
public void actionPerformed(ActionEvent e) { |
this.delegate.setValue(this.content.getTimestamp()); |
this.delegate.setValue(this.editorPanel.getTimestamp()); |
} |
public static void main(String[] args) { |
242,8 → 243,10 |
final JTable table = new EnhancedTable(rowData, new String[] { "a", "b" }); |
final TimestampTableCellEditor cellEditor = new TimestampTableCellEditor(true); |
table.getColumnModel().getColumn(0).setCellEditor(new TimestampTableCellEditor(true)); |
table.getColumnModel().getColumn(1).setCellEditor(new TimestampTableCellEditor(true)); |
cellEditor.setAllowNull(true); |
table.getColumnModel().getColumn(1).setCellEditor(cellEditor); |
JPanel p = new JPanel(); |
p.setLayout(new BorderLayout()); |
p.add(table, BorderLayout.CENTER); |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/TemplateGenerator.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/XMLTemplateGenerator.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/engine/DataModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/engine/OGNLDataModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
17,6 → 17,7 |
import java.util.Map; |
import ognl.Ognl; |
import ognl.OgnlContext; |
import ognl.OgnlException; |
/** |
41,7 → 42,7 |
public OGNLDataModel(OGNLDataModel dm) { |
this.root = dm.root; |
final Map<String, Object> copy = new HashMap<String, Object>(dm.context); |
this.context = Ognl.addDefaultContext(Ognl.getRoot(dm.context), Ognl.getClassResolver(dm.context), Ognl.getTypeConverter(dm.context), Ognl.getMemberAccess(dm.context), copy); |
this.context = Ognl.addDefaultContext(Ognl.getRoot(dm.context), ((OgnlContext) dm.context).getMemberAccess(), Ognl.getClassResolver(dm.context), Ognl.getTypeConverter(dm.context), copy); |
} |
@Override |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/engine/DataFormatter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/engine/Material.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/engine/Parsed.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/engine/Processor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/engine/ScriptEngineDataModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/statements/ForEach.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/statements/If.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/statements/BaseStatement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/statements/Include.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/statements/SetStmt.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/statements/Statement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/TemplateException.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/Template.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/ognl/OGNLScriptEngine.java |
---|
New file |
0,0 → 1,72 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.ognl; |
import java.io.Reader; |
import javax.script.AbstractScriptEngine; |
import javax.script.Bindings; |
import javax.script.ScriptContext; |
import javax.script.ScriptEngineFactory; |
import javax.script.ScriptException; |
import javax.script.SimpleBindings; |
import ognl.Ognl; |
import ognl.OgnlParser; |
public class OGNLScriptEngine extends AbstractScriptEngine { |
// the factory that created this engine |
private final OGNLScriptEngineFactory factory; |
OGNLScriptEngine(final OGNLScriptEngineFactory factory) { |
super(new SimpleBindings()); |
this.factory = factory; |
} |
@Override |
public Object eval(String script, ScriptContext context) throws ScriptException { |
try { |
final Bindings bindings = getBindings(context); |
return Ognl.getValue(script, bindings, Ognl.getRoot(bindings)); |
} catch (Exception e) { |
throw new ScriptException(e); |
} |
} |
// TODO also use ScriptContext.getWriter() & co. |
private Bindings getBindings(ScriptContext context) { |
return context.getBindings(ScriptContext.ENGINE_SCOPE); |
} |
@Override |
public Object eval(Reader reader, ScriptContext context) throws ScriptException { |
try { |
final Bindings bindings = getBindings(context); |
return Ognl.getValue(new OgnlParser(reader).topLevelExpression(), bindings, Ognl.getRoot(bindings)); |
} catch (Exception e) { |
throw new ScriptException(e); |
} |
} |
@Override |
public Bindings createBindings() { |
return new SimpleBindings(); |
} |
@Override |
public ScriptEngineFactory getFactory() { |
return this.factory; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/ognl/OGNLScriptEngineFactory.java |
---|
New file |
0,0 → 1,137 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.ognl; |
import org.openconcerto.utils.StringUtils; |
import java.util.Arrays; |
import java.util.Collections; |
import java.util.List; |
import javax.script.ScriptEngine; |
import javax.script.ScriptEngineFactory; |
public class OGNLScriptEngineFactory implements ScriptEngineFactory { |
@Override |
public String getEngineName() { |
return (String) getParameter(ScriptEngine.ENGINE); |
} |
@Override |
public String getEngineVersion() { |
return (String) getParameter(ScriptEngine.ENGINE_VERSION); |
} |
@Override |
public List<String> getExtensions() { |
return Collections.unmodifiableList(extensions); |
} |
@Override |
public String getLanguageName() { |
return (String) getParameter(ScriptEngine.LANGUAGE); |
} |
@Override |
public String getLanguageVersion() { |
return (String) getParameter(ScriptEngine.LANGUAGE_VERSION); |
} |
@Override |
public List<String> getMimeTypes() { |
return Collections.unmodifiableList(mimeTypes); |
} |
@Override |
public List<String> getNames() { |
return Collections.unmodifiableList(names); |
} |
@Override |
public Object getParameter(final String key) { |
switch (key) { |
case ScriptEngine.NAME: |
return "OGNL"; |
case ScriptEngine.ENGINE: |
return "ILM OGNL"; |
case ScriptEngine.ENGINE_VERSION: |
return "1.0"; |
case ScriptEngine.LANGUAGE: |
return "OGNL"; |
case ScriptEngine.LANGUAGE_VERSION: |
return "OGNL 3.3"; |
case "THREADING": |
// The engine implementation is not thread-safe. Can't be |
// used to execute scripts concurrently on multiple threads. |
return null; |
default: |
return null; |
} |
} |
@Override |
public String getMethodCallSyntax(final String obj, final String method, final String... args) { |
final StringBuilder sb = new StringBuilder().append(obj).append('.').append(method).append('('); |
final int len = args.length; |
if (len > 0) { |
sb.append(args[0]); |
} |
for (int i = 1; i < len; i++) { |
sb.append(',').append(args[i]); |
} |
sb.append(')'); |
return sb.toString(); |
} |
@Override |
public String getOutputStatement(String toDisplay) { |
return "@System@out.println(" + StringUtils.doubleQuote(toDisplay) + ")"; |
} |
@Override |
public String getProgram(final String... statements) { |
final StringBuilder sb = new StringBuilder(); |
for (final String statement : statements) { |
sb.append(statement).append(','); |
} |
return sb.toString(); |
} |
@Override |
public ScriptEngine getScriptEngine() { |
return new OGNLScriptEngine(this); |
} |
private static final List<String> names; |
private static final List<String> mimeTypes; |
private static final List<String> extensions; |
static { |
names = immutableList("OGNL", "ILM-OGNL"); |
mimeTypes = immutableList("application/ognl", "text/ognl"); |
extensions = Collections.singletonList("ognl"); |
} |
private static List<String> immutableList(final String... elements) { |
return Collections.unmodifiableList(Arrays.asList(elements)); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/sql/sqlobject/ITextWithCompletionPopUp.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/sql/sqlobject/ITextWithCompletion.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
418,9 → 418,21 |
private void showPopup() { |
assert SwingUtilities.isEventDispatchThread(); |
if (this.model.getSize() > 0) { |
if (this.popupInvoker.isShowing()) |
if (this.popupInvoker.isShowing()) { |
String max = ""; |
for (IComboSelectionItem item : this.model.getList()) { |
if (max.length() < item.getLabel().length()) { |
max = item.getLabel(); |
} |
} |
final int stringWidth = this.text.getGraphics().getFontMetrics().stringWidth(max); |
this.popup.setMinWith(Math.max(450, stringWidth + 20)); |
this.popup.show(this.popupInvoker, 0, this.text.getBounds().height); |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/sql/model/SQLInjector.java |
---|
22,6 → 22,7 |
import org.openconcerto.sql.utils.ChangeTable; |
import org.openconcerto.sql.utils.SQLCreateTable; |
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline; |
import org.openconcerto.utils.GestionDevise; |
import org.openconcerto.utils.StringUtils; |
import org.openconcerto.utils.cc.ITransformer; |
193,19 → 194,33 |
String label = rowVals.getString(to); |
SQLPreferences prefs = SQLPreferences.getMemCached(srcRow.getTable().getDBRoot()); |
if (prefs.getBoolean("TransfertRef", true) || !to.equals("NOM")) { |
if (label != null && label.trim().length() > 0) { |
rowVals.put(to, cleanRef(label + ", " + srcRow.getString(from))); |
} else { |
rowVals.put(to, srcRow.getString(from)); |
final String ref = srcRow.getString(from); |
if (ref != null && ref.trim().length() > 0) { |
if (prefs.getBoolean("TransfertRef", true) || !to.equals("NOM")) { |
if (label != null && label.trim().length() > 0) { |
rowVals.put(to, cleanRef(label + ", " + ref)); |
} else { |
rowVals.put(to, ref); |
} |
} else if (prefs.getBoolean("TransfertMultiRef", false)) { |
SQLRowValues rowValsHeader = new SQLRowValues(UndefinedRowValuesCache.getInstance().getDefaultRowValues(tableElementDestination)); |
// TODO taxe may be undefined set it to default |
rowValsHeader.put("NOM", ref); |
rowValsHeader.put(refField, rowVals); |
// On reprend les références dans la facture |
if (rowValsHeader.getTable().getName().equalsIgnoreCase("SAISIE_VENTE_FACTURE_ELEMENT")) { |
SQLRowValues rowValsHeaderRef = new SQLRowValues(UndefinedRowValuesCache.getInstance().getDefaultRowValues(tableElementDestination)); |
rowValsHeaderRef.put("ID_STYLE", 3); |
if (srcRow.getTable().getName().equalsIgnoreCase("DEVIS")) { |
rowValsHeaderRef.put("NOM", srcRow.getString("OBJET")); |
} else { |
rowValsHeaderRef.put("NOM", srcRow.getString("NOM")); |
} |
rowValsHeaderRef.put(refField, rowVals); |
} |
} |
} else if (prefs.getBoolean("TransfertMultiRef", false)) { |
SQLRowValues rowValsHeader = new SQLRowValues(UndefinedRowValuesCache.getInstance().getDefaultRowValues(tableElementDestination)); |
// TODO taxe may be undefined set it to default |
rowValsHeader.put("NOM", srcRow.getString(from)); |
rowValsHeader.put(refField, rowVals); |
} |
} |
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); |
213,27 → 228,30 |
protected void transfertNumberReference(SQLRowAccessor srcRow, SQLRowValues rowVals, final SQLTable tableElementDestination, String refField) { |
SQLPreferences prefs = SQLPreferences.getMemCached(srcRow.getTable().getDBRoot()); |
if (prefs.getBoolean("TransfertRef", true)) { |
String label = rowVals.getString("NOM"); |
if (label != null && label.trim().length() > 0) { |
final String value = label + ", " + srcRow.getString("NUMERO"); |
rowVals.put("NOM", cleanRef(value)); |
} else { |
rowVals.put("NOM", srcRow.getString("NUMERO")); |
if (!prefs.getBoolean("TransfertNoRef", false)) { |
if (prefs.getBoolean("TransfertRef", true)) { |
String label = rowVals.getString("NOM"); |
if (label != null && label.trim().length() > 0) { |
final String value = label + ", " + srcRow.getString("NUMERO"); |
rowVals.put("NOM", cleanRef(value)); |
} else { |
rowVals.put("NOM", srcRow.getString("NUMERO")); |
} |
} |
} else if (prefs.getBoolean("TransfertMultiRef", false)) { |
SQLRowValues rowValsHeader = new SQLRowValues(UndefinedRowValuesCache.getInstance().getDefaultRowValues(tableElementDestination)); |
// FIXME Style forcé en titre 1 via l'ID |
rowValsHeader.put("ID_STYLE", 3); |
SQLElement element = Configuration.getInstance().getDirectory().getElement(getSource()); |
//Utiliser pour les transfert du module commande interne |
if (element == null) { |
element = Configuration.getInstance().getDirectory().getElement(getSource().getName()); |
if (prefs.getBoolean("TransfertMultiRef", false)) { |
SQLRowValues rowValsHeader = new SQLRowValues(UndefinedRowValuesCache.getInstance().getDefaultRowValues(tableElementDestination)); |
// FIXME Style forcé en titre 1 via l'ID |
rowValsHeader.put("ID_STYLE", 3); |
SQLElement element = Configuration.getInstance().getDirectory().getElement(getSource()); |
// Utiliser pour les transfert du module commande interne |
if (element == null) { |
element = Configuration.getInstance().getDirectory().getElement(getSource().getName()); |
} |
String elementName = StringUtils.firstUp(element.getName().getVariant(org.openconcerto.utils.i18n.Grammar.SINGULAR)); |
rowValsHeader.put("NOM", elementName + "\n N° " + srcRow.getString("NUMERO") + " du " + dateFormat.format(srcRow.getDate("DATE").getTime())); |
rowValsHeader.put(refField, rowVals); |
} |
String elementName = StringUtils.firstUp(element.getName().getVariant(org.openconcerto.utils.i18n.Grammar.SINGULAR)); |
rowValsHeader.put("NOM", elementName + "\n N° " + srcRow.getString("NUMERO") + " du " + dateFormat.format(srcRow.getDate("DATE").getTime())); |
rowValsHeader.put(refField, rowVals); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/sql/model/SQLRowValues.java |
---|
709,12 → 709,12 |
public final Object getObject(String fieldName) { |
return this.values.get(fieldName); |
} |
@Override |
public final Object getObjectNoCheck(String fieldName) { |
return this.values.get(fieldName); |
} |
public final Value<Object> getNonDefaultObject(String fieldName) { |
return getNonDefaultObject(fieldName, Object.class); |
} |
1105,8 → 1105,17 |
// TODO support java.time.LocalDateTime in Java 8 |
public static <T, U> U convert(final Class<T> source, final Object value, final Class<U> dest) { |
final ValueConvertor<T, U> conv = ValueConvertorFactory.find(source, dest); |
if (conv == null) |
throw new IllegalArgumentException("No convertor to " + dest + " from " + source); |
if (conv == null) { |
// FIXME erreur dans passer une commande depuis le calcul des besoin, code à retirer |
if (SQLRowAccessor.class.isAssignableFrom(source) && Integer.class.isAssignableFrom(dest)) { |
System.err.println("Conversion d'une row en integer " + ((SQLRowAccessor) source.cast(value)).toString()); |
Thread.dumpStack(); |
return dest.cast(((SQLRowAccessor) source.cast(value)).getID()); |
} else { |
throw new IllegalArgumentException("No convertor to " + dest + " from " + source); |
} |
} |
return conv.convert(source.cast(value)); |
} |
/trunk/OpenConcerto/src/org/openconcerto/sql/utils/GenerationUtils.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/AutoCompletionManager.java |
---|
61,22 → 61,37 |
this(fromTableElement, fillFrom, table, tableModel, ITextWithCompletion.MODE_CONTAINS, false); |
} |
// FIXME Le validstatechecker est à passer au SQLTableElement |
public AutoCompletionManager(SQLTableElement fromTableElement, SQLField fillFrom, RowValuesTable table, RowValuesTableModel tableModel, ComboSQLRequest req) { |
this(fromTableElement, fillFrom, table, tableModel, ITextWithCompletion.MODE_CONTAINS, false, false, new ValidStateChecker(), req); |
} |
public AutoCompletionManager(SQLTableElement fromTableElement, SQLField fillFrom, RowValuesTable table, RowValuesTableModel tableModel, int modeCompletion, boolean expandWithShowAs, |
boolean foreign, ValidStateChecker checker) { |
this(fromTableElement, fillFrom, table, tableModel, modeCompletion, expandWithShowAs, foreign, checker, null); |
} |
// FIXME Le validstatechecker est à passer au SQLTableElement |
public AutoCompletionManager(SQLTableElement fromTableElement, SQLField fillFrom, RowValuesTable table, RowValuesTableModel tableModel, int modeCompletion, boolean expandWithShowAs, |
boolean foreign, ValidStateChecker checker, ComboSQLRequest req) { |
this.foreign = foreign; |
List<String> l = new Vector<String>(); |
if (req == null) { |
List<String> l = new Vector<String>(); |
if (expandWithShowAs) { |
List<SQLField> lSQLFields = Configuration.getInstance().getShowAs().getFieldExpand(fillFrom.getTable()); |
for (int i = 0; i < lSQLFields.size(); i++) { |
l.add(lSQLFields.get(i).getName()); |
if (expandWithShowAs) { |
List<SQLField> lSQLFields = Configuration.getInstance().getShowAs().getFieldExpand(fillFrom.getTable()); |
for (int i = 0; i < lSQLFields.size(); i++) { |
l.add(lSQLFields.get(i).getName()); |
} |
} else { |
l.add(fillFrom.getName()); |
// FIXME à mettre en parametre |
if (fillFrom.getName().equals("NOM") && fillFrom.getTable().contains("CODE")) { |
l.add("CODE"); |
} |
} |
} else { |
l.add(fillFrom.getName()); |
req = new ComboSQLRequest(fillFrom.getTable(), l); |
} |
ComboSQLRequest req = new ComboSQLRequest(fillFrom.getTable(), l); |
init(fromTableElement, fillFrom, table, tableModel, modeCompletion, req, foreign, checker); |
} |
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/RowValuesTable.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
27,6 → 27,7 |
import org.openconcerto.ui.state.JTableStateManager; |
import org.openconcerto.ui.table.AlternateTableCellRenderer; |
import org.openconcerto.ui.table.XTableColumnModel; |
import org.openconcerto.utils.checks.EmptyChangeSupport; |
import org.openconcerto.utils.checks.EmptyListener; |
import org.openconcerto.utils.checks.ValidListener; |
import org.openconcerto.utils.checks.ValidState; |
40,6 → 41,7 |
import java.beans.PropertyChangeListener; |
import java.io.File; |
import java.io.IOException; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Collections; |
import java.util.List; |
67,6 → 69,10 |
private boolean editorAndRendererDone; |
private List<String> clearElementList = new ArrayList<String>(); |
// supports |
private final List<ValidListener> validListeners; |
private final EmptyChangeSupport emptySupp; |
public RowValuesTable(RowValuesTableModel model, File f) { |
this(model, f, false); |
} |
95,6 → 101,9 |
public RowValuesTable(RowValuesTableModel model, File f, boolean tiny, XTableColumnModel colModel) { |
super(model, colModel); |
this.emptySupp = new EmptyChangeSupport(this); |
this.validListeners = new ArrayList<>(); |
this.setTableHeader(new RowValuesTableHeader(colModel)); |
if (f == null) { |
218,6 → 227,14 |
if (e.getType() == TableModelEvent.INSERT) { |
scrollRectToVisible(new Rectangle(getCellRect(e.getFirstRow(), 0, true))); |
} |
if (this.emptySupp != null) { |
this.emptySupp.fireEmptyChange(getRowCount() == 0); |
} |
if (this.validListeners != null) { |
for (ValidListener l : this.validListeners) { |
l.validChange(null, getValidState()); |
} |
} |
} |
public RowValuesTableModel getRowValuesTableModel() { |
225,7 → 242,11 |
} |
public void updateField(String field, SQLRowValues rowVals) { |
this.model.updateField(field, rowVals); |
try { |
this.model.updateField(field, rowVals); |
} catch (SQLException e) { |
throw new IllegalStateException(e); |
} |
// Clear pour fixer le probleme avec les editframe et ne pas fermer la fenetre |
// sinon les elements pointront sur la nouveau devis et l'ancien les perdra |
clear(); |
232,7 → 253,12 |
} |
public void updateField(String field, int id) { |
this.model.updateField(field, id); |
try { |
this.model.updateField(field, id); |
} catch (SQLException e) { |
throw new IllegalStateException(e); |
} |
// Clear pour fixer le probleme avec les editframe et ne pas fermer la fenetre |
// sinon les elements pointront sur la nouveau devis et l'ancien les perdra |
clear(); |
239,7 → 265,11 |
} |
public void updateField(String field, int id, String fieldCondition) { |
this.model.updateField(field, id, fieldCondition); |
try { |
this.model.updateField(field, id, fieldCondition); |
} catch (SQLException e) { |
throw new IllegalStateException(e); |
} |
// Clear pour fixer le probleme avec les editframe et ne pas fermer la fenetre |
// sinon les elements pointront sur la nouveau devis et l'ancien les perdra |
clear(); |
246,7 → 276,12 |
} |
public void updateField(String field, SQLRowValues rowVals, String fieldCondition) { |
this.model.updateField(field, rowVals, fieldCondition); |
try { |
this.model.updateField(field, rowVals, fieldCondition); |
} catch (SQLException e) { |
throw new IllegalStateException(e); |
} |
// Clear pour fixer le probleme avec les editframe et ne pas fermer la fenetre |
// sinon les elements pointront sur la nouveau devis et l'ancien les perdra |
clear(); |
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/SQLTextComboTableCellEditor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
15,6 → 15,7 |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.SQLField; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.Where; |
57,7 → 58,7 |
private IListFrame listFrame = null; |
public SQLTextComboTableCellEditor(final SQLElement elt, final boolean addUndefined) { |
this(elt, addUndefined, false,null); |
this(elt, addUndefined, false, null); |
} |
/** |
77,7 → 78,7 |
* @param chooseInListe possibilité de choisir via une IListe |
*/ |
public SQLTextComboTableCellEditor(final SQLElement elt, final boolean addUndefined, boolean chooseInListe, List<String> fieldsInCombo) { |
super(); |
super(); |
this.addUndefined = addUndefined; |
88,7 → 89,7 |
this.comboBox.setBorder(new LineBorder(Color.black)); |
this.comboBox.getPulseComponents().iterator().next().setBorder(null); |
ComboSQLRequest c = fieldsInCombo == null || fieldsInCombo.isEmpty() ? elt.getComboRequest(true) : elt.createComboRequest(fieldsInCombo, null); |
ComboSQLRequest c = fieldsInCombo == null || fieldsInCombo.isEmpty() ? elt.getComboRequest(true) : elt.createComboRequest(fieldsInCombo, null); |
this.comboBox.uiInit(c); |
if (chooseInListe) { |
135,8 → 136,13 |
} |
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { |
this.val = (Integer) value; |
if (value instanceof Integer) { |
this.val = (Integer) value; |
} else if (value instanceof SQLRowAccessor) { |
this.val = ((SQLRowAccessor) value).getID(); |
} else if (value != null) { |
throw new IllegalArgumentException("value type error for : " + value); |
} |
this.comboBox.setValue(this.val); |
this.comboBox.grabFocus(); |
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/RowValuesTableModel.java |
---|
31,7 → 31,6 |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.utils.AlterTable; |
import org.openconcerto.utils.CompareUtils; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.ListMap; |
import org.openconcerto.utils.OrderedSet; |
58,6 → 57,8 |
// synchronized is used to protect list access |
private List<SQLRowValues> rowValues = new ArrayList<SQLRowValues>(); |
private final boolean debug = false; |
private OrderedSet<TableModelListener> tableModelListeners = new OrderedSet<TableModelListener>(); |
protected SQLElement element; |
78,6 → 79,8 |
private Where fillWhere; |
private boolean gestionReferentActive = false; |
public RowValuesTableModel() { |
} |
152,6 → 155,10 |
return this.defautRow; |
} |
public void setGestionReferentActive(boolean gestionReferent) { |
this.gestionReferentActive = gestionReferent; |
} |
public synchronized void addColumn(SQLTableElement e) { |
this.nbColumn++; |
this.list.add(e); |
177,7 → 184,7 |
SQLTableElement elt = this.list.get(columnIndex); |
boolean validate = false; |
boolean fieldValidate = false; |
if (this.validationField != null) { |
if (this.validationField != null && this.validationField.getTable().getName().equals(getSQLElement().getTable().getName())) { |
fieldValidate = elt.getField().getName().equalsIgnoreCase(this.validationField.getName()); |
validate = this.getRowValuesAt(rowIndex).getBoolean(this.validationField.getName()); |
} |
205,7 → 212,14 |
SQLTableElement sqlTableElem = this.list.get(columnIndex); |
Object storedObject = val.getObject(sqlTableElem.getRowField()); |
result = sqlTableElem.getValueFrom(val); |
if (sqlTableElem.getElementClass() != null && Number.class.isAssignableFrom(sqlTableElem.getElementClass()) && !CompareUtils.equals(result, storedObject)) { |
final Object resultToCheck; |
if (sqlTableElem.getElementClass() != null && Number.class.isAssignableFrom(sqlTableElem.getElementClass()) && result != null && SQLRowAccessor.class.isAssignableFrom(result.getClass()) |
&& storedObject != null && Number.class.isAssignableFrom(storedObject.getClass())) { |
resultToCheck = ((SQLRowAccessor) result).getIDNumber(); |
} else { |
resultToCheck = result; |
} |
if (sqlTableElem.getElementClass() != null && Number.class.isAssignableFrom(sqlTableElem.getElementClass()) && !CompareUtils.equals(resultToCheck, storedObject)) { |
fireTableDataChanged(); |
} |
224,6 → 238,11 |
} |
public void putValue(Object value, int rowIndex, String fieldName, boolean forcedFire) { |
if (debug) { |
System.err.println("putValue(row:" + rowIndex + "]) :" + value + "(" + value.getClass() + " fieldName : " + fieldName + ")"); |
Thread.dumpStack(); |
} |
checkEDT(); |
final SQLRowValues rowVal = this.rowValues.get(rowIndex); |
Object oldValue = rowVal.getObject(fieldName); |
259,6 → 278,7 |
if (oldValue != null && oldValue.equals(aValue)) { |
return; |
} |
try { |
SQLTableElement sqlTableElem = this.list.get(columnIndex); |
267,10 → 287,6 |
if (realVal == null || realVal.getClass() == this.getColumnClass(columnIndex)) { |
sqlTableElem.setValueFrom(rowVal, realVal); |
fireTableChanged(new TableModelEvent(this, rowIndex, rowIndex, columnIndex)); |
} else { |
System.err.println("RowValuesTableModel:setValueAt:" + realVal + "(" + realVal.getClass() + ") at (row:" + rowIndex + "/col:" + columnIndex + ") column class : " |
+ this.getColumnClass(columnIndex)); |
Thread.dumpStack(); |
} |
} catch (Exception e) { |
// can append when stop editing occur while removing a line |
295,8 → 311,10 |
/** |
* Valider les modifications dans la base |
* |
* @throws SQLException |
*/ |
public void commitData() { |
public void commitData() throws SQLException { |
commitData(false); |
} |
303,75 → 321,103 |
/** |
* Valider les modifications dans la base |
*/ |
public void commitData(boolean useMultipleInsertUpdate) { |
public void commitData(boolean useMultipleInsertUpdate) throws SQLException { |
checkEDT(); |
final List<SQLRowValues> rowsToCommmit = new ArrayList<SQLRowValues>(); |
rowsToCommmit.addAll(this.rowValues); |
try { |
final SQLTable table = getDefaultRowValues().getTable(); |
// Remove constraint on ORDRE for private |
final Constraint constraint = table.getConstraint(ConstraintType.UNIQUE, Arrays.asList(table.getOrderField().getName())); |
if (constraint != null) { |
final String req = new AlterTable(table).dropConstraint(constraint.getName()).asString(); |
table.getDBSystemRoot().getDataSource().execute(req); |
table.fetchFields(); |
table.getSchema().updateVersion(); |
} |
BigDecimal o = table.getMaxOrder(Boolean.FALSE); |
final int size = rowsToCommmit.size(); |
final SQLTable table = getDefaultRowValues().getTable(); |
// Remove constraint on ORDRE for private |
final Constraint constraint = table.getConstraint(ConstraintType.UNIQUE, Arrays.asList(table.getOrderField().getName())); |
if (constraint != null) { |
final String req = new AlterTable(table).dropConstraint(constraint.getName()).asString(); |
table.getDBSystemRoot().getDataSource().execute(req); |
table.fetchFields(); |
table.getSchema().updateVersion(); |
} |
if (useMultipleInsertUpdate) { |
List<SQLUpdate> updates = new ArrayList<>(); |
ListMap<List<SQLField>, SQLInsert> mapInsertByFields = new ListMap<>(); |
ListMap<List<SQLField>, SQLRowValues> mapInsertRowValues = new ListMap<>(); |
BigDecimal o = table.getMaxOrder(Boolean.FALSE); |
final int size = rowsToCommmit.size(); |
for (int i = 0; i < size; i++) { |
final SQLRowValues r = rowsToCommmit.get(i); |
r.put(r.getTable().getOrderField().getFieldName(), o.add(new BigDecimal(i + 1))); |
if (r.hasID()) { |
SQLUpdate up = new SQLUpdate(new Where(table.getKey(), "=", r.getID())); |
up.importValuesFrom(r); |
updates.add(up); |
} else { |
SQLInsert insert = new SQLInsert(); |
insert.importValuesFrom(r); |
List<SQLField> fields = insert.getFields(); |
mapInsertByFields.add(fields, insert); |
mapInsertRowValues.add(fields, r); |
if (useMultipleInsertUpdate) { |
List<SQLUpdate> updates = new ArrayList<>(); |
ListMap<List<SQLField>, SQLInsert> mapInsertByFields = new ListMap<>(); |
ListMap<List<SQLField>, SQLRowValues> mapInsertRowValues = new ListMap<>(); |
for (int i = 0; i < size; i++) { |
final SQLRowValues r = rowsToCommmit.get(i); |
r.put(r.getTable().getOrderField().getFieldName(), o.add(new BigDecimal(i + 1))); |
if (r.hasID()) { |
SQLUpdate up = new SQLUpdate(new Where(table.getKey(), "=", r.getID())); |
up.importValuesFrom(r); |
updates.add(up); |
} else { |
SQLInsert insert = new SQLInsert(); |
insert.importValuesFrom(r); |
List<SQLField> fields = insert.getFields(); |
mapInsertByFields.add(fields, insert); |
mapInsertRowValues.add(fields, r); |
} |
} |
if (!mapInsertByFields.isEmpty()) { |
for (List<SQLField> fieldSize : mapInsertByFields.keySet()) { |
List<Number> ids = SQLInsert.executeSimilarInserts(table.getDBSystemRoot(), mapInsertByFields.get(fieldSize), true); |
List<SQLRowValues> insertsRowValues = mapInsertRowValues.get(fieldSize); |
if (ids.size() == insertsRowValues.size()) { |
for (int i = 0; i < ids.size(); i++) { |
final SQLRowValues r = insertsRowValues.get(i); |
r.setID(ids.get(i)); |
} |
} |
} |
if (!mapInsertByFields.isEmpty()) { |
for (List<SQLField> fieldSize : mapInsertByFields.keySet()) { |
List<Number> ids = SQLInsert.executeSimilarInserts(table.getDBSystemRoot(), mapInsertByFields.get(fieldSize), true); |
List<SQLRowValues> insertsRowValues = mapInsertRowValues.get(fieldSize); |
if (ids.size() == insertsRowValues.size()) { |
for (int i = 0; i < ids.size(); i++) { |
final SQLRowValues r = insertsRowValues.get(i); |
r.setID(ids.get(i)); |
} |
} |
if (!updates.isEmpty()) { |
SQLUpdate.executeMultipleWithBatch(table.getDBSystemRoot(), updates); |
} |
if (this.gestionReferentActive) { |
// Traitement des référents |
List<SQLInsert> insertsRefs = new ArrayList<>(); |
List<SQLUpdate> updatesRefs = new ArrayList<>(); |
for (SQLRowValues rowVals : rowsToCommmit) { |
final Collection<SQLRowValues> referentRows = rowVals.getReferentRows(); |
System.err.println(referentRows.size() + " ref Rows pour RowValues " + rowVals); |
for (SQLRowValues refRow : referentRows) { |
System.err.println("\t" + refRow); |
if (refRow.hasID()) { |
SQLUpdate update = new SQLUpdate(new Where(refRow.getTable().getKey(), "=", refRow.getID())); |
update.importValuesFrom(refRow); |
updatesRefs.add(update); |
} else { |
SQLInsert insert = new SQLInsert(); |
insert.importValuesFrom(refRow); |
System.err.println("\t\t" + insert.asString()); |
insertsRefs.add(insert); |
} |
} |
} |
if (!insertsRefs.isEmpty()) { |
SQLInsert.executeMultiple(table.getDBSystemRoot(), insertsRefs); |
} |
if (!updates.isEmpty()) { |
SQLUpdate.executeMultipleWithBatch(table.getDBSystemRoot(), updates); |
if (!updatesRefs.isEmpty()) { |
SQLUpdate.executeMultipleWithBatch(table.getDBSystemRoot(), updatesRefs); |
} |
table.fireTableModified(-1); |
} else { |
for (int i = 0; i < size; i++) { |
final SQLRowValues r = rowsToCommmit.get(i); |
r.put(r.getTable().getOrderField().getFieldName(), o.add(new BigDecimal(i + 1))); |
final StoreResult store = r.getGraph().store(StoreMode.COMMIT, false); |
final SQLRow row = store.getStoredRow(r); |
r.setID(row.getIDNumber()); |
} |
} |
} catch (SQLException e) { |
ExceptionHandler.handle("Unable to commit rows", e); |
table.fireTableModified(-1); |
} else { |
for (int i = 0; i < size; i++) { |
final SQLRowValues r = rowsToCommmit.get(i); |
r.put(r.getTable().getOrderField().getFieldName(), o.add(new BigDecimal(i + 1))); |
final StoreResult store = r.getGraph().store(StoreMode.COMMIT, false); |
final SQLRow row = store.getStoredRow(r); |
r.setID(row.getIDNumber()); |
} |
} |
} |
542,7 → 588,7 |
return this.list; |
} |
public void updateField(String field, SQLRowValues rowVals, String fieldCondition) { |
public void updateField(String field, SQLRowValues rowVals, String fieldCondition) throws SQLException { |
checkEDT(); |
if (rowVals != null) { |
int stop = this.rowValues.size(); |
590,12 → 636,9 |
} |
} |
this.rowValuesDeleted.clear(); |
try { |
this.element.archive(toArchive); |
} catch (SQLException e) { |
throw new IllegalStateException("Unable to archive rows : " + toArchive, e); |
} |
this.element.archive(toArchive); |
if (id != SQLRow.NONEXISTANT_ID) { |
this.commitData(); |
} |
602,15 → 645,15 |
} |
} |
public void updateField(String field, SQLRowValues rowVals) { |
public void updateField(String field, SQLRowValues rowVals) throws SQLException { |
updateField(field, rowVals, null); |
} |
public void updateField(String field, int id) { |
public void updateField(String field, int id) throws SQLException { |
updateField(field, id, null); |
} |
public void updateField(String field, int id, String fieldCondition) { |
public void updateField(String field, int id, String fieldCondition) throws SQLException { |
if (id > 0) { |
updateField(field, this.element.getTable().getForeignTable(field).getRow(id).createUpdateRow(), fieldCondition); |
} |
667,26 → 710,13 |
final List<SQLRowValues> newRows = new ArrayList<SQLRowValues>(); |
final SQLTable table = RowValuesTableModel.this.element.getTable(); |
if (rowVals.hasID() && !rowVals.isUndefined() && rowVals.getID() != SQLRow.NONEXISTANT_ID) { |
SQLRow row = rowVals.getTable().getRow(rowVals.getID()); |
List<SQLRow> rowSet; |
if (referentField == null) { |
rowSet = row.getReferentRows(RowValuesTableModel.this.element.getTable()); |
} else { |
rowSet = row.getReferentRows(referentField); |
} |
for (SQLRow row2 : rowSet) { |
if (fieldWhere == null || CompareUtils.equals(row2.getObject(fieldWhere.getName()), value)) { |
SQLRowValues rowVals2 = new SQLRowValues(RowValuesTableModel.this.element.getTable()); |
rowVals2.loadAbsolutelyAll(row2); |
newRows.add(rowVals2); |
} |
} |
newRows.addAll(fetchDataFromDB(rowVals, referentField, fieldWhere, value)); |
} else { |
final Collection<? extends SQLRowAccessor> colRows; |
if (referentField == null) { |
colRows = rowVals.getReferentRows(RowValuesTableModel.this.element.getTable()); |
colRows = rowVals.getReferentRows(table); |
} else { |
colRows = rowVals.getReferentRows(referentField); |
} |
704,6 → 734,27 |
} |
} |
public List<SQLRowValues> fetchDataFromDB(final SQLRowAccessor rowVals, final SQLField referentField, final SQLField fieldWhere, final Object value) { |
final List<SQLRowValues> newRows = new ArrayList<>(); |
final SQLTable table = getSQLElement().getTable(); |
SQLRow row = rowVals.getTable().getRow(rowVals.getID()); |
List<SQLRow> rowSet; |
if (referentField == null) { |
rowSet = row.getReferentRows(table); |
} else { |
rowSet = row.getReferentRows(referentField); |
} |
for (SQLRow row2 : rowSet) { |
if (fieldWhere == null || CompareUtils.equals(row2.getObject(fieldWhere.getName()), value)) { |
SQLRowValues rowVals2 = new SQLRowValues(table); |
rowVals2.loadAbsolutelyAll(row2); |
newRows.add(rowVals2); |
} |
} |
return newRows; |
} |
public void addRow(SQLRowValues row) { |
checkEDT(); |
addRow(row, true); |
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/RowValuesTableControlPanel.java |
---|
28,6 → 28,7 |
import javax.swing.ImageIcon; |
import javax.swing.JButton; |
import javax.swing.JOptionPane; |
import javax.swing.JPanel; |
import javax.swing.event.ListSelectionEvent; |
import javax.swing.event.ListSelectionListener; |
133,14 → 134,31 |
} |
SQLField validationField = RowValuesTableControlPanel.this.model.getValidationField(); |
if (validationField != null) { |
boolean canDelete = true; |
for (int i : table.getSelectedRows()) { |
SQLRowValues rowVals = RowValuesTableControlPanel.this.model.getRowValuesAt(i); |
canDelete &= (!rowVals.contains(validationField.getName()) || rowVals.getObject(validationField.getName()) == null || !rowVals.getBoolean(validationField.getName())); |
if (validationField.getTable().getName().equals(RowValuesTableControlPanel.this.model.getSQLElement().getTable().getName())) { |
boolean canDelete = true; |
for (int i : table.getSelectedRows()) { |
SQLRowValues rowVals = RowValuesTableControlPanel.this.model.getRowValuesAt(i); |
canDelete &= (!rowVals.contains(validationField.getName()) || rowVals.getObject(validationField.getName()) == null || !rowVals.getBoolean(validationField.getName())); |
} |
if (canDelete) { |
RowValuesTableControlPanel.this.model.removeRowsAt(table.getSelectedRows()); |
} else { |
JOptionPane.showMessageDialog(buttonSuppr, "Impossible de supprimer une ligne validée"); |
} |
} else { |
boolean canDelete = true; |
for (int i : table.getSelectedRows()) { |
SQLRowValues rowVals = RowValuesTableControlPanel.this.model.getRowValuesAt(i); |
if (rowVals.hasID()) { |
canDelete &= rowVals.asRow().getReferentRows(validationField).isEmpty(); |
} |
} |
if (canDelete) { |
RowValuesTableControlPanel.this.model.removeRowsAt(table.getSelectedRows()); |
} else { |
JOptionPane.showMessageDialog(buttonSuppr, "Impossible de supprimer une ligne référencée"); |
} |
} |
if (canDelete) { |
RowValuesTableControlPanel.this.model.removeRowsAt(table.getSelectedRows()); |
} |
// MAYBE show popup if can't delete |
} else { |
RowValuesTableControlPanel.this.model.removeRowsAt(table.getSelectedRows()); |
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/SQLTableElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
347,7 → 347,8 |
if (this.getModifier() != null) { |
result = this.getModifier().getValueFrom(row, this); |
// Test pour corriger les incohérences de BD (ex: PRIX_METRIQUE_VT_1 = 30 et PV_HT=0) |
if (this.getElementClass() != null && Number.class.isAssignableFrom(this.getElementClass()) && !CompareUtils.equals(result, row.getObject(this.rowField))) { |
if (this.getElementClass() != null && Number.class.isAssignableFrom(this.getElementClass()) && !row.getTable().getField(this.rowField).isForeignKey() |
&& !CompareUtils.equals(result, row.getObject(this.rowField))) { |
row.put(this.rowField, result); |
fireModification(row); |
} |
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/KeyTableCellRenderer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
15,6 → 15,7 |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLTable.ListenerAndConfig; |
import org.openconcerto.sql.model.SQLTableEvent; |
61,7 → 62,7 |
return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); |
} |
public void setValue(Object value) { |
protected void setValue(Object value) { |
if (this.isLoading) { |
this.toSelect = value; |
76,29 → 77,35 |
} |
try { |
if (value instanceof SQLRowValues) { |
newValue = ((SQLRowValues) value).getString("CODE"); |
// if (value instanceof SQLRowValues) { |
// newValue = ((SQLRowValues) value).getID();// getString("CODE"); |
// } else { |
final int id; |
if (value instanceof SQLRowAccessor) { |
id = ((SQLRowAccessor) value).getID();// getString("CODE"); |
} else { |
id = Integer.parseInt(value.toString()); |
} |
Number undefID = this.el.getTable().getUndefinedIDNumber(); |
if (undefID == null || id > undefID.intValue()) { |
IComboSelectionItem item = cacheMap.get(this.el).get(id); |
if (item != null) { |
newValue = item.getLabel(); |
} |
final int id = Integer.parseInt(value.toString()); |
Number undefID = this.el.getTable().getUndefinedIDNumber(); |
if (undefID == null || id > undefID.intValue()) { |
IComboSelectionItem item = cacheMap.get(this.el).get(id); |
if (item != null) { |
newValue = item.getLabel(); |
} |
// else { |
// else { |
// TODO créer une liste des ids à reloader |
// this.toSelect = value; |
// setText("Chargement ..."); |
// loadCacheAsynchronous(); |
// } |
} else { |
newValue = SQLTableElement.UNDEFINED_STRING; |
} |
// TODO créer une liste des ids à reloader |
// this.toSelect = value; |
// setText("Chargement ..."); |
// loadCacheAsynchronous(); |
// } |
} else { |
newValue = SQLTableElement.UNDEFINED_STRING; |
} |
// } |
} catch (NumberFormatException e) { |
e.printStackTrace(); |
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/IListe.java |
---|
49,6 → 49,7 |
import org.openconcerto.ui.MenuUtils; |
import org.openconcerto.ui.PopupMouseListener; |
import org.openconcerto.ui.SwingThreadUtils; |
import org.openconcerto.ui.WrapLayout; |
import org.openconcerto.ui.list.selection.BaseListStateModel; |
import org.openconcerto.ui.list.selection.ListSelection; |
import org.openconcerto.ui.list.selection.ListSelectionState; |
602,7 → 603,7 |
// car les updates du ITableModel se font de manière synchrone dans la EDT |
// donc on ne peut faire aucune action pendant les maj |
this.btnPanel = new JPanel(new FlowLayout(FlowLayout.LEADING)); |
this.btnPanel = new JPanel(new WrapLayout()); |
this.addListenerOnModel(new PropertyChangeListener() { |
@Override |
public void propertyChange(PropertyChangeEvent evt) { |
/trunk/OpenConcerto/src/org/openconcerto/sql/ui/ConnexionPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
47,8 → 47,10 |
import java.awt.event.ActionListener; |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.text.DateFormat; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Date; |
import java.util.List; |
import java.util.Locale; |
import java.util.ResourceBundle; |
319,6 → 321,7 |
final JPopupMenu menu = new JPopupMenu(); |
final Locale locale = UserProps.getInstance().getLocale(); |
for (final Locale l : ConnexionPanel.this.localesToDisplay) { |
System.err.println("ConnexionPanel.ConnexionPanel(...).new ActionListener() {...}.actionPerformed()" + l); |
final JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(l.getDisplayName(l)); |
if (l.equals(locale)) { |
menuItem.setSelected(true); |
506,6 → 509,8 |
} |
protected void setUILanguage(Locale locale) { |
System.err.println("ConnexionPanel.setUILanguage()" + locale + " : " + locale.getDisplayName()); |
final ResourceBundle bundle = ResourceBundle.getBundle(this.localeBaseName, locale, TranslationManager.getControl()); |
this.adminLogin = bundle.getString("adminLogin"); |
this.loginLabel.setText(bundle.getString("loginLabel")); |
528,5 → 533,8 |
// throw RuntimeException like ResourceBundle.getBundle() at the beginning of this |
// method |
TranslationManager.createDefaultInstance(); |
DateFormat df = DateFormat.getDateInstance(); |
System.err.println("ConnexionPanel.setUILanguage() Date :" + Locale.getDefault() + " : " + new Date() + ": format: " + df.format(new Date())); |
System.err.println("ConnexionPanel.setUILanguage() Category :" + Locale.getDefault(Locale.Category.FORMAT)); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/sql/ui/light/LightRowValuesTableOnline.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
25,6 → 25,7 |
import org.openconcerto.ui.light.TableSearchParameterType; |
import org.openconcerto.ui.light.UserSearch; |
import org.openconcerto.ui.light.UserSearchItem; |
import org.openconcerto.utils.StringUtils; |
import org.openconcerto.utils.cc.ITransformer; |
import java.util.ArrayList; |
101,10 → 102,21 |
String searchType = item.getType(); |
TableSearchMatcher m = LightRowValuesTableOnline.this.getSearchMatcher(colId, searchType); |
if (m != null) { |
final Where where = m.getWhere(sel, new TableSearchParameterType(searchType), userText); |
if (where != null) { |
wheres.add(where); |
if (searchType.equals(UserSearchItem.TYPE_CONTAINS)) { |
List<String> textParts = StringUtils.fastSplitTrimmed(userText, ' '); |
for (String p : textParts) { |
final Where where = m.getWhere(sel, new TableSearchParameterType(searchType), p); |
if (where != null) { |
wheres.add(where); |
} |
} |
} else { |
final Where where = m.getWhere(sel, new TableSearchParameterType(searchType), userText); |
if (where != null) { |
wheres.add(where); |
} |
} |
} else { |
Log.get().warning("no TableSearchMatcher for " + item); |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/protocol/jarjar/Handler.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/protocol/Helper.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/NoneSelectedButtonGroup.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/OSFamily.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/EnumOrderedSet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/DragUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/OrderedSet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/JavaTimeSQLConvertors.java |
---|
New file |
0,0 → 1,52 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.utils.convertor; |
public class JavaTimeSQLConvertors { |
static public ValueConvertor<java.time.LocalTime, java.sql.Time> LOCAL_TIME = new NullIsNullConvertor<java.time.LocalTime, java.sql.Time>() { |
@Override |
protected java.sql.Time convertNonNull(java.time.LocalTime o) { |
return java.sql.Time.valueOf(o); |
} |
@Override |
protected java.time.LocalTime unconvertNonNull(java.sql.Time o) { |
return o.toLocalTime(); |
} |
}; |
static public ValueConvertor<java.time.LocalDate, java.sql.Date> LOCAL_DATE = new NullIsNullConvertor<java.time.LocalDate, java.sql.Date>() { |
@Override |
protected java.sql.Date convertNonNull(java.time.LocalDate o) { |
return java.sql.Date.valueOf(o); |
} |
@Override |
protected java.time.LocalDate unconvertNonNull(java.sql.Date o) { |
return o.toLocalDate(); |
} |
}; |
static public ValueConvertor<java.time.LocalDateTime, java.sql.Timestamp> LOCAL_DATETIME = new NullIsNullConvertor<java.time.LocalDateTime, java.sql.Timestamp>() { |
@Override |
protected java.sql.Timestamp convertNonNull(java.time.LocalDateTime o) { |
return java.sql.Timestamp.valueOf(o); |
} |
@Override |
protected java.time.LocalDateTime unconvertNonNull(java.sql.Timestamp o) { |
return o.toLocalDateTime(); |
} |
}; |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/DateTSConvertor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/ValueConvertorFactory.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
14,10 → 14,15 |
package org.openconcerto.utils.convertor; |
import org.openconcerto.utils.ReflectUtils; |
import org.openconcerto.utils.Tuple2.List2; |
import org.openconcerto.utils.cache.LRUMap; |
import java.util.ArrayList; |
import java.util.List; |
import java.util.Map; |
import net.jcip.annotations.GuardedBy; |
public final class ValueConvertorFactory { |
@SuppressWarnings("rawtypes") |
32,39 → 37,102 |
return o; |
} |
}; |
private static final ValueConvertor<?, ?> MISSING_CONV = new ValueConvertor<Void, Void>() { |
@Override |
public Void convert(Void o) { |
return null; |
} |
@Override |
public Void unconvert(Void o) { |
return null; |
} |
}; |
@SuppressWarnings("unchecked") |
public static final <T> ValueConvertor<T, T> getIdentityConvertor() { |
return (ValueConvertor<T, T>) IdentityConvertor; |
return IdentityConvertor; |
} |
private static final List<ValueConvertor<?, ?>> convs; |
private static final List<ValueConvertor<?, ?>> STRICT_CONVERTORS; |
private static final List<ValueConvertor<?, ?>> LENIENT_CONVERTORS; |
@GuardedBy("self") |
private static Map<List2<Class<?>>, ValueConvertor<?, ?>> CACHE = new LRUMap<>(512, 32); |
@GuardedBy("self") |
private static Map<List2<Class<?>>, ValueConvertor<?, ?>> LENIENT_CACHE = new LRUMap<>(512, 32); |
static { |
convs = new ArrayList<ValueConvertor<?, ?>>(); |
convs.add(new DateTSConvertor()); |
convs.add(new DateToSQLConvertor()); |
convs.add(new DateToTimeConvertor()); |
convs.add(StringClobConvertor.INSTANCE); |
convs.add(NumberConvertor.INT_TO_LONG); |
convs.add(NumberConvertor.SHORT_TO_INT); |
// common |
LENIENT_CONVERTORS = new ArrayList<>(); |
STRICT_CONVERTORS = new ArrayList<>(); |
LENIENT_CONVERTORS.add(new DateTSConvertor()); |
LENIENT_CONVERTORS.add(new DateToSQLConvertor()); |
LENIENT_CONVERTORS.add(new DateToTimeConvertor()); |
LENIENT_CONVERTORS.add(NumberConvertor.INT_TO_LONG); |
LENIENT_CONVERTORS.add(NumberConvertor.SHORT_TO_INT); |
LENIENT_CONVERTORS.add(JavaTimeSQLConvertors.LOCAL_DATE); |
LENIENT_CONVERTORS.add(JavaTimeSQLConvertors.LOCAL_TIME); |
LENIENT_CONVERTORS.add(JavaTimeSQLConvertors.LOCAL_DATETIME); |
STRICT_CONVERTORS.addAll(LENIENT_CONVERTORS); |
STRICT_CONVERTORS.add(StringClobConvertor.INSTANCE); |
STRICT_CONVERTORS.add(NumberConvertor.INT_TO_BIGDECIMAL_EXACT); |
LENIENT_CONVERTORS.add(StringClobConvertor.INSTANCE_LENIENT); |
} |
@SuppressWarnings("unchecked") |
public static final <T, U> U convert(final T o, final Class<U> c2, final boolean lenient) { |
if (c2.isInstance(o)) |
return c2.cast(o); |
@SuppressWarnings("unchecked") |
final ValueConvertor<T, U> conv = (ValueConvertor<T, U>) find(o.getClass(), c2, lenient); |
if (conv == null) |
throw new IllegalArgumentException("No convertor to " + c2 + " from " + o); |
return conv.convert(o); |
} |
public static final <T, U> ValueConvertor<T, U> find(Class<T> c1, Class<U> c2) { |
if (c1 == c2) |
return (ValueConvertor<T, U>) getIdentityConvertor(); |
for (final ValueConvertor<?, ?> vc : convs) { |
return find(c1, c2, false); |
} |
public static final <T, U> ValueConvertor<T, U> find(Class<T> c1, Class<U> c2, final boolean lenient) { |
final ValueConvertor<?, ?> res; |
if (c1 == c2) { |
res = getIdentityConvertor(); |
} else { |
final List2<Class<?>> key = new List2<>(c1, c2); |
final Map<List2<Class<?>>, ValueConvertor<?, ?>> c = lenient ? LENIENT_CACHE : CACHE; |
synchronized (c) { |
final ValueConvertor<?, ?> inCache = c.get(key); |
if (inCache == MISSING_CONV) { |
return null; |
} else if (inCache != null) { |
res = inCache; |
} else { |
res = create(c1, c2, lenient); |
c.put(key, res == null ? MISSING_CONV : res); |
} |
} |
} |
@SuppressWarnings("unchecked") |
final ValueConvertor<T, U> casted = (ValueConvertor<T, U>) res; |
return casted; |
} |
private static final ValueConvertor<?, ?> create(Class<?> c1, Class<?> c2, final boolean lenient) { |
assert c1 != c2; |
for (final ValueConvertor<?, ?> vc : (lenient ? LENIENT_CONVERTORS : STRICT_CONVERTORS)) { |
final List<Class<?>> args = ReflectUtils.getTypeArguments(vc, ValueConvertor.class); |
if (args.size() != 2) |
throw new IllegalStateException(vc + " don't specify type arguments"); |
if (args.get(0).equals(c1) && args.get(1).equals(c2)) { |
return (ValueConvertor<T, U>) vc; |
return vc; |
} else if (args.get(0).equals(c2) && args.get(1).equals(c1)) { |
return new ReverseConvertor<T, U>((ValueConvertor<U, T>) vc); |
return ReverseConvertor.create(vc); |
} |
} |
if (Number.class.isAssignableFrom(c1) && Number.class.isAssignableFrom(c2)) |
return (ValueConvertor<T, U>) NumberConvertor.create(c1.asSubclass(Number.class), c2.asSubclass(Number.class), true); |
return NumberConvertor.create(c1.asSubclass(Number.class), c2.asSubclass(Number.class), !lenient); |
return null; |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/StringClobConvertor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/NumberConvertor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
28,7 → 28,7 |
@Override |
public Integer unconvert(Long o) { |
return o.intValue(); |
return Math.toIntExact(o.longValue()); |
} |
}; |
40,10 → 40,25 |
@Override |
public Short unconvert(Integer o) { |
return o.shortValue(); |
final short res = o.shortValue(); |
if (res != o.intValue()) |
throw new OverflowException(o, Short.class); |
return res; |
} |
}; |
public static final NumberConvertor<Integer, BigDecimal> INT_TO_BIGDECIMAL_EXACT = new NumberConvertor<Integer, BigDecimal>() { |
@Override |
public BigDecimal convert(Integer o) { |
return BigDecimal.valueOf(o.longValue()); |
} |
@Override |
public Integer unconvert(BigDecimal o) { |
return o.intValueExact(); |
} |
}; |
public static final <N1 extends Number, N2 extends Number> NumberConvertor<N1, N2> create(final Class<N1> c1, final Class<N2> c2, final boolean exact) { |
return new NumberConvertor<N1, N2>() { |
@Override |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/ReverseConvertor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
15,6 → 15,11 |
public class ReverseConvertor<T, U> implements ValueConvertor<T, U> { |
// avoid illegal new ReverseConvertor<?,?>() |
public static final <T, U> ReverseConvertor<T, U> create(ValueConvertor<U, T> o) { |
return new ReverseConvertor<>(o); |
} |
private final ValueConvertor<U, T> delegate; |
public ReverseConvertor(ValueConvertor<U, T> delegate) { |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/ValueConvertor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/DateToTimeConvertor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/DateToSQLConvertor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/NullIsNullConvertor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Matrix.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/CopyOnWriteMap.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/ConstantFactory.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/TransformedMap.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/IClosure.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/ITransformerExn.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/TransformerFuture.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/TransformedSet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/IExnClosure.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/ITransformerFuture.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/ClosureFuture.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/Factory.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/ExnTransformer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/IFactory.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/IClosureFuture.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/CustomEquals.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/ExnClosure.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/TruncatableList.java |
---|
New file |
0,0 → 1,87 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.utils.cc; |
import java.util.Collections; |
import java.util.List; |
import java.util.Objects; |
public final class TruncatableList<T> { |
@SuppressWarnings("rawtypes") |
private static final TruncatableList EMPTY_LIST = new TruncatableList<>(Collections.emptyList(), false); |
@SuppressWarnings("unchecked") |
public static final <T> TruncatableList<T> empty() { |
return EMPTY_LIST; |
} |
/** |
* Create an instance from the passed list. |
* |
* @param <T> type of items. |
* @param l the list to use. |
* @param maxCount the maximum item count desired, negative meaning no limit. |
* @return a new instance with a view (not a copy) of the passed list. |
*/ |
static public final <T> TruncatableList<T> create(final List<T> l, final int maxCount) { |
final boolean truncated = maxCount >= 0 && l.size() > maxCount; |
return new TruncatableList<T>(truncated ? l.subList(0, maxCount) : l, truncated); |
} |
private final List<T> list; |
private final boolean truncated; |
public TruncatableList(List<T> list, boolean truncated) { |
super(); |
this.list = Objects.requireNonNull(list); |
this.truncated = truncated; |
} |
public final List<T> getList() { |
return this.list; |
} |
public final boolean isTruncated() { |
return this.truncated; |
} |
public final TruncatableList<T> truncate(final int maxCount) { |
if (this.getList().size() <= maxCount) |
return this; |
return new TruncatableList<>(this.getList().subList(0, maxCount), true); |
} |
@Override |
public int hashCode() { |
return Objects.hash(this.list, this.truncated); |
} |
@Override |
public boolean equals(Object obj) { |
if (this == obj) |
return true; |
if (obj == null) |
return false; |
if (getClass() != obj.getClass()) |
return false; |
final TruncatableList<?> other = (TruncatableList<?>) obj; |
return Objects.equals(this.list, other.list) && this.truncated == other.truncated; |
} |
@Override |
public String toString() { |
return this.getClass().getSimpleName() + (this.isTruncated() ? " truncated : " : " not truncated : ") + this.getList(); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/MatchedList.java |
---|
New file |
0,0 → 1,80 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.utils.cc; |
import org.openconcerto.utils.ExceptionUtils; |
import java.util.BitSet; |
import java.util.Collections; |
import java.util.List; |
import java.util.Objects; |
import java.util.function.Function; |
import net.jcip.annotations.Immutable; |
@Immutable |
public class MatchedList<T> { |
@SuppressWarnings("rawtypes") |
private static final MatchedList EMPTY_LIST = new MatchedList<>(TruncatableList.empty(), null, Collections.emptyList()); |
@SuppressWarnings("unchecked") |
public static final <T> MatchedList<T> empty() { |
return EMPTY_LIST; |
} |
public static final <T> MatchedList<T> createNotFiltered(TruncatableList<T> truncatableItems) { |
return new MatchedList<T>(truncatableItems, null, null); |
} |
public static final <T> MatchedList<T> createFiltered(TruncatableList<T> truncatableItems, Function<? super T, String> asString, List<BitSet> matchedIndexes) { |
return new MatchedList<T>(truncatableItems, Objects.requireNonNull(asString), Objects.requireNonNull(matchedIndexes)); |
} |
// ATTN none of the attributes are copied/immutable |
private final TruncatableList<T> items; |
private final Function<? super T, String> asString; |
private final List<BitSet> matchedIndexes; |
private MatchedList(TruncatableList<T> truncatableItems, Function<? super T, String> asString, List<BitSet> matchedIndexes) { |
this.items = Objects.requireNonNull(truncatableItems); |
this.asString = asString; |
this.matchedIndexes = matchedIndexes; |
if (matchedIndexes != null) |
ExceptionUtils.requireEquals(truncatableItems.getList().size(), matchedIndexes.size(), "Size mismatch"); |
} |
public final TruncatableList<T> getTruncatableList() { |
return this.items; |
} |
public final List<T> getList() { |
return this.getTruncatableList().getList(); |
} |
public final Function<? super T, String> getAsString() { |
return this.asString; |
} |
/** |
* For each item in {@link #getList() the list}, the indexes in the {@link #getAsString() string |
* representation} which matched. |
* |
* @return the matching indexes, can be <code>null</code>. |
*/ |
public final List<BitSet> getMatchedIndexes() { |
return this.matchedIndexes; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/Transformer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/AbstractMapDecorator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/HashingStrategy.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/IdentitySet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/IPredicate.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/ITransformer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/Closure.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Backup.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/JImageAsynchronous.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Tuple2.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/SleepingQueue.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/RecursionType.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ClipboardUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/SortDirection.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/CopyUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/AbstractXMLDateFormat.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/PrefType.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/FeatureMode.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/LogUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/StringCodec.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/MessageDigestUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ArrayListOfInt.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/ValidState.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/EmptyChangeSupport.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/EmptyObjFromVO.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/ValidChangeSupport.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/ValueObject.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/EmptyListener.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/ValidListener.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/ValidObjectCombiner.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/ValidObject.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/ChainValidListener.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/EmptyObj.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/EmptyObjHelper.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/ChainPropertyListener.java |
---|
New file |
0,0 → 1,87 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.utils.checks; |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.util.function.Consumer; |
/** |
* Allow to propagate an event for another object, but still appear as the source of changes. |
* |
* @author Sylvain |
*/ |
public final class ChainPropertyListener implements PropertyChangeListener { |
static public final PropertyChangeEvent copyEvent(final Object bean, final PropertyChangeEvent evt) { |
return copyEvent(bean, evt.getPropertyName(), evt); |
} |
static public final PropertyChangeEvent copyEvent(final Object bean, final String propName, final PropertyChangeEvent evt) { |
final PropertyChangeEvent res = new PropertyChangeEvent(bean, propName, evt.getOldValue(), evt.getNewValue()); |
res.setPropagationId(evt.getPropagationId()); |
return res; |
} |
private final Consumer<PropertyChangeEvent> delegate; |
private final Object target; |
private final String propName; |
public ChainPropertyListener(Object target, PropertyChangeListener delegate) { |
this(target, null, delegate::propertyChange); |
} |
public ChainPropertyListener(final Object target, final String propName, final Consumer<PropertyChangeEvent> delegate) { |
if (target == null || delegate == null) |
throw new NullPointerException(); |
this.target = target; |
this.propName = propName; |
this.delegate = delegate; |
} |
public final String getPropName() { |
return this.propName; |
} |
private final String getPropName(PropertyChangeEvent evt) { |
return this.propName != null ? this.propName : evt.getPropertyName(); |
} |
@Override |
public void propertyChange(PropertyChangeEvent evt) { |
this.delegate.accept(copyEvent(this.target, this.getPropName(evt), evt)); |
} |
@Override |
public int hashCode() { |
final int prime = 31; |
int result = 1; |
result = prime * result + this.delegate.hashCode(); |
result = prime * result + this.target.hashCode(); |
return result; |
} |
@Override |
public boolean equals(Object obj) { |
if (this == obj) |
return true; |
if (obj == null) |
return false; |
if (getClass() != obj.getClass()) |
return false; |
final ChainPropertyListener other = (ChainPropertyListener) obj; |
return this.delegate.equals(other.delegate) && this.target.equals(other.target); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/Log.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cache/CacheWatcher.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cache/CacheItem.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cache/CacheResult.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cache/Memoizer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cache/CacheWatcherFactory.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cache/CacheTimeOut.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cache/ICache.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/doc/Documented.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/StringUtils.java |
---|
57,7 → 57,36 |
final protected static char[] hexArray = "0123456789ABCDEF".toCharArray(); |
static public final String describe(Object o) { |
return o + (o == null ? "" : "(" + o.getClass() + ")"); |
} |
/** |
* Remove invalid character for PDF Font (Helvetica ...) |
* |
* @param s string to clean |
* @return cleaned string |
*/ |
public static String cleanPDFString(String s) { |
final StringBuilder b = new StringBuilder(s.length()); |
for (char c : s.toCharArray()) { |
if (Character.isLetterOrDigit(c)) { |
b.append(c); |
} else if (c == 'é' || c == 'è' || c == 'ê' || c == 'â' || c == 'à' || c == 'î' || c == 'ù' || c == 'û' || c == 'ô' || c == 'ç') { |
b.append(c); |
} else if (c >= 32 && c < 127) { |
b.append(c); |
} else { |
b.append(' '); |
} |
} |
return b.toString(); |
} |
/** |
* Retourne la chaine avec la première lettre en majuscule et le reste en minuscule. |
* |
* @param s la chaîne à transformer. |
841,6 → 870,14 |
return null; |
} |
public static final String nullIfEmpty(final String s) { |
return nullIfEmpty(s, false); |
} |
public static final String nullIfEmpty(final String s, final boolean trim) { |
return isEmpty(s, trim) ? null : s; |
} |
public static String toAsciiString(String str) { |
if (str == null) { |
return null; |
1028,4 → 1065,26 |
static public final String normalizeForSearch(final String s) { |
return normalizeCase(removeDiacritical(normalizeBlanks(s))); |
} |
static public final String escapeHTML(String html) { |
final int length = html.length(); |
final StringBuilder b = new StringBuilder(length * 2); |
for (int i = 0; i < length; i++) { |
final char c = html.charAt(i); |
if (c == '&') { |
b.append("&"); |
} else if (c == '\"') { |
b.append("""); |
} else if (c == '<') { |
b.append("<"); |
} else if (c == '>') { |
b.append(">"); |
} |
b.append(c); |
} |
return b.toString(); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/RangeList.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/RecursionType.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/Range.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/StreamUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/RollingChecksum32.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/HashWriter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/MoveOperationList.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/FileProperty.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/MoveOperation.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/I18nUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/MessageArgs.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/NounClass.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/Grammar_en.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/GrammaticalBase.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/VariantKey.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/Grammar_es.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/Grammar_fr.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/GrammaticalCase.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/translation/messages_en.properties |
---|
12,6 → 12,8 |
os=Operating system |
javaVersion=Version <b>{0}</b> of {1} |
javaHome=installation directory |
startTime=Start time |
vm.params=Virtual machine parameters |
no.laf=No look and feel |
properties.all=All properties |
env.all=Whole environment |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/translation/messages_fr.properties |
---|
12,6 → 12,8 |
os=Système d''exploitation |
javaVersion=Version <b>{0}</b> de {1} |
javaHome=dossier d'installation |
startTime=Heure de lancement |
vm.params=Paramètre de la machine virtuelle |
no.laf=Aucun thème |
properties.all=Toutes les propriétés |
env.all=Tout l'environnement |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/LocalizedInstances.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/TM.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/Grammar_pl.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/DefaultVariantKey.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/DynamicMap.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/Phrase.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/Grammar.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/Translator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/TranslationManager.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/GrammaticalNumber.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/TranslatorChain.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ImageUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/SystemUtils.java |
---|
132,6 → 132,10 |
return Enum.valueOf(clazz, propName); |
} |
static public final int getIntProperty(final String propName, final int def) { |
return getProperty(propName, Integer::parseInt, def); |
} |
static public final <T> T getProperty(final String propName, final Function<String, T> func, final T def) { |
final String prop = System.getProperty(propName); |
if (prop == null) |
/trunk/OpenConcerto/src/org/openconcerto/utils/XMLDateFormat.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/UnmodifiableCollectionMap.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/NumberUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/EncryptedClassLoader.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ProcessStreams.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/TableModelSelectionAdapter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/TinyMap.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/MultipleOutputStream.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/FillMode.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ui/StringWithId.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ThreadFactory.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/FileUtils.java |
---|
91,6 → 91,7 |
private static void browse(URI uri, final File f) throws IOException { |
assert (uri == null) != (f == null); |
boolean handled = false; |
IOException exn = null; |
final Desktop.Action action = Desktop.Action.BROWSE; |
if (isDesktopDesirable(action) && Desktop.isDesktopSupported()) { |
final Desktop d = Desktop.getDesktop(); |
120,16 → 121,30 |
} |
} |
} |
d.browse(uri); |
handled = true; |
try { |
d.browse(uri); |
handled = true; |
} catch (IOException e) { |
// On Ubuntu, we sometimes get spurious errors, so retry |
exn = e; |
} |
} |
} |
if (!handled) { |
// if the caller passed a file use it instead of our converted URI |
if (f != null) |
openNative(f); |
else |
openNative(uri); |
try { |
// if the caller passed a file use it instead of our converted URI |
if (f != null) |
openNative(f); |
else |
openNative(uri); |
} catch (IOException | RuntimeException e) { |
if (exn != null) { |
exn.addSuppressed(e); |
throw exn; |
} else { |
throw e; |
} |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/XMLCalendarFormat.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ReflectUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/GestionDevise.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/RunnableQueue.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/PropertiesUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/DecimalUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/IMutableListModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,11 → 13,15 |
package org.openconcerto.utils.model; |
import java.util.Collection; |
public interface IMutableListModel<T> extends IListModel<T> { |
// Adds an item at the end of the model. |
void addElement(T obj); |
void addAll(Collection<? extends T> items); |
// Adds an item at a specific index. |
void insertElementAt(T obj, int index); |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/NewSelection.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/ISearchable.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/DefaultIMutableListModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
124,11 → 124,17 |
return this.objects.indexOf(this.getSelectedItem()); |
} |
public final void setTruncated(boolean truncated) { |
this.truncated = truncated; |
} |
// implements javax.swing.MutableComboBoxModel |
@Override |
public final void addElement(T anObject) { |
this.addAll(Collections.singleton(anObject)); |
} |
@Override |
public void addAll(Collection<? extends T> items) { |
this.addAll(-1, items); |
} |
154,6 → 160,7 |
} |
// implements javax.swing.MutableComboBoxModel |
@Override |
public void insertElementAt(T anObject, int index) { |
this.objects.add(index, anObject); |
fireIntervalAdded(this, index, index); |
160,6 → 167,7 |
} |
// implements javax.swing.MutableComboBoxModel |
@Override |
public void removeElementAt(int index) { |
this.removeElementsAt(index, index); |
} |
255,7 → 263,7 |
// needed to implement javax.swing.MutableComboBoxModel |
protected final void removeForJRE(final Object anObject) { |
int index = this.objects.indexOf(anObject); |
final int index = this.objects.indexOf(anObject); |
if (index != -1) { |
removeElementAt(index); |
} |
276,6 → 284,7 |
/** |
* Empties the list. |
*/ |
@Override |
public void removeAllElements() { |
final int size = this.objects.size(); |
if (size > 0) { |
296,7 → 305,7 |
} |
protected void fire(int type, int index0, int index1, CollectionChangeEventCreator c) { |
Object[] listeners = this.listenerList.getListenerList(); |
final Object[] listeners = this.listenerList.getListenerList(); |
ListDataEvent e = null; |
for (int i = listeners.length - 2; i >= 0; i -= 2) { |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/IListModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
26,6 → 26,7 |
*/ |
public interface IListModel<T> extends ListModel<T> { |
@Override |
public T getElementAt(int index); |
/** |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/ListComboBoxModel.java |
---|
26,8 → 26,6 |
* @param <T> the type of the elements of this model |
*/ |
public class ListComboBoxModel<T> extends DefaultIMutableListModel<T> implements MutableComboBoxModel<T> { |
private boolean truncated; |
public ListComboBoxModel() { |
this(Collections.<T> emptyList()); |
45,13 → 43,4 |
public void removeElement(Object obj) { |
this.removeForJRE(obj); |
} |
public void setTruncated(boolean truncated) { |
this.truncated = truncated; |
} |
public boolean isTruncated() { |
return this.truncated; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/SimpleListDataListener.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/DefaultIListModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,6 → 13,8 |
package org.openconcerto.utils.model; |
import org.openconcerto.utils.cc.TruncatableList; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Collection; |
22,7 → 24,7 |
import javax.swing.AbstractListModel; |
/** |
* Un comboBoxModel qui utilise une liste, et possède un addAll(). |
* The default implementation for {@link IListModel}. |
* |
* @author Sylvain CUAZ |
* @param <T> type of items |
29,7 → 31,8 |
*/ |
public class DefaultIListModel<T> extends AbstractListModel<T> implements IListModel<T> { |
protected final List<T> objects; |
protected final List<T> objects; |
protected boolean truncated; |
/** |
* Constructs an empty DefaultComboBoxModel object. |
48,15 → 51,22 |
* @param v a Vector object ... |
*/ |
public DefaultIListModel(Collection<? extends T> v) { |
this(v, false); |
} |
public DefaultIListModel(Collection<? extends T> v, final boolean truncated) { |
this.objects = new ArrayList<T>(v); |
this.truncated = truncated; |
} |
// implements javax.swing.ListModel |
@Override |
public int getSize() { |
return this.objects.size(); |
} |
// implements javax.swing.ListModel |
@Override |
public T getElementAt(int index) { |
if (index >= 0 && index < this.objects.size()) |
return this.objects.get(index); |
64,8 → 74,16 |
return null; |
} |
@Override |
public List<T> getList() { |
return Collections.unmodifiableList(this.objects); |
} |
public final boolean isTruncated() { |
return this.truncated; |
} |
public final TruncatableList<T> copyTruncatableList() { |
return new TruncatableList<>(new ArrayList<>(this.objects), this.isTruncated()); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/Reloadable.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ntp/SNTPClient.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ntp/Timestamp.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ntp/Message.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/prog/SVNUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/prog/EncConv.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/prog/ModDate.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/prog/CorrectFNameEncoding.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/prog/RemoteDebugArgs.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/prog/VMLauncher.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/prog/CorrectPathEncoding.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ProductInfo.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/MultiLock.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/net/HTTPClient.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,6 → 13,8 |
package org.openconcerto.utils.net; |
import org.openconcerto.utils.StreamUtils; |
import java.io.IOException; |
import java.io.InputStream; |
import java.io.OutputStream; |
34,12 → 36,20 |
private final int responseCode; |
private final boolean authenticateError; |
protected ServerException(int responseCode, boolean authenticateError) { |
super("Response code was " + responseCode); |
private ServerException(final String message, final int responseCode, final boolean authenticateError) { |
super(message); |
this.responseCode = responseCode; |
this.authenticateError = authenticateError; |
} |
protected ServerException(int responseCode, boolean authenticateError) { |
this("Response code was " + responseCode, responseCode, authenticateError); |
} |
protected ServerException(Response response, String errorBody, boolean authenticateError) { |
this(response.toString() + (errorBody == null ? "" : "\n" + errorBody), response.getCode(), authenticateError); |
} |
public final int getResponseCode() { |
return this.responseCode; |
} |
53,16 → 63,18 |
protected final static Response create(HttpsURLConnection con, final Set<Integer> okCodes) throws IOException { |
final boolean success = okCodes == null ? con.getResponseCode() == 200 : okCodes.contains(con.getResponseCode()); |
return new Response(success, con.getResponseCode(), con.getResponseMessage(), con.getContentEncoding(), con.getContentType()); |
return new Response(con.getURL().toExternalForm(), success, con.getResponseCode(), con.getResponseMessage(), con.getContentEncoding(), con.getContentType()); |
} |
private final String url; |
private final boolean success; |
private final int code; |
private final String message; |
private final String contentEncoding, contentType; |
protected Response(boolean success, int code, String message, String contentEncoding, String contentType) { |
protected Response(final String url, boolean success, int code, String message, String contentEncoding, String contentType) { |
super(); |
this.url = url; |
this.success = success; |
this.code = code; |
this.message = message; |
70,6 → 82,10 |
this.contentType = contentType; |
} |
public final String getURL() { |
return this.url; |
} |
public final int getCode() { |
return this.code; |
} |
89,6 → 105,11 |
public final String getContentType() { |
return this.contentType; |
} |
@Override |
public String toString() { |
return this.getClass().getSimpleName() + (this.isSuccess() ? " SUCCESS (" : " ERROR (") + this.getCode() + ") \"" + this.getMessage() + "\" to " + this.url; |
} |
} |
private final String url; |
100,6 → 121,10 |
this.url = url; |
} |
public final String getURL() { |
return this.url; |
} |
public final SSLSocketFactory getSocketFactory() { |
return this.socketFactory; |
} |
134,8 → 159,13 |
public final Response checkResponseCode(final HttpsURLConnection con, final Set<Integer> okCodes) throws IOException { |
final Response res = Response.create(con, okCodes); |
if (this.throwsException() && !res.isSuccess()) |
throw new ServerException(res.getCode(), con.getHeaderField("WWW-Authenticate") != null); |
if (this.throwsException() && !res.isSuccess()) { |
final String errorBody; |
try (final InputStream errorStream = con.getErrorStream()) { |
errorBody = errorStream == null ? null : new String(StreamUtils.read(errorStream), StandardCharsets.UTF_8); |
} |
throw new ServerException(res, errorBody, con.getHeaderField("WWW-Authenticate") != null); |
} |
return res; |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/OSXAdapter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/CoreEqualizer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Value.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Screenshot.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ZippedFilesProcessor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ooxml/XLSXSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
18,6 → 18,8 |
import java.awt.Point; |
import java.io.IOException; |
import java.math.BigDecimal; |
import java.math.RoundingMode; |
import java.nio.charset.StandardCharsets; |
import java.util.ArrayList; |
import java.util.Calendar; |
34,8 → 36,6 |
import org.w3c.dom.NodeList; |
import org.xml.sax.SAXException; |
import com.ibm.icu.math.BigDecimal; |
public class XLSXSheet { |
private int columnCount; |
private int startX; |
136,6 → 136,8 |
} |
} else if (type.equals("s")) { |
cellValue = document.getSharedString(Integer.parseInt(value)); |
} else if (type.equals("str")) { |
cellValue = value; |
} |
this.rows.get(p.y - this.startY).set(p.x - this.startX, cellValue); |
} |
232,7 → 234,11 |
public static Date stringToDate(Calendar c, String d) { |
c.clear(); |
c.set(1900, 0, 0); |
c.add(Calendar.DAY_OF_YEAR, Integer.parseInt(d) - 1); |
BigDecimal b = new BigDecimal(d); |
final BigDecimal days = b.setScale(0, RoundingMode.FLOOR); |
c.add(Calendar.DAY_OF_YEAR, days.intValue() - 1); |
final BigDecimal ms = b.subtract(b.setScale(0, RoundingMode.FLOOR)).multiply(new BigDecimal(24)).multiply(new BigDecimal(36)).movePointRight(5); |
c.add(Calendar.MILLISECOND, ms.setScale(0, RoundingMode.HALF_UP).intValue()); |
return c.getTime(); |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/TimeUtils.java |
---|
18,6 → 18,7 |
import java.time.LocalDate; |
import java.time.LocalDateTime; |
import java.time.ZoneId; |
import java.time.ZonedDateTime; |
import java.util.Arrays; |
import java.util.Calendar; |
import java.util.Collection; |
428,6 → 429,16 |
return finerAmount == finer.convert(coarserAmount, coarser); |
} |
public static ZonedDateTime toZonedDateTime(Calendar cal) { |
if (cal == null) |
return null; |
if (cal instanceof GregorianCalendar) { |
return ((GregorianCalendar) cal).toZonedDateTime(); |
} else { |
return ZonedDateTime.ofInstant(cal.toInstant(), getTZ(cal)); |
} |
} |
public static LocalDateTime toLocalDateTime(Calendar calendar) { |
if (calendar == null) |
return null; |
440,11 → 451,22 |
} |
public static final Calendar toCalendar(final LocalDateTime dt) { |
final Calendar cal = Calendar.getInstance(); |
return setTime(Calendar.getInstance(), dt); |
} |
public static final Calendar setTime(final Calendar cal, final LocalDateTime dt) { |
cal.setTimeInMillis(dt.atZone(getTZ(cal)).toInstant().toEpochMilli()); |
return cal; |
} |
public static final GregorianCalendar toGregorianCalendar(final LocalDateTime dt) { |
return toGregorianCalendar(dt.atZone(ZoneId.systemDefault())); |
} |
public static final GregorianCalendar toGregorianCalendar(final ZonedDateTime dt) { |
return GregorianCalendar.from(dt); |
} |
public static LocalDate toLocalDate(Calendar calendar) { |
if (calendar == null) |
return null; |
/trunk/OpenConcerto/src/org/openconcerto/utils/ScreenImage.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Base64.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/EmailClient.java |
---|
376,7 → 376,7 |
final int returnCode = process.waitFor(); |
if (returnCode != 0) |
throw new IllegalStateException("Non zero return code: " + returnCode); |
throw new IllegalStateException("Non zero return code: " + returnCode + "\nCommande : " + CollectionUtils.join(pb.command(), " ")); |
return true; |
} |
}; |
/trunk/OpenConcerto/src/org/openconcerto/utils/Pair.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ExceptionHandler.java |
---|
153,10 → 153,12 |
return res; |
} |
@Deprecated |
static public Future<Boolean> handle(String msg, Throwable originalExn) { |
return handle(null, msg, originalExn); |
} |
@Deprecated |
static public Future<Boolean> handle(String msg) { |
return handle(msg, null); |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/SystemInfo.java |
---|
20,10 → 20,17 |
import org.openconcerto.utils.i18n.TM; |
import java.io.File; |
import java.lang.management.ManagementFactory; |
import java.lang.management.RuntimeMXBean; |
import java.net.InterfaceAddress; |
import java.net.NetworkInterface; |
import java.net.URI; |
import java.net.URISyntaxException; |
import java.time.Instant; |
import java.time.ZoneId; |
import java.time.ZonedDateTime; |
import java.time.format.DateTimeFormatter; |
import java.time.format.FormatStyle; |
import java.util.ArrayList; |
import java.util.Enumeration; |
import java.util.Formatter; |
49,6 → 56,7 |
public static final String CLASS_PROTOCOL = "class"; |
public static final String PROPS_PROTOCOL = "props"; |
public static final String ENV_PROTOCOL = "env"; |
private static final DateTimeFormatter DATETIME_FMT = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.LONG); |
static public NavigableMap<Info, String> get(final boolean html, final Locale locale) { |
final TM tm = TM.getInstance(locale); |
70,8 → 78,14 |
} |
final Runtime rt = Runtime.getRuntime(); |
final long totalMemory = rt.totalMemory(); |
final RuntimeMXBean rtBean = ManagementFactory.getRuntimeMXBean(); |
final Instant startTime = Instant.ofEpochMilli(rtBean.getStartTime()); |
final String startTimeDesc = DATETIME_FMT.withLocale(locale).format(ZonedDateTime.ofInstant(startTime, ZoneId.systemDefault())); |
final String rtDesc = "<i>" + tm.translate("startTime") + " :</i> " + startTimeDesc + lineBreak + "<i>" + tm.translate("vm.params") + " :</i> " + rtBean.getInputArguments(); |
final String stats = "<i>" + tm.translate("memory.used") + " :</i> " + formatBytes(tm, totalMemory - rt.freeMemory()) + " / " + formatBytes(tm, totalMemory) + " ; " |
+ tm.translate("processors", rt.availableProcessors()); |
+ tm.translate("processors", rt.availableProcessors()) + lineBreak + rtDesc; |
final String lafDesc = lookAndFeel == null ? tm.translate("no.laf") : getLink(lookAndFeel.getName(), lafURI, html) + ", " + lookAndFeel.getDescription(); |
URI propsURI = null; |
URI envURI = null; |
/trunk/OpenConcerto/src/org/openconcerto/utils/Zip.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ThreadHandler.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Unzip.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/function/FirstNonNull.java |
---|
New file |
0,0 → 1,62 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.utils.function; |
import org.openconcerto.utils.CollectionUtils; |
import java.util.Collection; |
import java.util.List; |
import java.util.function.Function; |
public class FirstNonNull<T, R> implements Function<T, R> { |
@SuppressWarnings("rawtypes") |
static private final Function EMPTY = (v) -> null; |
@SuppressWarnings("unchecked") |
public static final <T, R> Function<T, R> empty() { |
return EMPTY; |
} |
static public final <T, R> Function<T, R> create(final Collection<? extends Function<? super T, ? extends R>> functions) { |
if (functions.isEmpty()) |
return empty(); |
return new FirstNonNull<>(CollectionUtils.toImmutableList(functions)); |
} |
@SafeVarargs |
static public final <T, R> Function<T, R> create(final Function<? super T, ? extends R>... functions) { |
if (functions.length == 0) |
return empty(); |
return new FirstNonNull<>(CollectionUtils.toImmutableList(functions)); |
} |
private final List<Function<? super T, ? extends R>> functions; |
private FirstNonNull(final List<Function<? super T, ? extends R>> functions) { |
this.functions = functions; |
if (this.functions.contains(null)) |
throw new IllegalArgumentException("Null function : " + this.functions); |
} |
@Override |
public R apply(T t) { |
for (final Function<? super T, ? extends R> f : this.functions) { |
final R res = f.apply(t); |
if (res != null) |
return res; |
} |
return null; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/ColorFactory.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ArrayComparator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/NetUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Messages.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ClassPathLoader.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/TableModelAdapter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/TransformedComparator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Tuple3.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/Page.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/HTMLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/HTMLContent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/HTMLLink.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/HTMLFile.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/RawContent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/Site.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/HTMLTitle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/HTMLDiv.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/HTMLParagraph.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/HTMLManipulatorFrame.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/RTInterruptedException.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Windows.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/JImage.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ListAbstractMap.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/PEMImporter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,6 → 13,8 |
package org.openconcerto.utils; |
import static java.util.Base64.getMimeDecoder; |
import java.io.BufferedReader; |
import java.io.ByteArrayInputStream; |
import java.io.File; |
36,7 → 38,6 |
import javax.net.ssl.KeyManagerFactory; |
import javax.net.ssl.SSLContext; |
import javax.net.ssl.SSLServerSocketFactory; |
import javax.xml.bind.DatatypeConverter; |
public class PEMImporter { |
91,7 → 92,7 |
} |
r.close(); |
final String hexString = b.toString(); |
final byte[] bytes = DatatypeConverter.parseBase64Binary(hexString); |
final byte[] bytes = getMimeDecoder().decode(hexString); |
return generatePrivateKeyFromDER(bytes); |
} |
107,7 → 108,7 |
while (s != null) { |
if (s.contains("END CERTIFICATE")) { |
String hexString = b.toString(); |
final byte[] bytes = DatatypeConverter.parseBase64Binary(hexString); |
final byte[] bytes = getMimeDecoder().decode(hexString); |
X509Certificate cert = generateCertificateFromDER(bytes); |
result.add(cert); |
b = new StringBuilder(); |
/trunk/OpenConcerto/src/org/openconcerto/utils/IFutureTask.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Mozilla.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/mime/MimeType.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/mime/FreeDesktopMimeDetector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/mime/File.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/mime/FileMagicMimeDetector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/CollectionMap2.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/StreamUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/CollectionMap2Itf.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/RunnableWithCookies.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/DropperQueue.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Nombre.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ChainedThread.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ThrowableHandler.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/IScheduledFutureTask.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/Transferable.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/JSONParameter.java |
---|
New file |
0,0 → 1,92 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.utils.io; |
import java.util.Objects; |
import java.util.function.Function; |
import net.minidev.json.JSONObject; |
/** |
* Allow to omit default value from JSON. |
* |
* @author sylvain |
* @param <T> type of parameter |
*/ |
public final class JSONParameter<T> { |
private static final Function<Object, Object> DEFAULT_TO_JSON = JSONConverter::getJSON; |
public static <U> JSONParameter<U> createNoDefault(String name, Class<U> clazz) { |
return create(name, clazz, null); |
} |
public static <U> JSONParameter<U> create(String name, Class<U> clazz, U def) { |
return new JSONParameter<U>(name, clazz, DEFAULT_TO_JSON, (o) -> JSONConverter.getObjectFromJSON(o, clazz), def); |
} |
public static <U> JSONParameter<U> createWithFunction(String name, U def, Function<Object, U> fromJSON) { |
return createWithFunction(name, def, DEFAULT_TO_JSON, fromJSON); |
} |
public static <U> JSONParameter<U> createWithFunction(String name, U def, Function<? super U, ?> toJSON, Function<Object, U> fromJSON) { |
return new JSONParameter<U>(name, null, toJSON, fromJSON, def); |
} |
private final String name; |
private final T defaultVal; |
private final Class<T> clazz; |
private final Function<? super T, ?> toJSON; |
private final Function<Object, T> fromJSON; |
protected JSONParameter(String name, Class<T> clazz, Function<? super T, ?> toJSON, Function<Object, T> fromJSON, T defaultVal) { |
super(); |
this.name = Objects.requireNonNull(name); |
this.clazz = clazz; |
this.toJSON = Objects.requireNonNull(toJSON); |
this.fromJSON = Objects.requireNonNull(fromJSON); |
this.defaultVal = defaultVal; |
} |
public final String getName() { |
return this.name; |
} |
public final T getDefaultValue() { |
return this.defaultVal; |
} |
public final Class<T> getValueClass() { |
return this.clazz; |
} |
public final Function<? super T, ?> getToJSON() { |
return this.toJSON; |
} |
public final Function<Object, T> getFromJSON() { |
return this.fromJSON; |
} |
public final JSONObject put(final JSONObject json, T val) { |
if (!Objects.equals(this.getDefaultValue(), val)) { |
json.put(this.getName(), this.getToJSON().apply(val)); |
} |
return json; |
} |
public final T get(final JSONObject json) { |
return JSONConverter.getParameterFromJSON(json, this.getName(), this.getFromJSON(), this.getDefaultValue()); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/BOMSkipper.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/PrintStreamPrinter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/JSONNamed.java |
---|
New file |
0,0 → 1,18 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.utils.io; |
public interface JSONNamed { |
public String getJSONName(); |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/Mail.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/Printer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/HTMLable.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/JSONAble.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/NewLineWriter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/RandomAccessFileInputStream.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/MailAccount.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
110,6 → 110,10 |
return sb.toString(); |
} |
public static final MailAccount create(final String fromAddr, String smtpLogin, String smtpPassword) throws AddressException { |
return create(fromAddr, null, smtpLogin, smtpPassword); |
} |
public static final MailAccount create(final String fromAddr, String smtpServer, String smtpLogin, String smtpPassword) throws AddressException { |
Objects.requireNonNull(fromAddr, "Missing 'From:' address"); |
final InternetAddress fromInetAddr = new InternetAddress(fromAddr, true); |
145,8 → 149,8 |
public MailAccount(String name, String address, String smtpServer, int port) { |
super(); |
this.name = name; |
this.address = address; |
this.smtpServer = smtpServer; |
this.address = Objects.requireNonNull(address); |
this.smtpServer = Objects.requireNonNull(smtpServer); |
this.port = port; |
this.auth = null; |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/PercentEncoder.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/JSONConverter.java |
---|
22,6 → 22,7 |
import java.text.Format; |
import java.util.Calendar; |
import java.util.Date; |
import java.util.function.Function; |
import com.google.gson.Gson; |
import com.google.gson.JsonElement; |
68,6 → 69,8 |
result = ((HTMLable) param).getHTML(); |
} else if (param instanceof JSONAble) { |
result = ((JSONAble) param).toJSON(); |
} else if (param instanceof JSONNamed) { |
result = ((JSONNamed) param).getJSONName(); |
} else if (param instanceof Date) { |
result = format((Date) param); |
} else if (param instanceof Calendar) { |
93,6 → 96,8 |
result = "#" + hexString; |
} else if (param instanceof BigDecimal) { |
result = ((BigDecimal) param).doubleValue(); |
} else if (param instanceof Enum) { |
result = ((Enum<?>) param).name().toLowerCase(); |
} else { |
result = param; |
} |
134,6 → 139,16 |
} |
} else if (type.equals(Color.class)) { |
result = type.cast(Color.decode(o.toString())); |
} else if (JSONNamed.class.isAssignableFrom(type)) { |
for (final T enumConstant : type.getEnumConstants()) { |
if (((JSONNamed) enumConstant).getJSONName().equals(o)) |
return enumConstant; |
} |
throw new IllegalArgumentException("Unknown name '" + o + "' for " + type); |
} else if (Enum.class.isAssignableFrom(type)) { |
@SuppressWarnings("unchecked") |
final Enum<?> enumVal = Enum.valueOf(type.asSubclass(Enum.class), o.toString().toUpperCase()); |
result = type.cast(enumVal); |
} else { |
result = type.cast(o); |
} |
149,6 → 164,10 |
} |
public static <T> T getParameterFromJSON(final JSONObject json, final String key, final Class<T> type, T defaultValue) { |
return getParameterFromJSON(json, key, (o) -> getObjectFromJSON(o, type), defaultValue); |
} |
public static <T> T getParameterFromJSON(final JSONObject json, final String key, final Function<Object, T> ctor, T defaultValue) { |
if (json == null) { |
throw new IllegalArgumentException("null JSON"); |
} |
155,7 → 174,7 |
if (key == null) { |
throw new IllegalArgumentException("null key"); |
} |
return json.containsKey(key) ? getObjectFromJSON(json.get(key), type) : defaultValue; |
return json.containsKey(key) ? ctor.apply(json.get(key)) : defaultValue; |
} |
public static JSONObject convertStringToJsonObject(final String jsonString) { |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/DataInputStream.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/AutoLayouter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ImageInfo.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/LinkedListMap.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/StringInputStream.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/FixedWidthOuputer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/LimitedSizeDocumentFilter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/CSVWriter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/CharsetHelper.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/SimpleDocumentFilter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/SimpleDocumentListener.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/CSVParser.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/CSVReader.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/DocumentFilterList.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/change/IListDataEvent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/change/AddAllCreator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/change/ListChange.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/change/CollectionChangeEvent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/change/CollectionChangeEventCreator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/change/ConstructorCreator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/CommandeBlSQLInjector.java |
---|
32,6 → 32,9 |
if (tableCmd.getTable().contains("ID_POLE_PRODUIT") && tableBl.contains("ID_POLE_PRODUIT")) { |
map(tableCmd.getField("ID_POLE_PRODUIT"), tableBl.getField("ID_POLE_PRODUIT")); |
} |
if (tableCmd.contains("T_ACOMPTE") && tableBl.contains("T_ACOMPTE")) { |
map(tableCmd.getField("T_ACOMPTE"), tableBl.getField("T_ACOMPTE")); |
} |
if (getSource().getTable().contains("ID_CONTACT")) { |
map(getSource().getField("ID_CONTACT"), getDestination().getField("ID_CONTACT")); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/BonFactureSQLInjector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
34,6 → 34,9 |
if (tableBon.getTable().contains("ID_POLE_PRODUIT")) { |
map(tableBon.getField("ID_POLE_PRODUIT"), tableFacture.getField("ID_POLE_PRODUIT")); |
} |
if (tableBon.contains("T_ACOMPTE") && tableFacture.contains("T_ACOMPTE")) { |
map(tableBon.getField("T_ACOMPTE"), tableFacture.getField("T_ACOMPTE")); |
} |
if (getSource().getTable().contains("ID_CONTACT")) { |
map(getSource().getField("ID_CONTACT"), getDestination().getField("ID_CONTACT")); |
} |
70,6 → 73,9 |
if (getSource().getTable().contains("ACOMPTE_COMMANDE")) { |
map(getSource().getField("ACOMPTE_COMMANDE"), getDestination().getField("ACOMPTE_COMMANDE")); |
} |
if (getSource().getTable().contains("ID_COMMERCIAL")) { |
map(getSource().getField("ID_COMMERCIAL"), getDestination().getField("ID_COMMERCIAL")); |
} |
} |
@Override |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/FactureAvoirSQLInjector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
18,6 → 18,7 |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLInjector; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLTable; |
72,7 → 73,18 |
if (myListItem.size() != 0) { |
final SQLInjector injector = SQLInjector.getInjector(tableElementSource, tableElementDestination); |
for (SQLRowAccessor rowElt : myListItem) { |
final SQLRowValues createRowValuesFrom = injector.createRowValuesFrom(rowElt.asRow()); |
final SQLRow asRow = rowElt.asRow(); |
final SQLRowValues createRowValuesFrom = injector.createRowValuesFrom(asRow); |
if (asRow.getObject("MONTANT_FACTURABLE") != null) { |
createRowValuesFrom.put("PV_HT", asRow.getObject("MONTANT_FACTURABLE")); |
createRowValuesFrom.put("PRIX_METRIQUE_VT_1", asRow.getObject("MONTANT_FACTURABLE")); |
} else if (asRow.getObject("POURCENT_FACTURABLE") != null && asRow.getObject("PRIX_METRIQUE_VT_1") != null) { |
final BigDecimal pv = asRow.getBigDecimal("PRIX_METRIQUE_VT_1").multiply(asRow.getBigDecimal("POURCENT_FACTURABLE")).movePointLeft(2); |
createRowValuesFrom.put("PV_HT", pv); |
createRowValuesFrom.put("PRIX_METRIQUE_VT_1", pv); |
} |
if (createRowValuesFrom.getTable().getFieldsName().contains("POURCENT_ACOMPTE")) { |
if (createRowValuesFrom.getObject("POURCENT_ACOMPTE") == null) { |
createRowValuesFrom.put("POURCENT_ACOMPTE", new BigDecimal(100.0)); |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/CommandeFactureClientSQLInjector.java |
---|
35,6 → 35,10 |
if (tableCommande.contains("T_ACOMPTE")) { |
map(tableCommande.getField("T_ACOMPTE"), tableFacture.getField("T_ACOMPTE")); |
} |
if (tableCommande.contains("POURCENT_RG") && tableFacture.contains("POURCENT_RG")) { |
map(tableCommande.getField("POURCENT_RG"), tableFacture.getField("POURCENT_RG")); |
} |
if (tableCommande.contains("PORT_HT")) { |
map(tableCommande.getField("PORT_HT"), tableFacture.getField("PORT_HT")); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/ArticleCommandeEltSQLInjector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
31,4 → 31,5 |
remove(tableArticle.getField("ID_DEVISE"), tableCommandeElement.getField("ID_DEVISE")); |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/CommandeBlEltSQLInjector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
20,6 → 20,7 |
public CommandeBlEltSQLInjector(final DBRoot root) { |
super(root, "COMMANDE_CLIENT_ELEMENT", "BON_DE_LIVRAISON_ELEMENT", false); |
createDefaultMap(); |
remove(getSource().getField("QTE_LIVREE"), getDestination().getField("QTE_LIVREE")); |
mapDefaultValues(getDestination().getField("QTE_LIVREE"), Integer.valueOf(0)); |
if (getDestination().contains("ID_COMMANDE_CLIENT_ELEMENT")) { |
map(getSource().getKey(), getDestination().getField("ID_COMMANDE_CLIENT_ELEMENT")); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOXMLElement.java |
---|
133,6 → 133,15 |
if (brk != null && brk.trim().length() > 0) { |
res = (res == null ? res : res.toString().replaceAll(brk, "\n")); |
} |
String attributeValueMaxChar = this.elt.getAttributeValue("maxChar"); |
if (attributeValueMaxChar != null) { |
int maxChar = Integer.valueOf(attributeValueMaxChar); |
if (res != null && res.toString().length() > maxChar) { |
res = res.toString().substring(0, maxChar); |
} |
} |
return res; |
} |
141,6 → 150,7 |
sel.addSelect(field, function); |
Where w = new Where(field.getTable().getField("ID_" + this.row.getTable().getName()), "=", this.row.getID()); |
sel.setWhere(w); |
return Configuration.getInstance().getBase().getDataSource().executeScalar(sel.asString()); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOgenerationXML.java |
---|
208,7 → 208,7 |
} |
// Sauvegarde du fichier |
return saveSpreadSheet(spreadSheet, outputDirectory, expectedFileName, templateId, rowLanguage); |
return saveSpreadSheet(spreadSheet, outputDirectory, expectedFileName, templateId, rowLanguage, typeTemplate); |
} catch (final JDOMException e) { |
991,7 → 991,7 |
* @throws IOException |
*/ |
private static File saveSpreadSheet(SpreadSheet ssheet, File pathDest, String fileName, String templateId, SQLRow rowLanguage) throws IOException { |
private static File saveSpreadSheet(SpreadSheet ssheet, File pathDest, String fileName, String templateId, SQLRow rowLanguage, String type) throws IOException { |
final String langage = rowLanguage != null ? rowLanguage.getString("CHEMIN") : null; |
// Test des arguments |
if (ssheet == null || pathDest == null || fileName.trim().length() == 0) { |
1027,7 → 1027,7 |
// Copie de l'odsp |
File odspOut = new File(pathDest, fileName + ".odsp"); |
try (final InputStream odspIn = TemplateManager.getInstance().getTemplatePrintConfiguration(templateId, langage, null);) { |
try (final InputStream odspIn = TemplateManager.getInstance().getTemplatePrintConfiguration(templateId, langage, type);) { |
if (odspIn != null) { |
StreamUtils.copy(odspIn, odspOut); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOgenerationListeXML.java |
---|
166,10 → 166,11 |
int nbPage = fillTable(tableau, liste, sheet, mapStyle, true, style); |
int firstLine = Integer.valueOf(tableau.getAttributeValue("firstLine")); |
int endLine = Integer.valueOf(tableau.getAttributeValue("endLine")); |
Object printRangeObj = sheet.getPrintRanges(); |
System.err.println("Nombre de page == " + nbPage); |
if (nbPage == 1) { |
if (nbPage == 1 || endLine == -1) { |
fillTable(tableau, liste, sheet, mapStyle, false, style); |
} else { |
233,6 → 234,8 |
int currentLine = Integer.valueOf(tableau.getAttributeValue("firstLine")); |
int endPageLine = Integer.valueOf(tableau.getAttributeValue("endPageLine")); |
int endLine = Integer.valueOf(tableau.getAttributeValue("endLine")); |
List listElts = tableau.getChildren("element"); |
Object o = null; |
241,8 → 244,15 |
Map<String, Double> mapSousTotal = new HashMap<String, Double>(); |
Map<String, Double> mapTotal = new HashMap<String, Double>(); |
// agrandissement selon le nombre de ligne à insérer |
if (endLine == -1) { |
sheet.setRowCount(currentLine + 1); |
sheet.setRowCount(currentLine + liste.size(), currentLine); |
// sheet.duplicateRows(currentLine+1, liste.size(), 1); |
endPageLine = currentLine + 1 + liste.size(); |
} |
// on remplit chaque ligne à partir des rows recuperées |
for (int i = 0; i < liste.size(); i++) { |
Map<String, Object> mValues = liste.get(i); |
// System.err.println(mValues); |
402,6 → 412,15 |
private static Object resizeValue(Element elt, Object res) { |
{ |
String digitSize = elt.getAttributeValue("digitsFormat"); |
if (digitSize != null) { |
int size = Integer.valueOf(digitSize); |
if (res != null && res.toString().length() > 0) { |
res = String.format("%-" + size + "s", res).replace(' ', '0'); |
} |
} |
} |
{ |
String attributeValueMaxChar = elt.getAttributeValue("maxChar"); |
if (attributeValueMaxChar != null) { |
int maxChar = Integer.valueOf(attributeValueMaxChar); |
439,7 → 458,6 |
private static Object getValueOfComposant(Element eltField, Map<String, Object> mValues) { |
String field = eltField.getAttributeValue("name"); |
return mValues.get(field); |
} |
606,7 → 624,8 |
System.err.println("End column search : " + columnCount); |
int rowCount = (rowEnd > 0) ? rowEnd : sheet.getRowCount(); |
// Limite pour éviter les breakrepeated |
rowCount = Math.min(100, rowCount); |
System.err.println("End row search : " + rowCount); |
for (int i = 0; i < rowCount && (mapStyleDef.keySet().size() - 2) > mapStyleFounded.keySet().size(); i++) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/SheetXml.java |
---|
185,7 → 185,7 |
@Override |
public void run(Object source) { |
EmailTemplate.askTemplate(null, table.getDBRoot(), new ValueListener() { |
EmailTemplate.askTemplate(null, table.getDBRoot(), table.getName(), new ValueListener() { |
@Override |
public void valueSelected(Object value) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOXMLField.java |
---|
277,9 → 277,26 |
if (cellSize != null && cellSize.trim().length() != 0) { |
result = splitStringCell(cellSize, result); |
} |
String attributeValueMaxChar = this.elt.getAttributeValue("maxChar"); |
if (attributeValueMaxChar != null) { |
int maxChar = Integer.valueOf(attributeValueMaxChar); |
if (result != null && result.length() > maxChar) { |
result = result.substring(0, maxChar); |
} |
} |
return result; |
} else { |
if (display == null || !display.equalsIgnoreCase("false")) { |
String attributeValueMaxChar = this.elt.getAttributeValue("maxChar"); |
if (attributeValueMaxChar != null) { |
int maxChar = Integer.valueOf(attributeValueMaxChar); |
if (o != null && o.toString().length() > maxChar) { |
o = o.toString().substring(0, maxChar); |
} |
} |
if (cellSize != null && cellSize.trim().length() != 0 && o != null) { |
return splitStringCell(cellSize, o.toString()); |
} else { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/RecapFactureProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
19,6 → 19,7 |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.utils.GestionDevise; |
import java.text.SimpleDateFormat; |
import java.util.Calendar; |
import java.util.Collection; |
import java.util.HashSet; |
31,9 → 32,12 |
}; |
private final TypeRecapFactureProvider type; |
private final boolean withDate, withAvoir; |
public RecapFactureProvider(TypeRecapFactureProvider t) { |
public RecapFactureProvider(TypeRecapFactureProvider t, boolean withDate, boolean withAvoir) { |
this.type = t; |
this.withDate = withDate; |
this.withAvoir = withAvoir; |
} |
public Object getValue(SpreadSheetCellValueContext context) { |
55,8 → 59,14 |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.account.history", new RecapFactureProvider(TypeRecapFactureProvider.HT)); |
SpreadSheetCellValueProviderManager.put("sales.account.history.ttc", new RecapFactureProvider(TypeRecapFactureProvider.TTC)); |
SpreadSheetCellValueProviderManager.put("sales.account.history", new RecapFactureProvider(TypeRecapFactureProvider.HT, false, false)); |
SpreadSheetCellValueProviderManager.put("sales.account.history.ttc", new RecapFactureProvider(TypeRecapFactureProvider.TTC, false, false)); |
SpreadSheetCellValueProviderManager.put("sales.account.history.withdate", new RecapFactureProvider(TypeRecapFactureProvider.HT, true, false)); |
SpreadSheetCellValueProviderManager.put("sales.account.history.ttc.withdate", new RecapFactureProvider(TypeRecapFactureProvider.TTC, true, false)); |
SpreadSheetCellValueProviderManager.put("sales.account.history.with.credit", new RecapFactureProvider(TypeRecapFactureProvider.HT, false, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.history.with.credit.ttc", new RecapFactureProvider(TypeRecapFactureProvider.TTC, false, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.history.with.credit.withdate", new RecapFactureProvider(TypeRecapFactureProvider.HT, true, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.history.with.credit.ttc.withdate", new RecapFactureProvider(TypeRecapFactureProvider.TTC, true, true)); |
} |
public String getPreviousAcompte(SQLRowAccessor sqlRowAccessor, Set<SQLRowAccessor> alreadyAdded, Calendar c) { |
65,13 → 75,23 |
} |
Collection<? extends SQLRowAccessor> rows = sqlRowAccessor.getReferentRows(sqlRowAccessor.getTable().getTable("TR_COMMANDE_CLIENT")); |
StringBuffer result = new StringBuffer(); |
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy"); |
for (SQLRowAccessor sqlRowAccessor2 : rows) { |
SQLRowAccessor rowFact = sqlRowAccessor2.getForeign("ID_SAISIE_VENTE_FACTURE"); |
if (rowFact != null && !rowFact.isUndefined() && !alreadyAdded.contains(rowFact) && rowFact.getDate("DATE").before(c)) { |
if (rowFact != null && !rowFact.isUndefined() && !alreadyAdded.contains(rowFact) && rowFact.getDate("DATE").before(c) |
&& (!this.withAvoir || (this.withAvoir && rowFact.isForeignEmpty("ID_AVOIR_CLIENT")))) { |
alreadyAdded.add(rowFact); |
final String fieldTotal = this.type == TypeRecapFactureProvider.HT ? "T_HT" : "T_TTC"; |
result.append(rowFact.getString("NUMERO") + " (" + GestionDevise.currencyToString(rowFact.getLong(fieldTotal)) + "€), "); |
result.append(rowFact.getString("NUMERO")); |
result.append(" ("); |
if (this.withDate) { |
result.append(format.format(rowFact.getDate("DATE").getTime()) + " "); |
} |
result.append(GestionDevise.currencyToString(rowFact.getLong(fieldTotal)) + "€), "); |
if (this.withDate) { |
result.append("\n"); |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/RestantAReglerProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
35,18 → 35,18 |
public RestantAReglerProvider(TypeRestantAReglerProvider t) { |
this.type = t; |
if (this.type == TypeRestantAReglerProvider.HT) { |
acompteProv = new TotalAcompteProvider(TypeTotalAcompteProvider.HT); |
cmdProvider = new TotalCommandeClientProvider(TypeTotalCommandeClientProvider.HT); |
this.acompteProv = new TotalAcompteProvider(TypeTotalAcompteProvider.HT, false); |
this.cmdProvider = new TotalCommandeClientProvider(TypeTotalCommandeClientProvider.HT); |
} else { |
acompteProv = new TotalAcompteProvider(TypeTotalAcompteProvider.TTC); |
cmdProvider = new TotalCommandeClientProvider(TypeTotalCommandeClientProvider.TTC); |
this.acompteProv = new TotalAcompteProvider(TypeTotalAcompteProvider.TTC, false); |
this.cmdProvider = new TotalCommandeClientProvider(TypeTotalCommandeClientProvider.TTC); |
} |
} |
public Object getValue(SpreadSheetCellValueContext context) { |
Object acompte = acompteProv.getValue(context); |
Object cmd = cmdProvider.getValue(context); |
Object acompte = this.acompteProv.getValue(context); |
Object cmd = this.cmdProvider.getValue(context); |
if (acompte != null && cmd != null) { |
return ((BigDecimal) cmd).subtract((BigDecimal) acompte); |
} else { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/RecapLigneFactureProvider.java |
---|
New file |
0,0 → 1,108 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.generationDoc.provider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProvider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLRowValuesListFetcher; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.utils.DecimalUtils; |
import java.math.BigDecimal; |
import java.math.RoundingMode; |
import java.util.Calendar; |
import java.util.List; |
public class RecapLigneFactureProvider implements SpreadSheetCellValueProvider { |
private enum TypeLineRecapFactureProvider { |
HT, TTC, PERCENT; |
}; |
private final TypeLineRecapFactureProvider type; |
private final boolean old, withAvoir; |
public RecapLigneFactureProvider(TypeLineRecapFactureProvider t, boolean old) { |
this(t, old, false); |
} |
public RecapLigneFactureProvider(TypeLineRecapFactureProvider t, boolean old, boolean withAvoir) { |
this.type = t; |
this.old = old; |
this.withAvoir = withAvoir; |
} |
public Object getValue(SpreadSheetCellValueContext context) { |
SQLRowAccessor row = context.getRow(); |
final SQLRowAccessor factureOrigin = row.getNonEmptyForeign("ID_SAISIE_VENTE_FACTURE"); |
final Calendar date = factureOrigin.getDate("DATE"); |
final SQLRowAccessor foreignCmdItem = row.getNonEmptyForeign("ID_COMMANDE_CLIENT_ELEMENT"); |
if (foreignCmdItem != null && foreignCmdItem.getBigDecimal("T_PV_HT").signum() != 0) { |
SQLRowValues rowValsFactItem2Fetch = new SQLRowValues(row.getTable()); |
rowValsFactItem2Fetch.putNulls("T_PV_HT", "T_PV_TTC"); |
rowValsFactItem2Fetch.putRowValues("ID_SAISIE_VENTE_FACTURE").putNulls("DATE", "ID_AVOIR_CLIENT"); |
final List<SQLRowValues> fetch = SQLRowValuesListFetcher.create(rowValsFactItem2Fetch).fetch(new Where(row.getTable().getField("ID_COMMANDE_CLIENT_ELEMENT"), "=", foreignCmdItem.getID())); |
BigDecimal total = BigDecimal.ZERO; |
BigDecimal totalTTC = BigDecimal.ZERO; |
for (SQLRowAccessor sqlRowAccessor : fetch) { |
final SQLRowAccessor nonEmptyForeign = sqlRowAccessor.getNonEmptyForeign("ID_SAISIE_VENTE_FACTURE"); |
if (nonEmptyForeign != null && (!withAvoir || (withAvoir && sqlRowAccessor.isForeignEmpty("ID_AVOIR_CLIENT")))) { |
final Calendar date2 = nonEmptyForeign.getDate("DATE"); |
final boolean same = old && factureOrigin.getID() == nonEmptyForeign.getID(); |
if (same || date2.before(date) || (date2.equals(date) && nonEmptyForeign.getID() < factureOrigin.getID())) { |
total = total.add(sqlRowAccessor.getBigDecimal("T_PV_HT")); |
totalTTC = totalTTC.add(sqlRowAccessor.getBigDecimal("T_PV_TTC")); |
} |
} |
} |
if (this.type == TypeLineRecapFactureProvider.HT) { |
return total; |
} else if (this.type == TypeLineRecapFactureProvider.TTC) { |
return totalTTC; |
} else { |
if (foreignCmdItem.getBigDecimal("T_PV_HT").signum() != 0) { |
return total.divide(foreignCmdItem.getBigDecimal("T_PV_HT"), DecimalUtils.HIGH_PRECISION).movePointRight(2).setScale(2, RoundingMode.HALF_UP) + "%"; |
} else { |
return ""; |
} |
} |
} else { |
return ""; |
} |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.account.line.history", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.HT, false)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.ttc", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.TTC, false)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.percent", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.PERCENT, false)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.total", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.HT, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.total.ttc", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.TTC, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.total.percent", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.PERCENT, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.with.credit", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.HT, false, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.with.credit.ttc", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.TTC, false, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.with.credit.percent", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.PERCENT, false, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.with.credit.total", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.HT, true, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.with.credit.total.ttc", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.TTC, true, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.with.credit.total.percent", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.PERCENT, true, true)); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/QteLineDocProvider.java |
---|
47,16 → 47,17 |
} |
final BigDecimal qteUV = sqlRowAccessor.getBigDecimal("QTE_UNITAIRE"); |
final BigDecimal qte = new BigDecimal(sqlRowAccessor.getInt("QTE")); |
final BigDecimal qte = sqlRowAccessor.getTable().getName().equalsIgnoreCase("BON_DE_LIVRAISON_ELEMENT") ? new BigDecimal(sqlRowAccessor.getInt("QTE_LIVREE")) |
: new BigDecimal(sqlRowAccessor.getInt("QTE")); |
final BigDecimal tare; |
if (sqlRowAccessor.getObject("TARE") != null) { |
tare = new BigDecimal(sqlRowAccessor.getInt("NB_COLIS")); |
tare = sqlRowAccessor.getBigDecimal("TARE"); |
} else { |
tare = BigDecimal.ZERO; |
} |
BigDecimal pdsNet = nbColis.multiply(qte).multiply(qteUV); |
BigDecimal pdsNet = new BigDecimal(sqlRowAccessor.getFloat("POIDS")).multiply(qte).multiply(qteUV); |
if (this.type == TypePoidsDocProvider.POIDS_NET) { |
return pdsNet; |
} else { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/TotalAcompteProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
31,9 → 31,11 |
}; |
private final TypeTotalAcompteProvider type; |
private boolean old; |
public TotalAcompteProvider(TypeTotalAcompteProvider t) { |
public TotalAcompteProvider(TypeTotalAcompteProvider t, boolean old) { |
this.type = t; |
this.old = old; |
} |
public Object getValue(SpreadSheetCellValueContext context) { |
43,7 → 45,7 |
Collection<? extends SQLRowAccessor> rows = row.getReferentRows(row.getTable().getTable("TR_COMMANDE_CLIENT")); |
long total = 0; |
Set<SQLRowAccessor> facture = new HashSet<SQLRowAccessor>(); |
facture.add(row); |
for (SQLRowAccessor sqlRowAccessor : rows) { |
total += getPreviousAcompte(sqlRowAccessor.getForeign("ID_COMMANDE_CLIENT"), facture, c, row); |
} |
52,8 → 54,10 |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.account.total", new TotalAcompteProvider(TypeTotalAcompteProvider.HT)); |
SpreadSheetCellValueProviderManager.put("sales.account.total.ttc", new TotalAcompteProvider(TypeTotalAcompteProvider.TTC)); |
SpreadSheetCellValueProviderManager.put("sales.account.total.cumul", new TotalAcompteProvider(TypeTotalAcompteProvider.HT, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.total.cumul.ttc", new TotalAcompteProvider(TypeTotalAcompteProvider.TTC, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.total", new TotalAcompteProvider(TypeTotalAcompteProvider.HT, false)); |
SpreadSheetCellValueProviderManager.put("sales.account.total.ttc", new TotalAcompteProvider(TypeTotalAcompteProvider.TTC, false)); |
} |
public long getPreviousAcompte(SQLRowAccessor sqlRowAccessor, Set<SQLRowAccessor> alreadyAdded, Calendar c, SQLRowAccessor origin) { |
65,8 → 69,9 |
for (SQLRowAccessor sqlRowAccessor2 : rows) { |
SQLRowAccessor rowFact = sqlRowAccessor2.getForeign("ID_SAISIE_VENTE_FACTURE"); |
if (rowFact != null && !rowFact.isUndefined() && !alreadyAdded.contains(rowFact) |
&& (rowFact.getDate("DATE").before(c) || (rowFact.getDate("DATE").equals(c) && rowFact.getID() < origin.getID()))) { |
final boolean sameFact = rowFact.getDate("DATE").equals(c) && rowFact.getID() < origin.getID(); |
final boolean oldFact = rowFact.getID() == origin.getID() && this.old; |
if (rowFact != null && !rowFact.isUndefined() && !alreadyAdded.contains(rowFact) && (rowFact.getDate("DATE").before(c) || sameFact || oldFact)) { |
alreadyAdded.add(rowFact); |
l += this.type == TypeTotalAcompteProvider.HT ? rowFact.getLong("T_HT") : rowFact.getLong("T_TTC"); |
} |
73,5 → 78,4 |
} |
return l; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/ResteALivrerDocProvider.java |
---|
New file |
0,0 → 1,95 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.generationDoc.provider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProvider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import java.math.BigDecimal; |
public class ResteALivrerDocProvider implements SpreadSheetCellValueProvider { |
protected enum ResteProvider { |
RESTE, LIVRE_TOTAL, RESTE_CMD, LIVRE_TOTAL_CMD |
}; |
protected final ResteProvider type; |
public ResteALivrerDocProvider(ResteProvider t) { |
this.type = t; |
} |
@Override |
public Object getValue(SpreadSheetCellValueContext context) { |
SQLRowAccessor sqlRowAccessor = context.getRow(); |
return geTotalFromRow(sqlRowAccessor); |
} |
protected BigDecimal geTotalFromRow(SQLRowAccessor sqlRowAccessor) { |
BigDecimal totalD; |
BigDecimal total = sqlRowAccessor.getBigDecimal("QTE_UNITAIRE"); |
total = total.multiply(new BigDecimal(sqlRowAccessor.getInt("QTE"))); |
if (this.type == ResteProvider.RESTE_CMD || this.type == ResteProvider.LIVRE_TOTAL_CMD) { |
totalD = new BigDecimal(sqlRowAccessor.getInt("QTE_LIVREE")); |
final BigDecimal returnedValue; |
if (this.type == ResteProvider.RESTE_CMD) { |
returnedValue = total.subtract(totalD); |
} else { |
returnedValue = totalD; |
} |
if (!sqlRowAccessor.isForeignEmpty("ID_ARTICLE") && returnedValue.signum() > 0) { |
return returnedValue; |
} else { |
return null; |
} |
} else { |
final SQLRowAccessor nonEmptyForeignCmdItem = sqlRowAccessor.getNonEmptyForeign("ID_COMMANDE_CLIENT_ELEMENT"); |
if (nonEmptyForeignCmdItem == null) { |
totalD = sqlRowAccessor.getBigDecimal("QTE_UNITAIRE"); |
totalD = totalD.multiply(new BigDecimal(sqlRowAccessor.getInt("QTE_LIVREE"))); |
return total.subtract(totalD); |
} else { |
totalD = nonEmptyForeignCmdItem.getBigDecimal("QTE_LIVREE"); |
} |
if (this.type == ResteProvider.LIVRE_TOTAL) { |
if (totalD.signum() > 0) { |
return totalD; |
} else { |
return null; |
} |
} else { |
BigDecimal r = total.subtract(totalD); |
if (r.signum() > 0) { |
return r; |
} else { |
return null; |
} |
} |
} |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.qty.delivred.total", new ResteALivrerDocProvider(ResteProvider.LIVRE_TOTAL)); |
SpreadSheetCellValueProviderManager.put("sales.qty.delivred.remained", new ResteALivrerDocProvider(ResteProvider.RESTE)); |
SpreadSheetCellValueProviderManager.put("sales.qty.cmd.delivred.total", new ResteALivrerDocProvider(ResteProvider.LIVRE_TOTAL_CMD)); |
SpreadSheetCellValueProviderManager.put("sales.qty.cmd.delivred.remained", new ResteALivrerDocProvider(ResteProvider.RESTE_CMD)); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/RGProvider.java |
---|
New file |
0,0 → 1,76 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.generationDoc.provider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProvider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager; |
import org.openconcerto.utils.DecimalUtils; |
import java.math.BigDecimal; |
import java.math.RoundingMode; |
public class RGProvider implements SpreadSheetCellValueProvider { |
private enum TypeRGProvider { |
HT_RESTANT(true, true), TTC_RESTANT(false, true), HT_RG(true, false), TTC_RG(false, false); |
private final boolean restant, ht; |
TypeRGProvider(boolean ht, boolean restant) { |
this.restant = restant; |
this.ht = ht; |
} |
public boolean isHt() { |
return this.ht; |
} |
public boolean isRestant() { |
return this.restant; |
} |
}; |
private final TypeRGProvider type; |
public RGProvider(TypeRGProvider t) { |
this.type = t; |
} |
public Object getValue(SpreadSheetCellValueContext context) { |
final BigDecimal total; |
if (this.type.isHt()) { |
total = new BigDecimal(context.getRow().getLong("T_HT")).movePointLeft(2); |
} else { |
total = new BigDecimal(context.getRow().getLong("T_TTC")).movePointLeft(2); |
} |
final BigDecimal pourcentRG = context.getRow().getBigDecimal("POURCENT_RG"); |
final BigDecimal totalRG = total.multiply(pourcentRG.movePointLeft(2), DecimalUtils.HIGH_PRECISION).setScale(2, RoundingMode.HALF_UP); |
if (this.type.isRestant()) { |
return total.subtract(totalRG); |
} else { |
return totalRG; |
} |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.rg.due", new RGProvider(TypeRGProvider.TTC_RG)); |
SpreadSheetCellValueProviderManager.put("sales.total.sub.rg", new RGProvider(TypeRGProvider.TTC_RESTANT)); |
SpreadSheetCellValueProviderManager.put("sales.rg.due.ht", new RGProvider(TypeRGProvider.HT_RG)); |
SpreadSheetCellValueProviderManager.put("sales.total.sub.rg.ht", new RGProvider(TypeRGProvider.HT_RESTANT)); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/LabelAccountInvoiceProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
22,12 → 22,18 |
public class LabelAccountInvoiceProvider implements SpreadSheetCellValueProvider { |
private final String label; |
public LabelAccountInvoiceProvider(String label) { |
this.label = label; |
} |
public Object getValue(SpreadSheetCellValueContext context) { |
final SQLRowAccessor row = context.getRow(); |
final Collection<? extends SQLRowAccessor> rows = row.getReferentRows(row.getTable().getTable("TR_COMMANDE_CLIENT")); |
String result; |
if (row.getBoolean("PARTIAL")) { |
result = "Facturation intermédiaire, commande N°"; |
result = this.label + ", commande N°"; |
} else { |
result = "Solde, commande N°"; |
} |
41,7 → 47,8 |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.account.label", new LabelAccountInvoiceProvider()); |
SpreadSheetCellValueProviderManager.put("sales.account.label", new LabelAccountInvoiceProvider("Facturation intermédiaire")); |
SpreadSheetCellValueProviderManager.put("sales.account.label.account", new LabelAccountInvoiceProvider("Facture d'acompte")); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/BatchListProvider.java |
---|
New file |
0,0 → 1,80 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.generationDoc.provider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import java.text.DateFormat; |
import java.text.SimpleDateFormat; |
import java.util.Calendar; |
import java.util.Collection; |
public class BatchListProvider extends UserInitialsValueProvider { |
private final String refTable; |
public BatchListProvider(String refTable) { |
this.refTable = refTable; |
} |
@Override |
public Object getValue(SpreadSheetCellValueContext context) { |
final DateFormat format = new SimpleDateFormat("dd/MM/yyyy"); |
final SQLRowAccessor row = context.getRow(); |
final Collection<? extends SQLRowAccessor> cols = row.asRow().getReferentRows(row.getTable().getTable(this.refTable)); |
final StringBuilder res = new StringBuilder(); |
for (SQLRowAccessor sqlRowAccessor : cols) { |
final Calendar dluo = sqlRowAccessor.getDate("DLUO"); |
final Calendar dlc = sqlRowAccessor.getDate("DLC"); |
final String lot = sqlRowAccessor.getString("NUMERO_LOT"); |
final String serie = sqlRowAccessor.getString("NUMERO_SERIE"); |
if (res.length() > 0) { |
res.append("\n"); |
} |
if (serie != null && serie.trim().length() > 0) { |
res.append("N° Série : " + serie); |
} |
if (lot != null && lot.trim().length() > 0) { |
if (res.length() > 0) { |
res.append(", "); |
} |
res.append("N° Lot : " + lot); |
} |
if (dlc != null) { |
if (res.length() > 0) { |
res.append(", "); |
} |
res.append("DLC : " + format.format(dlc.getTime())); |
} |
if (dluo != null) { |
if (res.length() > 0) { |
res.append(", "); |
} |
res.append("DLUO : " + format.format(dluo.getTime())); |
} |
} |
return res.toString(); |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.batch.list", new BatchListProvider("LOT_LIVRAISON")); |
SpreadSheetCellValueProviderManager.put("purchase.batch.list", new BatchListProvider("LOT_RECEPTION")); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/FormatedGlobalQtyTotalProvider.java |
---|
43,10 → 43,13 |
this.pieceName = withPieceName; |
} |
private final BigDecimal cent = new BigDecimal(100); |
public Object getValue(SpreadSheetCellValueContext context) { |
final SQLRowAccessor row = context.getRow(); |
final BigDecimal pv = row.getBigDecimal("PV_HT"); |
if (!this.alwaysShowOnZeroQty && pv != null && pv.compareTo(BigDecimal.ZERO) == 0) { |
final BigDecimal pR = row.getBigDecimal("POURCENT_REMISE"); |
if (!this.alwaysShowOnZeroQty && pv != null && pv.compareTo(BigDecimal.ZERO) == 0 && (pR == null || pR.compareTo(cent) != 0)) { |
return null; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/TitleInvoiceProvider.java |
---|
New file |
0,0 → 1,42 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.generationDoc.provider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProvider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager; |
import org.openconcerto.sql.model.SQLRowAccessor; |
public class TitleInvoiceProvider implements SpreadSheetCellValueProvider { |
public Object getValue(SpreadSheetCellValueContext context) { |
final SQLRowAccessor row = context.getRow(); |
String result; |
if (row.getBoolean("PARTIAL")) { |
result = "Facture de situation"; |
} else { |
result = "Facture de solde"; |
} |
if (row.getBoolean("PREVISIONNELLE")) { |
result += " Prévisionnelle"; |
} |
return result; |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.account.title", new TitleInvoiceProvider()); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/SpreadSheetGenerator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
29,6 → 29,7 |
import java.awt.Point; |
import java.io.File; |
import java.io.FileInputStream; |
import java.io.FileNotFoundException; |
import java.io.IOException; |
import java.io.InputStream; |
56,7 → 57,7 |
private String printer; |
private boolean exportPDF; |
private Map mapReplaceText; |
private String fODSP = null; |
private InputStream fODSP = null; |
protected static final String defaultLocationTemplate = "/Configuration/Template/Default/"; |
77,15 → 78,17 |
// on parcourt chaque ligne de la feuille pour recuperer les styles |
int columnCount = (colEnd == -1) ? sheet.getColumnCount() : (colEnd + 1); |
System.err.println("End column search : " + columnCount); |
int endColumnSearch = Math.min(100, columnCount); |
System.err.println("End column search : " + endColumnSearch); |
int rowCount = (rowEnd > 0) ? rowEnd : sheet.getRowCount(); |
for (int i = 0; i < rowCount; i++) { |
int endRowSearch = Math.min(100, rowCount); |
for (int i = 0; i < endRowSearch; i++) { |
int x = 0; |
Map<Integer, String> mapCellStyle = new HashMap<Integer, String>(); |
String style = ""; |
for (int j = 0; j < columnCount; j++) { |
for (int j = 0; j < endColumnSearch; j++) { |
if (sheet.isCellValid(j, i)) { |
183,18 → 186,25 |
} |
protected SpreadSheet loadTemplate() throws IOException { |
InputStream f = getStreamStatic(modelDir + File.separator + this.modele); |
fODSP = modelDir + File.separator + this.modele + "p"; |
InputStream f = TemplateManager.getInstance().getTemplate(modele.replaceAll(".ods", "")); |
if (f == null) { |
f = getStreamStatic(defaultLocationTemplate + File.separator + this.modele); |
fODSP = defaultLocationTemplate + File.separator + this.modele + "p"; |
f = getStreamStatic(modelDir + File.separator + this.modele); |
fODSP = getStreamStatic(modelDir + File.separator + this.modele + "p"); |
if (f == null) { |
ExceptionHandler.handle("Modele " + this.modele + " introuvable. Impossible de générer le document."); |
System.err.println("Modele introuvable : " + (defaultLocationTemplate + File.separator + this.modele)); |
fODSP = null; |
return null; |
f = getStreamStatic(defaultLocationTemplate + File.separator + this.modele); |
fODSP = getStreamStatic(defaultLocationTemplate + File.separator + this.modele + "p"); |
if (f == null) { |
ExceptionHandler.handle("Modele " + this.modele + " introuvable. Impossible de générer le document."); |
System.err.println("Modele introuvable : " + (defaultLocationTemplate + File.separator + this.modele)); |
fODSP = null; |
return null; |
} |
} |
} else { |
fODSP = TemplateManager.getInstance().getTemplatePrintConfiguration(modele.replaceAll(".ods", ""), null, null); |
} |
final SpreadSheet res = new ODPackage(f).getSpreadSheet(); |
f.close(); |
return res; |
217,13 → 227,12 |
fTmp.renameTo(fDest); |
fDest = new File(this.destDirOO, this.destFileName + ".ods"); |
try (final InputStream stream = getStreamStatic(fODSP)) { |
if (stream != null) { |
// Copie de l'odsp |
File odspOut = new File(this.destDirOO, this.destFileName + ".odsp"); |
StreamUtils.copy(stream, odspOut); |
} |
if (this.fODSP != null) { |
// Copie de l'odsp |
File odspOut = new File(this.destDirOO, this.destFileName + ".odsp"); |
StreamUtils.copy(this.fODSP, odspOut); |
} |
try { |
ssheet.saveAs(fDest); |
} catch (FileNotFoundException e) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/gestcomm/OptionDocProcessor.java |
---|
61,12 → 61,18 |
BigDecimal totalHT = sqlRowValues.getBigDecimal("T_PV_HT"); |
final BigDecimal remisePercent = sqlRowValues.getBigDecimal("POURCENT_REMISE"); |
if (remisePercent != null && remisePercent.signum() > 0) { |
totalHT = totalHT.divide(BigDecimal.ONE.subtract(remisePercent.movePointLeft(2)), org.openconcerto.utils.DecimalUtils.HIGH_PRECISION); |
if (remisePercent != null && remisePercent.signum() > 0 && remisePercent.movePointLeft(2).compareTo(BigDecimal.ONE) != 0) { |
if (BigDecimal.ONE.subtract(remisePercent.movePointLeft(2)).signum() != 0) { |
totalHT = totalHT.divide(BigDecimal.ONE.subtract(remisePercent.movePointLeft(2)), org.openconcerto.utils.DecimalUtils.HIGH_PRECISION); |
} |
} |
BigDecimal unitPrice = totalHT.divide(qte, DecimalUtils.HIGH_PRECISION); |
sqlRowValues.put("PV_HT", unitPrice); |
sqlRowValues.put("PRIX_METRIQUE_VT_1", unitPrice); |
// On ne recalcule pas le prix unitaire si la remise est de 100% sinon le prix |
// unitaire est à 0 et les provider de quantité n'affiche plus rien |
if (remisePercent == null || remisePercent.movePointLeft(2).compareTo(BigDecimal.ONE) != 0) { |
BigDecimal unitPrice = totalHT.divide(qte, DecimalUtils.HIGH_PRECISION); |
sqlRowValues.put("PV_HT", unitPrice); |
sqlRowValues.put("PRIX_METRIQUE_VT_1", unitPrice); |
} |
} |
} |
result.add(sqlRowValues); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtDepotChequeClient.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
28,6 → 28,9 |
import org.openconcerto.erp.core.common.element.BanqueSQLElement; |
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement; |
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement; |
import org.openconcerto.erp.core.finance.payment.element.TypeReglementSQLElement; |
import org.openconcerto.erp.preferences.DefaultNXProps; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
90,7 → 93,21 |
int idJrnl = this.banque.getForeignID("ID_JOURNAL"); |
this.putValue("ID_JOURNAL", idJrnl); |
} |
if (!depot.isForeignEmpty("ID_" + BanqueSQLElement.TABLENAME)) { |
SQLRow rowBanque = depot.getForeignRow("ID_" + BanqueSQLElement.TABLENAME); |
if (rowBanque.getTable().contains("TYPE_CAISSE") && rowBanque.getBoolean("TYPE_CAISSE")) { |
final SQLRow row = rowBanque.getTable().getTable("TYPE_REGLEMENT").getRow(TypeReglementSQLElement.CHEQUE); |
if (row.getTable().contains("ID_COMPTE_PCE_CAISSE")) { |
Number n = row.getNonEmptyForeignIDNumber("ID_COMPTE_PCE_CAISSE"); |
if (n != null) { |
this.putValue("ID_JOURNAL", JournalSQLElement.CAISSES); |
} |
} |
} |
} |
boolean genEcrDisabled = DefaultNXProps.getInstance().getBooleanValue(GenerationMvtSaisieVenteFacture.NOT_GEN_ECRITURE, false); |
List<Integer> pieceIDs = new ArrayList<Integer>(); |
SQLRowValues rowValsDepotElt = new SQLRowValues(depot.getTable().getTable("DEPOT_CHEQUE_ELEMENT")); |
rowValsDepotElt.putNulls("MONTANT", "TIERS", "PIECE"); |
131,20 → 148,36 |
this.putValue("ID_COMPTE_PCE", new Integer(idCompteClient)); |
this.putValue("DEBIT", new Long(0)); |
this.putValue("CREDIT", new Long(sqlRowAccessor.getLong("MONTANT"))); |
SQLRow insertedRow = ajoutEcriture(); |
sqlRowAccessor.createEmptyUpdateRow().put("ID_ECRITURE", insertedRow.getID()).getGraph().store(StoreMode.COMMIT, false); |
if (!genEcrDisabled) { |
SQLRow insertedRow = ajoutEcriture(); |
sqlRowAccessor.createEmptyUpdateRow().put("ID_ECRITURE", insertedRow.getID()).getGraph().store(StoreMode.COMMIT, false); |
} |
sqlRowAccessor.getForeign("ID_CHEQUE_A_ENCAISSER").createEmptyUpdateRow().put("ENCAISSE", Boolean.TRUE).getGraph().store(StoreMode.COMMIT, false); |
} |
// compte de reglement cheque, ... |
fillCompteBanqueFromRow(depot, "VenteCheque", false); |
if (!depot.isForeignEmpty("ID_" + BanqueSQLElement.TABLENAME)) { |
SQLRow rowBanque = depot.getForeignRow("ID_" + BanqueSQLElement.TABLENAME); |
if (rowBanque.getTable().contains("TYPE_CAISSE") && rowBanque.getBoolean("TYPE_CAISSE")) { |
final SQLRow row = rowBanque.getTable().getTable("TYPE_REGLEMENT").getRow(TypeReglementSQLElement.CHEQUE); |
if (row.getTable().contains("ID_COMPTE_PCE_CAISSE")) { |
Number n = row.getNonEmptyForeignIDNumber("ID_COMPTE_PCE_CAISSE"); |
if (n != null) { |
this.putValue("ID_COMPTE_PCE", n); |
} |
} |
} |
} |
this.putValue("NOM", this.nom); |
this.putValue("DEBIT", new Long(this.montant)); |
this.putValue("CREDIT", new Long(0)); |
SQLRow insertedRow = ajoutEcriture(); |
depot.createEmptyUpdateRow().put("ID_MOUVEMENT", idMvt).put("ID_ECRITURE", insertedRow.getID()).getGraph().store(StoreMode.COMMIT, false); |
if (!genEcrDisabled) { |
SQLRow insertedRow = ajoutEcriture(); |
depot.createEmptyUpdateRow().put("ID_MOUVEMENT", idMvt).put("ID_ECRITURE", insertedRow.getID()).getGraph().store(StoreMode.COMMIT, false); |
} else { |
depot.createEmptyUpdateRow().put("ID_MOUVEMENT", idMvt).getGraph().store(StoreMode.COMMIT, false); |
} |
pieceIDs.add(mouvementTable.getRow(idMvt).getForeignID("ID_PIECE")); |
lettrageAuto(pieceIDs, this.date); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/Exercice.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
380,10 → 380,27 |
SQLUpdate.executeMultipleWithBatch(sysRoot, mvtUpdate); |
// Creation des inserts des écritures sans analytique |
final List<SQLInsert> insertsEcrituresSansAnalytique = new ArrayList<>(insertsMouvement.size() * 2); |
final List<SQLInsert> insertsEcrituresAvecAnalytique = new ArrayList<>(insertsMouvement.size() * 2); |
final List<Ecriture> ecrituresAvecAnalytique = new ArrayList<>(insertsEcrituresAvecAnalytique.size()); |
final List<SQLInsert> insertsURL = new ArrayList<>(insertsMouvement.size()); |
for (int i = 0; i < pieces.size(); i++) { |
Piece piece = pieces.get(i); |
piece.setId(idsPieces.get(i)); |
for (Mouvement m : piece.getMouvements()) { |
if (m.hasURLs()) { |
List<MouvementGED> urLs = m.getURLs(); |
for (MouvementGED urls : urLs) { |
insertsURL.add(urls.createInsert(root, user)); |
} |
} |
} |
} |
if (!insertsURL.isEmpty()) { |
SQLInsert.executeSimilarInserts(sysRoot, insertsURL, false); |
} |
// Creation des inserts des écritures sans liens ( analytique) |
final List<SQLInsert> insertsEcrituresSansLiens = new ArrayList<>(insertsMouvement.size() * 2); |
final List<SQLInsert> insertsEcrituresAvecLiens = new ArrayList<>(insertsMouvement.size() * 2); |
final List<Ecriture> ecrituresAvecLiens = new ArrayList<>(insertsEcrituresAvecLiens.size()); |
for (Piece p : pieces) { |
final List<Mouvement> mouvements = p.getMouvements(); |
final int stop = mouvements.size(); |
391,31 → 408,42 |
final Mouvement m = mouvements.get(i); |
for (Ecriture e : m.getEcritures()) { |
if (e.hasAnalytique()) { |
insertsEcrituresAvecAnalytique.add(e.createInsert(root, user)); |
ecrituresAvecAnalytique.add(e); |
insertsEcrituresAvecLiens.add(e.createInsert(root, user)); |
ecrituresAvecLiens.add(e); |
} else { |
insertsEcrituresSansAnalytique.add(e.createInsert(root, user)); |
insertsEcrituresSansLiens.add(e.createInsert(root, user)); |
} |
} |
} |
} |
// Insertions des écritures des mouvements |
SQLInsert.executeSimilarInserts(sysRoot, insertsEcrituresSansAnalytique, false); |
if (!insertsEcrituresSansLiens.isEmpty()) { |
// Insertions des écritures des mouvements |
SQLInsert.executeSimilarInserts(sysRoot, insertsEcrituresSansLiens, false); |
} |
// Insertions des écritures avec analytique |
if (!ecrituresAvecAnalytique.isEmpty()) { |
final List<Number> idsEcritues = SQLInsert.executeSimilarInserts(sysRoot, insertsEcrituresAvecAnalytique, true); |
if (!ecrituresAvecLiens.isEmpty()) { |
final List<Number> idsEcritues = SQLInsert.executeSimilarInserts(sysRoot, insertsEcrituresAvecLiens, true); |
// Analytique |
final List<SQLInsert> insertsAssociationAnalytique = new ArrayList<>(insertsEcrituresAvecAnalytique.size()); |
final int size = ecrituresAvecAnalytique.size(); |
final List<SQLInsert> insertsAssociationAnalytique = new ArrayList<>(insertsEcrituresAvecLiens.size()); |
final List<SQLInsert> insertsURLs = new ArrayList<>(insertsEcrituresAvecLiens.size()); |
final int size = ecrituresAvecLiens.size(); |
for (int i = 0; i < size; i++) { |
final Ecriture e = ecrituresAvecAnalytique.get(i); |
final Ecriture e = ecrituresAvecLiens.get(i); |
e.setId(idsEcritues.get(i)); |
for (AssociationAnalytique a : e.getAssociationsAnalytiques()) { |
insertsAssociationAnalytique.add(a.createInsert(root, user)); |
if (e.hasAnalytique()) { |
for (AssociationAnalytique a : e.getAssociationsAnalytiques()) { |
insertsAssociationAnalytique.add(a.createInsert(root, user)); |
} |
} |
} |
SQLInsert.executeSimilarInserts(sysRoot, insertsAssociationAnalytique, false); |
if (!insertsAssociationAnalytique.isEmpty()) { |
SQLInsert.executeSimilarInserts(sysRoot, insertsAssociationAnalytique, false); |
} |
if (!insertsURLs.isEmpty()) { |
SQLInsert.executeSimilarInserts(sysRoot, insertsURLs, false); |
} |
} |
for (Piece p : pieces) { |
final List<Mouvement> mouvements = p.getMouvements(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtAcompte.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
18,13 → 18,12 |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.GestionDevise; |
import java.sql.SQLException; |
import java.util.Date; |
public final class GenerationMvtAcompte extends GenerationEcritures implements Runnable { |
public final class GenerationMvtAcompte extends GenerationEcritures { |
private int idSalarie; |
private long montant; |
44,10 → 43,10 |
this.montant = GestionDevise.parseLongCurrency(String.valueOf(rowAcompte.getFloat("MONTANT"))); |
SQLRow rowSal = tableSalarie.getRow(this.idSalarie); |
this.idMvt = getNewMouvement("ACOMPTE", this.idAcompte, 1, "Acompte " + rowSal.getString("NOM")); |
new Thread(GenerationMvtAcompte.this).start(); |
genereComptaAcompte(); |
} |
private void genereComptaAcompte() throws Exception { |
private void genereComptaAcompte() throws SQLException { |
System.out.println("Génération des ecritures du mouvement " + this.idMvt); |
99,12 → 98,4 |
} |
public void run() { |
try { |
genereComptaAcompte(); |
} catch (Exception e) { |
ExceptionHandler.handle("Erreur lors de la génération des mouvements", e); |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtSaisieVenteFacture.java |
---|
16,15 → 16,20 |
import org.openconcerto.erp.core.common.ui.TotalCalculator; |
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement; |
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement; |
import org.openconcerto.erp.core.finance.payment.element.TypeReglementSQLElement; |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache; |
import org.openconcerto.erp.generationDoc.SheetXml; |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache; |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProvider; |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProviderManager; |
import org.openconcerto.erp.model.PrixTTC; |
import org.openconcerto.erp.preferences.DefaultNXProps; |
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.utils.DecimalUtils; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.StringUtils; |
42,6 → 47,7 |
public class GenerationMvtSaisieVenteFacture extends GenerationEcritures implements Runnable { |
public static final String ID = "accounting.records.invoice.sales"; |
public static final String NOT_GEN_ECRITURE = "accounting.invoice.generation.disable"; |
private static final String source = "SAISIE_VENTE_FACTURE"; |
public static final Integer journal = Integer.valueOf(JournalSQLElement.VENTES); |
private int idSaisieVenteFacture; |
99,13 → 105,10 |
SQLRow saisieRow = GenerationMvtSaisieVenteFacture.saisieVFTable.getRow(this.idSaisieVenteFacture); |
setRowAnalytiqueSource(saisieRow); |
boolean genEcrDisabled = DefaultNXProps.getInstance().getBooleanValue(GenerationMvtSaisieVenteFacture.NOT_GEN_ECRITURE, false); |
this.putValue("ID_JOURNAL", GenerationMvtSaisieVenteFacture.journal); |
SQLRow clientRow = saisieRow.getForeignRow("ID_CLIENT"); |
// Calcul des montants |
PrixTTC prixTTC = new PrixTTC(((Long) saisieRow.getObject("T_TTC")).longValue()); |
// Total des acomptes déjà versés sur la facture |
long montantAcompteTTC = 0; |
int idCompteClient = clientRow.getInt("ID_COMPTE_PCE"); |
Boolean acompte = saisieRow.getBoolean("ACOMPTE"); |
114,7 → 117,36 |
} else { |
this.nom = "Fact. vente " + saisieRow.getObject("NUMERO").toString(); |
} |
this.nom += " " + StringUtils.limitLength(clientRow.getString("NOM"), 20); |
boolean typeCaisse = false; |
SQLRow modeRegl = saisieRow.getForeignRow("ID_MODE_REGLEMENT"); |
final SQLRow typeRegRow = modeRegl.getForeignRow("ID_TYPE_REGLEMENT"); |
final SQLRowAccessor nonEmptyForeign = modeRegl.getNonEmptyForeign("ID_BANQUE"); |
if (nonEmptyForeign != null && nonEmptyForeign.getTable().contains("TYPE_CAISSE") && nonEmptyForeign.getBoolean("TYPE_CAISSE")) { |
typeCaisse = true; |
idCompteClient = nonEmptyForeign.getForeignID("ID_COMPTE_PCE"); |
Number idJournal = nonEmptyForeign.getNonEmptyForeignIDNumber("ID_JOURNAL"); |
if (idJournal != null) { |
this.putValue("ID_JOURNAL", idJournal); |
} else { |
this.putValue("ID_JOURNAL", JournalSQLElement.CAISSES); |
} |
this.nom += " (" + typeRegRow.getString("NOM") + ") " + StringUtils.limitLength(clientRow.getString("NOM"), 20); |
} else { |
this.nom += " " + StringUtils.limitLength(clientRow.getString("NOM"), 20); |
} |
if (SQLPreferences.getMemCached(saisieRow.getTable().getDBRoot()).getBoolean(GestionCommercialeGlobalPreferencePanel.ECRITURE_FACTURE_REF_LIBELLE, false)) { |
if (saisieRow.getString("NOM") != null && saisieRow.getString("NOM").trim().length() > 0) |
this.nom += " " + StringUtils.limitLength(saisieRow.getString("NOM"), 30); |
} |
// Calcul des montants |
PrixTTC prixTTC = new PrixTTC(((Long) saisieRow.getObject("T_TTC")).longValue()); |
// Total des acomptes déjà versés sur la facture |
long montantAcompteTTC = 0; |
this.putValue("NOM", this.nom); |
// iniatilisation des valeurs de la map |
123,7 → 155,7 |
provider.putLabel(saisieRow, this.mEcritures); |
this.putValue("DATE", this.date); |
this.putValue("ID_JOURNAL", GenerationMvtSaisieVenteFacture.journal); |
this.putValue("ID_MOUVEMENT", Integer.valueOf(1)); |
// on calcule le nouveau numero de mouvement |
176,7 → 208,9 |
this.putValue("ID_COMPTE_PCE", rowCompl.getForeignID("ID_COMPTE_PCE")); |
this.putValue("DEBIT", Long.valueOf(0)); |
this.putValue("CREDIT", Long.valueOf(taxeC)); |
ajoutEcriture(); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
taxe += taxeC; |
// this.putValue("ID_COMPTE_PCE", |
// rowCompl.getForeignID("ID_COMPTE_PCE_PRODUITS")); |
197,7 → 231,9 |
this.putValue("ID_COMPTE_PCE", idComptePCE); |
this.putValue("DEBIT", Long.valueOf(0)); |
this.putValue("CREDIT", Long.valueOf(b - taxe)); |
ajoutEcriture(); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
} |
} |
208,7 → 244,9 |
this.putValue("ID_COMPTE_PCE", rowAc.getID()); |
this.putValue("DEBIT", Long.valueOf(0)); |
this.putValue("CREDIT", longValue); |
ajoutEcriture(); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
} |
} |
226,7 → 264,9 |
} |
this.putValue("DEBIT", ttcLongValue); |
this.putValue("CREDIT", Long.valueOf(0)); |
ajoutEcriture(); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
// TODO Gestion des factures d'acomptes |
// Solde des acomptes |
303,9 → 343,8 |
if (genereReglement) { |
// Génération du reglement |
SQLRow modeRegl = saisieRow.getForeignRow("ID_MODE_REGLEMENT"); |
final SQLRow typeRegRow = modeRegl.getForeignRow("ID_TYPE_REGLEMENT"); |
String label = this.nom + " (" + typeRegRow.getString("NOM") + ") " + StringUtils.limitLength(clientRow.getString("NOM"), 20); |
String label = this.nom + " (" + typeRegRow.getString("NOM") + ") "; |
int idAvoir = saisieRow.getInt("ID_AVOIR_CLIENT"); |
if (idAvoir > 1) { |
// SQLRow avoirRow = base.getTable("AVOIR_CLIENT").getRow(idAvoir); |
312,10 → 351,45 |
long l = ((Number) saisieRow.getObject("T_AVOIR_TTC")).longValue(); |
prixTTC = new PrixTTC(((Long) saisieRow.getObject("T_TTC")).longValue() - l); |
} |
prixTTC = new PrixTTC(saisieRow.getLong("NET_A_PAYER")); |
if (prixTTC.getLongValue() > 0) { |
new GenerationReglementVenteNG(label.trim(), clientRow, prixTTC, this.date, modeRegl, saisieRow, mvtTable.getRow(idMvt)); |
final long totalNet = saisieRow.getLong("NET_A_PAYER"); |
final SQLRow rowClient; |
final SQLRow rowCptTiers; |
if (typeCaisse) { |
rowClient = null; |
rowCptTiers = modeRegl.getForeign("ID_BANQUE").getForeign("ID_COMPTE_PCE"); |
} else { |
rowClient = clientRow; |
rowCptTiers = null; |
} |
final String tiers = clientRow.getString("NOM"); |
if (saisieRow.contains("POURCENT_RG") && saisieRow.getBigDecimal("POURCENT_RG") != null && saisieRow.getBigDecimal("POURCENT_RG").signum() != 0) { |
long totalRG = new BigDecimal(totalNet).multiply(saisieRow.getBigDecimal("POURCENT_RG"), DecimalUtils.HIGH_PRECISION).movePointLeft(2).setScale(0, RoundingMode.HALF_UP) |
.longValue(); |
PrixTTC prixRG = new PrixTTC(totalRG); |
prixTTC = new PrixTTC(totalNet - totalRG); |
if (prixTTC.getLongValue() > 0) { |
new GenerationReglementVenteNG(label.trim(), rowClient, prixTTC, this.date, modeRegl, saisieRow, mvtTable.getRow(idMvt), true, false, tiers, rowCptTiers); |
} |
if (prixRG.getLongValue() > 0) { |
SQLRowValues rowValsMdrRg = new SQLRowValues(modeRegl.getTable()); |
rowValsMdrRg.put("AJOURS", 365); |
rowValsMdrRg.put("LENJOUR", 0); |
rowValsMdrRg.put("COMPTANT", Boolean.FALSE); |
rowValsMdrRg.put("FIN_MOIS", Boolean.FALSE); |
rowValsMdrRg.put("DATE_FACTURE", Boolean.TRUE); |
rowValsMdrRg.put("RG", Boolean.TRUE); |
rowValsMdrRg.put("ID_TYPE_REGLEMENT", TypeReglementSQLElement.INDEFINI); |
final SQLRow rowMdrRG = rowValsMdrRg.commit(); |
new GenerationReglementVenteNG(label.trim(), rowClient, prixRG, this.date, rowMdrRG, saisieRow, mvtTable.getRow(idMvt), true, false, tiers, rowCptTiers); |
} |
} else { |
prixTTC = new PrixTTC(totalNet); |
if (prixTTC.getLongValue() > 0) { |
new GenerationReglementVenteNG(label.trim(), rowClient, prixTTC, this.date, modeRegl, saisieRow, mvtTable.getRow(idMvt), true, false, tiers, rowCptTiers); |
} |
} |
} |
// Mise à jour de mouvement associé à la facture |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/MouvementGED.java |
---|
New file |
0,0 → 1,48 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.generationEcritures; |
import org.openconcerto.erp.core.edm.Attachment; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLInsert; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.users.User; |
public class MouvementGED { |
private String url; |
private Mouvement mvt; |
public MouvementGED(String url) { |
this.url = url; |
} |
public void setEcriture(Mouvement mvt) { |
this.mvt = mvt; |
} |
public SQLInsert createInsert(DBRoot root, User user) { |
final SQLInsert insert = new SQLInsert(); |
final SQLTable table = root.getTable("ATTACHMENT"); |
insert.add(table.getField("SOURCE_TABLE"), "MOUVEMENT"); |
insert.add(table.getField("SOURCE_ID"), this.mvt.getId().intValue()); |
insert.add(table.getField("NAME"), this.url); |
insert.add(table.getField("FILENAME"), this.url); |
insert.add(table.getField("MIMETYPE"), Attachment.MIMETYPE_URL); |
insert.add(table.getField("FILESIZE"), 0); |
insert.add(table.getField("STORAGE_PATH"), ""); |
insert.add(table.getField("STORAGE_FILENAME"), ""); |
return insert; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtFichePaye.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
57,7 → 57,7 |
private Map<String, SQLTable> mapTableSource = new HashMap<String, SQLTable>(); |
public GenerationMvtFichePaye(int[] idFichePaye, String mois, String annee) throws SQLException { |
public GenerationMvtFichePaye(int[] idFichePaye, String mois, String annee, Date d) throws SQLException { |
setRowAnalytiqueSource(null); |
SQLTable tableNet = Configuration.getInstance().getBase().getTable("RUBRIQUE_NET"); |
73,6 → 73,7 |
this.idFichePaye = idFichePaye; |
this.annee = annee; |
this.mois = mois; |
this.date = d; |
this.idMvt = getNewMouvement("", 1, 1, "Paye " + this.mois + " " + this.annee); |
new Thread(GenerationMvtFichePaye.this).start(); |
} |
98,7 → 99,7 |
// SQLRow rowFiche = |
// Configuration.getInstance().getBase().getTable("FICHE_PAYE").getRow(this.idFichePaye); |
// iniatilisation des valeurs de la map |
this.date = new Date(); |
// this.date = new Date(); |
// SQLRow rowMois = tableMois.getRow(rowFiche.getInt("ID_MOIS")); |
// SQLRow rowSal = tableSalarie.getRow(rowFiche.getInt("ID_SALARIE")); |
348,15 → 349,19 |
Tuple2<Integer, Integer> t = mapCaisse.get(idCaisse); |
// on recupere les comptes tiers et charge de la caisse associée |
int idCompteCharge = (t == null ? ComptePCESQLElement.getId("645") : t.get0()); |
// } |
int idCompteCharge; |
if (rowSource.getString("NUMERO_COMPTE_PCE_CHARGES") != null && rowSource.getString("NUMERO_COMPTE_PCE_CHARGES").trim().length() > 0) { |
idCompteCharge = ComptePCESQLElement.getId(rowSource.getString("NUMERO_COMPTE_PCE_CHARGES")); |
} else { |
idCompteCharge = (t == null ? ComptePCESQLElement.getId("645") : t.get0()); |
} |
int idCompteTiers; |
if (rowSource.getString("NUMERO_COMPTE_PCE") != null && rowSource.getString("NUMERO_COMPTE_PCE").trim().length() > 0) { |
idCompteTiers = ComptePCESQLElement.getId(rowSource.getString("NUMERO_COMPTE_PCE")); |
} else { |
idCompteTiers = (t == null ? ComptePCESQLElement.getId("437") : t.get1()); |
} |
// int idCompteTiers = rowCaisse.getInt("ID_COMPTE_PCE_TIERS"); |
// if (idCompteTiers <= 1) { |
int idCompteTiers = (t == null ? ComptePCESQLElement.getId("437") : t.get1()); |
// int idCompteTiers = ComptePCESQLElement.getId("437"); |
// } |
// Cotisations sal. |
if (row.getObject("MONTANT_SAL_DED") != null && row.getFloat("MONTANT_SAL_DED") != 0) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtReglementFactureFournisseur.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
38,7 → 38,7 |
import java.util.Map; |
// FIXME mettre toute les generations dans des threads à part |
public final class GenerationMvtReglementFactureFournisseur extends GenerationEcritures implements Runnable { |
public final class GenerationMvtReglementFactureFournisseur extends GenerationEcritures { |
private int idfacture; |
50,13 → 50,13 |
private static final SQLRow rowPrefsCompte = tablePrefCompte.getRow(2); |
private int idPere = 1; // Id du mouvement pere |
public GenerationMvtReglementFactureFournisseur(int idFacture, int idMvt) { |
public GenerationMvtReglementFactureFournisseur(int idFacture, int idMvt) throws SQLException { |
this.idfacture = idFacture; |
this.idPere = idMvt; |
new Thread(GenerationMvtReglementFactureFournisseur.this).start(); |
genereReglement(); |
} |
private void genereReglement() throws Exception { |
private void genereReglement() throws SQLException { |
System.out.println("Génération des ecritures du reglement du mouvement " + this.idMvt); |
249,7 → 249,7 |
public void run() { |
try { |
genereReglement(); |
} catch (Exception e) { |
ExceptionHandler.handle("Erreur pendant la générations des écritures comptables", e); |
e.printStackTrace(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtSaisieKm.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
61,7 → 61,7 |
getNewMouvement(GenerationMvtSaisieKm.source, this.idSaisieKm, 1, rowValsPiece); |
// gnération des ecritures |
SQLTable tableElt = Configuration.getInstance().getRoot().findTable("SAISIE_KM_ELEMENT"); |
SQLTable tableElt = table.getDBRoot().findTable("SAISIE_KM_ELEMENT"); |
List<SQLRow> set = saisieRow.getReferentRows(tableElt); |
SQLTable tableAssoc = Configuration.getInstance().getRoot().findTable("ASSOCIATION_ANALYTIQUE"); |
70,6 → 70,9 |
int idCpt = ComptePCESQLElement.getId(rowElement.getString("NUMERO"), rowElement.getString("NOM")); |
if (ecritureTable.contains("DATE_ECHEANCE") && table.getDBRoot().findTable("SAISIE_KM_ELEMENT").contains("DATE_ECHEANCE")) { |
this.putValue("DATE_ECHEANCE", rowElement.getObject("DATE_ECHEANCE")); |
} |
// Ajout de l'écriture |
this.putValue("ID_COMPTE_PCE", new Integer(idCpt)); |
this.putValue("NOM", rowElement.getString("NOM_ECRITURE")); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/provider/SalesInvoiceAccountingRecordsProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
15,9 → 15,11 |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.generationEcritures.GenerationMvtSaisieVenteFacture; |
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.utils.StringUtils; |
import java.util.Map; |
40,7 → 42,21 |
} else { |
nom = "Fact. vente " + rowSource.getObject("NUMERO").toString(); |
} |
SQLRowAccessor modeRegl = rowSource.getForeign("ID_MODE_REGLEMENT"); |
final SQLRowAccessor typeRegRow = modeRegl.getForeign("ID_TYPE_REGLEMENT"); |
final SQLRowAccessor nonEmptyForeign = modeRegl.getNonEmptyForeign("ID_BANQUE"); |
if (nonEmptyForeign != null && nonEmptyForeign.getTable().contains("TYPE_CAISSE") && nonEmptyForeign.getBoolean("TYPE_CAISSE")) { |
nom += " (" + typeRegRow.getString("NOM") + ") "; |
} |
nom += " " + StringUtils.limitLength(rowSource.getForeign("ID_CLIENT").getString("NOM"), 20); |
if (SQLPreferences.getMemCached(rowSource.getTable().getDBRoot()).getBoolean(GestionCommercialeGlobalPreferencePanel.ECRITURE_FACTURE_REF_LIBELLE, false)) { |
if (rowSource.getString("NOM") != null && rowSource.getString("NOM").trim().length() > 0) |
nom += " " + StringUtils.limitLength(rowSource.getString("NOM"), 30); |
} |
values.put("NOM", nom); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/Mouvement.java |
---|
25,6 → 25,7 |
public class Mouvement { |
private String numero; |
private List<Ecriture> ecritures = new ArrayList<>(); |
private List<MouvementGED> gedURLs; |
private Number id; |
private BigDecimal debit = BigDecimal.ZERO; |
private BigDecimal credit = BigDecimal.ZERO; |
62,6 → 63,22 |
return this.id; |
} |
public List<MouvementGED> getURLs() { |
return this.gedURLs; |
} |
public void addURL(MouvementGED e) { |
if (this.gedURLs == null) { |
this.gedURLs = new ArrayList<>(); |
} |
e.setEcriture(this); |
this.gedURLs.add(e); |
} |
public boolean hasURLs() { |
return this.gedURLs != null; |
} |
SQLInsert createInsert(DBRoot root, User user) { |
final SQLInsert insert = new SQLInsert(); |
final SQLTable table = root.getTable("MOUVEMENT"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationEcritures.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
482,23 → 482,45 |
final SQLTable tablePrefCompte = Configuration.getInstance().getRoot().findTable("PREFS_COMPTE"); |
final SQLRow rowPrefsCompte = SQLBackgroundTableCache.getInstance().getCacheForTable(tablePrefCompte).getRowFromId(2); |
SQLRow rowDefaultCptPort; |
if (rowTVAPort.getFloat("TAUX") > 0) { |
rowDefaultCptPort = cacheCompte.getRowFromId(rowPrefsCompte.getForeignID("ID_COMPTE_PCE_PORT_SOUMIS")); |
if (rowDefaultCptPort == null || rowDefaultCptPort.isUndefined()) { |
try { |
rowDefaultCptPort = ComptePCESQLElement.getRowComptePceDefault("PortVenteSoumisTVA"); |
} catch (Exception e) { |
e.printStackTrace(); |
if (achat) { |
if (rowTVAPort.getFloat("TAUX") > 0) { |
rowDefaultCptPort = cacheCompte.getRowFromId(rowPrefsCompte.getForeignID("ID_COMPTE_PCE_PORT_SOUMIS_ACHAT")); |
if (rowDefaultCptPort == null || rowDefaultCptPort.isUndefined()) { |
try { |
rowDefaultCptPort = ComptePCESQLElement.getRowComptePceDefault("PortAchatSoumisTVA"); |
} catch (Exception e) { |
e.printStackTrace(); |
} |
} |
} else { |
rowDefaultCptPort = cacheCompte.getRowFromId(rowPrefsCompte.getForeignID("ID_COMPTE_PCE_PORT_NON_SOUMIS_ACHAT")); |
if (rowDefaultCptPort == null || rowDefaultCptPort.isUndefined()) { |
try { |
rowDefaultCptPort = ComptePCESQLElement.getRowComptePceDefault("PortAchatNonSoumisTVA"); |
} catch (Exception e) { |
e.printStackTrace(); |
} |
} |
} |
} else { |
rowDefaultCptPort = cacheCompte.getRowFromId(rowPrefsCompte.getForeignID("ID_COMPTE_PCE_PORT_NON_SOUMIS")); |
if (rowDefaultCptPort == null || rowDefaultCptPort.isUndefined()) { |
try { |
rowDefaultCptPort = ComptePCESQLElement.getRowComptePceDefault("PortVenteNonSoumisTVA"); |
} catch (Exception e) { |
e.printStackTrace(); |
if (rowTVAPort.getFloat("TAUX") > 0) { |
rowDefaultCptPort = cacheCompte.getRowFromId(rowPrefsCompte.getForeignID("ID_COMPTE_PCE_PORT_SOUMIS")); |
if (rowDefaultCptPort == null || rowDefaultCptPort.isUndefined()) { |
try { |
rowDefaultCptPort = ComptePCESQLElement.getRowComptePceDefault("PortVenteSoumisTVA"); |
} catch (Exception e) { |
e.printStackTrace(); |
} |
} |
} else { |
rowDefaultCptPort = cacheCompte.getRowFromId(rowPrefsCompte.getForeignID("ID_COMPTE_PCE_PORT_NON_SOUMIS")); |
if (rowDefaultCptPort == null || rowDefaultCptPort.isUndefined()) { |
try { |
rowDefaultCptPort = ComptePCESQLElement.getRowComptePceDefault("PortVenteNonSoumisTVA"); |
} catch (Exception e) { |
e.printStackTrace(); |
} |
} |
} |
} |
final SQLRowValues rowValsArt = rowValsPort.putRowValues("ID_ARTICLE"); |
606,6 → 628,12 |
SQLRow rowJournal = rowBanque.getForeignRow("ID_JOURNAL"); |
this.mEcritures.put("ID_JOURNAL", rowJournal.getID()); |
} |
} else if (sqlRow.getTable().contains("ID_TYPE_REGLEMENT") && !sqlRow.isForeignEmpty("ID_TYPE_REGLEMENT")) { |
SQLRow rowType = sqlRow.getForeignRow("ID_TYPE_REGLEMENT"); |
if (rowType.getTable().contains("ID_JOURNAL") && !rowType.isForeignEmpty("ID_JOURNAL")) { |
SQLRow rowJournal = rowType.getForeignRow("ID_JOURNAL"); |
this.mEcritures.put("ID_JOURNAL", rowJournal.getID()); |
} |
} |
} |
615,7 → 643,7 |
* @param sqlRow sqlRow contenant la foreignKey Banque |
* @throws Exception |
*/ |
protected void fillCompteBanqueFromRow(SQLRow sqlRow, String defaultProps, boolean achat) throws Exception { |
protected void fillCompteBanqueFromRow(SQLRow sqlRow, String defaultProps, boolean achat) throws SQLException { |
int idPce = -1; |
if (sqlRow.getTable().contains("ID_TYPE_REGLEMENT")) { |
idPce = sqlRow.getForeign("ID_TYPE_REGLEMENT").getInt("ID_COMPTE_PCE_" + (achat ? "FOURN" : "CLIENT")); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/Ecriture.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
31,6 → 31,7 |
private BigDecimal credit; |
private Mouvement mouvement; |
private String nom; |
private String nomPieceCommerciale; |
private String compteNumero; |
private String compteNom; |
private Number compteID; |
50,6 → 51,7 |
this.date = date; |
this.debit = debit; |
this.credit = credit; |
this.nomPieceCommerciale = ""; |
} |
public SQLInsert createInsert(DBRoot root, User user) { |
79,7 → 81,7 |
insert.add(table.getField("ID_JOURNAL"), this.journalID); |
insert.add(table.getField("JOURNAL_NOM"), this.journalNom); |
insert.add(table.getField("JOURNAL_CODE"), this.journalCode); |
insert.add(table.getField("NOM_PIECE"), this.mouvement.getPiece().getNom()); |
insert.add(table.getField("NOM_PIECE"), this.nomPieceCommerciale); |
insert.add(table.getField("ID_USER_COMMON_CREATE"), user.getId()); |
insert.add(table.getField("ID_USER_COMMON_MODIFY"), user.getId()); |
insert.add(table.getField("CLOTURE"), this.cloture); |
104,6 → 106,14 |
this.dateLettrage = dateLettrage; |
} |
public void setNomPieceCommerciale(String nomPieceCommerciale) { |
this.nomPieceCommerciale = nomPieceCommerciale; |
} |
public String getNomPieceCommerciale() { |
return this.nomPieceCommerciale; |
} |
public void setLettrage(String lettrage) { |
this.lettrage = lettrage; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtAvoirClient.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
19,6 → 19,7 |
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement; |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProvider; |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProviderManager; |
import org.openconcerto.erp.preferences.DefaultNXProps; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
52,6 → 53,7 |
} |
public int genereMouvement() throws Exception { |
boolean genEcrDisabled = DefaultNXProps.getInstance().getBooleanValue(GenerationMvtSaisieVenteFacture.NOT_GEN_ECRITURE, false); |
SQLTable avoirClientTable = base.getTable("AVOIR_CLIENT"); |
120,7 → 122,9 |
this.putValue("ID_COMPTE_PCE", rowCompl.getForeignID("ID_COMPTE_PCE")); |
this.putValue("CREDIT", Long.valueOf(0)); |
this.putValue("DEBIT", Long.valueOf(taxeC)); |
ajoutEcriture(); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
taxe += taxeC; |
// this.putValue("ID_COMPTE_PCE", |
// rowCompl.getForeignID("ID_COMPTE_PCE_PRODUITS")); |
134,8 → 138,10 |
this.putValue("ID_COMPTE_PCE", row.getID()); |
this.putValue("DEBIT", Long.valueOf(b - taxe)); |
this.putValue("CREDIT", Long.valueOf(0)); |
SQLRow rowEcr = ajoutEcriture(); |
// addAssocAnalytiqueFromProvider(rowEcr, avoirRow); |
if (!genEcrDisabled) { |
SQLRow rowEcr = ajoutEcriture(); |
// addAssocAnalytiqueFromProvider(rowEcr, avoirRow); |
} |
} |
} |
147,7 → 153,9 |
this.putValue("ID_COMPTE_PCE", rowAc.getID()); |
this.putValue("DEBIT", Long.valueOf(longValue)); |
this.putValue("CREDIT", Long.valueOf(0)); |
ajoutEcriture(); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
} |
} |
164,8 → 172,9 |
this.putValue("DEBIT", Long.valueOf(0)); |
long ttc = calc.getTotalTTC().movePointRight(2).longValue(); |
this.putValue("CREDIT", Long.valueOf(ttc)); |
ajoutEcriture(); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
// Mise à jour de mouvement associé à la facture d'avoir |
SQLRowValues valAvoir = new SQLRowValues(avoirClientTable); |
valAvoir.put("ID_MOUVEMENT", Integer.valueOf(this.idMvt)); |
179,8 → 188,9 |
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteClient)); |
this.putValue("DEBIT", Long.valueOf(ttc)); |
this.putValue("CREDIT", Long.valueOf(0)); |
ajoutEcriture(); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
// compte Factor |
int idComptefactor = rowPrefsCompte.getInt("ID_COMPTE_PCE_FACTOR"); |
if (idComptefactor <= 1) { |
197,7 → 207,9 |
this.putValue("ID_COMPTE_PCE", idComptefactor); |
this.putValue("DEBIT", Long.valueOf(0)); |
this.putValue("CREDIT", Long.valueOf(ttc)); |
ajoutEcriture(); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
} |
if (avoirRow.getInt("ID_MODE_REGLEMENT") > 1) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationReglementVenteNG.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
26,6 → 26,7 |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProvider; |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProviderManager; |
import org.openconcerto.erp.model.PrixTTC; |
import org.openconcerto.erp.preferences.DefaultNXProps; |
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLElement; |
161,6 &ra |