|
| 1 | +--- |
| 2 | +sidebar_position: 3 |
| 3 | +title: Sample Code |
| 4 | +--- |
| 5 | + |
| 6 | +# Sample Code |
| 7 | + |
| 8 | +This course includes hands-on sample code for each chapter. The samples are BBj source files that you can run, modify, and experiment with as you progress through the training. |
| 9 | + |
| 10 | +## Getting the Samples |
| 11 | + |
| 12 | +The sample files are included in the `samples/` directory of the course repository: |
| 13 | + |
| 14 | +```bash |
| 15 | +git clone https://github.com/BasisHub/DWC-Course.git |
| 16 | +cd DWC-Course/samples |
| 17 | +``` |
| 18 | + |
| 19 | +If you've already cloned the repository, the samples are ready to use. |
| 20 | + |
| 21 | +## Sample Directory Structure |
| 22 | + |
| 23 | +Each directory corresponds to topics covered in the course: |
| 24 | + |
| 25 | +| Directory | Chapter | Description | |
| 26 | +|-----------|---------|-------------| |
| 27 | +| `01_GUI2BUI2DWC/` | [GUI to BUI to DWC](gui-to-bui-to-dwc/) | Basic GUI samples and DWC migration examples | |
| 28 | +| `02_CSSStylesAndCustomProperties/` | [Browser Developer Tools](browser-developer-tools/) | CSS styling and custom property examples | |
| 29 | +| `03B_ArcFiles/` | [Upgrading Apps](upgrading-apps/) | ARC file configuration samples | |
| 30 | +| `03C_Grid2GridEx/` | [Upgrading Apps](upgrading-apps/) | Grid to GridEx migration examples | |
| 31 | +| `04_ExtendedAttributes/` | [DWC Controls](dwc-controls/) | Extended control attribute demos | |
| 32 | +| `05_CssLayouts/` | [Flow Layouts](flow-layouts/) | Flexbox and CSS Grid layout examples | |
| 33 | +| `06_IconPools/` | [Icon Pools](icon-pools/) | Icon pool usage and customization | |
| 34 | +| `07_ControlValiation/` | [Control Validation](control-validation/) | Input validation pattern examples | |
| 35 | +| `08_BrowserConstraints/` | [Browser Constraints](browser-constraints/) | Browser constraint handling | |
| 36 | +| `09_EmbeddingOtherComponents/` | [Embedding Components](embedding-components/) | Web component integration examples | |
| 37 | + |
| 38 | +## Running the Samples |
| 39 | + |
| 40 | +1. **Open in Eclipse/BDT**: Import the sample files into your BBj project in Eclipse with the BDT plugin installed. |
| 41 | + |
| 42 | +2. **Configure for DWC**: Ensure your BBj Services are configured to run applications in DWC mode. See [Registering and Launching](gui-to-bui-to-dwc/registering-launching) for setup instructions. |
| 43 | + |
| 44 | +3. **Run and Experiment**: Execute the `.bbj` files and observe the results in your browser. Each sample is designed to demonstrate specific DWC concepts. |
| 45 | + |
| 46 | +## Sample File Types |
| 47 | + |
| 48 | +The samples include various file types: |
| 49 | + |
| 50 | +- **`.bbj`** - BBj source code files (the main samples) |
| 51 | +- **`.css`** - Custom CSS stylesheets |
| 52 | +- **`.arc`** - Application resource configuration files |
| 53 | +- **`.js`** - JavaScript files for embedded components |
| 54 | + |
| 55 | +## Tips for Learning |
| 56 | + |
| 57 | +- **Read the code comments**: Many samples include inline comments explaining key concepts |
| 58 | +- **Modify and re-run**: Change values, add controls, and see what happens |
| 59 | +- **Compare before/after**: Some directories include exercise files and their completed versions (e.g., `Exercise-*.bbj` and `*Complete.bbj`) |
| 60 | +- **Use browser DevTools**: Inspect the generated HTML and CSS to understand how DWC renders your BBj code |
0 commit comments