SHARE
TWEET

Untitled

a guest Aug 12th, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. final WebMarkupContainer previewLink = createLinkToPreview(linkToPreview, modalActionWindow, modalWindowForm, documentModel);
  2. add(previewLink);
  3. previewLink.add(createThumbnailSmall(imageThumbnail, documentModel));
  4.  
  5.  
  6. protected Component createThumbnailSmall(final String id, final IModel<BaseDocument> documentModel) {
  7.         final BaseDocument document = documentModel.getObject();
  8.  
  9.         if (document.getType() == DocumentType.EMAIL) {
  10.             final WebMarkupContainer imageContainer = new WebMarkupContainer(id);
  11.             imageContainer.add(new AttributeAppender("src", new Model<String>("img/de_image2.jpg"), "; "));
  12.             return imageContainer;
  13.         }        
  14.        
  15.         final DocumentVariation documentVariation = document.getDocumentVariation(DocumentVariationType.THUMBNAIL_SMALL);      
  16.        
  17.         ImageResourceDescriptor imageDescriptor = null;
  18.         if (documentVariation != null) {
  19.             imageDescriptor = document.getImageResourceDescriptor((DocumentVariationImage) documentVariation);          
  20.         }
  21.        
  22.         final DocumentResource thumbnailResource = _documentOperations.getDocumentResource(imageDescriptor);
  23.  
  24.         if (thumbnailResource != null) {  
  25.             String path = _fileRetrievalService.getPath(imageDescriptor.getFilePath());
  26.             final ThumbnailWebResource resource = new ThumbnailWebResource(path);          
  27.            
  28.            // final DynamicWebResource resource = getWebResource(thumbnailResource);            
  29.             final Image image = new Image(id, resource);
  30.             return image;
  31.         }
  32.            
  33.         return new InvisibleContainer(id);
  34.     }
RAW Paste Data
Top