OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Compare Revisions

Regard whitespace Rev 184 → Rev 185

/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/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/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/Default/RepartitionAnalytique.xml
28,7 → 28,11
<field name="POSTE_NOM" />
</element>
 
<element location="D" type="fill">
<field name="CLASSE" />
</element>
<element location="E" type="fill">
<field name="DEBIT" />
</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/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/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/EtatStockInventaire.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/FichePayeSimplifiee.ods
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/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/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/RepartitionAnalytique.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/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" />
29,5 → 29,9
<field name="QTE" />
</element>
 
<element location="H" type="fill">
<field name="DEPOT" />
</element>
 
</table>
</contentDocument>
/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/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,13 → 137,21
map.put(villeEtCode, v);
}
 
public static synchronized void addVille(final Ville v) {
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)) {
return;
}
if (!map.containsKey(villeEtCode)) {
addVilleSilently(v);
accessor.store(v);
modified = true;
}
}
if (modified)
fireListModified();
}
 
/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/GenerationTask.java
File deleted
/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/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/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/ReportType.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/generation/generator/ExtractGenerator.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/openoffice/generation/generator/ManualGenerator.java
File deleted
/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/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/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/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/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/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/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,14 → 170,45
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;
}
return (MutableCell<D>) this.getValidCellAt(col);
 
// 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;
}
}
assert res.size() == count;
return res;
}
 
// rempli cette ligne avec autant de cellules vides qu'il faut
void columnCountChanged(StyleStyleDesc<CellStyle> cellStyleDesc) {
final int diff = this.getSheet().getColumnCount() - getCellCount();
/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 firstIndex = repState.getFirstIndex();
final int lastIndex = repState.getLastIndex();
int indexOfElement = repState.getIndexOfElement();
 
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 - col;
final int postRepeated = lastIndex - lastCol;
 
// 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);
}
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));
}
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,10 → 394,8
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) {
final Point res = resolve(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,12 → 1057,24
} else {
elemToClone = (Element) getRow(rowIndex).getElement().clone();
}
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, getRowStyleDesc(), getCellStyleDesc());
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);
}
}
}
}
 
public final void removeRow(int index) {
this.removeRows(index, index + 1);
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/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/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/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/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/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/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/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/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/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="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/>
<style:font-face style:name="DejaVu Sans" svg:font-family="&apos;DejaVu Sans&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
<style:font-face style:name="Lohit Devanagari" svg:font-family="&apos;Lohit Devanagari&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
<style:font-face style:name="Lucida Sans Unicode" svg:font-family="&apos;Lucida Sans Unicode&apos;" 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="&apos;Noto Sans CJK SC&apos;" 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/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/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/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/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/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/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/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/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/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/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/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/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));
 
/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/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/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;
public int getYScrollLocation() {
return this.scroll.getVerticalScrollBar().getValue();
}
};
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 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/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,7 → 254,19
}
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) {
SwingUtilities.invokeLater(new Runnable() {
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/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/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/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,8 → 57,18
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();
67,15 → 80,25
}
 
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);
 
}
}
 
@Override
public JSONObject toJSON() {
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/odtemplate/TemplateGenerator.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/XMLTemplateGenerator.java
File deleted
/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/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/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/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/utils/GenerationUtils.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/sql/model/SQLRowValues.java
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)
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/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,20 → 194,34
String label = rowVals.getString(to);
SQLPreferences prefs = SQLPreferences.getMemCached(srcRow.getTable().getDBRoot());
 
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 + ", " + srcRow.getString(from)));
rowVals.put(to, cleanRef(label + ", " + ref));
} else {
rowVals.put(to, srcRow.getString(from));
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", srcRow.getString(from));
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);
}
}
}
}
 
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
 
213,6 → 228,7
protected void transfertNumberReference(SQLRowAccessor srcRow, SQLRowValues rowVals, final SQLTable tableElementDestination, String refField) {
SQLPreferences prefs = SQLPreferences.getMemCached(srcRow.getTable().getDBRoot());
 
if (!prefs.getBoolean("TransfertNoRef", false)) {
if (prefs.getBoolean("TransfertRef", true)) {
String label = rowVals.getString("NOM");
if (label != null && label.trim().length() > 0) {
221,7 → 237,8
} else {
rowVals.put("NOM", srcRow.getString("NUMERO"));
}
} else if (prefs.getBoolean("TransfertMultiRef", false)) {
}
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);
236,6 → 253,7
rowValsHeader.put(refField, rowVals);
}
}
}
 
public synchronized SQLRow insertFrom(final SQLRowAccessor srcRow) throws SQLException {
return createRowValuesFrom(Arrays.asList(srcRow)).insert();
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/AutoCompletionManager.java
61,11 → 61,21
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;
if (req == null) {
List<String> l = new Vector<String>();
 
if (expandWithShowAs) {
75,8 → 85,13
}
} else {
l.add(fillFrom.getName());
// FIXME à mettre en parametre
if (fillFrom.getName().equals("NOM") && fillFrom.getTable().contains("CODE")) {
l.add("CODE");
}
ComboSQLRequest req = new ComboSQLRequest(fillFrom.getTable(), l);
}
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,7 → 227,15
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() {
return this.model;
225,7 → 242,11
}
 
public void updateField(String field, SQLRowValues 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) {
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) {
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) {
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;
135,8 → 136,13
}
 
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
 
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/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,6 → 134,7
}
SQLField validationField = RowValuesTableControlPanel.this.model.getValidationField();
if (validationField != null) {
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);
140,7 → 142,23
}
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");
}
}
// MAYBE show popup if can't delete
} else {
RowValuesTableControlPanel.this.model.removeRowsAt(table.getSelectedRows());
/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,11 → 321,11
/**
* 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()));
359,6 → 377,38
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 (!updatesRefs.isEmpty()) {
SQLUpdate.executeMultipleWithBatch(table.getDBSystemRoot(), updatesRefs);
}
}
table.fireTableModified(-1);
} else {
for (int i = 0; i < size; i++) {
368,11 → 418,7
final SQLRow row = store.getStoredRow(r);
r.setID(row.getIDNumber());
}
 
}
} catch (SQLException e) {
ExceptionHandler.handle("Unable to commit rows", e);
}
 
}
 
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,11 → 636,8
}
}
this.rowValuesDeleted.clear();
try {
 
this.element.archive(toArchive);
} catch (SQLException e) {
throw new IllegalStateException("Unable to archive rows : " + toArchive, e);
}
 
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());
newRows.addAll(fetchDataFromDB(rowVals, referentField, fieldWhere, value));
} 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);
}
}
 
} 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/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,11 → 77,17
}
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 {
 
final int id = Integer.parseInt(value.toString());
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);
98,7 → 105,7
} 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/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) {
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/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/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,11 → 418,23
 
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);
}
}
}
 
public void changedUpdate(DocumentEvent e) {
updateAutoCompletion(false);
/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/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/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/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/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/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/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/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/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,7 → 105,12
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;
private SSLSocketFactory socketFactory;
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/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/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/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/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/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/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/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/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/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/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/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/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/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/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
30,6 → 32,7
public class DefaultIListModel<T> extends AbstractListModel<T> implements IListModel<T> {
 
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/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
27,8 → 27,6
*/
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/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/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/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/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/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/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/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/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);
}
 
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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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,18 → 121,32
}
}
}
try {
d.browse(uri);
handled = true;
} catch (IOException e) {
// On Ubuntu, we sometimes get spurious errors, so retry
exn = e;
}
}
}
if (!handled) {
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;
}
}
}
}
 
public static boolean isDesktopDesirable(Desktop.Action action) {
// apparently the JRE just checks if gnome libs are available (e.g. open Nautilus in XFCE)
/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/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/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/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/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/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/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/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/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/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/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("&amp;");
} else if (c == '\"') {
b.append("&quot;");
} else if (c == '<') {
b.append("&lt;");
} else if (c == '>') {
b.append("&gt;");
}
b.append(c);
}
 
