コード例 #1
0
  /**
   * @see
   *     org.opencms.ade.galleries.client.preview.A_CmsResourcePreview#selectResource(java.lang.String,
   *     java.lang.String)
   */
  @Override
  public void selectResource(String resourcePath, String title) {

    CmsCroppingParamBean param;
    switch (getGalleryMode()) {
      case widget:
        param = getInitialCroppingParameter(resourcePath);
        if (CmsPreviewUtil.isAdvancedWidget()) {
          CmsPreviewUtil.setVfsImage(
              resourcePath,
              param.getScaleParam(),
              param.getFormatName(),
              ((double) param.getTargetWidth() / param.getTargetHeight()) + "");
        } else {
          CmsPreviewUtil.setResourcePath(
              resourcePath
                  + ((param.isCropped() || param.isScaled()) ? "?" + param.toString() : ""));
        }
        break;
      case editor:
        Map<String, String> attributes = new HashMap<String, String>();
        attributes.put("title", title);
        param = getInitialCroppingParameter(resourcePath);
        attributes.put("width", String.valueOf(param.getResultingWidth()));
        attributes.put("height", String.valueOf(param.getResultingHeight()));
        CmsPreviewUtil.setImage(CmsCoreProvider.get().link(resourcePath), attributes);
        CmsPreviewUtil.closeDialog();
        break;
      case ade:
      case view:
      default:
        // nothing to do here, should not be called
        break;
    }
  }
コード例 #2
0
  /**
   * Removes a widget from the button panel.
   *
   * <p>
   *
   * @param w the widget to remove
   */
  public void removeButton(Widget w) {

    m_buttonPanel.remove(w);
    if (CmsCoreProvider.get().isIe7()) {
      m_buttonPanel.getElement().getStyle().setWidth(m_buttonPanel.getWidgetCount() * 22, Unit.PX);
    }
  }
コード例 #3
0
  /**
   * Adds a widget to the front of the button panel.
   *
   * <p>
   *
   * @param w the widget to add
   */
  public void addButtonToFront(Widget w) {

    m_buttonPanel.insert(w, 0);
    if (CmsCoreProvider.get().isIe7()) {
      m_buttonPanel.getElement().getStyle().setWidth(m_buttonPanel.getWidgetCount() * 22, Unit.PX);
    }
  }
コード例 #4
0
  /** @see org.opencms.gwt.client.ui.contextmenu.I_CmsContextMenuEntry#execute() */
  public void execute() {

    String sitePath = getHoverbar().getSitePath();
    if (!sitePath.endsWith("/")) {
      sitePath += "/";
    }
    CmsSitemapController controller = getHoverbar().getController();
    String uri = CmsCoreProvider.get().getUri() + "?path=" + sitePath;
    final String returnCode = Window.Location.getParameter(CmsCoreProvider.PARAM_RETURNCODE);
    if ((returnCode != null) && (returnCode.length() != 0)) {
      uri += "&returncode=" + returnCode;
    }
    controller.leaveEditor(uri);
  }
コード例 #5
0
  /** @see org.opencms.ade.galleries.client.preview.A_CmsResourcePreview#setResource() */
  @Override
  public void setResource() {

    if (m_handler == null) {
      throw new UnsupportedOperationException("Preview handler not initialized");
    }
    CmsCroppingParamBean croppingParam = m_handler.getCroppingParam();

    switch (getGalleryMode()) {
      case widget:
        if (CmsPreviewUtil.isAdvancedWidget()) {
          CmsPreviewUtil.setVfsImage(
              m_infoBean.getResourcePath(),
              croppingParam.getScaleParam(),
              croppingParam.getFormatName(),
              ((double) croppingParam.getTargetWidth() / croppingParam.getTargetHeight()) + "");
        } else {
          CmsPreviewUtil.setResourcePath(
              m_infoBean.getResourcePath()
                  + ((croppingParam.isCropped() || croppingParam.isScaled())
                      ? "?" + croppingParam.toString()
                      : ""));
        }
        break;
      case editor:
        Map<String, String> attributes = m_handler.getImageAttributes();
        CmsPreviewUtil.setImage(
            CmsCoreProvider.get()
                .link(
                    m_infoBean.getResourcePath()
                        + ((croppingParam.isCropped() || croppingParam.isScaled())
                            ? "?" + croppingParam.toString()
                            : "")),
            attributes);
        break;
      case ade:
      case view:
      default:
        // nothing to do here, should not be called
        break;
    }
  }
コード例 #6
0
  /**
   * Creates the URL for the gallery dialog IFrame.
   *
   * <p>
   *
   * @return the URL for the gallery dialog IFrame
   */
  protected String buildGalleryUrl() {

    String basePath = "/system/modules/org.opencms.ade.galleries/gallery.jsp";
    return CmsCoreProvider.get().link(basePath + "?dialogmode=widget&fieldid=" + m_id);
  }