WEB开发网
开发学院软件开发Java Tapestry 和 Wicket 的比较 阅读

Tapestry 和 Wicket 的比较

 2010-03-30 00:00:00 来源:WEB开发网   
核心提示: 清单 19. Tapestry HTML 标记<spanjwcid="table"><table><tr><spanjwcid="receivedItemsColumns"class="title&quo

清单 19. Tapestry HTML 标记

<span jwcid="table"> 
  <table> 
    <tr><span jwcid="receivedItemsColumns" class="title"/></tr> 
    <tr jwcid="receivedItemsRows"> 
      <td jwcid="receivedItemsValues"/> 
    </tr> 
  </table> 
  <span jwcid="receivedItemsPages"/> 
</span> 

Wicket 一同提供了一个 DataView 类和一个 IDataProvider 实现,如下所示:

清单 20. Wicket 的 DataView 类

public class ItemsDataProvider implements IdataProvider { 
 
  public Iterator iterator(int first, int count) { 
    return getActionItemManager().getActionItemsListByRecipient(uid, first, count); 
  } 
 
  public int size() { 
    return getActionItemManager().getActionItemsCountByRecipient(uid); 
  } 
 
  public IModel model(Object object) { 
    return new LoadableDetachableModel(object); 
  } 
} 
 
public ListActionItems extends WebPage { 
  public ListActionItems() { 
    DataView dataView = new DataView("receivedItemsView", new ItemsDataProvider()) { 
      protected void populateItem(final Item item) { 
        ActionItem todo = (ActionItem) item.getModelObject(); 
        item.add(new Label("itemId", String.valueOf(todo.getItemId())); 
        item.add(new Label("subject", todo.getSubject())); 
        item.add(new Label("creator", todo.getCreator())); 
        item.add(new Label("recipient", todo.getRecipient())); 
      } 
    }; 
    dataView.setItemsPerPage(10); 
    add(dataView); 
    add(new PagingNavigator("receivedItemsPages", dataView)); 
  } 
} 

上一页  4 5 6 7 8 9 10  下一页

Tags:Tapestry Wicket 比较

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接