Service dedicated to QR code generation and saving.
More...
|
| boolean | checkNPEInputs (EncodedData qrData, CommonFields config, JProgressBar loader) |
| | Validates that all required inputs are non-null.
|
| |
| File | chooseOutputFile (EncodedData qrData) |
| | Opens a JFileChooser to select the output PNG file and handles file name conflicts.
|
| |
| void | executeQrGeneration (EncodedData qrData, CommonFields config, JProgressBar loader, File outputFile) |
| | Executes QR code generation asynchronously using a SwingWorker.
|
| |
| File | getSelectedPngFile (JFileChooser chooser) |
| | Ensures the selected file has a ".png" extension.
|
| |
| File | resolveFileNameConflict (File file) |
| | Resolves potential file name conflicts by checking if the specified file already exists.
|
| |
Service dedicated to QR code generation and saving.
◆ GenerateAndSaveService()
| fr.softsf.canscan.service.GenerateAndSaveService.GenerateAndSaveService |
( |
EncodedImage | encodedImage | ) |
|
Constructs a GenerateAndSaveService with the given QR code image generator.
- Parameters
-
| encodedImage | the QR code image generator; must not be null |
◆ checkNPEInputs()
| boolean fr.softsf.canscan.service.GenerateAndSaveService.checkNPEInputs |
( |
EncodedData | qrData, |
|
|
CommonFields | config, |
|
|
JProgressBar | loader ) |
|
private |
Validates that all required inputs are non-null.
- Parameters
-
| qrData | the QR code data to validate |
| config | the configuration to validate |
| loader | the progress bar to validate |
- Returns
- true if all inputs are valid, false otherwise
◆ chooseOutputFile()
| File fr.softsf.canscan.service.GenerateAndSaveService.chooseOutputFile |
( |
EncodedData | qrData | ) |
|
|
private |
Opens a JFileChooser to select the output PNG file and handles file name conflicts.
- Parameters
-
| qrData | the QR code data used to generate the default file name |
- Returns
- the selected file ready for writing, or null if the user cancels
◆ executeQrGeneration()
| void fr.softsf.canscan.service.GenerateAndSaveService.executeQrGeneration |
( |
EncodedData | qrData, |
|
|
CommonFields | config, |
|
|
JProgressBar | loader, |
|
|
File | outputFile ) |
|
private |
Executes QR code generation asynchronously using a SwingWorker.
- Parameters
-
| qrData | the QR code data |
| config | the visual configuration |
| loader | the progress bar to hide after completion |
| outputFile | the file where the QR code will be saved |
◆ generateAndSave()
| void fr.softsf.canscan.service.GenerateAndSaveService.generateAndSave |
( |
EncodedData | qrData, |
|
|
CommonFields | config, |
|
|
JProgressBar | loader ) |
Generates and saves a QR code as a PNG file using the provided data and configuration.
Validates input data, applies visual settings, generates the QR code image, and saves it to a user-selected file location. All operations are performed asynchronously to prevent UI blocking.
- Parameters
-
| qrData | the QR code data; must not be null |
| config | the visual configuration; must not be null |
| loader | the progress indicator to display during generation |
◆ getSelectedFileForTests()
| File fr.softsf.canscan.service.GenerateAndSaveService.getSelectedFileForTests |
( |
JFileChooser | chooser | ) |
|
|
package |
Returns the selected PNG file for testing.
◆ getSelectedPngFile()
| File fr.softsf.canscan.service.GenerateAndSaveService.getSelectedPngFile |
( |
JFileChooser | chooser | ) |
|
|
private |
Ensures the selected file has a ".png" extension.
- Parameters
-
- Returns
- a File guaranteed to have a ".png" extension
◆ resolveFileNameConflict()
| File fr.softsf.canscan.service.GenerateAndSaveService.resolveFileNameConflict |
( |
File | file | ) |
|
|
private |
Resolves potential file name conflicts by checking if the specified file already exists.
If the file exists, the user is prompted to overwrite it. If the user declines, a new file name is generated by appending a numeric suffix to avoid overwriting existing files.
- Parameters
-
| file | the initial File to check for conflicts |
- Returns
- a File ready for writing, either the original, user-approved, or auto-renamed, or null if input file is null
◆ resolveFileNameConflictForTests()
| File fr.softsf.canscan.service.GenerateAndSaveService.resolveFileNameConflictForTests |
( |
File | file | ) |
|
|
package |
Resolves file name conflicts for testing.
◆ encodedImage
| final EncodedImage fr.softsf.canscan.service.GenerateAndSaveService.encodedImage |
|
private |
The documentation for this class was generated from the following file: