-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correct the handling of CodeDomain types in the pivot table #615
Changes from 8 commits
71d0a93
20675e2
3208975
6cb0b90
ccf05d6
978fe94
afef8a5
95384ed
72623fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. supprimer l'attribut : format: VCellFormat? |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Restaurer la ligne 34 : internal var userRows: ArrayList? = ArrayList() |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. supprimer cette import : import org.kopi.galite.visual.report.VCellFormat There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Corriger l'indentation : |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.kopi.galite.visual.pivottable | ||
|
||
import org.kopi.galite.util.base.InconsistencyException | ||
import org.kopi.galite.visual.dsl.pivottable.Dimension | ||
|
||
class VBooleanCodeColumn (ident: String?, | ||
position: Dimension.Position?, | ||
type: String?, | ||
source: String?, | ||
name: Array<String>, | ||
private val codes: BooleanArray) | ||
: VCodeColumn(ident, | ||
position, | ||
type, | ||
source, | ||
name) { | ||
|
||
init { | ||
if (codes.size > 2) { | ||
throw InconsistencyException("Can't define more than two codes for a boolean column") | ||
} | ||
} | ||
|
||
override fun compareTo(object1: Any, object2: Any): Int { | ||
return if (object1 == object2) 0 else if (true == object1) 1 else -1 | ||
} | ||
|
||
override fun getIndex(value: Any?): Int { | ||
return if ((value as Boolean) == codes[0]) 0 else 1 | ||
} | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. supprimer cette import : import org.kopi.galite.visual.report.VCellFormat There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changer ces deux lignes :
2022 --> 2023 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.kopi.galite.visual.pivottable | ||
|
||
import org.kopi.galite.visual.dsl.pivottable.Dimension | ||
|
||
/** | ||
* Represents a pivot table column description | ||
* @param ident The identifier of the field | ||
* @param position The position of the dimension field | ||
*/ | ||
class VBooleanColumn(ident: String?, | ||
position: Dimension.Position?) | ||
: VPivotTableColumn(ident, | ||
position) { | ||
|
||
/** | ||
* Compare two objects. | ||
* | ||
* @param object1 the first operand of the comparison | ||
* @param object2 the second operand of the comparison | ||
* @return -1 if the first operand is smaller than the second | ||
* 1 if the second operand if smaller than the first | ||
* 0 if the two operands are equal | ||
*/ | ||
override fun compareTo(object1: Any, object2: Any): Int { | ||
return if (object1 == object2) 0 else if (true == object1) 1 else -1 | ||
} | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. supprimer cette import : import org.kopi.galite.visual.report.VCellFormat Changer la méthode format à : There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changer ces deux lignes :
2022 --> 2023 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright (c) 2013-2022 kopiLeft Services SARL, Tunis TN | ||
* Copyright (c) 1990-2022 kopiRight Managed Solutions GmbH, Wien AT | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License version 2.1 as published by the Free Software Foundation. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
*/ | ||
|
||
package org.kopi.galite.visual.pivottable | ||
|
||
import org.kopi.galite.visual.dsl.pivottable.Dimension | ||
import org.kopi.galite.visual.l10n.FieldLocalizer | ||
import org.kopi.galite.visual.l10n.TypeLocalizer | ||
|
||
/** | ||
* Represents a pivot table column description | ||
* @param ident The identifier of the field | ||
* @param position The position of the dimension field | ||
*/ | ||
abstract class VCodeColumn(ident: String?, | ||
position : Dimension.Position?, | ||
private val type: String?, | ||
private val source: String?, | ||
private val idents: Array<String>) | ||
: VPivotTableColumn(ident, | ||
position) { | ||
|
||
protected var names: Array<String?>? = null // array of external representations | ||
|
||
/** | ||
* Compares two objects. | ||
* | ||
* @param object1 the first operand of the comparison | ||
* @param object2 the second operand of the comparison | ||
* @return -1 if the first operand is smaller than the second | ||
* 1 if the second operand if smaller than the first | ||
* 0 if the two operands are equal | ||
*/ | ||
abstract override fun compareTo(object1: Any, object2: Any): Int | ||
|
||
/** | ||
* Return a string representation. | ||
*/ | ||
override fun format(o: Any?): String { | ||
return if (names != null) names!![getIndex(o)]!! else idents[getIndex(o)] | ||
} | ||
|
||
/** | ||
* Get the index of the value. | ||
*/ | ||
abstract fun getIndex(value: Any?): Int | ||
|
||
// ---------------------------------------------------------------------- | ||
// LOCALIZATION | ||
// ---------------------------------------------------------------------- | ||
/** | ||
* Localizes this field | ||
* | ||
* @param parentLocalizer the caller localizer | ||
*/ | ||
override fun localize(parentLocalizer: FieldLocalizer) { | ||
val loc: TypeLocalizer = parentLocalizer.manager.getTypeLocalizer(source, type) | ||
names = Array(idents.size) { i -> | ||
val label = loc.getCodeLabel(idents[i]) | ||
label | ||
} | ||
} | ||
|
||
fun initLabels(labels: Array<String>) { | ||
names = labels.map { | ||
it | ||
}.toTypedArray() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.kopi.galite.visual.pivottable | ||
|
||
import org.kopi.galite.visual.dsl.pivottable.Dimension | ||
import java.time.LocalDate | ||
|
||
/** | ||
* Represents a pivot table column description | ||
* @param ident The identifier of the field | ||
* @param position The position of the dimension field | ||
*/ | ||
class VDateColumn (ident: String?, | ||
position: Dimension.Position?) | ||
: VPivotTableColumn(ident, | ||
position) { | ||
|
||
/** | ||
* Compare two objects. | ||
* | ||
* @param object1 the first operand of the comparison | ||
* @param object2 the second operand of the comparison | ||
* @return -1 if the first operand is smaller than the second | ||
* 1 if the second operand if smaller than the first | ||
* 0 if the two operands are equal | ||
*/ | ||
override fun compareTo(object1: Any, object2: Any): Int = (object1 as LocalDate).compareTo(object2 as LocalDate) | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. supprimer cette import : import org.kopi.galite.visual.report.VCellFormat |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.kopi.galite.visual.pivottable | ||
|
||
import java.math.BigDecimal | ||
|
||
import org.kopi.galite.util.base.InconsistencyException | ||
import org.kopi.galite.visual.dsl.pivottable.Dimension | ||
|
||
class VDecimalCodeColumn (ident: String?, | ||
position: Dimension.Position?, | ||
type: String?, | ||
source: String?, | ||
name: Array<String>, | ||
private val codes: Array<BigDecimal?>) | ||
: VCodeColumn(ident, | ||
position, | ||
type, | ||
source, | ||
name) { | ||
|
||
/** | ||
* Compares two objects. | ||
* | ||
* @param object1 the first operand of the comparison | ||
* @param object2 the second operand of the comparison | ||
* @return -1 if the first operand is smaller than the second | ||
* 1 if the second operand if smaller than the first | ||
* 0 if the two operands are equal | ||
*/ | ||
override fun compareTo(object1: Any, object2: Any): Int = (object1 as BigDecimal) | ||
.compareTo(object2 as BigDecimal) | ||
|
||
/** | ||
* Get the index of the value. | ||
*/ | ||
override fun getIndex(value: Any?): Int { | ||
for (i in codes.indices) { | ||
if (value == codes[i]) { | ||
return i | ||
} | ||
} | ||
throw InconsistencyException(">>>>$value") | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corriger l'ordre des imports
supprimer cette ligne : format: VCellFormat?
supprimer l'affectation du l'attribut format au class VBooleanCodeColumn, VDecimalCodeColumn, VIntegerCodeColumn et VStringCodeColumn