package textbender.a.r.page; // Copyright 2007, Michael Allan. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Textbender Software"), to deal in the Textbender Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Textbender Software, and to permit persons to whom the Textbender Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Textbender Software. THE TEXTBENDER SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE TEXTBENDER SOFTWARE OR THE USE OR OTHER DEALINGS IN THE TEXTBENDER SOFTWARE. import textbender.a.r.page.navdo.*; import textbender.g.lang.*; import textbender.o.awt.*; /** Facilities of the page visit, restricted to the AWT event dispatch thread. *

* Warning: though parts of this API are thread-safe, * that of the objects it dispenses are not. * The APIs of those objects are (at least partly) * restricted to the AWT event dispatch thread; * owing either to a specific restriction, or to general thread unsafety. *

*/ public @ThreadSafe final class PageVisitEDT { @ThreadRestricted("AWT event dispatch") PageVisitEDT( PageVisit pV ) { pageVisit = pV; assert java.awt.EventQueue.isDispatchThread(); reloadAction = new ReloadAction( pageVisit ); saveAction = new SaveAction( pageVisit ); } // ------------------------------------------------------------------------------------ /** A shared load action. *

* Warning: when a short-lived control is set with this action|model, * it must be unset later when the control is disposed; * else the action|model will accumulate zombie listeners. *

*/ public ReloadAction reloadAction() { return reloadAction; } private final ReloadAction reloadAction; /** A shared save action. *

* Warning: when a short-lived control is set with this action|model, * it must be unset later when the control is disposed; * else the action|model will accumulate zombie listeners. *

*/ public SaveAction saveAction() { return saveAction; } private final SaveAction saveAction; /** Spool unwound on the AWT event dispatch thread, * as this instance is released. * * @see PageVisit#spool() */ public SpoolEDT spool() { return pageVisit.applet().spoolEDT; } //// P r i v a t e /////////////////////////////////////////////////////////////////////// private final PageVisit pageVisit; }