---

# (DD05) Business Logic — UI.comboBox1() [7 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.github.blaxk3.ui.UI` |
| Layer | Utility / UI Component |
| Module | `ui` (Package: `com.github.blaxk3.ui`) |

## 1. Role

### UI.comboBox1()

This method creates and prepares the first currency selection control used by the UI layer. It instantiates a Swing `JComboBox`, applies a fixed presentation size, and immediately triggers asynchronous population of the dropdown with currency codes. In business terms, it provides the user-facing entry point for selecting a base currency or reference currency used elsewhere in the screen flow. The method follows a builder-style initialization plus delegation pattern: the UI component is created locally, but the data-loading responsibility is delegated to `CurrencyCode`, which performs the actual retrieval and population work in the background.

The method does not branch by service type itself, but its downstream worker supports a currency-code loading use case that is shared across the application screen. Its role in the larger system is to ensure the screen is responsive while reference data is fetched asynchronously, preventing the UI from blocking during data acquisition. The returned component is then embedded into the enclosing form panel and later consumed by exchange-rate logic elsewhere in the same class.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["comboBox1()"])
    INIT["Create JComboBox instance"]
    SIZE["Set preferred size to 300 x 30"]
    WORKER["Instantiate CurrencyCode SwingWorker with comboBox1"]
    EXEC["execute() - start background currency code fetch"]
    RETURN_NODE["Return comboBox1"]
    START --> INIT
    INIT --> SIZE
    SIZE --> WORKER
    WORKER --> EXEC
    EXEC --> RETURN_NODE
```

**CRITICAL — Constant Resolution:**
This method does not reference any application constants in conditions or assignments.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no parameters. It relies only on the class field `comboBox1`, which stores the currency selection control instance for later screen use. |

**External state read by the method:** class field `comboBox1` is assigned and then returned; no other instance fields are read in this method.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `CurrencyCode.execute()` | N/A | Currency code reference data | Starts asynchronous creation/loading of the dropdown contents by launching the worker that later populates currency codes into the combo box. |
| R | `CurrencyRateAPI.getCurrencyCode()` | N/A | External currency-code source | Retrieves the list of currency codes used to populate the selection control. |

**Method-call analysis:**
- `new JComboBox<>()` — UI component instantiation, not a CRUD operation.
- `setPreferredSize(new Dimension(300, 30))` — presentation configuration, not CRUD.
- `new CurrencyCode(comboBox1).execute()` — asynchronous service-style trigger that initiates data loading.
- Inside `CurrencyCode.doInBackground()` the worker calls `new CurrencyRateAPI().getCurrencyCode()` to read reference data.
- Inside `CurrencyCode.done()` the loaded values are sorted and added to the combo box, but that population happens after the method returns and is therefore outside the direct synchronous CRUD boundary of `comboBox1()`.

## 5. Dependency Trace

### Pre-computed evidence from code analysis graph:

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: -

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:UI | `UI.<init>` -> `panelFramePanel1.add(comboBox1())` -> `UI.comboBox1()` | `CurrencyRateAPI.getCurrencyCode [R] Currency code source` |

`comboBox1()` is invoked during UI construction when the first panel is assembled. The method’s downstream dependency is the asynchronous `CurrencyCode` worker, which ultimately reads currency-code reference data and then populates the dropdown.

## 6. Per-Branch Detail Blocks

**Block 1** — [SEQUENTIAL] `(method entry)` (L95)

> Creates the first currency combo box for the screen and prepares it for later data population.

| # | Type | Code |
|---|------|------|
| 1 | SET | `comboBox1 = new JComboBox<>();` |

**Block 2** — [SEQUENTIAL] `(presentation setup)` (L96)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `comboBox1.setPreferredSize(new Dimension(300, 30));` |

**Block 3** — [SEQUENTIAL] `(asynchronous data load trigger)` (L97)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `new CurrencyCode(comboBox1).execute();` |

**Block 4** — [SEQUENTIAL] `(return)` (L99)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return comboBox1;` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `comboBox1` | Field / UI control | The first dropdown on the screen, used for selecting a currency code. |
| `CurrencyCode` | Class | Background worker responsible for loading currency codes and placing them into the combo box. |
| `CurrencyRateAPI` | Class | External API client used to obtain currency reference data. |
| `JComboBox` | UI component | Swing dropdown control that lets the user choose one value from a list. |
| `SwingWorker` | Technical term | Background execution helper that keeps the UI responsive while data is loaded asynchronously. |
| `currency code` | Business term | Standard code representing a currency, such as USD or JPY. |
| `preferred size` | UI term | Fixed screen size used to standardize the control layout. |
| `reference data` | Business term | Stable lookup data used by the screen rather than transaction-specific business records. |
| `selected item` | UI term | The option chosen by the user from the dropdown. |
