Skip to content

Commit 66415c4

Browse files
Enhance documentation for UI components
1 parent 9c5bb5f commit 66415c4

File tree

18 files changed

+562
-142
lines changed

18 files changed

+562
-142
lines changed

platform/core/viewers/src/main/java/tools/dynamia/viewers/ViewDescriptorBuilder.java

Lines changed: 285 additions & 76 deletions
Large diffs are not rendered by default.

platform/core/web/src/main/java/tools/dynamia/web/controllers/PeriodicTaskExecutorRestController.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
import org.springframework.web.bind.annotation.RestController;
88
import tools.dynamia.integration.scheduling.PeriodicTaskExecutor;
99

10+
/**
11+
* REST controller that exposes endpoints for executing periodic tasks defined in the {@link PeriodicTaskExecutor} class. This controller allows you to trigger the execution of morning, midday, afternoon, and evening tasks via HTTP GET requests. Each endpoint corresponds to a specific time of day and will execute the associated tasks when accessed. This can be useful for testing or manually triggering scheduled tasks without waiting for their scheduled execution time.
12+
*
13+
* @author Mario A. Serrano Leones
14+
*/
1015
@RestController
1116
@RequestMapping("/schedule/execute-tasks")
1217
@Tag(name = "DynamiaPeriodicTasks")

platform/core/web/src/main/java/tools/dynamia/web/navigation/DefaultCrudRestNavigationCustomizer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
import tools.dynamia.navigation.Page;
66
import tools.dynamia.web.navigation.CrudRestNavigationCustomizer;
77

