Package org.apache.wicket.markup.repeater.data

Examples of org.apache.wicket.markup.repeater.data.DataView


         {
            return Identity.instance().isLoggedIn() && hotelSearch.getHotels().size() == 0;
         }
      };
      body.add(noHotelsFound.setOutputMarkupId(true));
      hotelDataView = new DataView("hotel", new SimpleDataProvider() // A DataProvider adapts between your data and Wicket's internal representation
      {
         public Iterator iterator(int from, int count)
         {
            return hotelSearch.getHotels().subList(from, from + count).iterator();
         }

         public int size()
         {
            return hotelSearch.getHotels().size();
         }

      })
      {
         /**
          * You specify the tr in the html, and populate each one here
          */
         @Override
         protected void populateItem(Item item)
         {
            final Hotel hotel = (Hotel) item.getModelObject();
            item.add(new Label("hotelName", hotel.getName()));
            item.add(new Label("hotelAddress", hotel.getAddress()));
            item.add(new Label("hotelCityStateCountry", hotel.getCity() + ", " + hotel.getState() + ", " + hotel.getCountry()));
            item.add(new Label("hotelZip", hotel.getZip()));
            //item.add(new BookmarkablePageLink("viewHotel", org.jboss.seam.example.wicket.Hotel.class).setParameter("hotelId", hotel.getId()));
            item.add(new Link("viewHotel")
            {

               @Begin
               @Override
               public void onClick()
               {
                  hotelBooking.selectHotel(hotel);
                  setResponsePage(new org.jboss.seam.example.wicket.Hotel(new PageParameters()));
               }
           
            });
         }
        
      };
     
      // Set the maximum items per page
      hotelDataView.setItemsPerPage(hotelSearchForm.getPageSize());
      hotelDataView.setOutputMarkupId(true);
      hotels = new WebMarkupContainer("hotels");
      hotels.add(hotelDataView).setOutputMarkupId(true);
     
     
      // Add a pager
      hotels.add(new AjaxPagingNavigator("hotelPager", hotelDataView)
      {
         @Override
         public boolean isVisible()
         {
            return hotelDataView.isVisible();
         }

      });
     
      body.add(hotels);
     
      /*
       * Existing hotel booking
       */
      bookedHotelDataView = new DataView("bookedHotel", new SimpleDataProvider()
      {
         public Iterator iterator(int from, int count)
         {
            return bookings.subList(from, from + count).iterator();
         }
View Full Code Here


                                                     ((AbstractAdminWebApplication) getApplication()).getPortletRequest(),
                                                     ApplicationsListApplication.PRM_TOPIC,
                                                     ApplicationsListApplication.SELECTED_APPLICATION_EVENT,
                                                     pa
                                                     );
                            DataView portletView = (DataView) getPage().get(PORTLET_TABLE);                   
                            PortletDataProvider pdp = (PortletDataProvider) portletView.getDataProvider();
                            if (pdp.getSearchMode() == true)
                            {
                                pdp.setSearchMode(false);                           
                                pdp.refresh();
                            }
View Full Code Here

            add(new Button("appSearchButton", new ResourceModel("pam.details.action.search"))
            {
                @Override
                public void onSubmit()
                {
                    DataView appView = (DataView) getPage().get(APP_TABLE);
                    DataView portletView = (DataView) getPage().get(PORTLET_TABLE);
                    ApplicationDataProvider adp = (ApplicationDataProvider) appView.getDataProvider();
                    adp.searchApplications(getAppSearchField());
                    PortletDataProvider pdp = (PortletDataProvider) portletView.getDataProvider();
                    pdp.searchPortlets(getAppSearchField());                   
                }
            });
           
            add(new Link<String>("appDeploy")
            {
                private static final long serialVersionUID = 1L;

                @Override
                public void onClick()
                {
                    UploadPortletApp upa = new UploadPortletApp((((AbstractAdminWebApplication) getApplication()).getServiceLocator().getDeploymentManager()));
                    this.setResponsePage(upa);
                }
            });
           
            add(new Link<String>("appHome")
            {
                private static final long serialVersionUID = 1L;

                @Override
                public void onClick()
                {
                    DataView appView = (DataView) getPage().get(APP_TABLE);
                    ApplicationDataProvider adp = (ApplicationDataProvider) appView.getDataProvider();
                    adp.setSearchMode(false);
                    adp.refresh();
                    DataView portletView = (DataView) getPage().get(PORTLET_TABLE);                   
                    PortletDataProvider pdp = (PortletDataProvider) portletView.getDataProvider();
                    pdp.setSearchMode(false);
                    pdp.refresh();
                }
            });
        }
