ooodev.adapter.form.submission.submission_veto_events module
- class ooodev.adapter.form.submission.submission_veto_events.SubmissionVetoEvents(trigger_args=None, cb=None, listener=None, subscriber=None)[source]
Bases:
objectClass for managing Submission Events.
- Parameters:
trigger_args (GenericArgs | None) –
cb (ListenerEventCallbackT | None) –
listener (SubmissionVetoListener | None) –
subscriber (XSubmission | None) –
- __init__(trigger_args=None, cb=None, listener=None, subscriber=None)[source]
Constructor
- Parameters:
trigger_args (GenericArgs, optional) – Args that are passed to events when they are triggered. This only applies if the listener is not passed.
cb (ListenerEventCallbackT | None, optional) – Callback that is invoked when an event is added or removed.
listener (SubmissionVetoListener | None, optional) – Listener that is used to manage events.
subscriber (XSubmission, optional) – An UNO object that implements the
XSubmissioninterface. If passed in then this instance listener is automatically added to it.
- Return type:
None
- add_event_submission_veto_events_disposing(cb)[source]
Adds a listener for an event.
Event is invoked when the broadcaster is about to be disposed.
The callback
EventArgs.event_datawill contain a UNOcom.sun.star.lang.EventObjectstruct.- Return type:
None- Parameters:
cb (Any) –
- add_event_submitting(cb)[source]
Adds a listener for an event.
Is invoked when a component, at which the listener has been registered, is about to submit its data. If event is canceled and the cancel args are not handled then a
VetoExceptionwill be raised.The callback
CancelEventArgs.event_datawill contain a UNOcom.sun.star.lang.EventObjectstruct.Note
When callback event is invoked it will contain a
CancelEventArgsinstance as the event. TheCancelEventArgs.cancelcan be set toTrueto cancel the submission. Also if canceled theCancelEventArgs.handledcan be set toTrueto indicate that the submission should be performed. TheCancelEventArgs.event_datawill contain the originalcom.sun.star.lang.EventObjectthat triggered the update.Also the
CancelEventArgscan set amessagevalue that will be used as the message for theVetoException.If the
event.set("skip_veto_exception", True)is set then theVetoExceptionwill not be raised. This is probably not a good idea but it is there if you need it.The following example shows how to use the
CancelEventArgsto cancel the submission of data.def on_submitting(src: Any, event: CancelEventArgs, *args: Any, **kwargs: Any) -> None: if not validate_data(): event.cancel = True event.set("message", "Canceling due to data validation fail.")
- Return type:
None- Parameters:
cb (Any) –
- remove_event_submission_veto_events_disposing(cb)[source]
Removes a listener for an event
- Return type:
None- Parameters:
cb (Any) –
- remove_event_submitting(cb)[source]
Removes a listener for an event
- Return type:
None- Parameters:
cb (Any) –
- property events_listener_submission_veto: SubmissionVetoListener
Returns listener
- Return type:
- ooodev.adapter.form.submission.submission_veto_events.on_lazy_cb(source, event)[source]
Callback that is invoked when an event is added or removed.
This method is generally used to add the listener to the component in a lazy manner. This means this callback will only be called once in the lifetime of the component.
- Parameters:
source (Any) – Expected to be an instance of SubmissionVetoEvents that is a partial class of a component based class.
event (ListenerEventArgs) – Event arguments.
- Return type:
None
Warning
This method is intended for internal use only.