Package javax.faces.model

Examples of javax.faces.model.DataModel


        return getField().isFile();
    }
   
    @SuppressWarnings("unchecked")
    public void add(DcWebObject wod) {
        DataModel model = getData();
        List<List<Object>> list = (List) model.getWrappedData();
        List<DcWebField> fields = (List<DcWebField>) getColumnHeaders().getWrappedData();
       
        DcObject dco = wod.getDcObject();
        List<Object> row = new ArrayList<Object>();
        for (DcWebField wfs : fields) {
View Full Code Here


        list.add(0, row);
    }
   
    @SuppressWarnings("unchecked")
    public void update(DcWebObject wod) {
        DataModel model = getData();
        List<List<Object>> list = (List) model.getWrappedData();
        List<Object> row = list.get(wod.getRowIdx());
        List<DcWebField> fields = (List<DcWebField>) getColumnHeaders().getWrappedData();
       
        int idx = 0;
        DcObject dco = wod.getDcObject();
        for (DcWebField wfs : fields) {
            for (DcField field : dco.getFields()) {
                if (wfs.getIndex() == field.getIndex() && field.getIndex() != DcObject._ID)
                    row.set(idx++, WebUtilities.getValue(dco, wfs, dco.getValue(wfs.getIndex())));
            }
        }    
       
        model.setRowIndex(wod.getRowIdx());
    }
View Full Code Here

        model.setRowIndex(wod.getRowIdx());
    }

    @SuppressWarnings("unchecked")
    public void remove(DcWebObject wod) {
        DataModel model = getData();
        List<List<Object>> list = (List) model.getWrappedData();
        list.remove(wod.getRowIdx());
    }
View Full Code Here

            @Override
            protected void renderResponse() throws Exception
            {
                Object discs = getValue("#{discs.dataModel}");
                assert discs instanceof DataModel;
                DataModel dataModel = (DataModel) discs;
               
                // Check for the correct number of results
                assert dataModel.getRowCount() == 6;
               
                // Check for correct ordering
                assertDisc(dataModel, 0, DISC5_NAME, DISC5_ARTIST);
                assertDisc(dataModel, 1, DISC6_NAME, DISC6_ARTIST);
                assertDisc(dataModel, 2, DISC1_NAME, DISC1_ARTIST);
View Full Code Here

            @Override
            protected void renderResponse() throws Exception
            {
                Object artists = getValue("#{artists.dataModel}");
                assert artists instanceof DataModel;
                DataModel artistsDataModel = (DataModel) artists;
               
                // Check for the correct number of results
                assert artistsDataModel.getRowCount() == 6;
               
                // Check for correct ordering
                assertArtist(artistsDataModel, 0, ARTIST5_NAME);
                assertArtist(artistsDataModel, 1, ARTIST6_NAME);
                assertArtist(artistsDataModel, 2, ARTIST1_NAME);
View Full Code Here

            @Override
            protected void renderResponse() throws Exception
            {
                Object artists = getValue("#{artists.dataModel}");
                assert artists instanceof DataModel;
                DataModel artistsDataModel = (DataModel) artists;
               
                // Check for the correct number of results
                assert artistsDataModel.getRowCount() == 2;
               
                // Check for correct ordering
                assertArtist(artistsDataModel, 0, ARTIST5_NAME);
                assertArtist(artistsDataModel, 1, ARTIST6_NAME);
            }
           
        }.run();
       
        new FacesRequest("/artists.xhtml")
        {
           
            @Override
            protected void updateModelValues() throws Exception
            {
                setValue("#{exampleArtist.name}", "Ri");
            }
           
            @Override
            protected void renderResponse() throws Exception
            {
                Object artists = getValue("#{artists.dataModel}");
                assert artists instanceof DataModel;
                DataModel artistsDataModel = (DataModel) artists;
               
                // Check for the correct number of results
                assert artistsDataModel.getRowCount() == 1;
               
                // Check for correct ordering
                assertArtist(artistsDataModel, 0, ARTIST6_NAME);
            }
           
View Full Code Here

         }
        
         @Override
         protected void renderResponse() throws Exception
         {
            DataModel auctions = (DataModel) Contexts.getSessionContext().get("auctions");
            assert auctions.getRowCount() == 1;
            Auction auction = ((Auction) auctions.getRowData());
            assert auction.getTitle().equals("BidTestZZZ");
            assert auction.getHighBid() == null;
         }
        
      }.run();
        
      new FacesRequest()
      {
         @Override
         protected void invokeApplication() throws Exception
         {
            Contexts.getEventContext().set("auction", getValue("#{auctionSearch.auctions[0]}"));
           
            assert invokeAction("#{bidAction.placeBid}") == null;
            assert getValue("#{bidAction.outcome}").equals("required");
            Contexts.getEventContext().set("bidAmount", "5.00");
           
            assert invokeAction("#{bidAction.placeBid}") == null;
            assert getValue("#{bidAction.outcome}").equals("confirm");
           
            assert invokeAction("#{bidAction.confirmBid}").equals("success");
         }
      }.run();
     
      new FacesRequest()
      {
         @Override
         protected void invokeApplication() throws Exception
         {
            assert invokeAction("#{auctionSearch.queryAuctions}") == null;
         }
        
         protected void renderResponse() throws Exception
         {
            DataModel auctions = (DataModel) Contexts.getSessionContext().get("auctions");
            Auction auction = ((Auction) auctions.getRowData());
            assert auction.getHighBid() != null;
         }
      }.run();
     
     