View Full Code Here

        String firstLabelPath = "form:panel:listContainer:items:1:itemProperties:0:component";
        tester.assertComponent(firstLabelPath, Label.class);
        assertEquals(new Integer(0), tester.getComponentFromLastRenderedPage(firstLabelPath).getModelObject());
       
        // check we actually rendered 10 rows
        DataView dv = (DataView) tester.getComponentFromLastRenderedPage("form:panel:listContainer:items");
        assertEquals(10, dv.size());
    }
View Full Code Here

   
    public void testLoad() {
        tester.assertRenderedPage(StorePage.class);
        tester.assertNoErrorMessage();
       
        DataView dv = (DataView) tester.getComponentFromLastRenderedPage("table:listContainer:items");
        assertEquals(dv.size(), getCatalog().getStores(StoreInfo.class).size());
        StoreInfo ws = (StoreInfo) dv.getDataProvider().iterator(0, 1).next();
        assertEquals(getCatalog().getStores(StoreInfo.class).get(0), ws);
    }
View Full Code Here

        filterForm.setDefaultButton(hiddenSubmit);

        // setup the table
        listContainer.setOutputMarkupId(true);
        add(listContainer);
        dataView = new DataView("items", dataProvider) {

            @Override
            protected void populateItem(Item item) {
                final IModel itemModel = item.getModel();
View Full Code Here

   
    public void testLoad() {
        tester.assertRenderedPage(LayerGroupPage.class);
        tester.assertNoErrorMessage();
       
        DataView dv = (DataView) tester.getComponentFromLastRenderedPage("table:listContainer:items");
        assertEquals(getCatalog().getLayerGroups().size(), dv.size());
        LayerGroupInfo lg = (LayerGroupInfo) dv.getDataProvider().iterator(0, 1).next();
        assertEquals(getCatalog().getLayerGroups().get(0), lg);
    }
View Full Code Here

   
    public void testLoad() {
        tester.assertRenderedPage(WorkspacePage.class);
        tester.assertNoErrorMessage();
       
        DataView dv = (DataView) tester.getComponentFromLastRenderedPage("table:listContainer:items");
        assertEquals(dv.size(), getCatalog().getWorkspaces().size());
        WorkspaceInfo ws = (WorkspaceInfo) dv.getDataProvider().iterator(0, 1).next();
        assertEquals("cdf", ws.getName());
    }
View Full Code Here

       
        final WebMarkupContainer table = new WebMarkupContainer("fileTable");
        table.setOutputMarkupId(true);
        add(table);
       
        DataView fileTable = new DataView("files", fileProvider) {

            @Override
            protected void populateItem(final Item item) {
                File file = (File) item.getModelObject();
               
View Full Code Here

   */
  public OIRPage()
  {
    SortableContactDataProvider dp = new SortableContactDataProvider();

    final DataView dataView = new DataView("oir", dp)
    {
      protected void populateItem(final Item item)
      {
        Contact contact = (Contact)item.getModelObject();
        item.add(new ActionPanel("actions", item.getModel()));
        item.add(new Link("toggleHighlite")
        {
          public void onClick()
          {
            HighlitableDataItem hitem = (HighlitableDataItem)item;
            hitem.toggleHighlite();
          }
        });
        item.add(new Label("contactid", String.valueOf(contact.getId())));
        item.add(new Label("firstname", contact.getFirstName()));
        item.add(new Label("lastname", contact.getLastName()));
        item.add(new Label("homephone", contact.getHomePhone()));
        item.add(new Label("cellphone", contact.getCellPhone()));

        item.add(new AttributeModifier("class", true, new AbstractReadOnlyModel()
        {
          public Object getObject()
          {
            return (item.getIndex() % 2 == 1) ? "even" : "odd";
          }
        }));
      }

      protected Item newItem(String id, int index, IModel model)
      {
        return new HighlitableDataItem(id, index, model);
      }
    };

    dataView.setItemsPerPage(8);
    dataView.setItemReuseStrategy(ReuseIfModelsEqualStrategy.getInstance());

    add(new OrderByBorder("orderByFirstName", "firstName", dp)
    {
      protected void onSortChanged()
      {
        dataView.setCurrentPage(0);
      }
    });

    add(new OrderByBorder("orderByLastName", "lastName", dp)
    {
      protected void onSortChanged()
      {
        dataView.setCurrentPage(0);
      }
    });

    add(dataView);
    add(new PagingNavigator("navigator", dataView));
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.repeater.data.DataView

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.