View Javadoc

1   package org.weda.model.actions;
2   
3   import org.weda.action.Action;
4   import org.weda.action.ActionContainer;
5   import org.weda.action.ActionState;
6   import org.weda.model.PageableTableModel;
7   import org.weda.model.TableModel;
8   import org.weda.store.ObjectSource;
9   import org.weda.action.impl.AbstractAction;
10  import org.weda.action.impl.ActionStateImpl;
11  
12  /**Цель: перейти на первую страницу
13   *
14   * @author tim
15   */
16  public class PageableTableModelFirstPageAction extends AbstractAction {
17      public ActionState getActionState(ActionContainer targetObject) 
18          throws Exception 
19      {
20          PageableTableModel model = (PageableTableModel)targetObject;
21          return new ActionStateImpl(
22                  true
23                  ,   model.getMode()==TableModel.Mode.VIEW
24                   && model.getData().getPageNumber()>0);
25      }
26  
27      public Object execute(ActionContainer targetObject) throws Exception {
28          PageableTableModel model = (PageableTableModel)targetObject;
29          model.getData().setPageNumber(0);
30          return null;
31      }
32      
33  }