8+
/**
9+
* Default implementation of the {@link CrudRestNavigationCustomizer} interface that provides a basic customization for CRUD REST API endpoints. This implementation simply returns the actual endpoint without any modifications, allowing for a straightforward mapping of CRUD operations to their respective endpoints based on the page's virtual path. Developers can extend this class and override the `customEndpoint` method to implement specific customizations for their application's REST API routes as needed.
10+
*
11+
* @author Mario A. Serrano Leones
12+
*/
813
@Provider
914
public class DefaultCrudRestNavigationCustomizer implements CrudRestNavigationCustomizer {
1015

platform/core/web/src/main/java/tools/dynamia/web/navigation/PageNavigationConfiguration.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,21 @@
1515
import java.lang.reflect.Method;
1616
import java.util.List;
1717

18-
18+
/**
19+
* Configuration class that dynamically registers page navigation routes based on the pages defined in the application's modules.
20+
*
21+
* <p>This class listens for the application context to be fully initialized and then iterates through all modules and their associated pages to create dynamic routes for page navigation. Each page's virtual path is used to construct a unique URI, which is then mapped to the {@link PageNavigationController#route} method.</p>
22+
*
23+
* <p>Example usage:</p>
24+
* <pre>{@code
25+
* @Configuration
26+
* public class MyAppPageNavigationConfig extends PageNavigationConfiguration {
27+
* // Additional configuration or overrides can be added here if needed
28+
* }
29+
* }</pre>
30+
*
31+
* @author Mario A. Serrano Leones
32+
*/
1933
public class PageNavigationConfiguration {
2034

2135
public static final String PAGE_URI = "/page/";

platform/core/web/src/main/java/tools/dynamia/web/navigation/PageNavigationController.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434

3535
import static tools.dynamia.navigation.NavigationElement.PATH_SEPARATOR;
3636

37+
/**
38+
* Controller responsible for handling page navigation requests in the web application. It maps incoming HTTP requests to specific page paths and manages the navigation flow based on the requested URL structure. The controller supports various URL patterns to accommodate different levels of page hierarchy, allowing for flexible navigation within the application. It also handles access restrictions and integrates with page navigation interceptors to provide additional functionality during the navigation process.
39+
*
40+
* @author Mario A. Serrano Leones
41+
*/
3742
@Controller("pageNavigationController")
3843
@RequestMapping("/page")
3944
public class PageNavigationController {

platform/core/web/src/main/java/tools/dynamia/web/navigation/RestApiNavigationConfiguration.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,21 @@
1717
import java.lang.reflect.Method;
1818
import java.util.List;
1919

20-
20+
/**
21+
* Configuration class that dynamically registers REST API routes for CRUD operations based on the pages defined in the application's modules.
22+
*
23+
* <p>This class listens for the application context to be fully initialized and then iterates through all modules and their associated pages to create dynamic REST API routes for CRUD operations. Each page's virtual path is used to construct unique URIs for the standard CRUD operations (Create, Read, Update, Delete), which are then mapped to the corresponding methods in the {@link RestNavigationController}.</p>
24+
*
25+
* <p>Example usage:</p>
26+
* <pre>{@code
27+
* @Configuration
28+
* public class MyAppRestApiNavigationConfig extends RestApiNavigationConfiguration {
29+
* // Additional configuration or overrides can be added here if needed
30+
* }
31+
* }</pre>
32+
*
33+
* @author Mario A. Serrano Leones
34+
*/
2135
public class RestApiNavigationConfiguration {
2236

2337

platform/core/web/src/main/java/tools/dynamia/web/navigation/RestNavigationController.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@
5252
import java.util.List;
5353
import java.util.Map;
5454

55+
/**
56+
* Controller responsible for handling RESTful API requests related to CRUD operations on entities defined in the application. It provides endpoints for reading, creating, updating, and deleting entities based on the paths defined in the application's navigation structure. The controller utilizes the CrudService to perform database operations and returns JSON responses with the appropriate data and metadata for each request. It also handles pagination and query parameters for listing entities, as well as access restrictions based on the navigation configuration.
57+
*
58+
* @author Mario A. Serrano Leones
59+
*/
5560
@RestController("restNavigationController")
5661
@Order(1000)
5762
public class RestNavigationController extends AbstractLoggable {

platform/ui/ui-shared/src/main/java/tools/dynamia/ui/Form.java

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,71 @@
1919
import tools.dynamia.commons.Callback;
2020
import tools.dynamia.commons.PropertyChangeSupport;
2121

22-
22+
/**
23+
* Base class for forms in the UI layer. This class provides common functionality for handling form actions such as submit, cancel, and close.
24+
* It also supports property change notifications to allow UI components to react to changes in form state.
25+
*
26+
* <p>Subclasses can override the submit(), cancel(), and close() methods to implement specific behavior for these actions.</p>
27+
*
28+
* @author Mario A. Serrano Leones
29+
*/
2330
public class Form extends PropertyChangeSupport {
2431

2532
private Callback onSubmitCallback;
2633
private Callback onCancelCallback;
2734
private Callback onCloseCallback;
2835

29-
36+
/**
37+
* Trigger the submit action. This method checks if an onSubmitCallback is registered and executes it if present.
38+
* Subclasses can override this method to provide additional behavior on form submission.
39+
*/
3040
protected void submit() {
3141
if (onSubmitCallback != null) {
3242
onSubmitCallback.doSomething();
3343
}
3444
}
3545

46+
/**
47+
* Trigger the cancel action. This method checks if an onCancelCallback is registered and executes it if present.
48+
* Subclasses can override this method to provide additional behavior on form cancellation.
49+
*/
3650
protected void cancel() {
3751
if (onCancelCallback != null) {
3852
onCancelCallback.doSomething();
3953
}
4054
}
4155

56+
/**
57+
* Trigger the close action. This method checks if an onCloseCallback is registered and executes it if present.
58+
* Subclasses can override this method to provide additional behavior on form closure.
59+
*/
4260
public void close() {
4361
if (onCloseCallback != null) {
4462
onCloseCallback.doSomething();
4563
}
4664
}
4765

66+
/**
67+
* Setters for action callbacks. These methods allow external code to register callbacks that will be executed when the corresponding form actions are triggered.
68+
*/
4869
public void onCancel(Callback onCancelCallback) {
4970
this.onCancelCallback = onCancelCallback;
5071
}
5172

73+
/**
74+
* Set the callback to be executed when the form is submitted. This allows external code to define custom behavior for form submission.
75+
*
76+
* @param onSubmitCallback The callback to execute on form submission.
77+
*/
5278
public void onSubmit(Callback onSubmitCallback) {
5379
this.onSubmitCallback = onSubmitCallback;
5480
}
5581

82+
/**
83+
* Set the callback to be executed when the form is closed. This allows external code to define custom behavior for form closure.
84+
*
85+
* @param callback The callback to execute on form closure.
86+
*/
5687
public void onClose(Callback callback) {
5788
this.onCloseCallback = callback;
5889
}

platform/ui/ui-shared/src/main/java/tools/dynamia/ui/MessageType.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
package tools.dynamia.ui;
1818

1919
/**
20+
* Enumeration representing different types of messages that can be displayed in the UI.
21+
* This enum can be used to categorize messages based on their severity or purpose, such as normal informational messages,
22+
* warnings, errors, critical issues, or special notifications.
23+
*
2024
* @author Mario A. Serrano Leones
2125
*/
2226
public enum MessageType {

platform/ui/ui-shared/src/main/java/tools/dynamia/ui/UITools.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,33 @@
44

55
import java.util.List;
66

7+
/**
8+
* Central utility class for UI-related operations in the Dynamia Tools framework.
9+
* This class provides static methods for creating and displaying common UI components
10+
* such as dialogs, listboxes, comboboxes, and buttons. It serves as a facade over
11+
* the underlying {@link UIToolsProvider} implementation, allowing for decoupled
12+
* UI component creation and management.
13+
*
14+
* <p>Example usage:</p>
15+
* <pre>{@code
16+
* DialogComponent dialog = UITools.showDialog("My Dialog", "This is the content");
17+
* ListboxComponent<String> listbox = UITools.listbox(List.of("Option 1", "Option 2"));
18+
* ButtonComponent button = UITools.button("Click Me", () -> System.out.println("Button clicked"));
19+
* }</pre>
20+
*
21+
* @author Mario A. Serrano Leones
22+
*/
723
public class UITools {
824

925
private static UIToolsProvider currentProvider;
1026

1127

28+
/**
29+
* Get the current UIToolsProvider instance.
30+
*
31+
* @return the current provider
32+
* @throws IllegalStateException if no provider is found
33+
*/
1234
private static UIToolsProvider getProvider() {
1335
if (currentProvider == null) {
1436
currentProvider = Containers.get().findObject(UIToolsProvider.class);
@@ -19,6 +41,12 @@ private static UIToolsProvider getProvider() {
1941
return currentProvider;
2042
}
2143

44+
/**
45+
* Set the current UIToolsProvider instance. This method can be used to override the default provider
46+
* found in the container, allowing for custom implementations or testing purposes.
47+
*
48+
* @param currentProvider the new provider to set
49+
*/
2250
public static void setCurrentProvider(UIToolsProvider currentProvider) {
2351
UITools.currentProvider = currentProvider;
2452
}

0 commit comments

Comments
 (0)