return b.toString();
}
 
}
/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/erp/panel/compta/ImportFEC.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
52,7 → 52,8
try (BufferedReader bReader = new BufferedReader(new InputStreamReader(new FileInputStream(file), Charset.forName("Cp1252")))) {
String line = bReader.readLine();
final List<String> headers = StringUtils.fastSplit(line, ExportFEC.ZONE_SEPARATOR);
for (int i = 0; i < headers.size(); i++) {
for (int i = 0; i < headers.size() && i < ExportFEC.COLS.size(); i++) {
 
String c1 = headers.get(i);
String c2 = ExportFEC.COLS.get(i);
// Typo chez les stars de Ciel : MontantDevise au lieu de Montantdevise
66,17 → 67,19
final List<String> parts = fastSplit(line, ExportFEC.ZONE_SEPARATOR);
final String journalCode = parts.get(0).trim();
final String journalLib = parts.get(1).trim();
// final String ecritureNum = parts.get(2).trim();
final String ecritureNum = parts.get(2).trim();
final Date ecritureDate = parseDate(parts.get(3).trim());
final String compteNum = parts.get(4).trim();
final String compteLib = parts.get(5).trim();
// final String compAuxNum = parts.get(6).trim();
// final String compAuxLib = parts.get(7).trim();
 
String mvtKey = ecritureNum + "-" + journalCode;
String pieceRef = parts.get(8).trim();
// final String pieceDate = parts.get(9).trim();
final String ecritureLib = parts.get(10).trim();
final BigDecimal debit = new BigDecimal(parts.get(11).replace(',', '.'));
final BigDecimal credit = new BigDecimal(parts.get(12).replace(',', '.'));
final BigDecimal debit = new BigDecimal(parts.get(11).replace(" ", "").replace(',', '.'));
final BigDecimal credit = new BigDecimal(parts.get(12).replace(" ", "").replace(',', '.'));
final String ecritureLet = parts.get(13).trim();
final Date dateLet = parseDate(parts.get(14).trim());
final Date validDate = parseDate(parts.get(15).trim());
84,15 → 87,15
// final String idevise = parts.get(17).trim();
 
if (pieceRef.isEmpty()) {
pieceRef = "Import";
pieceRef = mvtKey;
}
Piece p = this.mapPiece.get(pieceRef);
Piece p = this.mapPiece.get(mvtKey);
Mouvement mouvement;
if (p == null) {
p = new Piece(pieceRef);
mouvement = new Mouvement();
p.add(mouvement);
this.mapPiece.put(pieceRef, p);
this.mapPiece.put(mvtKey, p);
} else {
mouvement = p.getMouvements().get(0);
}
/trunk/OpenConcerto/src/org/openconcerto/erp/model/MouseSheetXmlListeListener.java
15,6 → 15,7
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.common.ui.PreviewFrame;
import org.openconcerto.erp.core.customerrelationship.mail.EmailCreator;
import org.openconcerto.erp.core.customerrelationship.mail.EmailTemplate;
import org.openconcerto.erp.core.customerrelationship.mail.ValueListener;
import org.openconcerto.erp.generationDoc.AbstractSheetXml;
36,6 → 37,7
import org.openconcerto.utils.Action;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.ListMap;
import org.openconcerto.utils.Tuple2;
import org.openconcerto.utils.i18n.Grammar;
import org.openconcerto.utils.i18n.TranslationManager;
 
142,7 → 144,7
final Thread t = new Thread() {
@Override
public void run() {
ListMap<String, File> mailFilesMap = new ListMap<>();
ListMap<String, Tuple2<SQLRow, File>> mailFilesMap = new ListMap<>();
for (AbstractSheetXml sheet : sheets) {
String mail = "";
final SQLRow row = sheet.getSQLRow();
231,9 → 233,9
}
try {
if (readOnly) {
mailFilesMap.add(mail, sheet.getOrCreatePDFDocumentFile(true).getAbsoluteFile());
mailFilesMap.add(mail, Tuple2.create(row, sheet.getOrCreatePDFDocumentFile(true).getAbsoluteFile()));
} else {
mailFilesMap.add(mail, sheet.getOrCreateDocumentFile().getAbsoluteFile());
mailFilesMap.add(mail, Tuple2.create(row, sheet.getOrCreateDocumentFile().getAbsoluteFile()));
 
}
} catch (Exception e) {
243,7 → 245,7
 
for (final String mailDest : mailFilesMap.keySet()) {
 
final List<File> files = mailFilesMap.get(mailDest);
final List<Tuple2<SQLRow, File>> tuples = mailFilesMap.get(mailDest);
 
SwingUtilities.invokeLater(new Runnable() {
 
255,11 → 257,13
subject = template.getTitle() + " " + sheets.get(0).getReference().trim();
}
subject = subject.trim();
if (subject.isEmpty()) {
final StringJoiner joiner = new StringJoiner(", ");
for (File f : files) {
joiner.add(f.getName());
List<File> files = new ArrayList<>();
for (Tuple2<SQLRow, File> f : tuples) {
joiner.add(f.get1().getName());
files.add(f.get1());
}
if (subject.isEmpty()) {
subject = joiner.toString();
}
String message = getMailObject(sheets.get(0).getSQLRow());
270,6 → 274,15
message += template.getText();
}
}
if (template != null) {
List<SQLRow> rows = new ArrayList<>();
for (Tuple2<SQLRow, File> f : tuples) {
rows.add(f.get0());
}
EmailCreator creator = new EmailCreator(template, rows, joiner.toString());
subject = creator.getObject();
message = creator.getValue();
}
EmailComposer.getInstance().compose(mailDest, subject, message, files.toArray(new File[files.size()]));
} catch (Exception e) {
ExceptionHandler.handle("Impossible d'envoyer le courriel!", e);
328,7 → 341,7
 
@Override
public void run(Object source) {
EmailTemplate.askTemplate(IListe.get(ev), table.getDBRoot(), new ValueListener() {
EmailTemplate.askTemplate(IListe.get(ev), table.getDBRoot(), table.getName(), new ValueListener() {
 
@Override
public void valueSelected(Object value) {
610,7 → 623,7
rows.add(table.getRow(r.getID()));
}
 
EmailTemplate.askTemplate(IListe.get(ev), table.getDBRoot(), new ValueListener() {
EmailTemplate.askTemplate(IListe.get(ev), table.getDBRoot(), table.getName(), new ValueListener() {
 
@Override
public void valueSelected(Object value) {
/trunk/OpenConcerto/src/org/openconcerto/erp/model/FichePayeModel.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
902,6 → 902,9
if (rowSource.getBoolean("CSG_REDUIT")) {
this.salBrutCSGReduite = this.salBrutCSGReduite.subtract(montant);
}
if (rowSource.getBoolean("PART_CSG_SANS_ABATTEMENT")) {
this.csgSansAbattement = this.csgSansAbattement.subtract(montant);
}
} // Gain
else {
 
925,7 → 928,10
if (rowSource.getBoolean("CSG_REDUIT")) {
this.salBrutCSGReduite = this.salBrutCSGReduite.add(montant);
}
if (rowSource.getBoolean("PART_CSG_SANS_ABATTEMENT")) {
this.csgSansAbattement = this.csgSansAbattement.add(montant);
}
}
 
// Mis a jour du salaire brut
// updateValueFiche();
948,7 → 954,10
if (rowSource.getBoolean("CSG_REDUIT")) {
this.salBrutCSGReduite = this.salBrutCSGReduite.subtract(ded);
}
if (rowSource.getBoolean("PART_CSG_SANS_ABATTEMENT")) {
this.csgSansAbattement = this.csgSansAbattement.subtract(ded);
}
}
BigDecimal add = rowVals.getBigDecimal("MONTANT_SAL_AJ");
if (add != null) {
this.salBrut = this.salBrut.add(add);
970,10 → 979,13
if (rowSource.getBoolean("CSG_REDUIT")) {
this.salBrutCSGReduite = this.salBrutCSGReduite.add(add);
}
if (rowSource.getBoolean("PART_CSG_SANS_ABATTEMENT")) {
this.csgSansAbattement = this.csgSansAbattement.add(add);
}
}
}
}
}
 
private void calculNet(SQLRow rowSource, SQLRowValues rowVals) {
 
/trunk/OpenConcerto/src/org/openconcerto/erp/graph/MargeDataModel.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
43,12 → 43,12
final SQLElementDirectory directory = Configuration.getInstance().getDirectory();
SQLTable tableSaisieVenteF = directory.getElement("SAISIE_VENTE_FACTURE").getTable();
SQLTable tableSaisieVenteFElt = directory.getElement("SAISIE_VENTE_FACTURE_ELEMENT").getTable();
final SQLSelect sel = new SQLSelect(tableSaisieVenteF.getBase());
final SQLSelect sel = new SQLSelect();
sel.addSelect(tableSaisieVenteFElt.getField("T_PA_HT"), "SUM");
sel.addSelect(tableSaisieVenteFElt.getField("T_PV_HT"), "SUM");
final Where w = new Where(tableSaisieVenteF.getField("DATE"), d1, d2);
final Where w2 = new Where(tableSaisieVenteFElt.getField("ID_SAISIE_VENTE_FACTURE"), "=", tableSaisieVenteF.getKey());
sel.setWhere(w.and(w2));
sel.setWhere(w.and(w2).and(new Where(tableSaisieVenteFElt.getField("NIVEAU"), "=", 1)));
 
BigDecimal total = BigDecimal.ZERO;
Object[] o = tableSaisieVenteF.getBase().getDataSource().executeA1(sel.asString());
61,11 → 61,11
}
 
final long value = total.longValue();
if (value > chart.getHigherRange().longValue()) {
final List<AxisLabel> labels = chart.getLeftAxis().getLabels();
if (value > this.chart.getHigherRange().longValue()) {
final List<AxisLabel> labels = this.chart.getLeftAxis().getLabels();
labels.get(2).setLabel(total.setScale(0, RoundingMode.HALF_UP).toString() + " €");
labels.get(1).setLabel(total.divide(new BigDecimal(2), DecimalUtils.HIGH_PRECISION).setScale(0, RoundingMode.HALF_UP) + " €");
chart.setHigherRange(value);
this.chart.setHigherRange(value);
}
return value;
}
/trunk/OpenConcerto/src/org/openconcerto/erp/importer/RowValuesNavigatorPanel.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,6 → 14,7
package org.openconcerto.erp.importer;
 
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.SQLRowValuesCluster.StoreMode;
import org.openconcerto.ui.DefaultGridBagConstraints;
 
import java.awt.Dimension;
104,11 → 105,11
c = 0;
try {
for (SQLRowValues row : insertList) {
row.insert();
row.getGraph().store(StoreMode.INSERT, false);
updateBar();
}
for (SQLRowValues row : updateList) {
row.update();
row.getGraph().store(StoreMode.COMMIT, false);
updateBar();
}
doAfterImport();
/trunk/OpenConcerto/src/org/openconcerto/erp/importer/DataImporter.java
410,7 → 410,17
for (int i = 0; i < rowCount; i++) {
 
// Recherche d'existant
SQLRowValues existingRow = findMatchingRow(model, converters, i, cache);
 
updateOrInsert(model, converters, i, existingRow);
}
 
}
 
protected SQLRowValues findMatchingRow(ArrayTableModel model, final ValueConverter[] converters, int i, Map<SQLField, Map<Object, SQLRowValues>> cache) {
SQLRowValues existingRow = null;
 
if (existingRow == null) {
for (SQLField field : this.uniqueField) {
List<Integer> cols = this.fieldMap.get(field);
Object objectToInsert = null;
429,10 → 439,8
break;
}
}
 
updateOrInsert(model, converters, i, existingRow);
}
 
return existingRow;
}
 
private void updateOrInsert(ArrayTableModel model, final ValueConverter[] converters, int i, SQLRowValues existingRow) {
/trunk/OpenConcerto/src/org/openconcerto/erp/preferences/UIPreferencePanel.java
79,11 → 79,21
c.gridy++;
c.gridx = 0;
this.add(new JLabel("High DPI"), c);
this.comboDPI = new JComboBox(new String[] { "Désactivé", "x1.3", "x2", "x3", "x4" });
this.comboDPI = new JComboBox(new String[] { "Désactivé", "x1.15", "x1.3", "x2", "x3", "x4" });
String dpi = this.properties.getProperty(UI_DPI);
if (dpi != null && !dpi.equals("1")) {
comboDPI.setSelectedIndex(Float.valueOf(dpi).intValue());
if (dpi.equalsIgnoreCase("1.15")) {
comboDPI.setSelectedIndex(1);
} else if (dpi.equalsIgnoreCase("1.3")) {
comboDPI.setSelectedIndex(2);
} else if (dpi.equalsIgnoreCase("2")) {
comboDPI.setSelectedIndex(3);
} else if (dpi.equalsIgnoreCase("3")) {
comboDPI.setSelectedIndex(4);
} else if (dpi.equalsIgnoreCase("4")) {
comboDPI.setSelectedIndex(5);
}
}
 
c.gridx++;
this.add(comboDPI, c);
222,12 → 232,14
}
 
if (this.comboDPI.getSelectedIndex() == 1) {
properties.setProperty(UI_DPI, "1.15");
} else if (this.comboDPI.getSelectedIndex() == 2) {
properties.setProperty(UI_DPI, "1.3");
} else if (this.comboDPI.getSelectedIndex() == 2) {
} else if (this.comboDPI.getSelectedIndex() == 3) {
properties.setProperty(UI_DPI, "2");
} else if (this.comboDPI.getSelectedIndex() == 3) {
} else if (this.comboDPI.getSelectedIndex() == 4) {
properties.setProperty(UI_DPI, "3");
} else if (this.comboDPI.getSelectedIndex() == 4) {
} else if (this.comboDPI.getSelectedIndex() == 5) {
properties.setProperty(UI_DPI, "4");
} else {
properties.setProperty(UI_DPI, "1");
/trunk/OpenConcerto/src/org/openconcerto/erp/preferences/GestionPieceCommercialePanel.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,7
package org.openconcerto.erp.preferences;
 
import org.openconcerto.erp.generationEcritures.GenerationMvtSaisieVenteFacture;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.preferences.DefaultPreferencePanel;
import org.openconcerto.ui.preferences.DefaultProps;
25,7 → 26,7
public class GestionPieceCommercialePanel extends DefaultPreferencePanel {
 
public static final String SHOW_MOUVEMENT_NUMBER = "ShowMouvementNumber";
private final JCheckBox checkMvtPieceShow;
private final JCheckBox checkMvtPieceShow, checkAccountingInvoiceDisable;
 
public GestionPieceCommercialePanel() {
super();
36,9 → 37,10
c.weighty = 1;
 
this.checkMvtPieceShow = new JCheckBox("Afficher le numéro de mouvement lors de la création d'une pièce commerciale");
 
this.checkAccountingInvoiceDisable = new JCheckBox("Désactiver la génération automatique d'écriture des factures");
this.add(this.checkMvtPieceShow, c);
 
c.gridy++;
this.add(this.checkAccountingInvoiceDisable, c);
setValues();
 
}
48,6 → 50,8
final DefaultProps props = DefaultNXProps.getInstance();
 
props.setProperty(SHOW_MOUVEMENT_NUMBER, String.valueOf(this.checkMvtPieceShow.isSelected()));
props.setProperty(GenerationMvtSaisieVenteFacture.NOT_GEN_ECRITURE, String.valueOf(this.checkAccountingInvoiceDisable.isSelected()));
 
props.store();
}
 
54,6 → 58,7
@Override
public void restoreToDefaults() {
this.checkMvtPieceShow.setSelected(false);
this.checkAccountingInvoiceDisable.setSelected(false);
}
 
@Override
67,6 → 72,10
final String showMvt = props.getStringProperty(SHOW_MOUVEMENT_NUMBER);
final Boolean bShowMvt = Boolean.valueOf(showMvt);
this.checkMvtPieceShow.setSelected(bShowMvt == null || bShowMvt.booleanValue());
 
final String d = props.getStringProperty(GenerationMvtSaisieVenteFacture.NOT_GEN_ECRITURE);
final Boolean bD = Boolean.valueOf(d);
this.checkAccountingInvoiceDisable.setSelected(bD == null || bD.booleanValue());
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/preferences/TemplateNXProps.java
17,7 → 17,10
import org.openconcerto.erp.core.customerrelationship.customer.report.FicheClientXmlSheet;
import org.openconcerto.erp.core.edm.AttachmentSQLElement;
import org.openconcerto.erp.core.finance.accounting.report.BalanceSheet;
import org.openconcerto.erp.core.finance.accounting.report.GrandLivreSheetXML;
import org.openconcerto.erp.core.finance.accounting.report.JournauxSheetXML;
import org.openconcerto.erp.core.finance.accounting.report.RepartitionAnalytiqueSheetXML;
import org.openconcerto.erp.core.finance.accounting.report.VentilationAnalytiqueSheetXML;
import org.openconcerto.erp.core.humanresources.payroll.report.EtatChargesPayeSheet;
import org.openconcerto.erp.core.humanresources.payroll.report.FichePayeSheetXML;
import org.openconcerto.erp.core.humanresources.payroll.report.LivrePayeSheet;
151,6 → 154,9
register(ListeVenteXmlSheet.TEMPLATE_ID, ListeVenteXmlSheet.TEMPLATE_PROPERTY_NAME, null);
register(BalanceSheet.TEMPLATE_ID, BalanceSheet.TEMPLATE_PROPERTY_NAME, BalanceSheet.TEMPLATE_ID);
register(JournauxSheetXML.TEMPLATE_ID, JournauxSheetXML.TEMPLATE_PROPERTY_NAME, JournauxSheetXML.TEMPLATE_ID);
register(GrandLivreSheetXML.TEMPLATE_ID, GrandLivreSheetXML.TEMPLATE_PROPERTY_NAME, GrandLivreSheetXML.TEMPLATE_ID);
register(VentilationAnalytiqueSheetXML.TEMPLATE_ID, VentilationAnalytiqueSheetXML.TEMPLATE_PROPERTY_NAME, VentilationAnalytiqueSheetXML.TEMPLATE_ID);
register(RepartitionAnalytiqueSheetXML.TEMPLATE_ID, RepartitionAnalytiqueSheetXML.TEMPLATE_PROPERTY_NAME, RepartitionAnalytiqueSheetXML.TEMPLATE_ID);
register(EtatChargesPayeSheet.TEMPLATE_ID, EtatChargesPayeSheet.TEMPLATE_PROPERTY_NAME, "Etat des charges");
register(FichePayeSheetXML.TEMPLATE_ID, FichePayeSheetXML.TEMPLATE_PROPERTY_NAME, "Fiche paye");
register(LivrePayeSheet.TEMPLATE_ID, LivrePayeSheet.TEMPLATE_PROPERTY_NAME, "Livre paye");
/trunk/OpenConcerto/src/org/openconcerto/erp/preferences/GestionCommercialeGlobalPreferencePanel.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
24,7 → 24,9
import org.openconcerto.ui.preferences.PrefView;
import org.openconcerto.utils.PrefType;
 
import javax.swing.ButtonGroup;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
 
import javax.swing.JCheckBox;
 
public class GestionCommercialeGlobalPreferencePanel extends JavaPrefPreferencePanel {
44,6 → 46,11
public static String IMPUT_ECART = "ImputEcart";
public static String FRAIS_DOCUMENT = "GestionFraisDocuments";
public static String COMPTE_CLIENT_AUTO = "CompteClientAuto";
public static String FACTURE_PREVISIONNELLE = "FacturePrevisionnelle";
public static String TRANSFERT_AUTOMATIQUE = "Tr_Automatique";
public static final String POURCENT_RG = "PourcentRG";
public static final String DEVIS_VALIDITE_JOURS = "DevisValiditeJours";
public static final String ECRITURE_FACTURE_REF_LIBELLE = "RefFactureEcritureLibelle";
 
public GestionCommercialeGlobalPreferencePanel() {
super("Gestion des pièces commerciales", null);
72,6 → 79,10
orderPackaging.setDefaultValue(Boolean.TRUE);
this.addView(orderPackaging);
 
PrefView<Boolean> orderPackagingTrAuto = new PrefView<Boolean>(PrefType.BOOLEAN_TYPE, "Activer les options de transferts automatique", TRANSFERT_AUTOMATIQUE);
orderPackagingTrAuto.setDefaultValue(Boolean.FALSE);
this.addView(orderPackagingTrAuto);
 
PrefView<Boolean> orderQuoting = new PrefView<Boolean>(PrefType.BOOLEAN_TYPE, "Gérer le chiffrage détaillés des commandes clients", CHIFFRAGE_COMMANDE_CLIENT);
orderQuoting.setDefaultValue(Boolean.FALSE);
this.addView(orderQuoting);
84,6 → 95,10
viewAcompteDevis.setDefaultValue(Boolean.FALSE);
this.addView(viewAcompteDevis);
 
PrefView<Boolean> viewPrev = new PrefView<Boolean>(PrefType.BOOLEAN_TYPE, "Activer la gestion des factures prévisionnelles", FACTURE_PREVISIONNELLE);
viewPrev.setDefaultValue(Boolean.FALSE);
this.addView(viewPrev);
 
PrefView<Boolean> addressSpec = new PrefView<Boolean>(PrefType.BOOLEAN_TYPE, "Afficher les sélecteurs d'adresse spécifique", ADDRESS_SPEC);
addressSpec.setDefaultValue(Boolean.TRUE);
this.addView(addressSpec);
124,10 → 139,51
createEcrImput.setDefaultValue(Boolean.TRUE);
this.addView(createEcrImput);
 
ButtonGroup group = new ButtonGroup();
group.add((JCheckBox) viewMultiTransfert.getVW().getComp());
group.add((JCheckBox) viewTransfert.getVW().getComp());
group.add((JCheckBox) viewNo.getVW().getComp());
final PrefView<Boolean> rg = new PrefView<>(PrefType.BOOLEAN_TYPE, "Activer la gestion des pourcentages de retenue de garantie", POURCENT_RG);
rg.setDefaultValue(Boolean.FALSE);
this.addView(rg);
 
final PrefView<Integer> devisJours = new PrefView<>(PrefType.INT_TYPE, "Nombre de jours de validité des devis", DEVIS_VALIDITE_JOURS);
devisJours.setDefaultValue(30);
this.addView(devisJours);
final PrefView<Boolean> refEcriture = new PrefView<>(PrefType.BOOLEAN_TYPE, "Inclure la référence des factures clients dans le libellé des écritures.", ECRITURE_FACTURE_REF_LIBELLE);
refEcriture.setDefaultValue(Boolean.FALSE);
this.addView(refEcriture);
 
final JCheckBox boxMulti = (JCheckBox) viewMultiTransfert.getVW().getComp();
final JCheckBox boxTR = (JCheckBox) viewTransfert.getVW().getComp();
final JCheckBox boxNoTR = (JCheckBox) viewNo.getVW().getComp();
boxNoTR.addItemListener(new ItemListener() {
 
@Override
public void itemStateChanged(ItemEvent e) {
if (boxNoTR.isSelected()) {
boxMulti.setSelected(false);
boxTR.setSelected(false);
}
 
}
});
 
boxMulti.addItemListener(new ItemListener() {
 
@Override
public void itemStateChanged(ItemEvent e) {
if (boxMulti.isSelected()) {
boxNoTR.setSelected(false);
}
 
}
});
boxTR.addItemListener(new ItemListener() {
 
@Override
public void itemStateChanged(ItemEvent e) {
if (boxTR.isSelected()) {
boxNoTR.setSelected(false);
}
 
}
});
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/preferences/GenerationDocumentComptaPreferencePanel.java
14,7 → 14,10
package org.openconcerto.erp.preferences;
 
import org.openconcerto.erp.core.finance.accounting.report.BalanceSheet;
import org.openconcerto.erp.core.finance.accounting.report.GrandLivreSheetXML;
import org.openconcerto.erp.core.finance.accounting.report.JournauxSheetXML;
import org.openconcerto.erp.core.finance.accounting.report.RepartitionAnalytiqueSheetXML;
import org.openconcerto.erp.core.finance.accounting.report.VentilationAnalytiqueSheetXML;
import org.openconcerto.utils.Tuple2;
 
public class GenerationDocumentComptaPreferencePanel extends AbstractGenerationDocumentPreferencePanel {
21,8 → 24,11
 
public GenerationDocumentComptaPreferencePanel() {
super();
this.mapKeyLabel.put(Tuple2.create(BalanceSheet.TEMPLATE_ID, BalanceSheet.TEMPLATE_PROPERTY_NAME), BalanceSheet.TEMPLATE_ID);
this.mapKeyLabel.put(Tuple2.create(GrandLivreSheetXML.TEMPLATE_ID, GrandLivreSheetXML.TEMPLATE_PROPERTY_NAME), GrandLivreSheetXML.TEMPLATE_ID);
this.mapKeyLabel.put(Tuple2.create(JournauxSheetXML.TEMPLATE_ID, JournauxSheetXML.TEMPLATE_PROPERTY_NAME), JournauxSheetXML.TEMPLATE_ID);
this.mapKeyLabel.put(Tuple2.create(BalanceSheet.TEMPLATE_ID, BalanceSheet.TEMPLATE_PROPERTY_NAME), BalanceSheet.TEMPLATE_ID);
this.mapKeyLabel.put(Tuple2.create(RepartitionAnalytiqueSheetXML.TEMPLATE_ID, RepartitionAnalytiqueSheetXML.TEMPLATE_PROPERTY_NAME), RepartitionAnalytiqueSheetXML.TEMPLATE_ID);
this.mapKeyLabel.put(Tuple2.create(VentilationAnalytiqueSheetXML.TEMPLATE_ID, VentilationAnalytiqueSheetXML.TEMPLATE_PROPERTY_NAME), VentilationAnalytiqueSheetXML.TEMPLATE_ID);
}
 
public String getTitleName() {
/trunk/OpenConcerto/src/org/openconcerto/erp/config/InstallationPanel.java
14,6 → 14,7
package org.openconcerto.erp.config;
 
import org.openconcerto.erp.config.update.Updater_1_5;
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.humanresources.payroll.report.LignePayeSimplifiee;
import org.openconcerto.erp.core.sales.order.ui.EtatCommandeClient;
import org.openconcerto.erp.core.sales.quote.element.EtatDevisSQLElement;
100,6 → 101,8
public class InstallationPanel extends JPanel {
private static final boolean DEBUG_FK = false;
 
public static final String METADATA_VERSION = "OpenConcerto_Version";
 
public static void insertUndef(final SQLCreateTable ct) throws SQLException {
// check that we can use insertReturnFirstField()
if (ct.getPrimaryKey().size() != 1)
864,6 → 867,26
alters.add(alter);
 
}
 
{
List<String> tables = Arrays.asList("FACTURE_FOURNISSEUR_ELEMENT", "DEVIS_ELEMENT", "COMMANDE_ELEMENT", "BON_RECEPTION_ELEMENT", "COMMANDE_CLIENT_ELEMENT", "BON_DE_LIVRAISON_ELEMENT",
"SAISIE_VENTE_FACTURE_ELEMENT", "AVOIR_CLIENT_ELEMENT", "DEMANDE_PRIX_ELEMENT"
 
);
for (String string : tables) {
 
final String fName = "T_POIDS_COLIS_NET";
if (root.getTable(string).contains(fName)) {
SQLField fieldRepFacture = root.getTable(string).getField(fName);
if (fieldRepFacture.getType().getSize() > 500) {
final AlterTable alter = new AlterTable(root.getTable(string));
alter.alterColumn(fName, EnumSet.allOf(Properties.class), "numeric(16,8)", "1", false);
alter.alterColumn("POIDS_COLIS_NET", EnumSet.allOf(Properties.class), "numeric(16,8)", "1", false);
alters.add(alter);
}
}
}
}
if (alters.size() > 0) {
final SQLDataSource ds = root.getDBSystemRoot().getDataSource();
 
3869,8 → 3892,21
rowValsUserRight.commit();
}
 
if (!codes.contains(ComptaSQLConfElement.NON_RESTREINT_PAR_COMMERCIAL_RIGHT)) {
SQLRowValues rowVals = new SQLRowValues(table);
rowVals.put("CODE", ComptaSQLConfElement.NON_RESTREINT_PAR_COMMERCIAL_RIGHT);
rowVals.put("NOM", "Non restreint aux éléments liés au commercial de l'utilisateur");
String desc = "Liste non restreinte aux éléments liés au commercial de l'utilisateur";
rowVals.put("DESCRIPTION", desc);
SQLRow row = rowVals.commit();
SQLRowValues rowValsUserRight = new SQLRowValues(table.getTable("USER_RIGHT"));
rowValsUserRight.put("ID_RIGHT", row.getID());
rowValsUserRight.put("HAVE_RIGHT", Boolean.TRUE);
rowValsUserRight.commit();
}
 
}
 
private void findBadForeignKey(DBRoot root) {
Set<SQLTable> tables = root.getTables();
for (SQLTable table : tables) {
4111,6 → 4147,20
rowVals.commit();
}
 
if (!prefs.contains("PortAchatSoumisTVA")) {
SQLRowValues rowVals = new SQLRowValues(table);
rowVals.put("NOM", "PortAchatSoumisTVA");
rowVals.put("NUMERO_DEFAULT", "608510");
rowVals.commit();
}
 
if (!prefs.contains("PortAchatNonSoumisTVA")) {
SQLRowValues rowVals = new SQLRowValues(table);
rowVals.put("NOM", "PortAchatNonSoumisTVA");
rowVals.put("NUMERO_DEFAULT", "608520");
rowVals.commit();
}
 
if (!prefs.contains("AvanceClients")) {
SQLRowValues rowVals = new SQLRowValues(table);
rowVals.put("NOM", "AvanceClients");
4187,6 → 4237,7
req += ", \"CODE_POSTAL\"=substring(\"VILLE\" from (position('(' in \"VILLE\")+1) for length(\"VILLE\")-position('(' in \"VILLE\")-1) WHERE \"VILLE\" LIKE '% (%)'";
tableAdresse.getDBRoot().getDBSystemRoot().getDataSource().execute(req);
}
 
}
 
private void updateVariablePaye(SQLTable table, String var, double value) throws SQLException {
4346,6 → 4397,15
}
 
final SQLTable tableRB = conf.getRoot().getTable("RUBRIQUE_BRUT");
if (!tableRB.contains("PART_CSG_SANS_ABATTEMENT")) {
final AlterTable alter = new AlterTable(tableRB);
alter.addBooleanColumn("PART_CSG_SANS_ABATTEMENT", Boolean.FALSE, false);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableRB.getName());
conf.getRoot().getSchema().updateVersion();
}
 
if (!tableRB.contains("AVANTAGE_NATURE")) {
final AlterTable alter = new AlterTable(tableRB);
alter.addBooleanColumn("AVANTAGE_NATURE", Boolean.FALSE, false);
4591,7 → 4651,7
}
}
// final Set<String> childrenNames = conf.getSystemRoot().getChildrenNames();
 
conf.getRoot().setMetadata(METADATA_VERSION, ProductInfo.getInstance().getVersion());
SwingUtilities.invokeLater(new Runnable() {
 
@Override
4720,6 → 4780,7
 
// at the end to let Updater_1_5 change field types from varchar to text
fixUnboundedVarchar(root);
root.setMetadata(METADATA_VERSION, ProductInfo.getInstance().getVersion());
return null;
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/config/DSNInstallationUtils.java
103,6 → 103,16
root.getSchema().updateVersion();
}
 
if (!tableRubCot.contains("NUMERO_COMPTE_PCE")) {
final AlterTable alter = new AlterTable(tableRubCot);
alter.addVarCharColumn("NUMERO_COMPTE_PCE", 128);
alter.addVarCharColumn("NUMERO_COMPTE_PCE_CHARGES", 128);
final String req = alter.asString();
root.getDBSystemRoot().getDataSource().execute(req);
root.refetchTable(tableRubCot.getName());
root.getSchema().updateVersion();
}
 
if (!tableRubCot.contains("TAXABLE_CM")) {
AlterTable tableRub = new AlterTable(tableRubCot);
tableRub.addBooleanColumn("TAXABLE_CM", Boolean.FALSE, false);
529,10 → 539,17
v.add(Tuple2.create("04", "Signalement Arrêt de travail"));
v.add(Tuple2.create("05", "Signalement Reprise suite à arrêt de travail"));
v.add(Tuple2.create("06", "DSN reprise d'historique"));
v.add(Tuple2.create("07", "Signalement Fin du contrat de travail unique"));
insertValues(v, table);
} catch (SQLException ex) {
throw new IllegalStateException("Erreur lors de la création de la table " + "DSN_NATURE", ex);
}
} else {
final SQLTable table = root.getTable("DSN_NATURE");
List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>();
// DSN 2023
v.add(Tuple2.create("07", "Signalement Fin du contrat de travail unique"));
insertValues(v, table);
}
 
if (!root.contains("DSN_TYPE")) {
/trunk/OpenConcerto/src/org/openconcerto/erp/config/ComptaPropsConfiguration.java
57,6 → 57,8
import org.openconcerto.erp.core.finance.accounting.element.NatureCompteSQLElement;
import org.openconcerto.erp.core.finance.accounting.element.PieceSQLElement;
import org.openconcerto.erp.core.finance.accounting.element.PosteAnalytiqueSQLElement;
import org.openconcerto.erp.core.finance.accounting.element.ReleveBancaireElementSQLElement;
import org.openconcerto.erp.core.finance.accounting.element.ReleveBancaireSQLElement;
import org.openconcerto.erp.core.finance.accounting.element.RepartitionAnalytiqueSQLElement;
import org.openconcerto.erp.core.finance.accounting.element.SaisieKmItemSQLElement;
import org.openconcerto.erp.core.finance.accounting.element.SaisieKmSQLElement;
189,6 → 191,8
import org.openconcerto.erp.core.sales.product.element.EcoContributionSQLElement;
import org.openconcerto.erp.core.sales.product.element.FamilleArticleSQLElement;
import org.openconcerto.erp.core.sales.product.element.FamilleEcoContributionSQLElement;
import org.openconcerto.erp.core.sales.product.element.LotLivraisonSQLElement;
import org.openconcerto.erp.core.sales.product.element.LotReceptionSQLElement;
import org.openconcerto.erp.core.sales.product.element.LotSQLElement;
import org.openconcerto.erp.core.sales.product.element.MetriqueSQLElement;
import org.openconcerto.erp.core.sales.product.element.ModeVenteArticleSQLElement;
244,6 → 248,7
import org.openconcerto.erp.generationDoc.provider.AdresseVilleNomClientValueProvider;
import org.openconcerto.erp.generationDoc.provider.ArticleCodeClientProvider;
import org.openconcerto.erp.generationDoc.provider.ArticleCodeFournisseurProvider;
import org.openconcerto.erp.generationDoc.provider.BatchListProvider;
import org.openconcerto.erp.generationDoc.provider.ConditionsReglementDetailsProvider;
import org.openconcerto.erp.generationDoc.provider.DateBLProvider;
import org.openconcerto.erp.generationDoc.provider.DateProvider;
266,13 → 271,17
import org.openconcerto.erp.generationDoc.provider.QteTotalDocProvider;
import org.openconcerto.erp.generationDoc.provider.QteTotalLineDocProvider;
import org.openconcerto.erp.generationDoc.provider.QteTotalProvider;
import org.openconcerto.erp.generationDoc.provider.RGProvider;
import org.openconcerto.erp.generationDoc.provider.RecapFactureProvider;
import org.openconcerto.erp.generationDoc.provider.RecapLigneFactureProvider;
import org.openconcerto.erp.generationDoc.provider.RefClientValueProvider;
import org.openconcerto.erp.generationDoc.provider.RemiseProvider;
import org.openconcerto.erp.generationDoc.provider.RemiseTotalProvider;
import org.openconcerto.erp.generationDoc.provider.RestantAReglerProvider;
import org.openconcerto.erp.generationDoc.provider.ResteALivrerDocProvider;
import org.openconcerto.erp.generationDoc.provider.SaledTotalNotDiscountedProvider;
import org.openconcerto.erp.generationDoc.provider.StockLocationProvider;
import org.openconcerto.erp.generationDoc.provider.TitleInvoiceProvider;
import org.openconcerto.erp.generationDoc.provider.TotalAcompteProvider;
import org.openconcerto.erp.generationDoc.provider.TotalCommandeClientProvider;
import org.openconcerto.erp.generationDoc.provider.UserCreateInitialsValueProvider;
623,6 → 632,7
}
 
private void registerCellValueProvider() {
RGProvider.register();
UserCreateInitialsValueProvider.register();
UserModifyInitialsValueProvider.register();
UserCurrentInitialsValueProvider.register();
635,6 → 645,7
FacturableValueProvider.register();
TotalCommandeClientProvider.register();
LabelAccountInvoiceProvider.register();
TitleInvoiceProvider.register();
DateBLProvider.register();
AdresseRueClientValueProvider.register();
AdresseVilleClientValueProvider.register();
647,6 → 658,7
QteTotalDocProvider.register();
StockLocationProvider.register();
RefClientValueProvider.register();
RecapLigneFactureProvider.register();
ModeDeReglementDetailsProvider.register();
FormatedGlobalQtyTotalProvider.register();
FichePayeHeureSupTotalProvider.register();
660,10 → 672,13
DateProvider.register();
RemiseTotalProvider.register();
RecapFactureProvider.register();
RecapLigneFactureProvider.register();
RestantAReglerProvider.register();
ResteALivrerDocProvider.register();
SaledTotalNotDiscountedProvider.register();
ArticleCodeFournisseurProvider.register();
IbanProvider.register();
BatchListProvider.register();
}
 
@Override
969,6 → 984,9
dir.addSQLElement(DemandePrixItemSQLElement.class);
dir.addSQLElement(FabricantSQLElement.class);
dir.addSQLElement(ChiffrageCommandeClientSQLElement.class);
dir.addSQLElement(LotSQLElement.class);
dir.addSQLElement(LotReceptionSQLElement.class);
dir.addSQLElement(LotLivraisonSQLElement.class);
 
dir.addSQLElement(new CommercialSQLElement());
 
1100,7 → 1118,10
dir.addSQLElement(EmailTemplateSQLElement.class);
 
dir.addSQLElement(ArretChomageIntemperieSQLElement.class);
 
if (this.isExperimental) {
dir.addSQLElement(ReleveBancaireSQLElement.class, this.getRootSociete());
dir.addSQLElement(ReleveBancaireElementSQLElement.class, this.getRootSociete());
}
if (getRootSociete().contains("FWK_LIST_PREFS")) {
dir.addSQLElement(new FWKListPrefs(getRootSociete()));
}
/trunk/OpenConcerto/src/org/openconcerto/erp/config/DefaultMenuConfiguration.java
58,6 → 58,7
import org.openconcerto.erp.core.finance.accounting.action.NouveauLettrageAction;
import org.openconcerto.erp.core.finance.accounting.action.NouveauPointageAction;
import org.openconcerto.erp.core.finance.accounting.action.NouvelleValidationAction;
import org.openconcerto.erp.core.finance.accounting.action.RelevesBancairesAction;
import org.openconcerto.erp.core.finance.accounting.action.ResultatAnalytiqueAction;
import org.openconcerto.erp.core.finance.accounting.ui.SaisieJournalAction;
import org.openconcerto.erp.core.finance.payment.action.ListeDesChequesAEncaisserAction;
110,6 → 111,7
import org.openconcerto.erp.core.sales.invoice.action.ListeDebiteursAction;
import org.openconcerto.erp.core.sales.invoice.action.ListeDesElementsFactureAction;
import org.openconcerto.erp.core.sales.invoice.action.ListeDesFactureItemsAction;
import org.openconcerto.erp.core.sales.invoice.action.ListeDesFacturesPrevisionnellesOCAction;
import org.openconcerto.erp.core.sales.invoice.action.ListeDesVentesAction;
import org.openconcerto.erp.core.sales.invoice.action.ListeEcheancePrelevementAction;
import org.openconcerto.erp.core.sales.invoice.action.ListeSDDMessageAction;
124,7 → 126,6
import org.openconcerto.erp.core.sales.order.action.ListeDesElementsACommanderClientAction;
import org.openconcerto.erp.core.sales.order.action.ListeDesFacturationCommandesClientAction;
import org.openconcerto.erp.core.sales.order.action.NouvelleCommandeClientAction;
import org.openconcerto.erp.core.sales.order.element.CommandeClientSQLElement;
import org.openconcerto.erp.core.sales.pos.action.ListeDesCaissesTicketAction;
import org.openconcerto.erp.core.sales.product.action.FamilleArticleAction;
import org.openconcerto.erp.core.sales.product.action.ListeDesArticlesAction;
136,6 → 137,7
import org.openconcerto.erp.core.sales.quote.action.ListeDesElementsDevisAction;
import org.openconcerto.erp.core.sales.quote.action.NouveauDevisAction;
import org.openconcerto.erp.core.sales.shipment.action.ListeDesBonsDeLivraisonAction;
import org.openconcerto.erp.core.sales.shipment.action.ListeDesElementsBLAction;
import org.openconcerto.erp.core.sales.shipment.action.ListeDesReliquatsBonsLivraisonsAction;
import org.openconcerto.erp.core.sales.shipment.action.NouveauBonLivraisonAction;
import org.openconcerto.erp.core.supplychain.credit.action.ListeDesAvoirsFournisseurAction;
167,6 → 169,7
import org.openconcerto.erp.preferences.DefaultNXProps;
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
import org.openconcerto.erp.preferences.GestionClientPreferencePanel;
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel;
import org.openconcerto.erp.rights.ComptaUserRight;
import org.openconcerto.erp.rights.NXRights;
import org.openconcerto.erp.utils.correct.CorrectMouvement;
458,7 → 461,9
group.addItem("accounting.general.ledger");
group.addItem("accounting.entries.ledger");
group.addItem("accounting.entries.list");
 
if (this.configuration.isExperimental()) {
group.addItem("accounting.bank.statement.list");
}
final Group gIO = new Group("menu.accounting.io", LayoutHints.DEFAULT_NOLABEL_SEPARATED_GROUP_HINTS);
gIO.addItem("accounting.import");
gIO.addItem("accounting.import.fec");
511,15 → 516,21
boolean useListDesVentesAction = bModeVenteComptoir;
if (useListDesVentesAction) {
gCustomer.addItem("sales.list");
 
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.FACTURE_PREVISIONNELLE, false)) {
gCustomer.addItem("customer.invoice.future.list");
}
} else {
 
gCustomer.addItem("customer.invoice.list");
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.FACTURE_PREVISIONNELLE, false)) {
gCustomer.addItem("customer.invoice.future.list");
}
}
 
gCustomer.addItem("customer.credit.list");
gCustomer.addItem("sales.quote.element.list");
gCustomer.addItem("customer.invoice.details.list");
gCustomer.addItem("customer.deliver.details.list");
 
final Group gSupplier = new Group("menu.list.supplier", LayoutHints.DEFAULT_NOLABEL_SEPARATED_GROUP_HINTS);
gSupplier.addItem("supplier.list");
666,14 → 677,16
boolean useListDesVentesAction = bModeVenteComptoir;
if (useListDesVentesAction) {
mManager.putAction(new ListeDesVentesAction(conf), "sales.list");
 
mManager.putAction(new ListeDesFacturesPrevisionnellesOCAction(), "customer.invoice.future.list");
} else {
 
mManager.putAction(new ListeSaisieVenteFactureAction(), "customer.invoice.list");
mManager.putAction(new ListeDesFacturesPrevisionnellesOCAction(), "customer.invoice.future.list");
}
 
mManager.putAction(new ListeDesAvoirsClientsAction(conf), "customer.credit.list");
mManager.putAction(new ListeDesFactureItemsAction(conf), "customer.invoice.details.list");
mManager.putAction(new ListeDesElementsBLAction(conf), "customer.deliver.details.list");
mManager.putAction(new ListeDesElementsDevisAction(conf), "sales.quote.element.list");
 
mManager.putAction(new ListeDesFournisseursAction(), "supplier.list");
721,7 → 734,10
mManager.putAction(new ExportRelationExpertAction(), "accounting.export");
mManager.putAction(new ImportEcritureFECAction(), "accounting.import.fec");
mManager.putAction(new ImportEcritureRImportAction(), "accounting.import.rimport");
if (configuration.isExperimental()) {
mManager.putAction(new RelevesBancairesAction(this.configuration.getDirectory()), "accounting.bank.statement.list");
}
}
 
public void registerStatsDocumentsActions(final MenuAndActions mManager) {
// mManager.putAction("accounting.vat.report", new DeclarationTVAAction());
/trunk/OpenConcerto/src/org/openconcerto/erp/config/translation_fr.xml
212,6 → 212,7
<action id="sales.invoice.create.supplier.order" label="Transférer en commande" />
<action id="sales.invoice.cancel.credit" label="Annuler l'avoir affecté" />
<action id="sales.shipment.create.invoice" label="Transfert en facture" />
<action id="cancel.regulation.cheque" label="Annuler la régularisation" />
 
<!-- Document -->
<action id="modify" label="Modifier" />
231,7 → 232,16
<action id="supplychain.order.valid" label="Marquer comme validée" />
<action id="supplychain.order.create.receipt" label="Transfert vers bon de réception" />
<action id="supplychain.invoice.clone" label="Créer à partir de" />
<item id="supplychain.order.state.waiting" label="Brouillon" />
<item id="supplychain.order.state.running" label="En attente de réception" />
<item id="supplychain.order.state.toReceipt" label="En cours de réception" />
<item id="supplychain.supplychain.state.receipt.partial" label="Réception partielle" />
<item id="supplychain.order.state.receipt" label="Réceptionnée" />
<item id="supplychain.order.state.block" label="Litige" />
<item id="supplychain.order.state.cancelled" label="Annulée" />
 
 
 
<!-- Customer order -->
<action id="sales.order.create.deliverynote" label="Transfert vers bon de livraison" />
<action id="sales.order.create.invoice" label="Transfert vers facture" />
383,5 → 393,6
<item id="common.SOCIETE_COMMON.grp5" label="Plan comptable de l'entreprise" />
<item id="common.SOCIETE_COMMON.accounting.plan" label="Choix du plan comptable" />
 
<action id="batch.history.pdf.action" label="Générer la fiche de suivi" />
 
</translation>
/trunk/OpenConcerto/src/org/openconcerto/erp/config/mappingCompta_fr.xml
19,9 → 19,12
<FIELD name="DATE_DEBUT_SUSPENSION" label="Début de suspension" />
<FIELD name="DATE_FIN_SUSPENSION" label="Fin de suspension" />
</element>
<element refid="customerrelationship.customer.agency" nameClass="feminine" name="agence">
<FIELD name="ID_CLIENT" label="Client" />
<FIELD name="ID_ADRESSE" label="Adresse" />
<FIELD name="DESIGNATION" label="Désignation" />
</element>
 
 
 
<element refid="customerrelationship.customer.category" nameClass="feminine" name="catégorie de client">
<FIELD name="name" label="Nom" />
</element>
430,6 → 433,10
<FIELD name="DATE_FIN" label="Date de fin d'intervention" />
<FIELD name="POURCENT_SERVICE" label="Pourcentage service" />
<FIELD name="ID_TAXE_PORT" label="Taxe sur port" />
<FIELD name="NIVEAU" label="Niveau" />
<FIELD name="LARGEUR" label="Largeur" />
<FIELD name="LONGUEUR" label="Longueur" />
<FIELD name="HAUTEUR" label="Hauteur" />
</element>
<element refid="supplychain.credit.note" nameClass="feminine" name="facture d'avoir fournisseur"
namePlural="factures d'avoir fournisseur">
507,6 → 514,7
</element>
<element refid="supplychain.receipt.item" nameClass="masculine" name="élément de bon"
namePlural="éléments de bon">
<FIELD name="ID_COMMANDE_ELEMENT" label="élement de bon de réception" />
<FIELD name="ID_ARTICLE_DECLINAISON_TAILLE" label="Taille" />
<FIELD name="ID_ARTICLE_DECLINAISON_COULEUR" label="Couleur" />
<FIELD name="NB_COLIS" label="Nb Colis" />
555,6 → 563,10
<FIELD name="SERVICE" label="Service" />
<FIELD name="ID_MODE_VENTE_ARTICLE" label="Mode de vente" />
<FIELD name="ID_FAMILLE_ARTICLE" label="Famille" />
<FIELD name="NIVEAU" label="Niveau" />
<FIELD name="LARGEUR" label="Largeur" />
<FIELD name="LONGUEUR" label="Longueur" />
<FIELD name="HAUTEUR" label="Hauteur" />
</element>
<element refid="sales.shipment.delivery.note" nameClass="masculine" name="bon de livraison"
namePlural="bons de livraison">
578,17 → 590,19
<FIELD name="TOTAL_TTC" label="Total TTC" />
<FIELD name="NOM" label="Référence" />
<FIELD name="T_ECOTAXE" label="Dont ecotaxe" />
<FIELD name="T_DEVISE" label="Total Devise" />
<FIELD name="T_DEVISE" label="Total devise" />
<FIELD name="PORT_HT" label="Frais de port HT" />
<FIELD name="REMISE_HT" label="Remise HT" />
<FIELD name="ID_TAXE_PORT" label="TVA sur Port" />
<FIELD name="ID_MODELE" label="Modèle" />
<FIELD name="T_ECO_CONTRIBUTION" label="Dont Eco-Contrib." />
<FIELD name="TOTAL_SERVICE" label="Total service" />
<FIELD name="invoiceProgress" label="Avancement facturation" />
<FIELD name="ID_COMMERCIAL" label="Commercial" />
</element>
<element refid="sales.shipment.item" nameClass="masculine" name="élément de bon de livraison"
namePlural="éléments de bon de livraison">
<FIELD name="ID_BON_DE_LIVRAISON" label="Bon de livraison" />
<FIELD name="ID_ARTICLE_DECLINAISON_TAILLE" label="Taille" />
<FIELD name="ID_ARTICLE_DECLINAISON_COULEUR" label="Couleur" />
<FIELD name="ID_DEPOT_STOCK" label="Dépôt Stock" />
648,6 → 662,11
<FIELD name="T_PRIX_FINAL_TTC" label="Total prix client TTC" />
<FIELD name="PRIX_FINAL_TTC" label="Prix client TTC" />
<FIELD name="T_ECOTAXE" label="Total Ecotaxe" />
<FIELD name="ID_COMMANDE_CLIENT_ELEMENT" label="Commande client élément" />
<FIELD name="NIVEAU" label="Niveau" />
<FIELD name="LARGEUR" label="Largeur" />
<FIELD name="LONGUEUR" label="Longueur" />
<FIELD name="HAUTEUR" label="Hauteur" />
</element>
<element refid="sales.pos.receipt" nameClass="feminine" name="caisse">
<FIELD name="NOM" label="Caisse" />
910,6 → 929,8
<FIELD name="BLOQUE_LIVRAISON" label="Bloquer les livraisons" />
<FIELD name="OBSOLETE" label="Obsolète" />
<FIELD name="ALERTE" label="Message d'alerte" />
<FIELD name="SOLDE_COMPTE" label="Solde"/>
</element>
<element refid="customerrelationship.customer.department" nameClass="masculine" name="service client"
namePlural="services client">
1116,7 → 1137,7
<FIELD name="DATE_FIN_SUSPENSION" label="Fin de supension (S21.G00.65.003)" />
<FIELD name="DATE_DEBUT_SUSPENSION" label="Début de supension (S21.G00.65.002)" />
<FIELD name="NATURE" label="Nature de l'emploi (*)" titlelabel="Nature de l'emploi" />
<FIELD name="COMPLEMENT_PCS" label="Code complément PCS-ESE" />
<FIELD name="COMPLEMENT_PCS" label="Code complément PCS-ESE (S21.G00.40.005)" />
<FIELD name="ID_CODE_EMPLOI" label="Catégorie socioprofessionnelle "
titlelabel="Code Catégorie socioprofessionnelle" />
<FIELD name="ID_CODE_CONTRAT_TRAVAIL" label="Contrat de travail" titlelabel="Code contrat" />
1145,6 → 1166,7
</element>
<element refid="supplychain.order" nameClass="feminine" name="commande fournisseur"
namePlural="commandes fournisseur">
<FIELD name="ETAT_COMMANDE" label="Etat" />
<FIELD name="DATE_RECEPTION_DEMANDEE" label="Date réception demandée" />
<FIELD name="DATE_RECEPTION_CONFIRMEE" label="Date réception confirmée" />
<FIELD name="INCOTERM" label="Incoterm" />
1162,8 → 1184,8
<FIELD name="SOURCE" label="Source" />
<FIELD name="T_HT" label="Total HT" />
<FIELD name="T_TVA" label="Total TVA" />
<FIELD name="T_SERVICE" label="Total service" />
<FIELD name="T_TTC" label="Total TTC" />
<FIELD name="T_TTC" label="Total TTC" />
<FIELD name="T_DEVISE" label="Total Devise" />
<FIELD name="T_POIDS" label="Poids total" />
<FIELD name="ID_POLE_PRODUIT" label="Pôle produit" />
1225,12 → 1247,17
<FIELD name="POURCENT_REMISE" label="% Remise" />
<FIELD name="T_POIDS" label="Poids total net" />
<FIELD name="ID_MODE_VENTE_ARTICLE" label="Mode de vente" />
<FIELD name="NIVEAU" label="Niveau" />
<FIELD name="LARGEUR" label="Largeur" />
<FIELD name="LONGUEUR" label="Longueur" />
<FIELD name="HAUTEUR" label="Hauteur" />
 
</element>
<element refid="sales.order" nameClass="feminine" name="commande client" namePlural="commandes clients">
<FIELD name="FACTURATION_INTERNE" label="Facturation interne" />
<FIELD name="T_ACOMPTE" label="Acompte" />
<FIELD name="ID_COMMANDE_CLIENT_PRECEDENT" label="Commande précedente" />
 
<FIELD name="POURCENT_RG" label="Pourcentage RG" />
<FIELD name="ID_TAXE_FRAIS_DOCUMENT" label="TVA sur frais documents" />
<FIELD name="FRAIS_DOCUMENT_HT" label="Frais de document HT" />
<FIELD name="DATE_LIVRAISON_PREV" label="Livraison prévue le" />
1254,10 → 1281,11
<FIELD name="T_HT" label="Total HT" />
<FIELD name="T_TVA" label="Total TVA" />
<FIELD name="T_TTC" label="Total TTC" />
<FIELD name="T_DEVISE" label="Total Devise" />
<FIELD name="T_DEVISE" label="Total devise" />
<FIELD name="INFOS" label="Informations" />
<FIELD name="SOURCE" label="Source" />
<FIELD name="T_POIDS" label="Poids total" />
<FIELD name="T_SERVICE" label="Total service" />
<FIELD name="ID_COMMERCIAL" label="Commercial" />
<FIELD name="ID_POLE_PRODUIT" label="Pôle produit" />
<FIELD name="TYPE_EXPEDITION" label="Type d'envoi" />
1320,6 → 1348,11
<FIELD name="LIVRE" label="Livré" />
<FIELD name="QTE_LIVREE" label="Qté livrée" />
<FIELD name="LIVRE_FORCED" label="Livraison forcée" />
<FIELD name="NIVEAU" label="Niveau" />
<FIELD name="LARGEUR" label="Largeur" />
<FIELD name="LONGUEUR" label="Longueur" />
<FIELD name="HAUTEUR" label="Hauteur" />
 
</element>
<element refid="humanresources.employe.salesman" nameClass="masculine" name="commercial">
<FIELD name="ID_POLE_PRODUIT" label="Pôle produit" />
1401,6 → 1434,11
</element>
<element refid="supplychain.order.demande.achat" nameClass="feminine" name="demande d'achat"
namePlural="demandes d'achat">
<FIELD name="ID_COMMANDE" label="Commande" />
<FIELD name="ID_BON_RECEPTION" label="Bon de réception" />
<FIELD name="IMPORT" label="Importé" />
<FIELD name="T_HT" label="Total HT" />
<FIELD name="P_HT" label="Prix HT" />
<FIELD name="NUMERO" label="Numéro" />
<FIELD name="ID_FOURNISSEUR" label="Fournisseur" />
<FIELD name="DATE" label="Date" />
1447,6 → 1485,7
</element>
<element refid="supplychain.order.demande.item" nameClass="masculine" name="élement de demande de prix"
namePlural="élements de demandes de prix">
<FIELD name="ID_ARTICLE_DECLINAISON_TAILLE" label="Taille" />
<FIELD name="ID_ARTICLE_DECLINAISON_COULEUR" label="Couleur" />
<FIELD name="ID_DEPOT_STOCK" label="Dépôt Stock" />
1495,6 → 1534,11
<FIELD name="T_PA_HT" label="Total achat HT" />
<FIELD name="T_POIDS" label="Poids total" />
<FIELD name="ID_MODE_VENTE_ARTICLE" label="Mode de vente" />
<FIELD name="NIVEAU" label="Niveau" />
<FIELD name="LARGEUR" label="Largeur" />
<FIELD name="LONGUEUR" label="Longueur" />
<FIELD name="HAUTEUR" label="Hauteur" />
 
</element>
<element refid="supplychain.stock.depot" nameClass="masculine" name="dépôt">
<FIELD name="NOM" label="Nom" titlelabel="Dépôt" />
1669,6 → 1713,11
<FIELD name="DUREE_MISSION" label="Durée approx." />
<FIELD name="FONCTION_SIGN" label="Fonction signataire" />
<FIELD name="DATE_SIGN" label="Date de signature" />
<FIELD name="NIVEAU" label="Niveau" />
<FIELD name="LARGEUR" label="Largeur" />
<FIELD name="LONGUEUR" label="Longueur" />
<FIELD name="HAUTEUR" label="Hauteur" />
 
</element>
<element refid="finance.accounting.DEVISE_HISTORIQUE">
<FIELD name="DATE" label="Date" />
1867,6 → 1916,8
<FIELD name="ID_CLIENT" label="Client" />
<FIELD name="ID_ADRESSE" label="Adresse de livraison spécifique" />
<FIELD name="T_ECO_CONTRIBUTION" label="Dont Eco-Contrib." />
<FIELD name="T_SERVICE" label="Service" />
<FIELD name="ID_MODE_REGLEMENT" label="Mode de règlement" />
</element>
<element refid="supplychain.orderinvoice.purchase.item" nameClass="masculine" name="élément de facture"
namePlural="éléments de facture">
1918,6 → 1969,10
<FIELD name="POURCENT_REMISE" label="% Remise" />
<FIELD name="T_POIDS" label="Poids total" />
<FIELD name="ID_MODE_VENTE_ARTICLE" label="Mode de vente" />
<FIELD name="NIVEAU" label="Niveau" />
<FIELD name="LARGEUR" label="Largeur" />
<FIELD name="LONGUEUR" label="Longueur" />
<FIELD name="HAUTEUR" label="Hauteur" />
</element>
<element refid="sales.product.family" nameClass="feminine" name="famille d'article"
namePlural="familles d'articles">
2035,6 → 2090,14
<FIELD name="NOTA" label="Nota" />
<FIELD name="VALID" label="Valider par le responsable" />
</element>
<element refid="sales.product.batch.receipt" nameClass="feminin" name="réception de lot"
namePlural="réceptions de lot">
<FIELD name="QUANTITE" label="Quantité" />
<FIELD name="NUMERO_LOT" label="N° Lot" />
<FIELD name="DLC" label="DLC" />
<FIELD name="DLUO" label="DLUO" />
<FIELD name="NUMERO_SERIE" label="N° Série" />
</element>
<element refid="supplychain.supplier" nameClass="masculine" name="fournisseur">
<FIELD name="ALG_MATRICULE" label="Matricule" />
<FIELD name="ALG_ARTICLE" label="Article" />
2250,7 → 2313,18
<FIELD name="ID_ADRESSE_COMMON" label="Adresse" />
<FIELD name="FACTURE_ADRESSE" label="Facturer à cette adresse" />
<FIELD name="ID_POSTE_ANALYTIQUE" label="Poste analytique" />
<FIELD name="controle.product.pole.address.default" label="Adresse" />
<FIELD name="analytic.poste.id" label="Poste analytique" />
</element>
 
<element refid="calendar-group" nameClass="feminine" name="section du planning"
namePlural="sections du planning">
<FIELD name="CALENDAR_GROUP_ACCESS" label="Utilisateur ayant accès en modification" />
<FIELD name="CALENDAR_USER_GROUP" label="Utilisateur dans cette section" />
<FIELD name="CALENDAR_GROUP_NOTIFY" label="Utilisateur à notifier" />
<FIELD name="NAME" label="Libellé" />
</element>
 
<element refid="finance.accounting.analytic.set" nameClass="masculine" name="poste analytique"
namePlural="postes analytiques">
<FIELD name="NOM" label="Nom du Poste" />
2430,6 → 2504,8
<FIELD name="DATE" label="le" />
<FIELD name="NOM" label="Libellé" />
<FIELD name="MONTANT_TTC" label="Montant TTC" titlelabel="TTC" />
<FIELD name="MONTANT_HT" label="Montant HT" titlelabel="HT" />
<FIELD name="MONTANT_TVA" label="Montant TTVA" titlelabel="TVA" />
<FIELD name="ID_TAXE" label="Taxe" />
<FIELD name="ID_MODE_REGLEMENT" label="Mode de règlement" />
<FIELD name="ID_FOURNISSEUR" label="Fournisseur" />
2481,6 → 2557,7
<FIELD name="CREATION_AUTO" label="Article généré" titlelabel="généré" />
</element>
<element refid="sales.invoice" nameClass="feminine" name="facture">
<FIELD name="POURCENT_RG" label="Pourcentage RG" />
<FIELD name="ID_TAXE_FRAIS_DOCUMENT" label="TVA sur frais documents" />
<FIELD name="FRAIS_DOCUMENT_HT" label="Frais de document HT" />
<FIELD name="ACOMPTE_COMMANDE" label="Acompte" />
2625,6 → 2702,10
<FIELD name="POURCENT_FACTURABLE" label="Facturable (€ ou %)" />
<FIELD name="POURCENT_CCIP" label="CCIP" />
<FIELD name="DATE_FIN" label="Date de fin d'intervention" />
<FIELD name="HAUTEUR" label="Hauteur" />
<FIELD name="LARGEUR" label="Largeur" />
<FIELD name="LONGUEUR" label="Longueur" />
<FIELD name="NIVEAU" label="Niveau" />
</element>
<element refid="humanresources.payroll.employe" nameClass="masculine" name="salarié">
<FIELD name="NOM" label="Nom (*)" titlelabel="Nom" />
2727,6 → 2808,7
<FIELD name="TOTAL_HT" label="Total HT" />
<FIELD name="TOTAL_TTC" label="Total TTC" />
<FIELD name="NUMERO" label="Numéro" />
<FIELD name="ID_CAISSE" label="Caisse" />
</element>
<element refid="civility" nameClass="masculine" name="titre personnel" namePlural="titres personnels">
<FIELD name="NOM" label="Libellé" />
2799,5 → 2881,6
<FIELD name="TEXTE" label="Texte" />
<FIELD name="FORMAT_DATE" label="Format de date" />
<FIELD name="PAR_DEFAUT" label="Par défaut" />
<FIELD name="TABLE_NAME" label="Table" />
</element>
</ROOT>
/trunk/OpenConcerto/src/org/openconcerto/erp/config/mapping_fr.xml
214,6 → 214,7
<FIELD name="PART_CP" label="Participe aux congés payés" />
<FIELD name="CSG_NORMAL" label="Participe à la base CSG normale" />
<FIELD name="CSG_REDUIT" label="Participe à la base CSG réduite" />
<FIELD name="PART_CSG_SANS_ABATTEMENT" label="Part CSG CRDS sans abattement" />
</element>
<element refid="humanresources.payroll.category.comment" nameClass="feminine" name="rubrique de commentaire"
namePlural="rubriques de commentaire">
246,6 → 247,8
<FIELD name="PART_PAT_IMPOSABLE" label="Montant patronale imposable" />
<FIELD name="LIGNE_PAYE_SIMPLIFIEE" label="Ligne simplifiée associée" />
<FIELD name="ALLEGEMENT_COTISATION" label="Allégement de cotisation financé par l'Etat" />
<FIELD name="NUMERO_COMPTE_PCE" label="Numéro de compte tiers spécifique" />
<FIELD name="NUMERO_COMPTE_PCE_CHARGES" label="Numéro de compte de charge spécifique" />
</element>
<element refid="common.SOCIETE_COMMON" nameClass="feminine" name="société">
<FIELD name="DATABASE_NAME" label="Nom" />
/trunk/OpenConcerto/src/org/openconcerto/erp/config/update/Updater_1_5.java
25,6 → 25,7
import org.openconcerto.erp.core.sales.pos.element.TicketCaisseSQLElement;
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
import org.openconcerto.erp.core.sales.quote.element.DevisLogMailSQLElement;
import org.openconcerto.erp.core.supplychain.order.ui.EtatCommandeFournisseur;
import org.openconcerto.erp.core.supplychain.stock.element.ComposedItemStockUpdater;
import org.openconcerto.erp.core.supplychain.stock.element.DepotStockSQLElement;
import org.openconcerto.erp.core.supplychain.stock.element.StockItem;
56,6 → 57,7
import java.math.BigDecimal;
import java.sql.Clob;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Arrays;
969,6 → 971,7
tableFournisseur.getSchema().updateVersion();
tableFournisseur.fetchFields();
}
 
if (!tableFournisseur.contains("CONDITIONS_PORT")) {
final AlterTable alter = new AlterTable(tableFournisseur);
alter.addVarCharColumn("CONDITIONS_PORT", 128);
1101,12 → 1104,21
 
SQLTable tableEncaisse = root.getTable("ENCAISSER_MONTANT");
final AlterTable alterC = new AlterTable(tableEncaisse);
alterC.addForeignColumn("ID_COMMANDE_CLIENT", tableDevisAcompte);
alterC.addForeignColumn("ID_COMMANDE_CLIENT", tableCommandeAcompte);
root.getBase().getDataSource().execute(alterC.asString());
root.refetchTable("ENCAISSER_MONTANT");
root.getSchema().updateVersion();
}
 
SQLTable tableBlAcompte = root.getTable("BON_DE_LIVRAISON");
if (!tableBlAcompte.contains("T_ACOMPTE")) {
final AlterTable alterB = new AlterTable(tableBlAcompte);
alterB.addLongColumn("T_ACOMPTE", 0L, false);
root.getBase().getDataSource().execute(alterB.asString());
root.refetchTable("BON_DE_LIVRAISON");
root.getSchema().updateVersion();
}
 
if (!tableDevisAcompte.contains("DATE_LIVRAISON")) {
final AlterTable alterB = new AlterTable(tableDevisAcompte);
alterB.addColumn("DATE_LIVRAISON", "date");
1276,6 → 1288,15
table.fetchFields();
}
 
if (!table.getFieldsName().contains("ID_COMPTE_PCE_PORT_SOUMIS_ACHAT")) {
AlterTable t = new AlterTable(table);
t.addForeignColumn("ID_COMPTE_PCE_PORT_SOUMIS_ACHAT", root.getTable("COMPTE_PCE"));
t.addForeignColumn("ID_COMPTE_PCE_PORT_NON_SOUMIS_ACHAT", root.getTable("COMPTE_PCE"));
table.getBase().getDataSource().execute(t.asString());
table.getSchema().updateVersion();
table.fetchFields();
}
 
if (!table.getFieldsName().contains("AUTO_LETTRAGE")) {
AlterTable t = new AlterTable(table);
t.addBooleanColumn("AUTO_LETTRAGE", Boolean.FALSE, false);
2017,7 → 2038,6
// for (SQLRow sqlRow : badStock) {
// initStock(sqlRow);
// }
 
}
 
// Tarification client par quantite
2096,6 → 2116,7
final SQLCreateTable createTable = new SQLCreateTable(root, EmailTemplateSQLElement.TABLE_NAME);
createTable.addVarCharColumn("NOM", 80);
createTable.addVarCharColumn("TITRE", 80);
createTable.addVarCharColumn("TABLE_NAME", 256);
createTable.addVarCharColumn("TEXTE", 4096);
createTable.addVarCharColumn("FORMAT_DATE", 20);
createTable.addBooleanColumn("PAR_DEFAUT", Boolean.FALSE, false);
2107,6 → 2128,16
} catch (SQLException ex) {
throw new IllegalStateException("Erreur lors de la création de la table " + EmailTemplateSQLElement.TABLE_NAME, ex);
}
} else if (!root.getTable(EmailTemplateSQLElement.TABLE_NAME).contains("TABLE_NAME")) {
AlterTable alter = new AlterTable(root.getTable(EmailTemplateSQLElement.TABLE_NAME));
alter.addVarCharColumn("TABLE_NAME", 256);
 
root.getBase().getDataSource().execute(alter.asString());
root.refetchTable(EmailTemplateSQLElement.TABLE_NAME);
root.getSchema().updateVersion();
UpdateBuilder up = new UpdateBuilder(root.getTable(EmailTemplateSQLElement.TABLE_NAME));
up.setObject("TABLE_NAME", "ECHEANCE_CLIENT");
root.getBase().getDataSource().execute(up.asString());
}
// Force undefined policy to inDb
root.setMetadata(SQLTable.UNDEFINED_ID_POLICY, "inDB");
2402,23 → 2433,6
throw new IllegalStateException("Erreur lors de la création de la table AGENCE", ex);
}
}
// Tarification client par famille article
if (root.getTable("TARIF_FAMILLE_ARTICLE_CLIENT") == null) {
final SQLCreateTable createTableQtyTarif = new SQLCreateTable(root, "TARIF_FAMILLE_ARTICLE_CLIENT");
createTableQtyTarif.addForeignColumn("ID_FAMILLE_ARTICLE", root.getTable("FAMILLE_ARTICLE"));
createTableQtyTarif.addForeignColumn("ID_CLIENT", root.getTable("CLIENT"));
createTableQtyTarif.addDecimalColumn("QUANTITE", 16, 3, BigDecimal.ONE, false);
createTableQtyTarif.addDecimalColumn("POURCENT_REMISE", 16, 3, null, true);
// createTableQtyTarif.addDecimalColumn("PRIX_METRIQUE_VT_1", 16, 6, null, true);
try {
root.getBase().getDataSource().execute(createTableQtyTarif.asString());
InstallationPanel.insertUndef(createTableQtyTarif);
root.refetchTable("TARIF_FAMILLE_ARTICLE_CLIENT");
root.getSchema().updateVersion();
} catch (SQLException ex) {
throw new IllegalStateException("Erreur lors de la création de la table " + "TARIF_FAMILLE_ARTICLE_CLIENT", ex);
}
}
 
// Tarification client par famille article
if (root.getTable("TARIF_FAMILLE_ARTICLE_CLIENT") == null) {
2619,42 → 2633,6
}
 
}
 
if (!root.contains("LOT_RECEPTION")) {
SQLCreateTable createLotReception = new SQLCreateTable(root, "LOT_RECEPTION");
createLotReception.addDateAndTimeColumn("DATE_RECEPTION");
createLotReception.addVarCharColumn("FOURNISSEUR", 256);
createLotReception.addVarCharColumn("ARTICLE", 256);
createLotReception.addForeignColumn("ID_ARTICLE", root.findTable("ARTICLE", true));
createLotReception.addForeignColumn("ID_DEPOT_STOCK", root.findTable("DEPOT_STOCK", true));
createLotReception.addDecimalColumn("QUANTITE", 16, 6, BigDecimal.ONE, false);
createLotReception.addVarCharColumn("NUMERO_LOT", 256);
createLotReception.addVarCharColumn("NUMERO_SERIE", 256);
createLotReception.addDateAndTimeColumn("DLC");
createLotReception.addDateAndTimeColumn("DLUO");
createLotReception.addForeignColumn("ID_BON_RECEPTION_ELEMENT", root.findTable("BON_RECEPTION_ELEMENT", true));
root.getBase().getDataSource().execute(createLotReception.asString());
InstallationPanel.insertUndef(createLotReception);
 
SQLCreateTable createLotLivraison = new SQLCreateTable(root, "LOT_LIVRAISON");
createLotLivraison.addDateAndTimeColumn("DATE_LIVRAISON");
createLotLivraison.addVarCharColumn("CLIENT", 256);
createLotLivraison.addVarCharColumn("ARTICLE", 256);
createLotLivraison.addForeignColumn("ID_ARTICLE", root.findTable("ARTICLE", true));
createLotLivraison.addForeignColumn("ID_DEPOT_STOCK", root.findTable("DEPOT_STOCK", true));
createLotLivraison.addDecimalColumn("QUANTITE", 16, 6, BigDecimal.ONE, false);
createLotLivraison.addVarCharColumn("NUMERO_LOT", 256);
createLotLivraison.addVarCharColumn("NUMERO_SERIE", 256);
createLotLivraison.addDateAndTimeColumn("DLC");
createLotLivraison.addDateAndTimeColumn("DLUO");
createLotLivraison.addForeignColumn("ID_BON_DE_LIVRAISON_ELEMENT", root.findTable("BON_DE_LIVRAISON_ELEMENT", true));
root.getBase().getDataSource().execute(createLotLivraison.asString());
InstallationPanel.insertUndef(createLotLivraison);
}
 
if (!root.contains("LOT")) {
SQLCreateTable createLot = new SQLCreateTable(root, "LOT");
createLot.addForeignColumn("ID_STOCK", root.findTable("STOCK", true));
2661,8 → 2639,8
createLot.addDecimalColumn("QUANTITE", 16, 6, BigDecimal.ONE, false);
createLot.addVarCharColumn("NUMERO_LOT", 256);
createLot.addVarCharColumn("NUMERO_SERIE", 256);
createLot.addDateAndTimeColumn("DLC");
createLot.addDateAndTimeColumn("DLUO");
createLot.addColumn("DLC", "date");
createLot.addColumn("DLUO", "date");
root.getBase().getDataSource().execute(createLot.asString());
InstallationPanel.insertUndef(createLot);
 
2698,7 → 2676,98
tableArticle.getSchema().updateVersion();
root.refetch();
}
if (!root.getTable("LOT").contains("NUMERO_LOT")) {
 
final AlterTable alterLot = new AlterTable(root.getTable("LOT"));
alterLot.addVarCharColumn("NUMERO_LOT", 256);
alterLot.addVarCharColumn("NUMERO_SERIE", 256);
alterLot.addColumn("DLC", "date");
alterLot.addColumn("DLUO", "date");
alterLot.dropColumn("ID_BON_RECEPTION_ELEMENT");
tableArticle.getBase().getDataSource().execute(alterLot.asString());
tableArticle.getSchema().updateVersion();
root.refetch();
}
 
if (!root.contains("LOT_RECEPTION")) {
SQLCreateTable createLotReception = new SQLCreateTable(root, "LOT_RECEPTION");
createLotReception.addDateAndTimeColumn("DATE_RECEPTION");
createLotReception.addVarCharColumn("FOURNISSEUR", 256);
createLotReception.addVarCharColumn("ARTICLE", 256);
createLotReception.addForeignColumn("ID_ARTICLE", root.findTable("ARTICLE", true));
createLotReception.addForeignColumn("ID_LOT", root.findTable("LOT", true));
createLotReception.addForeignColumn("ID_DEPOT_STOCK", root.findTable("DEPOT_STOCK", true));
createLotReception.addDecimalColumn("QUANTITE", 16, 6, BigDecimal.ONE, false);
createLotReception.addVarCharColumn("NUMERO_LOT", 256);
createLotReception.addVarCharColumn("NUMERO_SERIE", 256);
createLotReception.addColumn("DLC", "date");
createLotReception.addColumn("DLUO", "date");
createLotReception.addForeignColumn("ID_BON_RECEPTION_ELEMENT", root.findTable("BON_RECEPTION_ELEMENT", true));
root.getBase().getDataSource().execute(createLotReception.asString());
InstallationPanel.insertUndef(createLotReception);
 
SQLCreateTable createLotLivraison = new SQLCreateTable(root, "LOT_LIVRAISON");
 
createLotLivraison.addDateAndTimeColumn("DATE_LIVRAISON");
createLotLivraison.addVarCharColumn("CLIENT", 256);
createLotLivraison.addVarCharColumn("ARTICLE", 256);
createLotLivraison.addForeignColumn("ID_ARTICLE", root.findTable("ARTICLE", true));
createLotLivraison.addForeignColumn("ID_LOT", root.findTable("LOT", true));
createLotLivraison.addForeignColumn("ID_DEPOT_STOCK", root.findTable("DEPOT_STOCK", true));
createLotLivraison.addDecimalColumn("QUANTITE", 16, 6, BigDecimal.ONE, false);
createLotLivraison.addVarCharColumn("NUMERO_LOT", 256);
createLotLivraison.addVarCharColumn("NUMERO_SERIE", 256);
createLotLivraison.addColumn("DLC", "date");
createLotLivraison.addColumn("DLUO", "date");
createLotLivraison.addForeignColumn("ID_BON_DE_LIVRAISON_ELEMENT", root.findTable("BON_DE_LIVRAISON_ELEMENT", true));
root.getBase().getDataSource().execute(createLotLivraison.asString());
InstallationPanel.insertUndef(createLotLivraison);
root.getSchema().updateVersion();
root.refetch();
 
}
 
if (root.getTable("LOT_RECEPTION").getField("DLC").getType().getJavaType().equals(Timestamp.class)) {
AlterTable alterLotR = new AlterTable(root.getTable("LOT_RECEPTION"));
alterLotR.alterColumn("DLC", EnumSet.allOf(Properties.class), "date", null, true);
alterLotR.alterColumn("DLUO", EnumSet.allOf(Properties.class), "date", null, true);
tableArticle.getBase().getDataSource().execute(alterLotR.asString());
tableArticle.getSchema().updateVersion();
root.refetchTable("LOT_RECEPTION");
}
if (root.getTable("LOT_LIVRAISON").getField("DLC").getType().getJavaType().equals(Timestamp.class)) {
AlterTable alterLotL = new AlterTable(root.getTable("LOT_LIVRAISON"));
alterLotL.alterColumn("DLC", EnumSet.allOf(Properties.class), "date", null, true);
alterLotL.alterColumn("DLUO", EnumSet.allOf(Properties.class), "date", null, true);
tableArticle.getBase().getDataSource().execute(alterLotL.asString());
tableArticle.getSchema().updateVersion();
root.refetchTable("LOT_LIVRAISON");
}
 
if (root.getTable("LOT").getField("DLC").getType().getJavaType().equals(Timestamp.class)) {
AlterTable alterLot = new AlterTable(root.getTable("LOT"));
alterLot.alterColumn("DLC", EnumSet.allOf(Properties.class), "date", null, true);
alterLot.alterColumn("DLUO", EnumSet.allOf(Properties.class), "date", null, true);
tableArticle.getBase().getDataSource().execute(alterLot.asString());
tableArticle.getSchema().updateVersion();
root.refetchTable("LOT");
}
 
if (!root.getTable("LOT_RECEPTION").contains("ID_LOT")) {
final AlterTable alterLot = new AlterTable(root.getTable("LOT_RECEPTION"));
alterLot.addForeignColumn("ID_LOT", root.getTable("LOT"));
tableArticle.getBase().getDataSource().execute(alterLot.asString());
tableArticle.getSchema().updateVersion();
root.refetchTable("LOT_RECEPTION");
}
if (!root.getTable("LOT_LIVRAISON").contains("ID_LOT")) {
final AlterTable alterLot = new AlterTable(root.getTable("LOT_LIVRAISON"));
alterLot.addForeignColumn("ID_LOT", root.getTable("LOT"));
tableArticle.getBase().getDataSource().execute(alterLot.asString());
tableArticle.getSchema().updateVersion();
root.refetchTable("LOT_LIVRAISON");
}
 
SQLTable tableBR = root.getTable("BON_RECEPTION");
SQLTable tableModele = root.getTable("MODELE");
if (!tableBR.contains("ID_MODELE")) {
2721,6 → 2790,65
rowVals.put("DEFAULT_MODELE", "BonReception");
rowVals.commit();
}
 
// Pourcent RG
if (!tableVF.contains("POURCENT_RG")) {
final AlterTable alter = new AlterTable(tableVF);
alter.addDecimalColumn("POURCENT_RG", 6, 2, BigDecimal.ZERO, true);
tableVF.getBase().getDataSource().execute(alter.asString());
tableVF.getSchema().updateVersion();
tableVF.fetchFields();
}
SQLTable tableCmdCli = root.getTable("COMMANDE_CLIENT");
if (!tableCmdCli.contains("POURCENT_RG")) {
final AlterTable alter = new AlterTable(tableCmdCli);
alter.addDecimalColumn("POURCENT_RG", 6, 2, BigDecimal.ZERO, true);
tableCmdCli.getBase().getDataSource().execute(alter.asString());
tableCmdCli.getSchema().updateVersion();
tableCmdCli.fetchFields();
}
 
SQLTable tableEchCli = root.getTable("ECHEANCE_CLIENT");
if (!tableEchCli.contains("RG")) {
final AlterTable alter = new AlterTable(tableEchCli);
alter.addBooleanColumn("RG", Boolean.FALSE, false);
tableEchCli.getBase().getDataSource().execute(alter.asString());
tableEchCli.getSchema().updateVersion();
tableEchCli.fetchFields();
}
 
SQLTable tableMode = root.getTable("MODE_REGLEMENT");
if (!tableMode.contains("RG")) {
final AlterTable alter = new AlterTable(tableMode);
alter.addBooleanColumn("RG", Boolean.FALSE, false);
tableMode.getBase().getDataSource().execute(alter.asString());
tableMode.getSchema().updateVersion();
tableMode.fetchFields();
}
 
SQLTable tableCmdF = root.getTable("COMMANDE");
if (!tableCmdF.contains("ETAT_COMMANDE")) {
final AlterTable alter = new AlterTable(tableCmdF);
alter.addIntegerColumn("ETAT_COMMANDE", EtatCommandeFournisseur.EN_ATTENTE.getId());
tableCmdF.getBase().getDataSource().execute(alter.asString());
tableCmdF.getSchema().updateVersion();
tableCmdF.fetchFields();
SQLTable tableCmdElement = root.getTable("COMMANDE_ELEMENT");
 
String reqPartiel = "UPDATE " + tableCmdF.getSQLName().quote() + " c SET \"ETAT_COMMANDE\"=" + EtatCommandeFournisseur.RECEPTION_PARTIEL.getId() + " WHERE " + " (\"ETAT_COMMANDE\"="
+ EtatCommandeFournisseur.BROUILLON.getId() + " or \"ETAT_COMMANDE\"=" + EtatCommandeFournisseur.EN_ATTENTE.getId() + ") " + "and (select SUM(i.\"QTE_RECUE\") from "
+ tableCmdElement.getSQLName().quote() + " i" + " where i.\"ID_COMMANDE\"=c.\"ID\" and i.\"ARCHIVE\"=0)>0";
tableCmdF.getDBSystemRoot().getDataSource().execute(reqPartiel);
 
String req = "UPDATE " + tableCmdF.getSQLName().quote() + " c SET \"ETAT_COMMANDE\"=" + EtatCommandeFournisseur.RECEPTIONNEE.getId() + " WHERE " + " (\"ETAT_COMMANDE\"="
+ EtatCommandeFournisseur.BROUILLON.getId() + " or \"ETAT_COMMANDE\"=" + EtatCommandeFournisseur.EN_ATTENTE.getId() + " or c.\"ETAT_COMMANDE\"="
+ EtatCommandeFournisseur.EN_RECEPTION.getId() + " or c.\"ETAT_COMMANDE\"=" + EtatCommandeFournisseur.RECEPTION_PARTIEL.getId() + ") "
+ "and (select SUM((i.\"QTE\"*i.\"QTE_UNITAIRE\")-i.\"QTE_RECUE\") from " + tableCmdElement.getSQLName().quote() + " i"
+ " where i.\"ID_COMMANDE\"=c.\"ID\" and i.\"ARCHIVE\"=0)<=0";
tableCmdF.getDBSystemRoot().getDataSource().execute(req);
 
}
 
// Fix undefined
new SetFKDefault(root.getDBSystemRoot()).changeAll(root);
List<SQLUpdate> ups = new ArrayList<>();
/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,7 → 73,10
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
protected void merge(SQLRowAccessor srcRow, SQLRowValues rowVals) {
/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/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/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/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/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/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/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/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/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.