• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SafeStylesBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.gwt.safecss.shared.SafeStylesBuilder的典型用法代码示例。如果您正苦于以下问题:Java SafeStylesBuilder类的具体用法?Java SafeStylesBuilder怎么用?Java SafeStylesBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SafeStylesBuilder类属于com.google.gwt.safecss.shared包,在下文中一共展示了SafeStylesBuilder类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getImageHtml

import com.google.gwt.safecss.shared.SafeStylesBuilder; //导入依赖的package包/类
private SafeHtml getImageHtml(ImageResource res, VerticalAlignmentConstant valign) {
	AbstractImagePrototype proto = AbstractImagePrototype.create(res);
	SafeHtml image = SafeHtmlUtils.fromTrustedString(proto.getHTML());

	// Create the wrapper based on the vertical alignment.
	SafeStylesBuilder cssStyles =
			new SafeStylesBuilder().appendTrustedString(direction + ":0px;");
	if (HasVerticalAlignment.ALIGN_TOP == valign) {
		return templates.imageWrapperTop(cssStyles.toSafeStyles(), image);
	} else if (HasVerticalAlignment.ALIGN_BOTTOM == valign) {
		return templates.imageWrapperBottom(cssStyles.toSafeStyles(), image);
	} else {
		int halfHeight = (int) Math.round(res.getHeight() / 2.0);
		cssStyles.appendTrustedString("margin-top:-" + halfHeight + "px;");
		return templates.imageWrapperMiddle(cssStyles.toSafeStyles(), image);
	}
}
 
开发者ID:Novartis,项目名称:ontobrowser,代码行数:18,代码来源:ActionIconCellDecorator.java


示例2: render

