Package com.google.gwt.resources.client

Examples of com.google.gwt.resources.client.ImageResource


    };
   
    Column<Blog,ImageResource> imageColum =new  Column<Blog, ImageResource>(new ImageResourceCell()){
      @Override
      public ImageResource getValue(final Blog object) {
        return new ImageResource(){

          @Override
          public String getName() {
            // TODO Auto-generated method stub
            return null;
View Full Code Here


 
  @Override
  public void render(Element listItemBase, M item) {

    if (icons != null) {
      ImageResource icon = findIcon(item);
      int padding = defaultPadding;
      if (icon != null) {
        ImageResourceUtils.applyImageResource(listItemBase, icon, IMAGE_PADDING_LEFT_PX + "px",
            "center");
        padding = IMAGE_PADDING_LEFT_PX + icon.getWidth() + IMAGE_PADDING_RIGHT_PX;
      }
     
      // By breaking this up we can avoid overriding the listItems hover state
      listItemBase.getStyle().setPaddingLeft(padding, CSSStyleDeclaration.Unit.PX);
    }
View Full Code Here

    this.style.ensureInjected();
    initWidget(new SimplePanel());
    setStyleName(this.style.cellTreeWidget());

    // Initialize the open and close images strings.
    ImageResource treeOpen = resources.cellTreeOpenItem();
    ImageResource treeClosed = resources.cellTreeClosedItem();
    ImageResource treeLoading = resources.cellTreeLoading();
    openImageHtml = getImageHtml(treeOpen, false);
    closedImageHtml = getImageHtml(treeClosed, false);
    openImageTopHtml = getImageHtml(treeOpen, true);
    closedImageTopHtml = getImageHtml(treeClosed, true);
    loadingImageHtml = getImageHtml(treeLoading, false);
    imageWidth = Math.max(Math.max(treeOpen.getWidth(), treeClosed.getWidth()),
        treeLoading.getWidth());

    // We use one animation for the entire tree.
    setAnimation(SlideAnimation.create());

    // Add event handlers.
View Full Code Here

      }
      if (image.isWidthDirty() || image.isHeightDirty() || ignoreOptimizations) {
        element.setSize(new Size((int) Math.round(image.getWidth()), (int) Math.round(image.getHeight())));
      }
      if (image.isResourceDirty() || ignoreOptimizations) {
        ImageResource resource = image.getResource();
        StringBuilder builder = new StringBuilder();
        builder.append("url(").append(image.getResource().getSafeUri().asString()).append(") ");
        builder.append(-1 * resource.getLeft()).append("px ");
        builder.append(-1 * resource.getTop()).append("px");
        element.getStyle().setProperty("background", builder.toString());
      }
    }

    if (vml != null) {
View Full Code Here

      setExpanded(model, !node.isExpanded());
    }
  }

  protected ImageResource calculateIconStyle(M model) {
    ImageResource style = null;
    if (iconProvider != null) {
      ImageResource iconStyle = iconProvider.getIcon(model);
      if (iconStyle != null) {
        return iconStyle;
      }
    }
    TreeStyle ts = getStyle();
View Full Code Here

    boolean isBoolean = value != null && value instanceof Boolean;
    // is a boolean always a toggle button?
    String text = hasConstantHtml ? cell.getText() : (value != null && !isBoolean)
        ? SafeHtmlUtils.htmlEscape(value.toString()) : "";

    ImageResource icon = cell.getIcon();
    IconAlign iconAlign = cell.getIconAlign();

    String cls = style.button();
    String arrowCls = "";
    if (cell.getMenu() != null) {

      if (cell instanceof SplitButtonCell) {
        switch (cell.getArrowAlign()) {
          case RIGHT:
            arrowCls = style.split();
            break;
          case BOTTOM:
            arrowCls = style.splitBottom();
            break;
        }

      } else {
        switch (cell.getArrowAlign()) {
          case RIGHT:
            arrowCls = style.arrow();
            break;
          case BOTTOM:
            arrowCls = style.arrowBottom();
            break;
        }
      }

    }

    ButtonScale scale = cell.getScale();

    switch (scale) {
      case SMALL:
        cls += " " + style.small();
        break;

      case MEDIUM:
        cls += " " + style.medium();
        break;

      case LARGE:
        cls += " " + style.large();
        break;
    }

    SafeStylesBuilder stylesBuilder = new SafeStylesBuilder();

    int width = -1;

    if (cell.getWidth() != -1) {
      int w = cell.getWidth();
      if (w < cell.getMinWidth()) {
        w = cell.getMinWidth();
      }
      stylesBuilder.appendTrustedString("width:" + w + "px;");
      cls += " " + style.hasWidth() + " x-has-width";
      width = w;
    } else {

      if (cell.getMinWidth() != -1) {
        TextMetrics.get().bind(style.text());
        int length = TextMetrics.get().getWidth(text);
        length += 6; // frames

        if (icon != null) {
          switch (iconAlign) {
            case LEFT:
            case RIGHT:
              length += icon.getWidth();
              break;
          }
        }

        if (cell.getMinWidth() > length) {
          stylesBuilder.appendTrustedString("width:" + cell.getMinWidth() + "px;");
          cls += " " + style.hasWidth() + " x-has-width";
          width = cell.getMinWidth();
        }
      }
    }

    final int height = cell.getHeight();
    if (height != -1) {
      stylesBuilder.appendTrustedString("height:" + height + "px;");
    }

    if (icon != null) {
      switch (iconAlign) {
        case TOP:
          arrowCls += " " + style.iconTop();
          break;
        case BOTTOM:
          arrowCls += " " + style.iconBottom();
          break;
        case LEFT:
          arrowCls += " " + style.iconLeft();
          break;
        case RIGHT:
          arrowCls += " " + style.iconRight();
          break;
      }

    } else {
      arrowCls += " " + style.noIcon();
    }

    // toggle button
    if (value == Boolean.TRUE) {
      cls += " " + frame.pressedClass();
    }

    sb.append(templates.outer(cls, new SafeStylesBuilder().toSafeStyles()));

    SafeHtmlBuilder inside = new SafeHtmlBuilder();

    String innerWrap = arrowCls;
    if (GXT.isIE6() || GXT.isIE7()) {
      arrowCls += " " + CommonStyles.get().inlineBlock();
    }

    inside.appendHtmlConstant("<div class='" + innerWrap + "'>");
    inside.appendHtmlConstant("<table cellpadding=0 cellspacing=0 class='" + style.mainTable() + "'>");

    if (icon != null) {
      switch (iconAlign) {
        case LEFT:
          inside.appendHtmlConstant("<tr>");
          writeIcon(inside, icon, height);
          if (text != null) {
            int w = width - (icon != null ? icon.getWidth() : 0) - 4;
            writeText(inside, text, w, height);
          }
          inside.appendHtmlConstant("</tr>");
          break;
        case RIGHT:
          inside.appendHtmlConstant("<tr>");
          if (text != null) {
            int w = width - (icon != null ? icon.getWidth() : 0) - 4;
            writeText(inside, text, w, height);
          }
          writeIcon(inside, icon, height);
          inside.appendHtmlConstant("</tr>");
          break;
View Full Code Here

      elem.setClassName(css.rowEven());
    }

    Element headerElem = DocumentExt.get().createDivWithClassName(css.header());
    headerElem.getStyle().setPropertyPx("width", Constants.GRAPH_HEADER_WIDTH);
    ImageResource icon = getIconFromFileType(fileType);

    textElem = DocumentExt.get().createDivWithClassName(css.headerText());

    DivElement path = DocumentExt.get().createDivElement();
    // Strip query params from lastPathComponent.
View Full Code Here

   *
   * @param extension the mime type we are querying
   * @return the image icon for the mime type
   */
  private ImageResource getIconFromFileType(String extension) {
    ImageResource icon = mimeTypeMap.get(extension);
    return (icon != null) ? icon : mimeTypeMap.get("default");
  }
View Full Code Here

        Column<DataSource, ImageResource> statusColumn =
                new Column<DataSource, ImageResource>(new ImageResourceCell()) {
                    @Override
                    public ImageResource getValue(DataSource dataSource) {

                        ImageResource res = null;

                        if(dataSource.isEnabled())
                            res = Icons.INSTANCE.status_good();
                        else
                            res = Icons.INSTANCE.status_bad();
View Full Code Here

    }

    //TODO: get header from configuration instead of hard coding. - JLIU
    public IsWidget getModulesHeaderView(String perspectiveType) {
        String title;
        ImageResource image;
        if ( SOAPerspective.SOA_PERSPECTIVE.equals( perspectiveType ) ) {
            title = "Services";
            image = images.packages();
        } else if ( AuthorPerspective.AUTHOR_PERSPECTIVE.equals( perspectiveType ) ) {
            title = constants.KnowledgeBases();
View Full Code Here

TOP

Related Classes of com.google.gwt.resources.client.ImageResource

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.