AttachDetachException class
An exception that is thrown when the panel fails to attach or detach its children.
class AttachDetachException extends UmbrellaException { /** * The singleton command used to attach widgets. */ static AttachExceptionCommand attachCommand = new AttachExceptionCommand(); /** * The singleton command used to detach widgets. */ static DetachExceptionCommand detachCommand = new DetachExceptionCommand(); /** * <p> * Iterator through all child widgets, trying to perform the specified * {@link Command} for each. All widgets will be visited even if the Command * throws an exception. If one or more exceptions occur, they will be combined * and thrown as a single {@link AttachDetachException}. * </p> * <p> * Use this method when attaching or detaching a widget with children to * ensure that the logical and physical state of all children match the * logical and physical state of the parent. * </p> * * @param hasWidgets children to iterate * @param c the {@link Command} to try on all children */ static void tryCommand(Iterator<Widget> hasWidgets, AttachCommand c) { Set<Exception> caught = null; for (;hasWidgets.moveNext(); ) { Widget w = hasWidgets.current; try { c.execute(w); } on Exception catch (e) { // Catch all exceptions to prevent some children from being attached // while others are not. if (caught == null) { caught = new Set<Exception>(); } caught.add(e); } } // Throw the combined exceptions now that all children are attached. if (caught != null) { throw new AttachDetachException(caught); } } /** * <p> * Iterator through all child widgets, trying to perform the specified * {@link Command} for each. All widgets will be visited even if the Command * throws an exception. If one or more exceptions occur, they will be combined * and thrown as a single {@link AttachDetachException}. * </p> * <p> * Use this method when attaching or detaching a widget with children to * ensure that the logical and physical state of all children match the * logical and physical state of the parent. * </p> * * @param c the {@link Command} to try on all children * @param widgets children to iterate, null children are ignored */ static void tryCommand2(AttachCommand c, List<IsWidget> widgets) { Set<Exception> caught = null; for (IsWidget w in widgets) { try { if (w != null) { c.execute(w.asWidget()); } } on Exception catch (e) { // Catch all exceptions to prevent some children from being attached // while others are not. if (caught == null) { caught = new Set<Exception>(); } caught.add(e); } } // Throw the combined exceptions now that all children are attached. if (caught != null) { throw new AttachDetachException(caught); } } /** * Construct a new {@link AttachDetachException}. * * @param causes the causes of the exception */ AttachDetachException(Set<Exception> causes) : super (causes); }
Extends
UmbrellaException > AttachDetachException
Static Properties
AttachExceptionCommand attachCommand #
The singleton command used to attach widgets.
static AttachExceptionCommand attachCommand = new AttachExceptionCommand()
DetachExceptionCommand detachCommand #
The singleton command used to detach widgets.
static DetachExceptionCommand detachCommand = new DetachExceptionCommand()
Static Methods
void tryCommand(Iterator<Widget> hasWidgets, AttachCommand c) #
Iterator through all child widgets, trying to perform the specified {@link Command} for each. All widgets will be visited even if the Command throws an exception. If one or more exceptions occur, they will be combined and thrown as a single {@link AttachDetachException}.
Use this method when attaching or detaching a widget with children to ensure that the logical and physical state of all children match the logical and physical state of the parent.
@param hasWidgets children to iterate @param c the {@link Command} to try on all children
static void tryCommand(Iterator<Widget> hasWidgets, AttachCommand c) { Set<Exception> caught = null; for (;hasWidgets.moveNext(); ) { Widget w = hasWidgets.current; try { c.execute(w); } on Exception catch (e) { // Catch all exceptions to prevent some children from being attached // while others are not. if (caught == null) { caught = new Set<Exception>(); } caught.add(e); } } // Throw the combined exceptions now that all children are attached. if (caught != null) { throw new AttachDetachException(caught); } }
void tryCommand2(AttachCommand c, List<IsWidget> widgets) #
Iterator through all child widgets, trying to perform the specified {@link Command} for each. All widgets will be visited even if the Command throws an exception. If one or more exceptions occur, they will be combined and thrown as a single {@link AttachDetachException}.
Use this method when attaching or detaching a widget with children to ensure that the logical and physical state of all children match the logical and physical state of the parent.
@param c the {@link Command} to try on all children @param widgets children to iterate, null children are ignored
static void tryCommand2(AttachCommand c, List<IsWidget> widgets) { Set<Exception> caught = null; for (IsWidget w in widgets) { try { if (w != null) { c.execute(w.asWidget()); } } on Exception catch (e) { // Catch all exceptions to prevent some children from being attached // while others are not. if (caught == null) { caught = new Set<Exception>(); } caught.add(e); } } // Throw the combined exceptions now that all children are attached. if (caught != null) { throw new AttachDetachException(caught); } }
Constructors
new AttachDetachException(Set<Exception> causes) #
Construct a new {@link AttachDetachException}.
@param causes the causes of the exception
AttachDetachException(Set<Exception> causes) : super (causes);
Properties
final Set<Exception> causes #
Set<Exception> get causes => _causes;
Methods
String toString() #
Returns a string representation of this object.
String toString() => makeMessage(_causes);