本文整理汇总了Java中com.google.gwt.safecss.shared.SafeStylesUtils类的典型用法代码示例。如果您正苦于以下问题:Java SafeStylesUtils类的具体用法?Java SafeStylesUtils怎么用?Java SafeStylesUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SafeStylesUtils类属于com.google.gwt.safecss.shared包,在下文中一共展示了SafeStylesUtils类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createClosedArrowAndFolderSafeHtml
import com.google.gwt.safecss.shared.SafeStylesUtils; //导入依赖的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: decorate
import com.google.gwt.safecss.shared.SafeStylesUtils; //导入依赖的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
示例3: createClearIcon
import com.google.gwt.safecss.shared.SafeStylesUtils; //导入依赖的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.SafeStylesUtils; //导入依赖的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: render
import com.google.gwt.safecss.shared.SafeStylesUtils; //导入依赖的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
示例6: addMenuItem
import com.google.gwt.safecss.shared.SafeStylesUtils; //导入依赖的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.SafeStylesUtils; //导入依赖的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: FilterTextInputCell
import com.google.gwt.safecss.shared.SafeStylesUtils; //导入依赖的package包/类
public FilterTextInputCell(double width, Unit widthUnit) {
super(BrowserEvents.BLUR, BrowserEvents.CHANGE, BrowserEvents.KEYUP, PASTE);
if (template == null) {
template = GWT.create(Template.class);
}
if (width > 0) {
inputStyle = SafeStylesUtils.forWidth(width, widthUnit);
}
}
开发者ID:kaaproject,项目名称:avro-ui,代码行数:10,代码来源:FilterTextInputCell.java
示例9: render
import com.google.gwt.safecss.shared.SafeStylesUtils; //导入依赖的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(" <span style='color:red;'>");
sb.append(errorMessage);
sb.appendHtmlConstant("</span>");
}
}
开发者ID:Peergos,项目名称:Peergos,代码行数:30,代码来源:CwCellValidation.java
示例10: getSafeHtml
import com.google.gwt.safecss.shared.SafeStylesUtils; //导入依赖的package包/类
public SafeHtml getSafeHtml(SafeUri url,int left,int top,int width,int height)
{
String style = "width: " + width + "px; height: " + height + "px; background: url("
+ url.asString() + ") " + "no-repeat " + (-left + "px ")
+ (-top + "px;") + "background-size: "+ width + "px " + height + "px;";
return getTemplate().image(clearImage, SafeStylesUtils.fromTrustedString(style));
}
开发者ID:kDCYorke,项目名称:RetinaImages,代码行数:9,代码来源:ClippedImageImplRetina.java
示例11: addMenuItem
import com.google.gwt.safecss.shared.SafeStylesUtils; //导入依赖的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
示例12: addMenuItem
import com.google.gwt.safecss.shared.SafeStylesUtils; //导入依赖的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
示例13: addMenuItem
import com.google.gwt.safecss.shared.SafeStylesUtils; //导入依赖的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
示例14: renderRowValues
import com.google.gwt.safecss.shared.SafeStylesUtils; //导入依赖的package包/类
@Override
protected void renderRowValues(SafeHtmlBuilder sb, List<T> values, int start,
SelectionModel<? super T> selectionModel) {
Cell<T> cell = getCell();
String keyboardSelectedItem = " " + style.cellBrowserKeyboardSelectedItem();
String selectedItem = " " + style.cellBrowserSelectedItem();
String openItem = " " + style.cellBrowserOpenItem();
String evenItem = style.cellBrowserEvenItem();
String oddItem = style.cellBrowserOddItem();
int keyboardSelectedRow = getKeyboardSelectedRow() + getPageStart();
int length = values.size();
int end = start + length;
for (int i = start; i < end; i++) {
T value = values.get(i - start);
boolean isSelected = selectionModel == null ? false : selectionModel.isSelected(value);
boolean isOpen = isOpen(i);
StringBuilder classesBuilder = new StringBuilder();
classesBuilder.append(i % 2 == 0 ? evenItem : oddItem);
if (isOpen) {
classesBuilder.append(openItem);
}
if (isSelected) {
classesBuilder.append(selectedItem);
}
SafeHtmlBuilder cellBuilder = new SafeHtmlBuilder();
Context context = new Context(i, 0, getValueKey(value));
cell.render(context, value, cellBuilder);
// Figure out which image to use.
SafeHtml image;
if (isOpen) {
image = openImageHtml;
} else if (isLeaf(value)) {
image = LEAF_IMAGE;
} else {
image = closedImageHtml;
}
SafeStyles padding =
SafeStylesUtils.fromTrustedString("padding-right: " + imageWidth + "px;");
if (i == keyboardSelectedRow) {
// This is the focused item.
if (isFocused) {
classesBuilder.append(keyboardSelectedItem);
}
char accessKey = getAccessKey();
if (accessKey != 0) {
sb.append(template.divFocusableWithKey(i, classesBuilder.toString(), padding,
getTabIndex(), getAccessKey(), image, cellBuilder.toSafeHtml()));
} else {
sb.append(template.divFocusable(i, classesBuilder.toString(), padding, getTabIndex(),
image, cellBuilder.toSafeHtml()));
}
} else {
sb.append(template.div(i, classesBuilder.toString(), padding, image, cellBuilder
.toSafeHtml()));
}
}
// Update the child state.
updateChildState(this, true);
}
开发者ID:consulo,项目名称:consulo,代码行数:64,代码来源:CellBrowser.java
注:本文中的com.google.gwt.safecss.shared.SafeStylesUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论