import com.google.gwt.safecss.shared.SafeStylesBuilder; //导入依赖的package包/类
@Override
public void render(Context context, C value, SafeHtmlBuilder sb) {
	if (treeProvider != null) {
		SafeHtmlBuilder cellBuilder = new SafeHtmlBuilder();
		cell.render(context, value, cellBuilder);
		int deepness = getDeepness(context);
		int outerDivPadding = indent * deepness;
		SafeStylesBuilder styles = new SafeStylesBuilder();
		if (deepness > 0) {
			styles.paddingLeft(outerDivPadding, Style.Unit.PX);
		}
		styles.position(Style.Position.RELATIVE).height(100, Style.Unit.PCT).toSafeStyles();
		sb.append(template.outerDiv(outerDivClasses(context), styles.toSafeStyles(), cellBuilder.toSafeHtml()));
	} else {
		cell.render(context, value, sb);
	}
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:18,代码来源:TreeExpandableCell.java


示例3: decorate

import com.google.gwt.safecss.shared.SafeStylesBuilder; //导入依赖的package包/类
public static String decorate(SafeHtml toDecorate, String aId, PublishedCell aCell, VerticalAlignmentConstant valign, SafeHtmlBuilder sb) {
	SafeStylesBuilder stb = new SafeStylesBuilder();
	SafeUri imgSrc = null;
	if (aCell != null) {
		stb.append(SafeStylesUtils.fromTrustedString(aCell.toStyledWOBackground()));
		if (aCell.getIcon() != null) {
			ImageResource icon = aCell.getIcon();
			imgSrc = icon.getSafeUri();
		}
	}
	String decorId;
	if (aId != null && !aId.isEmpty()) {
		decorId = aId;
	} else {
		decorId = Document.get().createUniqueId();
	}
	if (imgSrc != null)
		sb.append(RenderedEditorCell.PaddedCell.INSTANCE.generate(stb.toSafeStyles(), imgSrc, decorId, toDecorate));
	else
		sb.append(RenderedEditorCell.PaddedCell.INSTANCE.generate(stb.toSafeStyles(), decorId, toDecorate));
	return decorId;
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:23,代码来源:StyleIconDecorator.java


示例4: update

import com.google.gwt.safecss.shared.SafeStylesBuilder; //导入依赖的package包/类
private void update() {
	long currentTime = System.currentTimeMillis();
	int time = (int) (currentTime - startTime);

	int left = time * WIDTH / MAX_TIME;
	int width = WIDTH - left;
	String message = second == 0 ? "時間切れ" : ("残り時間約" + second + "秒");
	String color = Utility.createBackgroundColorString((double) width / (double) WIDTH);
	SafeStyles styles = new SafeStylesBuilder()
			.position(Position.ABSOLUTE)
			.top(0, Unit.PX)
			.left(left, Unit.PX)
			.width(width, Unit.PX)
			.height(32, Unit.PX)
			.trustedBackgroundColor(color)
			.zIndex(-5)
			.toSafeStyles();
	SafeHtml safeHtml = TEMPLATE.bar(message, styles);
	html.setHTML(safeHtml);
}
 
开发者ID:nodchip,项目名称:QMAClone,代码行数:21,代码来源:WidgetTimeProgressBar.java


示例5: getImageHtml

import com.google.gwt.safecss.shared.SafeStylesBuilder; //导入依赖的package包/类
/**
 * Get the HTML representation of an image.
 *
 * @param res the {@link ImageResource} to render as HTML
 * @return the rendered HTML
 */
private SafeHtml getImageHtml(ImageResource res) {
  // Right-justify image if LTR, left-justify if RTL
  AbstractImagePrototype proto = AbstractImagePrototype.create(res);
  SafeHtml image = proto.getSafeHtml();

  SafeStylesBuilder cssBuilder = new SafeStylesBuilder();
  if (LocaleInfo.getCurrentLocale().isRTL()) {
    cssBuilder.appendTrustedString("left:0px;");
  } else {
    cssBuilder.appendTrustedString("right:0px;");
  }
  cssBuilder.appendTrustedString("width: " + res.getWidth() + "px;");
  cssBuilder.appendTrustedString("height: " + res.getHeight() + "px;");
  return template.imageWrapper(cssBuilder.toSafeStyles(), image);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:CellBrowser.java


示例6: addMenuItem

import com.google.gwt.safecss.shared.SafeStylesBuilder; //导入依赖的package包/类
public void addMenuItem(ImageResource image, String text,
        final ActionMenuItemListener<T> listener) {
    SafeHtml html = null;
    if (image != null) {
        SafeUri uri = image.getSafeUri();
        int left = image.getLeft();
        int top = image.getTop();
        int width = image.getWidth();
        int height = image.getHeight();
        int paddingRight = width + 8;

        String background = "url(\"" + uri.asString() + "\") no-repeat "
                + (-left + "px ") + (-top + "px");

        SafeStylesBuilder builder = new SafeStylesBuilder();
        builder.trustedNameAndValue("background", background)
                .width(width, Unit.PX).height(height, Unit.PX)
                .paddingRight(paddingRight, Unit.PX);

        SafeStyles style = SafeStylesUtils.fromTrustedString(builder
                .toSafeStyles().asString());

        html = template.menuImageItemContent(style, text);
    } else {
        html = template.menuItemContent(text);
    }
    final MenuItem item = new MenuItem(html, new Command() {

        @Override
        public void execute() {
            if (actionsPopup != null && actionsPopup.isVisible())
                actionsPopup.hide();
            listener.onMenuItemSelected(currentValue);
        }

    });

    menu.addItem(item);
}
 
开发者ID:kaaproject,项目名称:avro-ui,代码行数:40,代码来源:ActionsButtonCell.java


示例7: ActionButtonCell

import com.google.gwt.safecss.shared.SafeStylesBuilder; //导入依赖的package包/类
public ActionButtonCell(ImageResource imageResource,
        String text,
        boolean small,
        ActionListener<T> listener,
        ActionValidator<T> validator) {
    super(CLICK, KEYDOWN);
    this.listener = listener;
    this.validator = validator;
    if (template == null) {
        template = GWT.create(Template.class);
    }
    SafeUri uri = imageResource.getSafeUri();
    int width = imageResource.getWidth();
    int height = imageResource.getHeight();
    int paddingLeft = width;

    String background = "url(\"" + uri.asString() + "\") no-repeat scroll right center";

    SafeStylesBuilder builder = new SafeStylesBuilder();
    builder
    .trustedNameAndValue("background", background)
    .width(width, Unit.PX)
    .height(height, Unit.PX)
    .paddingLeft(paddingLeft, Unit.PX);

    SafeStyles style = SafeStylesUtils.fromTrustedString(builder.toSafeStyles().asString());
    if (small) {
        this.actionButtonHtml = template.actionButtonSmall(Utils.avroUiStyle.cellButton(), 
                Utils.avroUiStyle.cellButtonSmall(), text, style);
    } else {
        this.actionButtonHtml = template.actionButton(Utils.avroUiStyle.cellButton(), text, style);
    }
}
 
开发者ID:kaaproject,项目名称:avro-ui,代码行数:34,代码来源:ActionButtonCell.java


示例8: update

import com.google.gwt.safecss.shared.SafeStylesBuilder; //导入依赖的package包/类
@VisibleForTesting
void update() {
  // SHOW_ALL_TIMING_MS以降は目隠しを表示しない
  int showAllCount = SHOW_ALL_TIMING_MS / UPDATE_PERIOD_MS;
  if (++count > showAllCount) {
    html.setHTML(new SafeHtmlBuilder().append(prefix).append(SURFIX_TEMPLATE).toSafeHtml());
    return;
  }

  // 目隠しの位置を更新する
  int lineWidth = INITIALI_WIDTH * (showAllCount - count) / showAllCount;
  for (int i = 0; i < NUMBER_OF_LINE; ++i) {
    pos[i] += velocities[i];
    if (pos[i] < 0) {
      velocities[i] = Math.abs(velocities[i]);
    } else if (pos[i] > WIDTH - lineWidth) {
      velocities[i] = -Math.abs(velocities[i]);
    }
  }

  // 目隠しを表示する
  SafeHtmlBuilder builder = new SafeHtmlBuilder();
  builder.append(prefix);

  for (int i = 0; i < NUMBER_OF_LINE; ++i) {
    SafeStyles styles = new SafeStylesBuilder().position(Position.ABSOLUTE).left(pos[i], Unit.PX)
        .top(0, Unit.PX).trustedBackgroundColor(COLORS[i]).width(lineWidth, Unit.PX)
        .height(72, Unit.PX).toSafeStyles();
    builder.append(HINT_TEMPLATE.line(styles));
  }
  builder.append(SURFIX_TEMPLATE);

  html.setHTML(builder.toSafeHtml());
}
 
开发者ID:nodchip,项目名称:QMAClone,代码行数:35,代码来源:WidgetProblemSentenceEffect.java


示例9: addMenuItem

import com.google.gwt.safecss.shared.SafeStylesBuilder; //导入依赖的package包/类
public void addMenuItem(ImageResource image, String text,
        final ActionMenuItemListener listener) {

    SafeHtml html = null;
    if (image != null) {
        SafeUri uri = image.getSafeUri();
        int left = image.getLeft();
        int top = image.getTop();
        int width = image.getWidth();
        int height = image.getHeight();
        int paddingRight = width + 8;

        String background = "url(\"" + uri.asString() + "\") no-repeat "
                + (-left + "px ") + (-top + "px");

        SafeStylesBuilder builder = new SafeStylesBuilder();
        builder.trustedNameAndValue("background", background)
                .width(width, Unit.PX).height(height, Unit.PX)
                .paddingRight(paddingRight, Unit.PX);

        SafeStyles style = SafeStylesUtils.fromTrustedString(builder
                .toSafeStyles().asString());

        html = template.menuImageItemContent(style, text);
    }
    else {
        html = template.menuItemContent(text);
    }
    MenuItem item = new MenuItem(html, new Command() {

        @Override
        public void execute() {
            if (actionsPopup != null && actionsPopup.isVisible())
                actionsPopup.hide();
            listener.onMenuItemSelected();
        }

    });

    menu.addItem(item);
}
 
开发者ID:kaaproject,项目名称:sandbox-frame,代码行数:42,代码来源:ActionsLabel.java


示例10: render

import com.google.gwt.safecss.shared.SafeStylesBuilder; //导入依赖的package包/类
@Override
public void render(final Context context, final T value, SafeHtmlBuilder sb) {
	String viewDataId = "";
	if (isEditing(context, null, value)) {
		final ViewData<T> viewData = getViewData(context.getKey());
		viewDataId = viewData.id;
		Scheduler.get().scheduleDeferred(new ScheduledCommand() {

			@Override
			public void execute() {
				if (isEditing(context, null, value)) {
					Element identifiedCellTextSection = Document.get().getElementById(viewData.id);
					if (identifiedCellTextSection != null) {
						identifiedCellTextSection.blur();
						Element table = identifiedCellTextSection;
						while (table != null && !"table".equalsIgnoreCase(table.getTagName())) {
							table = table.getParentElement();
						}
						final Element table1 = table;
						if (identifiedCellTextSection.getOwnerDocument() == Document.get()) {
							startEditing(context, identifiedCellTextSection.getParentElement(), table1.getParentElement(), value, viewData.updater, new Runnable() {

								public void run() {
									if (onEditorClose != null && table1 != null) {
										onEditorClose.closed(table1);
									}
								}

							});
						}
					}
				}
			}

		});
	}
	if (renderer == null || !renderer.render(context, viewDataId, value, sb)) {
		SafeHtmlBuilder content = new SafeHtmlBuilder();
		renderCell(context, value, content);
		sb.append(PaddedCell.INSTANCE.generate(new SafeStylesBuilder().toSafeStyles(), viewDataId, content.toSafeHtml()));
	}
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:43,代码来源:RenderedEditorCell.java


示例11: addMenuItem

import com.google.gwt.safecss.shared.SafeStylesBuilder; //导入依赖的package包/类
public HandlerRegistration addMenuItem(ImageResource image, String text,
        final ActionMenuItemListener listener) {

    SafeHtml html = null;
    if (image != null) {
        SafeUri uri = image.getSafeUri();
        int left = image.getLeft();
        int top = image.getTop();
        int width = image.getWidth();
        int height = image.getHeight();
        int paddingRight = width + 8;

        String background = "url(\"" + uri.asString() + "\") no-repeat "
                + (-left + "px ") + (-top + "px");

        SafeStylesBuilder builder = new SafeStylesBuilder();
        builder.trustedNameAndValue("background", background)
                .width(width, Unit.PX).height(height, Unit.PX)
                .paddingRight(paddingRight, Unit.PX);

        SafeStyles style = SafeStylesUtils.fromTrustedString(builder
                .toSafeStyles().asString());

        html = template.menuImageItemContent(style, text);
    }
    else {
        html = template.menuItemContent(text);
    }
    final MenuItem item = new MenuItem(html, new Command() {

        @Override
        public void execute() {
            if (actionsPopup != null && actionsPopup.isVisible())
                actionsPopup.hide();
            listener.onMenuItemSelected();
        }

    });

    menu.addItem(item);
    HandlerRegistration registration = new HandlerRegistration() {
        
        @Override
        public void removeHandler() {
            menu.removeItem(item);
            
        }
    };
    return registration;
}
 
开发者ID:kaaproject,项目名称:avro-ui,代码行数:51,代码来源:ActionsButton.java


示例12: addMenuItem

import com.google.gwt.safecss.shared.SafeStylesBuilder; //导入依赖的package包/类
/**
 * Add menu item.
 *
 * @param image     the image
 * @param text      the text
 * @param listener  the listener
 */
public void addMenuItem(ImageResource image, String text,
                        final ActionMenuItemListener listener) {

  SafeHtml html = null;
  if (image != null) {
    SafeUri uri = image.getSafeUri();
    int left = image.getLeft();
    int top = image.getTop();
    int width = image.getWidth();
    int height = image.getHeight();
    int paddingRight = width + 8;

    String background = "url(\"" + uri.asString() + "\") no-repeat "
        + (-left + "px ") + (-top + "px");

    SafeStylesBuilder builder = new SafeStylesBuilder();
    builder.trustedNameAndValue("background", background)
        .width(width, Unit.PX).height(height, Unit.PX)
        .paddingRight(paddingRight, Unit.PX);

    SafeStyles style = SafeStylesUtils.fromTrustedString(builder
        .toSafeStyles().asString());

    html = template.menuImageItemContent(style, text);
  } else {
    html = template.menuItemContent(text);
  }
  MenuItem item = new MenuItem(html, new Command() {

    @Override
    public void execute() {
      if (actionsPopup != null && actionsPopup.isVisible()) {
        actionsPopup.hide();
      }
      listener.onMenuItemSelected();
    }

  });

  menu.addItem(item);
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:49,代码来源:ActionsLabel.java



注:本文中的com.google.gwt.safecss.shared.SafeStylesBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Trip类代码示例发布时间:2022-05-22
下一篇:
Java DriveTrain类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap