当前位置: 首页>>代码示例>>Java>>正文


Java SafeStyles类代码示例

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


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

示例1: createClosedArrowAndFolderSafeHtml

import com.google.gwt.safecss.shared.SafeStyles; //导入依赖的package包/类
private void createClosedArrowAndFolderSafeHtml(SafeHtmlBuilder sb,
		SafeStyles imgStyle) {
	SafeHtml rendered;
	if (currentRow.getChildren().size() != 0) {
		rendered = nodeImageTemplate.cell("ICON_ARROW__CLOSE", imgStyle,
				ICON_ARROW_CLOSE);
	} else {
		SafeStyles imageWidthStyle = SafeStylesUtils
				.fromTrustedString("float:left;width:16.0px;");
		rendered = nodeImageTemplate.cell("ICON_ARROW__CLOSE",
				imageWidthStyle, ICON_CLEAR);
	}
	sb.append(rendered);
	if (treeGrid.isSelectable()) {
		createCheckBoxImg(sb, imgStyle);
	}
	rendered = nodeImageTemplate.cell("ICON_FOLDER__CLOSE", imgStyle,
			ICON_FOLDER_CLOSE);
	sb.append(rendered);
}
 
开发者ID:treblereel,项目名称:TreeGridGWT,代码行数:21,代码来源:ExpandableCell.java

示例2: update

import com.google.gwt.safecss.shared.SafeStyles; //导入依赖的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

示例3: createClearIcon

import com.google.gwt.safecss.shared.SafeStyles; //导入依赖的package包/类
private void createClearIcon(SafeHtmlBuilder sb, SafeStyles imgStyle,
		int times) {
	imageWidthStyle = SafeStylesUtils
			.fromTrustedString("float:left;width:16.0px;");
	for (int i = 0; i < times; i++) {
		rendered = nodeImageTemplate.cell("ICON_ARROW__CLOSE",
				imageWidthStyle, ICON_CLEAR);
		sb.append(rendered);
	}
}
 
开发者ID:treblereel,项目名称:TreeGridGWT,代码行数:11,代码来源:ExpandableCell.java

示例4: createCheckBoxImg

import com.google.gwt.safecss.shared.SafeStyles; //导入依赖的package包/类
/**
 * @param sb
 * @param imgStyle
 */
@SuppressWarnings("unchecked")
private void createCheckBoxImg(SafeHtmlBuilder sb, SafeStyles imgStyle) {

	imageWidthStyle = SafeStylesUtils
			.fromTrustedString("float:left;width:16.0px;margin-right:2px;");
	SelectionModel<T> sm = (SelectionModel<T>) treeGrid.getSelectionModel();
	boolean selected = sm.isSelected(currentRow);
	if (selected) {
		if (currentRow.getChildren().size() > 0) {
			if (currentRow.isChidlrenSelected()) {
				rendered = nodeImageTemplate.cell("ICON_CHECKBOX",
						imageWidthStyle, ICON_CHECHBOX_CHILDS_SELECTED);
			} else {
				rendered = nodeImageTemplate.cell("ICON_CHECKBOX",
						imageWidthStyle, ICON_CHECHBOX_TRUE);
			}
		} else {
			rendered = nodeImageTemplate.cell("ICON_CHECKBOX",
					imageWidthStyle, ICON_CHECHBOX_TRUE);
		}
	} else {
		rendered = nodeImageTemplate.cell("ICON_CHECKBOX", imageWidthStyle,
				ICON_CHECHBOX_FALSE);
	}
	sb.append(rendered);
}
 
开发者ID:treblereel,项目名称:TreeGridGWT,代码行数:31,代码来源:ExpandableCell.java

示例5: createOpenArrowAndFolderSafeHtml

import com.google.gwt.safecss.shared.SafeStyles; //导入依赖的package包/类
private void createOpenArrowAndFolderSafeHtml(SafeHtmlBuilder sb,
		SafeStyles imgStyle) {
	SafeHtml rendered;
	if (currentRow.getChildren().size() != 0) {
		rendered = nodeImageTemplate.cell("ICON_ARROW__OPEN", imgStyle,
				ICON_ARROW_OPEN);
		sb.append(rendered);
	}
	if (treeGrid.isSelectable()) {
		createCheckBoxImg(sb, imgStyle);
	}
	rendered = nodeImageTemplate.cell("ICON_FOLDER__OPEN", imgStyle,
			ICON_FOLDER_OPEN);
	sb.append(rendered);
}
 
开发者ID:treblereel,项目名称:TreeGridGWT,代码行数:16,代码来源:ExpandableCell.java

示例6: render

