Package org.apache.wicket.markup.html.list

Examples of org.apache.wicket.markup.html.list.AbstractItem


        RepeatingView repeating = new RepeatingView(ID_REPEATING_SUMMARY);
        addOrReplace(repeating);

        for (ObjectAssociation numberAssociation : numberAssociations) {
            AbstractItem item = new AbstractItem(repeating.newChildId());

            repeating.add(item);

            String propertyName = numberAssociation.getName();
            item.add(new Label(ID_PROPERTY_NAME, new Model<String>(propertyName)));


            List<ObjectAdapter> adapters = model.getObject();
            Summary summary = new Summary(propertyName, adapters, numberAssociation);
            addItem(item, ID_SUM, summary.getTotal());
View Full Code Here


        RepeatingView repeating = new RepeatingView("repeating");
       
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
       
        for (BorrowTO borrow : borrowService.findAllBorrows()) {
            AbstractItem item = new AbstractItem(repeating.newChildId());
            PageParameters pageParameters = new PageParameters();
            pageParameters.add("borrowId", borrow.getBorrowID());
            PageParameters pageParameters2 = new PageParameters();
            pageParameters2.add("extend", borrow.getBorrowID());
            item.add(new BookmarkablePageLink<Void>("extend", ShowAllBorrow.class, pageParameters2));
            item.add(new BookmarkablePageLink<Void>("return", ShowAllBorrow.class, pageParameters));
            item.add(new Label("reader", borrow.getReaderTO().toString()));
            if (borrow.getTitlesTO().size() > 0) {
                item.add(new Label("title", borrow.getTitlesTO().toString()));     
            } else {
                item.add(new Label("title", new Model("[RETURNED]")));
            }
            item.add(new Label("borrowdate", dateFormat.format(borrow.getBorrowDate())));
            item.add(new Label("expirationdate", dateFormat.format(borrow.getExpirationDate())));
            repeating.add(item);
       }
       
       add(repeating);
      
View Full Code Here

        RepeatingView repeating = new RepeatingView("repeating");
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
        AuthenticatedSession session = ((AuthenticatedSession)Session.get());
        for (BorrowTO borrow : borrowService.findBorrowsByReader(session.getReader())) {
            for (BookTO book: borrow.getTitlesTO()){
                AbstractItem item = new AbstractItem(repeating.newChildId());
                item.add(new Label("title", book.getTitle()));     
                item.add(new Label("author", book.getAuthor()));
                item.add(new Label("borrowdate", dateFormat.format(borrow.getBorrowDate())));
                item.add(new Label("expirationdate", dateFormat.format(borrow.getExpirationDate())));
                repeating.add(item);
            }         
       }
       add(repeating)
    }
View Full Code Here

       add(repeating);
      
       List<BookTO> list = bookService.findAllAvailableBooks();
      
       for (final BookTO book : bookService.findAllBooks()) {
            AbstractItem item = new AbstractItem(repeating.newChildId());
            PageParameters pageParameters = new PageParameters();
            pageParameters.add("bookId", book.getId());
            if (list.contains(book)){
                Link link = new Link("edit"){
                      @Override
                      public void onClick() {
                          ReservationService reservationService = (ReservationService) ApplicationContextProvider.getApplicationContext().getBean("reservationService");
                          AuthenticatedSession session = ((AuthenticatedSession)Session.get());
                          ReaderTO reader = session.getReader();
                          BookTO book2 = bookService.findBookById(book.getId());
                          java.util.Date date = new java.util.Date();
                          if (reader != null && book != null){
                              ReservationTO reservation = new ReservationTO(reader, book2,new Timestamp(date.getTime()));
                              reservationService.insertReservation(reservation);
                              setResponsePage(ShowAllBookReader.class);
                          }
                         
                    } 
                };
                item.add(link);
                //item.add(new BookmarkablePageLink<Void>("edit", BookReservation.class, pageParameters));
            }else {
                item.add(new Label("edit", new Model("")));
            }
           
           
            item.add(new Label("title", book.getTitle()));
            item.add(new Label("author", book.getAuthor()));
            item.add(new Label("genre", String.valueOf(book.getGenre())));
            item.add(new Label("publicationYear", String.valueOf(book.getPublicationYear())));
            item.add(new Label("publicationPlace", book.getPublicationPlace()));
            item.add(new Label("publisher", book.getPublisher()));
            item.add(new Label("ISBN", book.getISBN()));
            item.add(new Label("status", String.valueOf(book.getStatus())));
            item.add(new Label("availability", String.valueOf(book.getAvailability())));           
            repeating.add(item);
      }
       
        BookmarkablePageLink homeLink = new BookmarkablePageLink<>(
                "home", HomePage.class);
