View Javadoc

1   /*
2    * joey-rt and its relative products are published under the terms
3    * of the Apache Software License.
4    * 
5    * Created on 2004/12/13 2:21:32
6    */
7   package org.asyrinx.joey.tapestry.components.entity;
8   
9   import org.apache.tapestry.ApplicationRuntimeException;
10  import org.apache.tapestry.IPage;
11  import org.apache.tapestry.IRequestCycle;
12  import org.asyrinx.brownie.tapestry.page.ReloadablePage;
13  
14  /***
15   * @author takeshi
16   */
17  public abstract class EntityDeletionLink extends AbstractEntityInstanceActionLink {
18  
19      protected void doAction(IRequestCycle cycle) {
20          final Object entity = deserialize(cycle);
21          try {
22              getDispatcher().delete(entity);
23          } catch (Throwable e) {
24              throw new ApplicationRuntimeException(e);
25          }
26          //
27          final IPage page = cycle.getPage();
28          if (page instanceof ReloadablePage) {
29              final ReloadablePage reloadablePage = (ReloadablePage) page;
30              reloadablePage.reload();
31          }
32          cycle.activate(page);
33      }
34  }