import com.google.gwt.safecss.shared.SafeStyles; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void render(com.google.gwt.cell.client.Cell.Context context,
		SafeHtml data, SafeHtmlBuilder sb) {
	currentRow = (T) treeGrid.getDataStore().getList()
			.get(context.getIndex());
	/*
	 * Always do a null check on the value. Cell widgets can pass null to
	 * cells if the underlying data contains a null, or if the data arrives
	 * out of order.
	 */
	if (data == null) {
		return;
	}

	// generate the image cell
	SafeStyles imgStyle = SafeStylesUtils
			.fromTrustedString("float:left;cursor:hand;cursor:pointer;");
	SafeStyles valueStyle = SafeStylesUtils
			.fromTrustedString("float:left;");
	SafeHtml rendered;
	if (currentRow.getChildren().size() > 0) {
		createClearIcon(sb, imgStyle, currentRow.getLevel());
		if (!currentRow.isExpand()) {
			createClosedArrowAndFolderSafeHtml(sb, imgStyle);
		} else {
			createOpenArrowAndFolderSafeHtml(sb, imgStyle);
		}
	} else {
		createClearIcon(sb, imgStyle, currentRow.getLevel() + 1);
		if (treeGrid.isSelectable()) {
			createCheckBoxImg(sb, imgStyle);
		}
		createLeafSafeHtml(sb, imgStyle);
	}
	// generate the value cell
	rendered = nodeImageTemplate.cellNode("EXPANDABLE_VALUE", valueStyle,
			SafeHtmlUtils.fromString(data.asString()));
	sb.append(rendered);
}
 
开发者ID:treblereel,项目名称:TreeGridGWT,代码行数:41,代码来源:ExpandableCell.java

示例7: addMenuItem

import com.google.gwt.safecss.shared.SafeStyles; //导入依赖的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

示例8: ActionButtonCell

import com.google.gwt.safecss.shared.SafeStyles; //导入依赖的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

示例9: update

import com.google.gwt.safecss.shared.SafeStyles; //导入依赖的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

示例10: render

import com.google.gwt.safecss.shared.SafeStyles; //导入依赖的package包/类
@Override
public void render(Context context, String value, SafeHtmlBuilder sb) {
  // Get the view data.
  Object key = context.getKey();
  ValidationData viewData = getViewData(key);
  if (viewData != null && viewData.getValue().equals(value)) {
    // Clear the view data if the value is the same as the current value.
    clearViewData(key);
    viewData = null;
  }

  /*
   * If viewData is null, just paint the contents black. If it is non-null,
   * show the pending value and paint the contents red if they are known to
   * be invalid.
   */
  String pendingValue = (viewData == null) ? null : viewData.getValue();
  boolean invalid = (viewData == null) ? false : viewData.isInvalid();

  String color = pendingValue != null ? (invalid ? "red" : "blue") : "black";
  SafeStyles safeColor = SafeStylesUtils.fromTrustedString("color: " + color + ";");
  sb.append(template.input(pendingValue != null ? pendingValue : value, safeColor));

  if (invalid) {
    sb.appendHtmlConstant("&nbsp;<span style='color:red;'>");
    sb.append(errorMessage);
    sb.appendHtmlConstant("</span>");
  }
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:30,代码来源:CwCellValidation.java

示例11: menuImageItemContent

import com.google.gwt.safecss.shared.SafeStyles; //导入依赖的package包/类
@Template("<div tabindex=\"0\" style=\"vertical-align:middle;\">"
        + "<span style='{0}'></span>" + "<span>{1}</span>" + "</div>")
SafeHtml menuImageItemContent(SafeStyles style, String text);
 
开发者ID:kaaproject,项目名称:sandbox-frame,代码行数:4,代码来源:ActionsLabel.java

示例12: addMenuItem

import com.google.gwt.safecss.shared.SafeStyles; //导入依赖的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

示例13: cellNode

import com.google.gwt.safecss.shared.SafeStyles; //导入依赖的package包/类
@SafeHtmlTemplates.Template("<div name=\"{0}\" style=\"{1}\">&nbsp;{2}</div>")
SafeHtml cellNode(String name, SafeStyles styles, SafeHtml value);
 
开发者ID:treblereel,项目名称:TreeGridGWT,代码行数:3,代码来源:ExpandableCell.java

示例14: createLeafSafeHtml

import com.google.gwt.safecss.shared.SafeStyles; //导入依赖的package包/类
private void createLeafSafeHtml(SafeHtmlBuilder sb, SafeStyles imgStyle) {
	rendered = nodeImageTemplate.cell("ICON_DOCUMENT", imgStyle,
			ICON_DOCUMENT);
	sb.append(rendered);
}
 
开发者ID:treblereel,项目名称:TreeGridGWT,代码行数:6,代码来源:ExpandableCell.java

示例15: generate

import com.google.gwt.safecss.shared.SafeStyles; //导入依赖的package包/类
@Template("<div class=\"grid-cell-anchor\"></div><img class=\"grid-cell-image\" style=\"{0}\" src=\"{1}\"></img><div id=\"{2}\" class=\"grid-cell-text\" style=\"{0}\">{3}</div>")
public SafeHtml generate(SafeStyles aStyle, SafeUri aImgSrc, String aId, SafeHtml aContent);
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:3,代码来源:RenderedEditorCell.java


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