Package org.olat.core.gui.components.image

Examples of org.olat.core.gui.components.image.ImageComponent


    myContent = createVelocityContainer("displayportrait");
    myContent.contextPut("canLinkToHomePage", canLinkToHomePage ? Boolean.TRUE : Boolean.FALSE);
    if (portraitIdent == null) throw new AssertException("identity can not be null!");
    this.portraitIdent = portraitIdent;
   
    ImageComponent ic = null;
   
    GenderPropertyHandler genderHander = (GenderPropertyHandler) UserManager.getInstance().getUserPropertiesConfig().getPropertyHandler(UserConstants.GENDER);
    String gender = "-"; // use as default
    if (genderHander != null) {
      gender = genderHander.getInternalValue(portraitIdent.getUser());
    }
   
    MediaResource portrait = null;
    if (useLarge){
      portrait = DisplayPortraitManager.getInstance().getPortrait(portraitIdent, DisplayPortraitManager.PORTRAIT_BIG_FILENAME);
      if (gender.equals("-")) {
        myContent.contextPut("portraitCssClass", DisplayPortraitManager.DUMMY_BIG_CSS_CLASS);
      } else if (gender.equals("male")) {
        myContent.contextPut("portraitCssClass", DisplayPortraitManager.DUMMY_MALE_BIG_CSS_CLASS);
      } else if (gender.equals("female")) {
        myContent.contextPut("portraitCssClass", DisplayPortraitManager.DUMMY_FEMALE_BIG_CSS_CLASS);
      }
    } else {
      portrait = DisplayPortraitManager.getInstance().getPortrait(portraitIdent, DisplayPortraitManager.PORTRAIT_SMALL_FILENAME);
      if (gender.equals("-")) {
        myContent.contextPut("portraitCssClass", DisplayPortraitManager.DUMMY_SMALL_CSS_CLASS);
      } else if (gender.equals("male")) {
        myContent.contextPut("portraitCssClass", DisplayPortraitManager.DUMMY_MALE_SMALL_CSS_CLASS);
      } else if (gender.equals("female")) {
        myContent.contextPut("portraitCssClass", DisplayPortraitManager.DUMMY_FEMALE_SMALL_CSS_CLASS);
      }
    }
    myContent.contextPut("hasPortrait", (portrait != null) ? Boolean.TRUE : Boolean.FALSE);
    myContent.contextPut("identityKey", portraitIdent.getKey().toString());

    if (portrait != null){
        ic = new ImageComponent("image");
        ic.setMediaResource(portrait);
        myContent.put(ic);
    }
    putInitialPanel(myContent);
  }
View Full Code Here


    imageContainer = FormLayoutContainer.createCustomFormLayout("imageContainer", getTranslator(), VELOCITY_ROOT + "/image_container.html");
    imageContainer.setLabel("feed.file.label", null);
    flc.add(imageContainer);
    // Add a delete link and an image component to the image container.
    deleteImageLink = uifactory.addFormLink("feed.image.delete", imageContainer);
    image = new ImageComponent("icon");
    imageContainer.put("image", image);

    file = uifactory.addFileElement("feed.file.label", this.flc);
    file.addActionListener(this, FormEvent.ONCHANGE);
View Full Code Here

    downloadButton.setTextReasonForDisabling(translate("disabledexportreason"));
   
    if (repositoryEntry.getDescription() != null) {
      main.contextPut("description", Formatter.formatLatexFormulas(repositoryEntry.getDescription()));
    }
    ImageComponent ic = RepositoryEntryImageController.getImageComponentForRepositoryEntry("image", repositoryEntry);

    if (ic != null) {
      // display only within 600x300 - everything else looks ugly
      ic.setMaxWithAndHeightToFitWithin(600, 300);
      main.contextPut("hasImage", Boolean.TRUE);
      main.put("image", ic);
    } else {
      main.contextPut("hasImage", Boolean.FALSE);
    }
View Full Code Here

 
  /**
   * Internal helper to create the image component and push it to the view
   */
  private void displayImage() {
    ImageComponent ic = getImageComponentForRepositoryEntry("image",this.repositoryEntry);
    if (ic != null) {
      // display only within 400x200 in form
      ic.setMaxWithAndHeightToFitWithin(400, 200);
      vContainer.put("image", ic);
      vContainer.contextPut("hasImage",Boolean.TRUE);
    }else{
      vContainer.contextPut("hasImage",Boolean.FALSE);
    }
View Full Code Here

    File repositoryEntryImageFile= new File(new File(FolderConfig.getCanonicalRoot() + FolderConfig.getRepositoryHome()),
        getImageFilename(repositoryEntry));
    if (!repositoryEntryImageFile.exists()) {
      return null;
    }
    ImageComponent imageComponent = new ImageComponent(componentName);
    imageComponent.setMediaResource(new FileMediaResource(repositoryEntryImageFile));
    return imageComponent;
  }
View Full Code Here

  /**
   * @param wControl
   */
  public JFreeChartController(JFreeChart chart, Long height, Long width, WindowControl wControl) {
    super(wControl);
    imgComponent = new ImageComponent("jfreechartwrapper");
    imgComponent.setWidth(width);
    imgComponent.setHeight(height);
    imgComponent.setMediaResource(new JFreeChartMediaResource(chart, width, height));
    setInitialComponent(imgComponent);
  }
View Full Code Here

    myContent.contextPut("children", childCe);
    for ( Object leaf : childCe ) {
      CatalogEntry entry = (CatalogEntry)leaf;
      if(entry.getType() == CatalogEntry.TYPE_NODE) continue;
      String name = "image" + childCe.indexOf(leaf);
      ImageComponent ic = RepositoryEntryImageController.getImageComponentForRepositoryEntry(name, entry.getRepositoryEntry());
      if(ic == null) {
        myContent.remove(myContent.getComponent(name));
        continue;
      }
      ic.setMaxWithAndHeightToFitWithin(200, 100);
      myContent.put(name, ic);
    }
    myContent.contextPut(CATCMD_HISTORY, historyStack);

    String url = Settings.getServerContextPathURI() + "/url/CatalogEntry/" + ce.getKey();
View Full Code Here

TOP

Related Classes of org.olat.core.gui.components.image.ImageComponent

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.