View Full Code Here

       BookService bookService = (BookService) ApplicationContextProvider.getApplicationContext().getBean("bookService");
       RepeatingView repeating = new RepeatingView("repeating");
       add(repeating);      
      
       for (BookTO book : bookService.findAllBooks()) {
            AbstractItem item = new AbstractItem(repeating.newChildId());
            PageParameters pageParameters = new PageParameters();
            pageParameters.add("bookId", book.getId());
            item.add(new BookmarkablePageLink<Void>("edit", EditBook.class, pageParameters));
            item.add(new BookmarkablePageLink<Void>("delete", ShowAllBook.class, pageParameters));
            item.add(new Label("title", book.getTitle()));
            item.add(new Label("author", book.getAuthor()));
            item.add(new Label("genre", String.valueOf(book.getGenre())));
            item.add(new Label("publicationYear", String.valueOf(book.getPublicationYear())));
            item.add(new Label("publicationPlace", book.getPublicationPlace()));
            item.add(new Label("publisher", book.getPublisher()));
            item.add(new Label("ISBN", book.getISBN()));
            item.add(new Label("status", String.valueOf(book.getStatus())));
            item.add(new Label("availability", String.valueOf(book.getAvailability())));           
           repeating.add(item);
      }
        BookmarkablePageLink addBookLink = new BookmarkablePageLink<>(
                "addBook", EditBook.class);
        add(addBookLink);
