![]() |
CanScan
|
Creating and configuring UI components. More...
Collaboration diagram for fr.softsf.canscan.ui.UiComponentsConfiguration:Public Member Functions | |
| void | addRow (JPanel panel, GridBagConstraints gbc, String labelText, String tooltipText, JComponent component) |
Adds a labeled row to a panel using GridBagLayout. | |
| void | assignComponentNames (NativeImageUiComponents nativeImageUiComponents) |
Assigns unique names to all GUI components encapsulated in the given NativeImageUiComponents instance. | |
| void | attachLimitedDocumentListener (JTextField field, int maxLength, Runnable action) |
Attaches a DocumentListener to a JTextField that: | |
| void | configureFreeTextArea (JTextArea textArea, JScrollPane scrollPane) |
| Configures a JTextArea for free text input with word wrapping and a fixed size. | |
| void | configureGenerateButton (JButton button, ActionListener listener) |
| Configures a generate button with a standard size, attaches an action listener, and sets its initial state to disabled. | |
| void | configureMarginSlider (JSlider slider, int initialValue) |
| Configures a JSlider with standard margin settings. | |
| void | configureRatioSlider (JSlider slider, double initialRatio) |
| Configures a JSlider for ratio selection with standard settings and tooltip updates. | |
| JPanel | createColorPanel (JButton qrColorButton, JButton bgColorButton) |
| Creates a panel containing buttons for selecting background and QR code colors. | |
| JPanel | createCoordinatesPanel (JTextField latField, JTextField longField) |
| Creates a panel with latitude and longitude text fields side by side, distributed evenly with a gap. | |
| JPanel | createDateTimePanel (DatePicker meetDatePicker, TimePicker meetTimePicker) |
| Creates a panel with date/time fields side by side, distributed evenly with a gap. | |
| GridBagConstraints | createDefaultConstraints () |
Creates default GridBagConstraints for consistent layout. | |
| DocumentListener | createDocumentListener (Runnable action) |
Creates a simple DocumentListener that executes the given action on any change to the document. | |
| JButton | createIconButton (String iconCode, String text) |
| Creates a JButton styled with a Material Icon and a text label. | |
| JButton | createIconOnlyButton (String iconCode) |
| Creates a JButton styled to display a bold Material Icon only. | |
| JPanel | createModePanel (JRadioButton mecardRadio, JRadioButton meetRadio, JRadioButton freeRadio, JButton updateButton, ButtonGroup buttonGroup) |
| Creates a mode selection panel containing radio buttons for different modes and an update button. | |
| JPanel | createQrCodeOverlayPanel (JProgressBar loader, JLabel qrCodeLabel) |
| Creates an overlay panel containing a loader and a QR code label. | |
| String | getIconAfterTextHtml (String text, String iconCode) |
| Generates the HTML string for a JLabel with text followed by an icon. | |
| void | populateFreePanel (JPanel freePanel, GridBagConstraints grid, JTextArea freeField, JScrollPane freeScrollPane) |
| Creates and populates a FREE text input panel. | |
| void | populateMecardPanel (JPanel mecardPanel, GridBagConstraints grid, MecardJFields mecardJFields) |
| Creates and populates a MECARD input panel with labeled input fields. | |
| void | populateMeetPanel (JPanel meetPanel, GridBagConstraints grid, MeetJFields meetJFields) |
| Creates and populates a MEET input panel with labeled input fields for event details. | |
Public Attributes | |
| INSTANCE | |
Private Member Functions | |
| JPanel | createRadioButtonsPanel (JRadioButton mecardRadio, JRadioButton meetRadio, JRadioButton freeRadio) |
| Creates a panel containing the given radio buttons arranged horizontally with spacing. | |
Static Private Attributes | |
| static final String | ADD_ROW = "addRow" |
| static final int | COLOR_BUTTONS_GAP = 10 |
| static final int | COORDINATES_FIELDS_GAP = 5 |
| static final String | CREATE_MODE_PANEL = "createModePanel" |
| static final double | GBC_HALF_WEIGHT_X = 0.5 |
| static final int | GENERATE_BUTTON_EXTRA_HEIGHT = 35 |
| static final int | MAJOR_TICK_SPACING = 25 |
| static final int | MULTILINE_TEXT_FIELDS_ROWS = 10 |
| static final String | POPULATE_MECARD_PANEL = "populateMecardPanel" |
| static final int | RADIO_BUTTON_GAP = 10 |
Creating and configuring UI components.
| void fr.softsf.canscan.ui.UiComponentsConfiguration.addRow | ( | JPanel | panel, |
| GridBagConstraints | gbc, | ||
| String | labelText, | ||
| String | tooltipText, | ||
| JComponent | component ) |
Adds a labeled row to a panel using GridBagLayout.
The row consists of a JLabel on the left and the specified JComponent on the right. Optionally, a tooltip can be set for the label.
| panel | the JPanel to which the row is added; must not be null |
| gbc | the GridBagConstraints used for layout positioning; must not be null |
| labelText | the text for the JLabel; must not be null |
| tooltipText | the tooltip text for the label; may be null or blank |
| component | the JComponent to add next to the label; must not be null |
| void fr.softsf.canscan.ui.UiComponentsConfiguration.assignComponentNames | ( | NativeImageUiComponents | nativeImageUiComponents | ) |
Assigns unique names to all GUI components encapsulated in the given NativeImageUiComponents instance.
This allows automated test frameworks, such as native image configuration simulators, to reliably identify each component by name.
| nativeImageUiComponents | the NativeImageUiComponents containing the GUI elements to name; must not be null |
| void fr.softsf.canscan.ui.UiComponentsConfiguration.attachLimitedDocumentListener | ( | JTextField | field, |
| int | maxLength, | ||
| Runnable | action ) |
Attaches a DocumentListener to a JTextField that:
action on any change to the document (insert, remove, or change), asynchronously on the Swing EDT. maxLength characters using a DocumentFilter. This allows dynamic updates (e.g., QR code preview) while preventing input overflow and unwanted line breaks.
| field | the JTextField to attach the listener to; must not be null |
| maxLength | the maximum number of characters allowed in the field |
| action | the Runnable to execute on document changes; must not be null |
Here is the call graph for this function:| void fr.softsf.canscan.ui.UiComponentsConfiguration.configureFreeTextArea | ( | JTextArea | textArea, |
| JScrollPane | scrollPane ) |
Configures a JTextArea for free text input with word wrapping and a fixed size.
Enables word wrap and line wrap for the text area, then calculates the preferred size of the enclosing JScrollPane based on character dimensions and predefined column and row counts.
| textArea | the JTextArea to configure; must not be null |
| scrollPane | the JScrollPane containing the text area; must not be null |
| void fr.softsf.canscan.ui.UiComponentsConfiguration.configureGenerateButton | ( | JButton | button, |
| ActionListener | listener ) |
Configures a generate button with a standard size, attaches an action listener, and sets its initial state to disabled.
The button's height is increased by GENERATE_BUTTON_EXTRA_HEIGHT, and its minimum, preferred, and maximum sizes are all set to this dimension. The provided ActionListener is added to handle button actions.
| button | the JButton to configure; must not be null |
| listener | the ActionListener to attach; must not be null |
| void fr.softsf.canscan.ui.UiComponentsConfiguration.configureMarginSlider | ( | JSlider | slider, |
| int | initialValue ) |
Configures a JSlider with standard margin settings.
Sets the slider to the given initial value, enables major tick spacing of 1, and ensures that tick marks and labels are painted.
| slider | the JSlider to configure; must not be null |
| initialValue | the initial value to set for the slider |
| void fr.softsf.canscan.ui.UiComponentsConfiguration.configureRatioSlider | ( | JSlider | slider, |
| double | initialRatio ) |
Configures a JSlider for ratio selection with standard settings and tooltip updates.
Sets the slider's value based on initialRatio (scaled to percentage), sets the maximum value, major and minor tick spacing, enables tick marks and labels, and updates the tooltip to show the current percentage dynamically.
| slider | the JSlider to configure; must not be null |
| initialRatio | the initial ratio (0.0 to 1.0) to set for the slider |
| JPanel fr.softsf.canscan.ui.UiComponentsConfiguration.createColorPanel | ( | JButton | qrColorButton, |
| JButton | bgColorButton ) |
Creates a panel containing buttons for selecting background and QR code colors.
The panel arranges the background color button on the left and the QR color button on the right, using GridBagLayout with horizontal spacing defined by .
COLOR_BUTTONS_GAP
| qrColorButton | the JButton for selecting the QR code color; must not be null |
| bgColorButton | the JButton for selecting the background color; must not be null |
JPanel containing the color selection buttons, or null if any button is null | JPanel fr.softsf.canscan.ui.UiComponentsConfiguration.createCoordinatesPanel | ( | JTextField | latField, |
| JTextField | longField ) |
Creates a panel with latitude and longitude text fields side by side, distributed evenly with a gap.
| latField | the latitude text field |
| longField | the longitude text field |
| JPanel fr.softsf.canscan.ui.UiComponentsConfiguration.createDateTimePanel | ( | DatePicker | meetDatePicker, |
| TimePicker | meetTimePicker ) |
Creates a panel with date/time fields side by side, distributed evenly with a gap.
| meetDatePicker | the date field |
| meetTimePicker | the time field |
| GridBagConstraints fr.softsf.canscan.ui.UiComponentsConfiguration.createDefaultConstraints | ( | ) |
Creates default GridBagConstraints for consistent layout.
The default constraints set uniform insets of 3 pixels on all sides, fill horizontally, start at gridx = 0, gridy = -1, and assign weightx = 1 for proper resizing behavior.
GridBagConstraints instance with default settings | DocumentListener fr.softsf.canscan.ui.UiComponentsConfiguration.createDocumentListener | ( | Runnable | action | ) |
Creates a simple DocumentListener that executes the given action on any change to the document.
The action is invoked asynchronously on the Swing event dispatch thread using SwingUtilities#invokeLater(Runnable) to ensure thread safety.
| action | the Runnable to execute when the document changes; must not be null |
DocumentListener that triggers the action on insert, remove, or change events, or null if the action is null | JButton fr.softsf.canscan.ui.UiComponentsConfiguration.createIconButton | ( | String | iconCode, |
| String | text ) |
Creates a JButton styled with a Material Icon and a text label.
Uses an HTML table structure for consistent vertical alignment of the icon and text.
| iconCode | The Unicode value of the Material Icon (e.g., "\uE2C7"). |
| text | The text label to display next to the icon. |
JButton configured with the icon and text. | JButton fr.softsf.canscan.ui.UiComponentsConfiguration.createIconOnlyButton | ( | String | iconCode | ) |
Creates a JButton styled to display a bold Material Icon only.
| iconCode | The Unicode value of the Material Icon (e.g., "\uE863"). |
| JPanel fr.softsf.canscan.ui.UiComponentsConfiguration.createModePanel | ( | JRadioButton | mecardRadio, |
| JRadioButton | meetRadio, | ||
| JRadioButton | freeRadio, | ||
| JButton | updateButton, | ||
| ButtonGroup | buttonGroup ) |
Creates a mode selection panel containing radio buttons for different modes and an update button.
The panel arranges the radio buttons on the left and the update button on the right. The provided ButtonGroup is used to group the radio buttons, and the "mecard" radio button is selected by default.
| mecardRadio | the JRadioButton for "mecard" mode; must not be null |
| meetRadio | the JRadioButton for "meet" mode; must not be null |
| freeRadio | the JRadioButton for "free" mode; must not be null |
| updateButton | the JButton used to trigger updates; must not be null |
| buttonGroup | the ButtonGroup to group the radio buttons; must not be null |
JPanel containing the configured mode selection UI, or null if any required component is null
Here is the call graph for this function:| JPanel fr.softsf.canscan.ui.UiComponentsConfiguration.createQrCodeOverlayPanel | ( | JProgressBar | loader, |
| JLabel | qrCodeLabel ) |
Creates an overlay panel containing a loader and a QR code label.
The loader is configured with a flat style, no border, transparent background, and set to indeterminate mode. Both the loader and the QR code label are added to a JPanel using OverlayLayout, allowing the loader to appear over the label.
| loader | the JProgressBar used as a loader; must not be null |
| qrCodeLabel | the JLabel displaying the QR code; must not be null |
JPanel containing the overlay, or null if any component is null
|
private |
Creates a panel containing the given radio buttons arranged horizontally with spacing.
Uses GridBagLayout to align the radio buttons and applies horizontal gaps between them according to RADIO_BUTTON_GAP.
| mecardRadio | the JRadioButton for "mecard" mode; must not be null |
| meetRadio | the JRadioButton for "meet" mode; must not be null |
| freeRadio | the JRadioButton for "free" mode; must not be null |
JPanel containing the aligned radio buttons | String fr.softsf.canscan.ui.UiComponentsConfiguration.getIconAfterTextHtml | ( | String | text, |
| String | iconCode ) |
Generates the HTML string for a JLabel with text followed by an icon.
| text | The text label to display first. |
| iconCode | The Unicode value of the Material Icon (e.g., "\uE161"). |
| void fr.softsf.canscan.ui.UiComponentsConfiguration.populateFreePanel | ( | JPanel | freePanel, |
| GridBagConstraints | grid, | ||
| JTextArea | freeField, | ||
| JScrollPane | freeScrollPane ) |
Creates and populates a FREE text input panel.
Configures the text area with wrapping and size using configureFreeTextArea(JTextArea, JScrollPane), then adds it to the panel with a label and tooltip. Uses GridBagLayout for layout.
| freePanel | the JPanel to populate; must not be null |
| grid | the GridBagConstraints used for layout positioning; must not be null |
| freeField | the JTextArea for free text input; must not be null |
| freeScrollPane | the JScrollPane containing the text area; must not be null |
Here is the call graph for this function:| void fr.softsf.canscan.ui.UiComponentsConfiguration.populateMecardPanel | ( | JPanel | mecardPanel, |
| GridBagConstraints | grid, | ||
| MecardJFields | mecardJFields ) |
Creates and populates a MECARD input panel with labeled input fields.
Configures the JPanel using GridBagLayout and adds rows for name, organization, phone, email, address, and URL fields. Tooltips provide guidance for each input field.
| mecardPanel | the JPanel to populate; must not be null |
| grid | the GridBagConstraints used for layout positioning; must not be null |
| mecardJFields | the MecardJFields containing the input fields; must not be null |
Here is the call graph for this function:| void fr.softsf.canscan.ui.UiComponentsConfiguration.populateMeetPanel | ( | JPanel | meetPanel, |
| GridBagConstraints | grid, | ||
| MeetJFields | meetJFields ) |
Creates and populates a MEET input panel with labeled input fields for event details.
Configures the JPanel using GridBagLayout and adds rows for the event title, unique identifier, start and end date/time, organizer name, and location coordinates. Tooltips provide guidance for each input field.
| meetPanel | the JPanel to populate; must not be null |
| grid | the GridBagConstraints used for layout positioning; must not be null |
| meetJFields | the MeetJFields containing the input fields; must not be null |
Here is the call graph for this function:
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
| fr.softsf.canscan.ui.UiComponentsConfiguration.INSTANCE |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |