![]() |
CanScan
|
CanScan — Swing QR code generator with MECARD, MEET, and FREE modes. More...
Inheritance diagram for fr.softsf.canscan.CanScan:
Collaboration diagram for fr.softsf.canscan.CanScan:Public Member Functions | |
| CanScan () | |
| Constructs the CanScan GUI, setting up layout, panels, inputs, and QR preview. | |
| void | dispose () |
| Releases QR-code resources and closes the window. | |
Static Public Member Functions | |
| static void | main (String[] args) |
| Application entry point. | |
Package Functions | |
| void | browseLogo (ActionEvent e) |
| Opens a file chooser to select a logo image and updates the logo text field. | |
| File | chooseLogoFile () |
| Opens a file chooser for PNG, JPG, or JPEG logos. | |
| Mode | getCurrentModeForTests () |
| Returns the current mode for testing. | |
| String | getLogoFieldTextForTests () |
| Returns the logo field text for testing. | |
| int | getMarginFieldIntForTests () |
| Returns the margin field int for testing. | |
| void | setAdrFieldTextForTests () |
| Sets the address field text for testing. | |
| void | setCurrentModeForTests (Mode mode) |
| Sets the current mode for testing. | |
| void | setEmailFieldTextForTests () |
| Sets the email field text for testing. | |
| void | setLogoFieldTextForTests (String text) |
| Sets the logo field text for testing. | |
| void | setMarginSliderValueForTests (int value) |
| Sets the margin slider value for testing. | |
| void | setNameFieldTextForTests () |
| Sets the name field text for testing. | |
| void | setOrgFieldTextForTests () |
| Sets the organization field text for testing. | |
| void | setPhoneFieldTextForTests () |
| Sets the phone field text for testing. | |
| void | setRatioSliderValueForTests (int value) |
| Sets the ratio slider value for testing. | |
| void | setSizeFieldTextForTests (String text) |
| Sets the size field text for testing. | |
| void | setUrlFieldTextForTests () |
| Sets the URL field text for testing. | |
| void | switchModeForTests (Mode mode) |
| Switches the mode for testing. | |
| int | validateAndGetMargin () |
| Validates and returns the current QR code margin from the margin slider. | |
| String | validateAndGetMeetUID () |
| Validates and returns the current meet UID from the meet title field. | |
| double | validateAndGetRatio () |
| Validates and returns the current image-to-QR ratio from the ratio slider. | |
| int | validateAndGetSize () |
| Validates and returns the QR code size from the corresponding text field. | |
Private Member Functions | |
| void | addNorthPanelCardPanels (JPanel northPanel, GridBagConstraints grid) |
| Adds MECARD MEET FREE card panels to the north panel. | |
| void | addNorthPanelCommonFields (JPanel northPanel, GridBagConstraints grid) |
| Adds common input fields to the north panel. | |
| void | addNorthPanelGenerateButton (JPanel northPanel, GridBagConstraints grid) |
| Adds the generate button to the north panel. | |
| void | addNorthPanelModeSelection (JPanel northPanel, GridBagConstraints grid) |
| Adds mode selection controls (MECARD/MEET/FREE) to the north panel. | |
| void | automaticQRCodeRenderingForFieldsAndControls () |
| Attaches automatic QR preview updates and input validation to all fields and controls. | |
| int | calculateAvailableQrCodeLabelHeight () |
| Calculates the available height for QR code rendering. | |
| JPanel | colorPanel () |
| Creates the color selection panel for QR code and background colors. | |
| void | configureUpdateButton () |
| Configures the update button for version checking. | |
| void | freeCard (JPanel freePanel, GridBagConstraints grid) |
| Populates the FREE panel with a multiline text area. | |
| void | generateQrCode (ActionEvent e) |
Generates a QR code from current input fields and visual settings, then saves it via GenerateAndSaveService. | |
| WholeFields | getQrInput () |
Collects current input and visual settings into a WholeFields for QR code generation. | |
| void | initializeComponentNames () |
| Assigns stable component names for testing and native-image configuration. | |
| JPanel | initializeMainPanel () |
| Builds the main panel with header, QR preview overlay, and bottom spacer. | |
| JPanel | initializeNorthPanel () |
| Builds the north panel with mode selection, card panels, common fields, and generate button. | |
| JScrollPane | initializeScrollPane (JPanel mainPanel) |
| Wraps the main panel in a scrollable container. | |
| void | initializeSliders () |
| Configures sliders for logo margin and ratio. | |
| void | initializeWindow () |
| Finalizes window layout: packs components, adjusts size for QR display and loader, and centers the window on screen. | |
| void | mecard (JPanel mecardPanel, GridBagConstraints grid) |
| Populates the MECARD panel with contact fields. | |
| void | meetCard (JPanel meetPanel, GridBagConstraints grid) |
| Populates the MEET panel with meet fields. | |
| GridBagConstraints | northPanelGridBagConstraints () |
| Creates default GridBagConstraints for consistent layout configuration. | |
| void | setLoaderSize () |
| Sets the loader size so it matches the QR code label height and remains centered. | |
| boolean | shouldDisableGenerateButton () |
| Determines whether the "Generate" button should be disabled for the current mode. | |
| void | switchMode (Mode mode) |
| Switches between MECARD, MEET, and FREE modes, updating the panel and QR preview. | |
| void | updateGenerateButtonState () |
| Enables or disables the "Generate" button based on required fields for the current mode. | |
Static Private Member Functions | |
| static JPanel | getNorthJPanel () |
| Creates the base north panel with layout, maximum width, and padding applied. | |
Private Attributes | |
| final JTextField | adrField = new JTextField(IntConstants.TEXT_FIELDS_COLUMNS.getValue()) |
| Color | bgColor = Color.WHITE |
| final JButton | bgColorButton = new JButton("#FFFFFF") |
| final JButton | browseButton |
| final CardLayout | cardLayout = new CardLayout() |
| final JPanel | cardPanel = new JPanel(cardLayout) |
| final transient ColorOperation | colorOperation = new ColorOperation() |
| Mode | currentMode = Mode.MECARD |
| final JTextField | emailField |
| final transient EncodedImage | encodedImage = new EncodedImage() |
| final JTextArea | freeField = new JTextArea("") |
| final JRadioButton | freeRadio |
| final JScrollPane | freeScrollPane = new JScrollPane(freeField) |
| final transient GenerateAndSaveService | generateAndSaveService |
| final JButton | generateButton |
| double | imageRatio = DoubleConstants.DEFAULT_IMAGE_RATIO.getValue() |
| final JProgressBar | loader = new JProgressBar() |
| final JTextField | logoField |
| int | margin = 3 |
| final JSlider | marginSlider = new JSlider(0, MINIMUM_QR_CODE_SIZE, margin) |
| final JRadioButton | mecardRadio |
| final DatePicker | meetBeginDatePicker = new FlatLafDatePicker() |
| final TimePicker | meetBeginTimePicker = new FlatLafTimePicker() |
| final DatePicker | meetEndDatePicker = new FlatLafDatePicker() |
| final TimePicker | meetEndTimePicker = new FlatLafTimePicker() |
| final JTextField | meetLatField = new JTextField() |
| final JTextField | meetLongField = new JTextField() |
| final JTextField | meetNameField |
| final JRadioButton | meetRadio |
| final JTextField | meetTitleField |
| final JTextField | meetUIdField |
| final JTextField | nameField |
| final JPanel | northPanelWrapper = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)) |
| final JTextField | orgField = new JTextField(IntConstants.TEXT_FIELDS_COLUMNS.getValue()) |
| final JTextField | phoneField |
| final JLabel | qrCodeLabel = new JLabel("", SwingConstants.CENTER) |
| final transient DynamicPreviewWorker | qrCodePreview |
| final transient DynamicResizeWorker | qrCodeResize |
| Color | qrColor = Color.BLACK |
| final JButton | qrColorButton = new JButton("#000000") |
| final JSlider | ratioSlider |
| final JCheckBox | roundedModulesCheckBox = new JCheckBox() |
| final JTextField | sizeField |
| final JPanel | southSpacer = new JPanel() |
| final JButton | update |
| final JTextField | urlField = new JTextField(IntConstants.TEXT_FIELDS_COLUMNS.getValue()) |
Static Private Attributes | |
| static final String | HTML_B_STRING_B_HTML = "<html><b>%s</b></html>" |
| static final int | MAX_COORDINATE_LENGTH = 12 |
| static final int | MINIMUM_QR_CODE_SIZE = 10 |
| static final String | NORTH_PANEL = "northPanel" |
| static final int | QR_CODE_LABEL_DEFAULT_SIZE = 50 |
| static final int | VERTICAL_SCROLL_UNIT_INCREMENT = 16 |
| static final String | WARNING_ICON = "\uE002" |
CanScan — Swing QR code generator with MECARD, MEET, and FREE modes.
| fr.softsf.canscan.CanScan.CanScan | ( | ) |
Constructs the CanScan GUI, setting up layout, panels, inputs, and QR preview.
Here is the call graph for this function:
|
private |
Adds MECARD MEET FREE card panels to the north panel.
Initializes both panels and registers them in the card layout.
Here is the call graph for this function:
|
private |
Adds common input fields to the north panel.
Includes logo path, margin, ratio, colors, size, and rounded modules options.
Here is the call graph for this function:
|
private |
Adds the generate button to the north panel.
Configures size, action listener, tooltip, and initial disabled state.
|
private |
Adds mode selection controls (MECARD/MEET/FREE) to the north panel.
Configures radio buttons, update button, and mode switching listeners.
Here is the call graph for this function:
|
private |
Attaches automatic QR preview updates and input validation to all fields and controls.
Here is the call graph for this function:
|
package |
Opens a file chooser to select a logo image and updates the logo text field.
| e | the ActionEvent that triggered the file chooser |
Here is the call graph for this function:
|
private |
Calculates the available height for QR code rendering.
|
package |
Opens a file chooser for PNG, JPG, or JPEG logos.
null if canceled
|
private |
Creates the color selection panel for QR code and background colors.
Initializes buttons, listeners, and updates preview on color changes.
Here is the call graph for this function:
|
private |
Configures the update button for version checking.
Sets tooltip, browser action, and background worker execution.
| void fr.softsf.canscan.CanScan.dispose | ( | ) |
Releases QR-code resources and closes the window.
|
private |
Populates the FREE panel with a multiline text area.
| freePanel | the panel to populate |
| grid | layout constraints |
|
private |
Generates a QR code from current input fields and visual settings, then saves it via GenerateAndSaveService.
| e | the triggering ActionEvent |
Here is the call graph for this function:
|
package |
Returns the current mode for testing.
|
package |
Returns the logo field text for testing.
|
package |
Returns the margin field int for testing.
|
staticprivate |
Creates the base north panel with layout, maximum width, and padding applied.
JPanel
|
private |
Collects current input and visual settings into a WholeFields for QR code generation.
WholeFields instance
Here is the call graph for this function:
|
private |
Assigns stable component names for testing and native-image configuration.
|
private |
Builds the main panel with header, QR preview overlay, and bottom spacer.
Registers resize listeners and enables automatic QR updates.
JPanel
Here is the call graph for this function:
|
private |
Builds the north panel with mode selection, card panels, common fields, and generate button.
Uses GridBagLayout with consistent spacing.
Here is the call graph for this function:
|
private |
Wraps the main panel in a scrollable container.
Removes borders and configures smooth vertical scrolling.
|
private |
Configures sliders for logo margin and ratio.
Sets tick spacing, labels, and listeners to update tooltips dynamically.
|
private |
Finalizes window layout: packs components, adjusts size for QR display and loader, and centers the window on screen.
Here is the call graph for this function:
|
static |
Application entry point.
Initializes the UI theme, font, and launches the GUI on the EDT.
| args | command-line arguments (ignored) |
Here is the call graph for this function:
|
private |
Populates the MECARD panel with contact fields.
| mecardPanel | target panel |
| grid | layout constraints |
|
private |
Populates the MEET panel with meet fields.
| meetPanel | target panel |
| grid | layout constraints |
|
private |
Creates default GridBagConstraints for consistent layout configuration.
Defines insets, fill behavior, and initial grid positions.
|
package |
Sets the address field text for testing.
|
package |
Sets the current mode for testing.
|
package |
Sets the email field text for testing.
|
private |
Sets the loader size so it matches the QR code label height and remains centered.
A small offset is applied to correct a slight visual misalignment.
Here is the call graph for this function:
|
package |
Sets the logo field text for testing.
|
package |
Sets the margin slider value for testing.
|
package |
Sets the name field text for testing.
|
package |
Sets the organization field text for testing.
|
package |
Sets the phone field text for testing.
|
package |
Sets the ratio slider value for testing.
|
package |
Sets the size field text for testing.
|
package |
Sets the URL field text for testing.
|
private |
Determines whether the "Generate" button should be disabled for the current mode.
true if the button should be disabled, false otherwise
|
private |
Switches between MECARD, MEET, and FREE modes, updating the panel and QR preview.
| mode | the selected Mode; ignored if null |
Here is the call graph for this function:
|
package |
Switches the mode for testing.
Here is the call graph for this function:
|
private |
Enables or disables the "Generate" button based on required fields for the current mode.
Here is the call graph for this function:
|
package |
Validates and returns the current QR code margin from the margin slider.
|
package |
Validates and returns the current meet UID from the meet title field.
|
package |
Validates and returns the current image-to-QR ratio from the ratio slider.
|
package |
Validates and returns the QR code size from the corresponding text field.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
staticprivate |