-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/galite-01X0' : Fix CodeDomain fi…
…elds in pivot table [APPS-01X0]
- Loading branch information
Showing
20 changed files
with
829 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
galite-core/src/main/kotlin/org/kopi/galite/visual/pivottable/VBooleanCodeColumn.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2013-2023 kopiLeft Services SARL, Tunis TN | ||
* Copyright (c) 1990-2023 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.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 | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
galite-core/src/main/kotlin/org/kopi/galite/visual/pivottable/VBooleanColumn.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2013-2023 kopiLeft Services SARL, Tunis TN | ||
* Copyright (c) 1990-2023 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 | ||
|
||
/** | ||
* 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 | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
galite-core/src/main/kotlin/org/kopi/galite/visual/pivottable/VCodeColumn.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright (c) 2013-2023 kopiLeft Services SARL, Tunis TN | ||
* Copyright (c) 1990-2023 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() | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
galite-core/src/main/kotlin/org/kopi/galite/visual/pivottable/VDateColumn.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2013-2023 kopiLeft Services SARL, Tunis TN | ||
* Copyright (c) 1990-2023 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 java.time.LocalDate | ||
|
||
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 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) | ||
} |
Oops, something went wrong.