96 | | ^(Describe your design here.)^ |
| 96 | === HUD and HALO === |
| 97 | * An AddTemplateHud should be introduced. It should contain the controls from the wireframe in the analysis. |
| 98 | * The old AddTemplateHaloButton should be changed to HudHaloButton. |
| 99 | * The HUD should contain a list of TemplatedKeys. If the HUD is displayed when a single frame is selected, the list should contain the templated keys of the frame, otherwise - the templated keys of the current page. |
| 100 | * The list of TemplatedKeys can be obtained with the following code: |
| 101 | {{{ |
| 102 | Class<? extends ResourceR4> resClass = ResourceR4.getClassByKind(ResourceR4.KEY_KIND.get(access)); |
| 103 | SubEntryNames subKeyNames = this.getSubEntryNames(resClass); |
| 104 | List<TemplatedKey<?>> tempKeys = ResourceR4.getKnownTemplatedKeys(resClass); |
| 105 | }}} |
| 106 | * The HUD should contain a BaseSwingVisualElement which will contain the list of checkboxes. It will depend on the list of TemplatedKeys. |
| 107 | |
| 108 | === BoundCheckBox === |
| 109 | * We need a specific type of BoundCheckBox which somewhat contains other sub checkboxes. |
| 110 | * Extend the BoundCheckBox class: |
| 111 | * It should contain a list property of BoundCheckBox, called subControls. |
| 112 | * Its state should be auto-computed based on the state of the sub controls. If all checkboxes are checked, the main one is checked. If all are unchecked, the main one is unchecked. Otherwise it is grayed out, indicating a mix of the states of the sub controls. |
| 113 | |
| 114 | === HUD logic === |
| 115 | * The Add buttons will do the following (let's say that a frame is selected): |
| 116 | * Create a new resource of a frame kind. |
| 117 | * Iterate over the checkboxes of the HUD and if set, set the appropriate key of the resource to USE_TEMPLATE mode, or CUSTOM otherwise. |
| 118 | * Set the selected frame as a template of the newly created one. |
| 119 | * Add the new frame to the frameTemplates list of the current book. |
| 120 | * The same applies if a page is selected. |
| 121 | * The Cancel button closes the HUD. |
| 122 | * The Select all/none buttons iterate over the checkboxes and set the appropriate state. |