|
| 1 | +/* |
| 2 | + * This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt). |
| 3 | + * |
| 4 | + * The MIT License |
| 5 | + * Copyright © 2014-2022 Ilkka Seppälä |
| 6 | + * |
| 7 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 8 | + * of this software and associated documentation files (the "Software"), to deal |
| 9 | + * in the Software without restriction, including without limitation the rights |
| 10 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 11 | + * copies of the Software, and to permit persons to whom the Software is |
| 12 | + * furnished to do so, subject to the following conditions: |
| 13 | + * |
| 14 | + * The above copyright notice and this permission notice shall be included in |
| 15 | + * all copies or substantial portions of the Software. |
| 16 | + * |
| 17 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 23 | + * THE SOFTWARE. |
| 24 | + */ |
| 25 | + |
| 26 | +package com.iluwatar.viewhelper; |
| 27 | + |
| 28 | + |
| 29 | +import java.math.BigDecimal; |
| 30 | +import java.time.LocalDate; |
| 31 | + |
| 32 | +/** The main application class that sets up and runs the View Helper pattern demo. */ |
| 33 | +public class App { |
| 34 | + /** |
| 35 | + * The entry point of the application. |
| 36 | + * |
| 37 | + * @param args the command line arguments |
| 38 | + */ |
| 39 | + public static void main(String[] args) { |
| 40 | + // Raw Product data (no formatting, no UI tags) |
| 41 | + var product = new Product( |
| 42 | + "Design patterns book", |
| 43 | + new BigDecimal("18.90"), |
| 44 | + LocalDate.of(2025, 4, 19), |
| 45 | + true |
| 46 | + ); |
| 47 | + |
| 48 | + // Create view, viewHelper and viewHelper |
| 49 | + var helper = new ProductViewHelper(); |
| 50 | + var view = new ConsoleProductView(); |
| 51 | + var controller = new ProductController(helper, view); |
| 52 | + |
| 53 | + // Handle “request” |
| 54 | + controller.handle(product); |
| 55 | + } |
| 56 | +} |
0 commit comments