View Full Code Here

       
        new NonFacesRequest("/showOrders.xhtml") {
            @SuppressWarnings("unchecked")
            @Override
            protected void renderResponse() throws Exception {
                DataModel model = (DataModel) getValue("#{orders}");

                List<Long> orders = new ArrayList<Long>();
                for (Order order: (List<Order>) model.getWrappedData()) {
                    orders.add(order.getOrderId());
                }

                assert orders.contains(order1);
                assert orders.contains(order2);
View Full Code Here

       
        String id = new NonFacesRequest("/showorders.xhtml") {
            @SuppressWarnings("unchecked")
            @Override
            protected void renderResponse() throws Exception {
                DataModel model = (DataModel) getValue("#{orders}");
                assert model!=null;
               
                assert Conversation.instance().isLongRunning();
            }
           
        }.run()
       
        id = new FacesRequest("/showorders.xhtml",id) {
            @SuppressWarnings("unchecked")
            @Override
            protected void applyRequestValues() throws Exception {
               DataModel model = (DataModel) getValue("#{orders}");
           
               int index =0;
               for (Order order: (List<Order>) model.getWrappedData()) {
                   if (order.getOrderId() == order1) {
                       model.setRowIndex(index);
                       break;
                   }
                   index++;
               }
            }
View Full Code Here

         }

         @Override
         protected void renderResponse()
         {
            DataModel hotels = (DataModel) Contexts.getSessionContext().get("hotels");
            assert hotels.getRowCount()==1;
            assert ( (Hotel) hotels.getRowData() ).getCity().equals("NY");
            assert getValue("#{hotelSearch.searchString}").equals("Union Square");
            assert !Manager.instance().isLongRunningConversation();
         }
        
      }.run();
     
      String id = new FacesRequest("/main.xhtml") {
        
         @Override
         protected void invokeApplication() throws Exception {
            HotelBookingAction hotelBooking = (HotelBookingAction) getInstance("hotelBooking");
            DataModel hotels = (DataModel) Contexts.getSessionContext().get("hotels");
            assert hotels.getRowCount()==1;
            hotelBooking.selectHotel( (Hotel) hotels.getRowData() );
         }

         @Override
         protected void renderResponse()
         {
View Full Code Here

TOP

Related Classes of javax.faces.model.DataModel

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.