Skip to content

Commit

Permalink
Nettoyer [APPS-01WEA]
Browse files Browse the repository at this point in the history
  • Loading branch information
Iyedchaabane committed Dec 6, 2023
1 parent 1c75f4f commit 15a996d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,15 @@
package org.kopi.galite.visual.pivottable

import org.kopi.galite.visual.UWindow
import java.io.IOException

interface UPivotTable : UWindow {

/**
* Builds the pivot table;
*/
fun build()

/**
* Exports to the PDF format.
*
* @throws IOException I/O errors.
* Print to the PDF format.
*/
@Throws(IOException::class)
fun exportToPDF()
fun imprimer()
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@

package org.kopi.galite.visual.pivottable

import java.io.File
import java.net.MalformedURLException

import org.jetbrains.annotations.TestOnly
import org.kopi.galite.util.base.InconsistencyException
import org.kopi.galite.visual.*
import org.kopi.galite.visual.dsl.common.Trigger
import org.kopi.galite.visual.form.VConstants
import org.kopi.galite.visual.l10n.LocalizationManager
import org.vaadin.addons.componentfactory.PivotTable.*
import java.io.File
import java.net.MalformedURLException

/**
* Represents a pivot table model.
Expand Down Expand Up @@ -275,16 +276,11 @@ abstract class VPivotTable internal constructor() : VWindow(), VConstants {
* Prints the report
*/
fun export(type: Int ) {
setWaitInfo(VlibProperties.getString("export-message"))
try {
when (type) {
VPivotTable.TYP_PDF -> {
(getDisplay() as UPivotTable).exportToPDF()
}
else -> throw InconsistencyException("Export type unknown")
when (type) {
TYP_PDF -> {
(getDisplay() as UPivotTable).imprimer()
}
} finally {
unsetWaitInfo()
else -> throw InconsistencyException("Export type unknown")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,11 @@ class DPivotTable(private val pivotTable: VPivotTable) : DWindow(pivotTable), UP
add(pivot)
}

override fun exportToPDF() {
override fun imprimer() {
if (::pivot.isInitialized) {
ui.get().access {
ui.get().page.executeJs("window.print()")
}
} else {
println("Pivot is not properly initialized ")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ class ClientP : PivotTable(title = "Clients_Pivot_Table", locale = Locale.UK) {
key = Key.F1
icon = Icon.HELP
}
val pdf = actor(menu = action, label = "PDF", help = "PDF Format", ident = "pdf") {
val imprimer = actor(menu = action, label = "PDF", help = "PDF Format", ident = "pdf") {
key = Key.F9
icon = Icon.EXPORT_PDF
icon = Icon.PRINT
}
val cmdQuit = command(item = quit) { model.close() }
val helpCmd = command(item = helpForm) { model.showHelp() }
val cmdPDF = command(item = pdf) {
val cmdPDF = command(item = imprimer) {
model.export(VPivotTable.TYP_PDF)
}

Expand Down

0 comments on commit 15a996d

Please sign in to comment.