View Full Code Here

        add(repeating);

        ReaderService readerService = (ReaderService) ApplicationContextProvider.getApplicationContext().getBean("readerService");
        for (ReaderTO reader : readerService.findAllReaders()) {

            AbstractItem item = new AbstractItem(repeating.newChildId());

            PageParameters pageParameters = new PageParameters();
            pageParameters.add("readerId", reader.getId());
            item.add(new BookmarkablePageLink<Void>("edit", EditReader.class, pageParameters));
            item.add(new BookmarkablePageLink<Void>("delete", ShowAllReader.class, pageParameters));
            item.add(new Label("firstName", reader.getFirstName()));
            item.add(new Label("surname", reader.getSurname()));
            item.add(new Label("birthNumber", reader.getBirthNumber()));
            item.add(new Label("address", reader.getAddress()));
            item.add(new Label("email", reader.getEmail()));
            item.add(new Label("telephoneNumber", reader.getTelephoneNumber()));
           
            item.add(new BookmarkablePageLink<Void>("reserve", EditReservation.class, pageParameters));
            repeating.add(item);
        }
       
        StringValue readerId = parameters.get("readerId");
        if (!readerId.isEmpty()) {
View Full Code Here

        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
        AuthenticatedSession session = ((AuthenticatedSession)Session.get());
        List<ReservationTO> list = reservationService.findReservationsByReader(session.getReader());
        if(list != null){
            for (ReservationTO reservation : list) {
                AbstractItem item = new AbstractItem(repeating.newChildId());
                PageParameters pageParameters = new PageParameters();
                item.add(new BookmarkablePageLink<Void>("delete", ShowAllReservation.class, pageParameters));
                pageParameters.add("reservationid", reservation.getReservationID());
                item.add(new Label("author", reservation.getBookTO().getAuthor()));
                item.add(new Label("title", reservation.getBookTO().getTitle()));
                item.add(new Label("reservationDate", dateFormat.format(reservation.getReservationDate())));
                repeating.add(item);
            }
        }
       
        //delete reservation
View Full Code Here

        RepeatingView repeating = new RepeatingView("repeating");
        add(repeating);
        ReservationService reservationService = (ReservationService) ApplicationContextProvider.getApplicationContext().getBean("reservationService");
        SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
        for (ReservationTO reservation : reservationService.findAllReservations()) {
            AbstractItem item = new AbstractItem(repeating.newChildId());
            PageParameters pageParameters = new PageParameters();
            item.add(new BookmarkablePageLink<Void>("delete", ShowAllReservation.class, pageParameters));
            pageParameters.add("reservationid", reservation.getReservationID());
            item.add(new Label("readerTO", reservation.getReaderTO().toString()));
            item.add(new Label("bookTO", reservation.getBookTO().toString()));
            item.add(new Label("reservationDate", dateFormat.format(reservation.getReservationDate())));
            repeating.add(item);
        }

        //delete reservation
        StringValue reservationId = parameters.get("reservationid");
View Full Code Here

    add(headers);

    final List<IColumn<T>> columns = table.getColumns();
    for (final IColumn<T> column : columns)
    {
      AbstractItem item = new AbstractItem(headers.newChildId());
      headers.add(item);

      WebMarkupContainer header = null;
      if (column.isSortable())
      {
        header = newSortableHeader("header", column.getSortProperty(), stateLocator);
      }
      else
      {
        header = new WebMarkupContainer("header");
      }

      if (column instanceof IStyledColumn)
      {
        CssAttributeBehavior cssAttributeBehavior = new DataTable.CssAttributeBehavior()
        {
          private static final long serialVersionUID = 1L;

          @Override
          protected String getCssClass()
          {
            return ((IStyledColumn<?>)column).getCssClass();
          }
        };

        header.add(cssAttributeBehavior);
      }

      item.add(header);
      item.setRenderBodyOnly(true);
      header.add(column.getHeader("label"));
    }
  }
View Full Code Here

        RepeatingView repeating = new RepeatingView(ID_REPEATING_SUMMARY_CHARTS);
        addOrReplace(repeating);

        List<ObjectAssociation> numberAssociations = elementSpec.getAssociations(CollectionContentsAsSummaryChartsFactory.OF_TYPE_BIGDECIMAL);
        for (ObjectAssociation numberAssociation : numberAssociations) {
            AbstractItem item = new AbstractItem(repeating.newChildId());

            repeating.add(item);

            String propertyName = numberAssociation.getName();
            item.add(new Label(ID_PROPERTY_NAME, new Model<String>(propertyName)));

            List<ObjectAdapter> adapters = model.getObject();
           
            CollectionContentsAsSummary.Summary summary = new CollectionContentsAsSummary.Summary(propertyName, adapters, numberAssociation);

            BigDecimal min = summary.getMin();
            BigDecimal max = summary.getMax();
           
            addItem(item, ID_SUM, summary.getTotal());
            addItem(item, ID_AVG, summary.getAverage());
            addItem(item, ID_MIN, min);
            addItem(item, ID_MAX, max);

            if(model.isStandalone()) {
                final BigDecimal minElseZero = min!=null?(min.compareTo(BigDecimal.ZERO)<0?min:BigDecimal.ZERO):null;
                final BigDecimal maxElseZero = max!=null?(max.compareTo(BigDecimal.ZERO)<0?BigDecimal.ZERO:max):null;
                final WickedChart chartValue = createChartValue(propertyName, summary.getTitles(), summary.getValuesAsNumbers(), minElseZero, maxElseZero);
                final StandaloneValueAsWickedChart wickedChart = new StandaloneValueAsWickedChart(ID_CHART, asValueModel(chartValue));
                item.add(wickedChart);
            } else {
                item.add(new Label(ID_CHART, ""));
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.html.list.AbstractItem

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.