Package com.storedobject.ui
Class ObjectViewer
java.lang.Object
com.storedobject.ui.Executor
com.storedobject.ui.ObjectViewer
- All Implemented Interfaces:
Executable,ObjectSetter<StoredObject>,AlertHandler,Runnable,Consumer<StoredObject>
The ObjectViewer class is a utility for viewing
StoredObject instances within an application.
This class extends Executor to provide execution functionalities and implements
ObjectSetter to set objects for viewing and AlertHandler to handle alerts associated
with StoredObject.- Author:
- Syam
-
Field Summary
Fields inherited from class com.storedobject.ui.Executor
application -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an ObjectViewer instance with the specified application. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the ObjectViewer by releasing associated resources and setting relevant fields to null.voidexecute()Executes the primary action associated with the ObjectViewer by invoking the view method.booleanChecks if the viewer is currently executing an action.Get the caption name to be used on the alert action button.Retrieves the icon associated with alert notifications for the ObjectViewer.voidhandleAlert(StoredObject object) Handles the alert action for the givenStoredObject.voidSets the object for the viewer using the given object ID.voidsetObject(StoredObject object) Sets the specifiedStoredObjectinstance for this ObjectViewer.voidview()Triggers the default view behavior for the object or content managed by the viewer without any specific parameters.voidDisplays the view associated with the specified object ID.voidview(Id objectId, ObjectViewerButton<?>... buttons) Opens a view for a specific object identified by its ID and allows optional buttons to be added for interaction.voidview(Id objectId, String actionName, Consumer<StoredObject> action) Executes an action on a stored object identified by the provided objectId.voidview(StoredObject object) Displays the specified stored object.voidview(StoredObject object, ObjectViewerButton<?>... buttons) Triggers the viewing process for the givenStoredObjectinstance and optional viewer buttons.voidview(StoredObject object, String actionName, Consumer<StoredObject> action) Displays the specifiedStoredObjectwith an associated action.voidview(ObjectViewerButton<?>... buttons) Triggers the view functionality using the specified buttons for the ObjectViewer.voidInitiates the view process with the specified caption.voidDisplays a view based on the given caption and object ID.voidview(String caption, Id objectId, ObjectViewerButton<?>... buttons) Displays a view of the specified object, identified by its ID, with the provided caption and optional buttons for additional actions.voidDisplays a view with the specified parameters.voidview(String caption, StoredObject object) Displays a view using the specified caption and stored object.voidview(String caption, StoredObject object, ObjectViewerButton<?>... buttons) Displays the specifiedStoredObjectin the ObjectViewer with a given caption and optional action buttons.voidview(String caption, StoredObject object, String actionName, Consumer<StoredObject> action) Displays a view with the specified caption and an action on the given stored object.voidview(String caption, ObjectViewerButton<?>... buttons) Opens a viewer for the specified object with the provided caption and optional buttons.voidview(String caption, String actionName, Consumer<StoredObject> action) Initiates the process of viewing an object with a specified action.voidview(String actionName, Consumer<StoredObject> action) Initiates a view operation using a specified action name and action logic.Methods inherited from class com.storedobject.ui.Executor
getApplication, getTransactionManagerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.storedobject.ui.AlertHandler
handleAlertMethods inherited from interface com.storedobject.common.Executable
act, runMethods inherited from interface com.storedobject.core.ObjectSetter
accept, getObjectClass, isAllowAny
-
Constructor Details
-
ObjectViewer
Constructs an ObjectViewer instance with the specified application.- Parameters:
a- The application instance used to initialize the ObjectViewer.
-
-
Method Details
-
execute
public void execute()Executes the primary action associated with the ObjectViewer by invoking the view method. This method triggers the default view behavior for the object or content managed by the viewer.- Specified by:
executein interfaceExecutable
-
setObject
Sets the specifiedStoredObjectinstance for this ObjectViewer.- Specified by:
setObjectin interfaceObjectSetter<StoredObject>- Parameters:
object- TheStoredObjectinstance to be set.
-
setObject
Sets the object for the viewer using the given object ID.- Specified by:
setObjectin interfaceObjectSetter<StoredObject>- Parameters:
objectId- The ID of the object to set.
-
view
Initiates the process of viewing an object with a specified action.- Parameters:
caption- the title or heading for the viewactionName- the name of the action to perform in the viewaction- the operation to be executed, provided as a Consumer of StoredObject
-
view
Opens a viewer for the specified object with the provided caption and optional buttons. If a viewer instance corresponding to the caption is found, it invokes the view mechanism on the associated object, adding the specified buttons to the interface.- Parameters:
caption- The caption to display for the object viewer. It is used to lookup or initialize the viewer instance.buttons- Optional buttons of typeObjectViewerButtonto enhance the viewer's functionality.
-
view
public void view()Triggers the default view behavior for the object or content managed by the viewer without any specific parameters. Delegates to the overloadedview(String, String, Consumer<StoredObject>)method with all parameters set tonull. -
view
Triggers the view functionality using the specified buttons for the ObjectViewer. This method invokes a secondary view method with anullcaption and the provided buttons.- Parameters:
buttons- An array ofObjectViewerButtoninstances that define actions or behaviors during the view operation.
-
view
Initiates a view operation using a specified action name and action logic.- Parameters:
actionName- The name of the action to be performed.action- AConsumerrepresenting the logic to be executed on theStoredObject.
-
view
Initiates the view process with the specified caption. This method is a convenience method that internally calls the overloadedviewmethod with the given caption, anullaction name, and no action.- Parameters:
caption- The caption to be displayed for the view.
-
view
Displays the specified stored object.- Parameters:
object- the StoredObject instance to be displayed. If null is passed, the method may handle it as per its implementation.
-
view
Displays the specifiedStoredObjectwith an associated action.- Parameters:
object- TheStoredObjectinstance to be displayed.actionName- The name of the action associated with the displayed object.action- AConsumerthat defines the action to be performed on theStoredObject.
-
view
Triggers the viewing process for the givenStoredObjectinstance and optional viewer buttons. The additional buttons can allow for extended actions or interactions during the viewing process.- Parameters:
object- TheStoredObjectinstance to be viewed.buttons- OptionalObjectViewerButtoninstances to include additional actions or controls.
-
view
Displays a view using the specified caption and stored object.- Parameters:
caption- the title or label of the viewobject- the stored object to be displayed in the view
-
view
public void view(String caption, StoredObject object, String actionName, Consumer<StoredObject> action) Displays a view with the specified caption and an action on the given stored object.- Parameters:
caption- the title or label for the viewobject- the stored object to be displayed in the viewactionName- the name of the action to be performedaction- a consumer defining the action to be executed on the stored object
-
view
Displays the specifiedStoredObjectin the ObjectViewer with a given caption and optional action buttons.- Parameters:
caption- The caption to display in the viewer.object- TheStoredObjectinstance to be viewed.buttons- Optional buttons of typeObjectViewerButtonto add custom actions in the viewer.
-
view
-
view
Displays a view with the specified parameters.- Parameters:
caption- The caption to be displayed in the view.objectId- The ID of the object to set for the view.actionName- The name of the action to be associated with the view.action- A consumer that defines the action to be performed on theStoredObject.
-
view
Displays a view of the specified object, identified by its ID, with the provided caption and optional buttons for additional actions.- Parameters:
caption- The caption to display in the view.objectId- The ID of the object to be viewed.buttons- Optional buttons to provide additional actions to perform in the view.
-
view
Displays the view associated with the specified object ID. This method utilizes the default caption for the view.- Parameters:
objectId- The ID of the object to be viewed.
-
view
Executes an action on a stored object identified by the provided objectId. Delegates the actual processing by invoking an overloaded version of the view method.- Parameters:
objectId- the identifier of the stored object to be acted uponactionName- the name of the action to be performed on the stored objectaction- the consumer that defines the specific action to apply to the stored object
-
view
Opens a view for a specific object identified by its ID and allows optional buttons to be added for interaction.- Parameters:
objectId- the ID of the object to be viewedbuttons- a varargs parameter allowing optional interactive buttons to be included in the view
-
executing
public boolean executing()Checks if the viewer is currently executing an action.- Returns:
trueif a viewer exists and it is executing an action,falseotherwise.
-
close
public void close()Closes the ObjectViewer by releasing associated resources and setting relevant fields to null. If the underlying viewer is not null, it will invoke the `close()` method of the viewer before resetting the viewer and related object fields to null. -
handleAlert
Handles the alert action for the givenStoredObject.- Specified by:
handleAlertin interfaceAlertHandler- Parameters:
object- TheStoredObjectinstance for which the alert is handled.
-
getAlertIcon
Retrieves the icon associated with alert notifications for the ObjectViewer.- Specified by:
getAlertIconin interfaceAlertHandler- Returns:
- A string representing the identifier of the alert icon.
-
getAlertCaption
Description copied from interface:AlertHandlerGet the caption name to be used on the alert action button. By default, "Process" is used.- Specified by:
getAlertCaptionin interfaceAlertHandler- Returns:
- Alert button caption.
-