Examples of AbstractItem


Examples of info.jtrac.domain.AbstractItem

        final SimpleAttributeModifier sam = new SimpleAttributeModifier("class", "alt");
       
        ListView itemList = new ListView("itemList", itemListModel) {
            protected void populateItem(ListItem listItem) {
                // cast to AbstactItem - show history may be == true
                final AbstractItem item = (AbstractItem) listItem.getModelObject();
               
                if (selectedItemId == item.getId()) {
                    listItem.add(new SimpleAttributeModifier("class", "selected"));
                } else if(listItem.getIndex() % 2 == 1) {
                    listItem.add(sam);
                }               
               
                final boolean showHistory = itemSearch.isShowHistory();
               
                ListView fieldValues = new ListView("columns", columnHeadings) {
                    protected void populateItem(ListItem listItem) {
                        ColumnHeading ch = (ColumnHeading) listItem.getModelObject();
                        IModel value = null;
                        if(ch.isField()) {
                            value = new Model(item.getCustomValue(ch.getField().getName()));
                        } else {
                            switch(ch.getName()) {
                                case ID:
                                    String refId = item.getRefId();
                                    Fragment refIdFrag = new Fragment("column", "refId", ItemListPanel.this);
                                    refIdFrag.setRenderBodyOnly(true);
                                    listItem.add(refIdFrag);
                                    Link refIdLink = new BookmarkablePageLink("refId", ItemViewPage.class, new PageParameters("0=" + refId));                               
                                    refIdFrag.add(refIdLink);
                                    refIdLink.add(new Label("refId", refId));
                                    if (showHistory) {                                                                                                           
                                        int index = ((History) item).getIndex();
                                        if (index > 0) {
                                            refIdFrag.add(new Label("index", " (" + index + ")"));
                                        } else {
                                            refIdFrag.add(new WebMarkupContainer("index").setVisible(false));
                                        }
                                    } else {                                                                          
                                        refIdFrag.add(new WebMarkupContainer("index").setVisible(false));
                                    }
                                    // the first column ID is a special case, where we add a fragment.
                                    // since we have already added a fragment return, instead of "break"
                                    // so avoid going to the new Label("column", value) after the switch case                                   
                                    return;                                   
                                case SUMMARY:
                                    value = new PropertyModel(item, "summary");
                                    break;
                                case DETAIL:                               
                                    if(showHistory) {
                                        Fragment detailFrag = new Fragment("column", "detail", ItemListPanel.this);
                                        final History history = (History) item;
                                        detailFrag.add(new AttachmentLinkPanel("attachment", history.getAttachment()));
                                        if (history.getIndex() > 0) {
                                            detailFrag.add(new Label("detail", new PropertyModel(history, "comment")));
                                        } else {
                                            detailFrag.add(new Label("detail", new PropertyModel(history, "detail")));
                                        }
                                        listItem.add(detailFrag);
                                        return;
                                    } else {                                   
                                        value = new PropertyModel(item, "detail");                                   
                                    }
                                    break;
                                case LOGGED_BY:
                                    value = new PropertyModel(item, "loggedBy.name");
                                    break;
                                case STATUS:
                                    value = new PropertyModel(item, "statusValue");
                                    break;
                                case ASSIGNED_TO:
                                    value = new PropertyModel(item, "assignedTo.name");
                                    break;
                                case TIME_STAMP:
                                    value = new Model(DateUtils.formatTimeStamp(item.getTimeStamp()));
                                    break;
                                case SPACE:
                                    if(showHistory) {
                                        value = new PropertyModel(item, "parent.space.name");
                                    } else {
View Full Code Here

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

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

        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

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

        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

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

       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

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

       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

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

        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

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

        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

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

        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

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

    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
TOP
Copyright © 2018 www.massapi.com. 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.