Example #1
0
 /*
  * (non-Javadoc)
  *
  * @see com.pdt.cms.ui.content.SingleTableContentSegment#deleteItem(java.lang.Object)
  */
 @Override
 protected void deleteItem(Object itemId) {
   if (itemId == null) {
     LOGGER.warn(
         "Try to DELETE a tour with NULL itemId. RETURN, no action", new IllegalStateException());
     return;
   }
   Tour t = coreService.findById(Tour.class, (Long) itemId);
   PdtTourService tservice = ServiceResolver.findService(PdtTourService.class);
   tservice.removeTour(t);
   refresh();
 }
Example #2
0
 /*
  * (non-Javadoc)
  *
  * @see com.pdt.cms.ui.content.SingleTableContentSegment#editItem(java.lang.Object)
  */
 @Override
 protected void editItem(Object itemId) {
   if (itemId == null) {
     LOGGER.warn("Try to EDIT a tour with NULL itemId. RETURN, no action");
     return;
   }
   Tour t = coreService.findById(Tour.class, (Long) itemId);
   if (t != null) {
     List<Image> images =
         ServiceResolver.findService(PdtTourService.class).getImagesByTour(t.getId());
     TourImageDto dto = new TourImageDto(t, images);
     UI.getCurrent()
         .addWindow(
             new TourManagementDialog(
                 TourImageDto.class, dto, "Edit tour information", new RefreshOnUpdate()));
   }
 }
Example #3
0
  /*
   * (non-Javadoc)
   *
   * @see com.pdt.cms.ui.ContentSegment#refresh()
   */
  @SuppressWarnings("unchecked")
  @Override
  public void refresh() {
    // synchronize with database
    ImmutableList<Tour> items = ImmutableList.copyOf(coreService.findAll(Tour.class));
    getContainer().removeAllItems();
    for (int i = 0; i < items.size(); i++) {
      Item item = container.addItem(items.get(i).getId());
      item.getItemProperty(ID_COLUMN.getId()).setValue(items.get(i).getId());
      item.getItemProperty(TOUR_COLUMN.getId()).setValue(items.get(i).getName());
      item.getItemProperty(TOUR_RECOMMEND_ORDER.getId()).setValue(items.get(i).getRecommendOrder());
      item.getItemProperty(TOUR_FAVOURITE_ORDER.getId()).setValue(items.get(i).getFavouriteOrder());
      item.getItemProperty(BEGINDATE_COLUMN.getId()).setValue(items.get(i).getBeginDate());
      item.getItemProperty(ENDDATE_COLUMN.getId()).setValue(items.get(i).getEndDate());
      item.getItemProperty(REGION.getId()).setValue(items.get(i).getRegionType().name());
      item.getItemProperty(FROM_PRICE.getId()).setValue(items.get(i).getFromPrice());
      item.getItemProperty(PRIORITY.getId()).setValue(items.get(i).getPriority().name());
    }

    if (table != null) table.setContainerDataSource(container);
  }