本文整理汇总了Java中com.google.gwt.dom.client.StyleElement类的典型用法代码示例。如果您正苦于以下问题:Java StyleElement类的具体用法?Java StyleElement怎么用?Java StyleElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StyleElement类属于com.google.gwt.dom.client包,在下文中一共展示了StyleElement类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setMultiRowDragDecoration
import com.google.gwt.dom.client.StyleElement; //导入依赖的package包/类
/**
* Styles a multi-row selection with the number of elements.
*
* @param drag
* the current drag event holding the context.
*/
void setMultiRowDragDecoration(VDragEvent drag) {
Widget widget = drag.getTransferable().getDragSource().getWidget();
if (widget instanceof VScrollTable) {
VScrollTable table = (VScrollTable) widget;
int rowCount = table.selectedRowKeys.size();
Element dragCountElement = Document.get().getElementById(SP_DRAG_COUNT);
if (rowCount > 1 && table.selectedRowKeys.contains(table.focusedRow.getKey())) {
if (dragCountElement == null) {
dragCountElement = Document.get().createStyleElement();
dragCountElement.setId(SP_DRAG_COUNT);
HeadElement head = HeadElement.as(Document.get().getElementsByTagName(HeadElement.TAG).getItem(0));
head.appendChild(dragCountElement);
}
SafeHtml formattedCssStyle = getDraggableTemplate().multiSelectionStyle(determineActiveTheme(drag),
String.valueOf(rowCount));
StyleElement dragCountStyleElement = StyleElement.as(dragCountElement);
dragCountStyleElement.setInnerSafeHtml(formattedCssStyle);
} else if (dragCountElement != null) {
dragCountElement.removeFromParent();
}
}
}
示例2: injectCornerStyle
import com.google.gwt.dom.client.StyleElement; //导入依赖的package包/类
private static Registration injectCornerStyle(String id, Cell cell) {
Color borderColor = cell.get(Cell.BORDER_COLOR);
String border = borderColor == null ? "none" : "1px solid " + borderColor.toCssColor();
Color backgroundColor = cell.get(Cell.BACKGROUND);
String background = backgroundColor == null ? Color.WHITE.toCssColor() : backgroundColor.toCssColor();
final StyleElement styleElement = StyleInjector.injectStylesheet("." + id
+ "::before { border-top: " + border + "; border-left: " + border + "; " +
"background: linear-gradient(135deg, " + background + " 0%, " + background
+ " 70%, rgba(0,0,0,0) 71%, rgba(0,0,0,0) 100%) }");
StyleInjector.flush();
return new Registration() {
@Override
protected void doRemove() {
styleElement.removeFromParent();
}
};
}
示例3: processMultiRowDragDecorationMultiSelection
import com.google.gwt.dom.client.StyleElement; //导入依赖的package包/类
@Test
@Description("Check multi row drag decoration with a valid multi selection")
public void processMultiRowDragDecorationMultiSelection() {
final ViewClientCriterion cut = new ViewClientCriterion();
// prepare table
final VScrollTable table = Mockito.spy(new VScrollTable());
table.selectedRowKeys.add("one");
table.selectedRowKeys.add("two");
table.focusedRow = Mockito.mock(VScrollTable.VScrollTableBody.VScrollTableRow.class);
when(table.focusedRow.getKey()).thenReturn("one");
// prepare drag-event with table widget:
final VDragEvent dragEvent = CriterionTestHelper.createMockedVDragEvent("thisId", table, "myTheme");
dragEvent.getTransferable().getDragSource().getConnection().getUIConnector();
// prepare document
final Document document = Document.get();
final StyleElement ele = Mockito.spy(StyleElement.class);
when(ele.getTagName()).thenReturn(StyleElement.TAG);
when(document.getElementById(ViewClientCriterion.SP_DRAG_COUNT)).thenReturn(ele);
try {
// act
cut.setMultiRowDragDecoration(dragEvent);
// assure that multi-row decoration for the table was processed
verify(document).getElementById(ViewClientCriterion.SP_DRAG_COUNT);
// assure that no multi selection was detected
verify(ele).setInnerSafeHtml(any(SafeHtml.class));
} finally {
reset(Document.get());
}
}
示例4: init
import com.google.gwt.dom.client.StyleElement; //导入依赖的package包/类
void init(Element css, Element header, Element footer) {
cssElement = StyleElement.as(css);
headerElement = header;
footerElement = footer;
cssText = getCssText(this.cssElement);
headerHtml = header.getInnerHTML();
footerHtml = footer.getInnerHTML();
}
示例5: handleStyling
import com.google.gwt.dom.client.StyleElement; //导入依赖的package包/类
private void handleStyling(String css) {
if ((css == null) || (css.length() == 0)) {
return;
}
if (isIE()) {
addStyleSheet(css);
} else {
// Append custom css style as last thing in the Head element
Element head = Document.get().getElementsByTagName("head").getItem(0);
StyleElement styleElement = Document.get().createStyleElement();
styleElement.setType("text/css");
styleElement.setInnerText(css);
head.appendChild(styleElement);
}
}
示例6: getCssText
import com.google.gwt.dom.client.StyleElement; //导入依赖的package包/类
@Override
protected String getCssText(StyleElement el) {
return el.getCssText();
}
示例7: setCssText
import com.google.gwt.dom.client.StyleElement; //导入依赖的package包/类
@Override
protected void setCssText(StyleElement el, String css) {
el.setCssText(css);
}
示例8: injectStyle
import com.google.gwt.dom.client.StyleElement; //导入依赖的package包/类
@Override
public StyleElement injectStyle(
Class<? extends HasStyleResources> bundle, Class<?>[] styles
) {
throw new UnsupportedOperationException();
}
示例9: registerStyle
import com.google.gwt.dom.client.StyleElement; //导入依赖的package包/类
@Override
public Out1<StyleElement> registerStyle(
Class<? extends HasStyleResources> bundle, String css, Class<?>[] styles
) {
throw new UnsupportedOperationException();
}