本文整理了Java中com.vaadin.flow.dom.Element.getStyle()
方法的一些代码示例,展示了Element.getStyle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getStyle()
方法的具体详情如下:
包路径:com.vaadin.flow.dom.Element
类名称:Element
方法名:getStyle
[英]Gets the style instance for managing element inline styles.
[中]获取用于管理元素内联样式的样式实例。
代码示例来源:origin: com.vaadin/flow-server
/**
* Gets the style instance for managing inline styles for the element of
* this component.
*
* @return the style object for the element, not <code>null</code>
*/
default Style getStyle() {
return getElement().getStyle();
}
代码示例来源:origin: com.vaadin/flow-server
@Override
public void removeAttribute(Element element) {
element.getStyle().clear();
}
}
代码示例来源:origin: com.vaadin/flow-server
@Override
public boolean hasAttribute(Element element) {
return element.getStyle().getNames().findAny().isPresent();
}
代码示例来源:origin: com.vaadin/vaadin-split-layout-flow
private void setInnerComponentStyle(Component innerComponent,
String styleName, String value) {
Optional.ofNullable(innerComponent).ifPresent(component -> component
.getElement().getStyle().set(styleName, value));
}
}
代码示例来源:origin: com.vaadin/flow-server
/**
*
* Gets the width defined for the component.
* <p>
* Note that this does not return the actual size of the component but the
* width which has been set using {@link #setWidth(String)}.
*
* @return the width which has been set for the component
*/
default String getWidth() {
return getElement().getStyle().get(ElementConstants.STYLE_WIDTH);
}
代码示例来源:origin: com.vaadin/flow-server
/**
* Gets the max-height defined for the component.
* <p>
* Note that this does not return the actual size of the component but the
* max-height which has been set using {@link #setMaxHeight(String)}.
*
* @return the max-height which has been set for the component
*/
default String getMaxHeight() {
return getElement().getStyle().get(ElementConstants.STYLE_MAX_HEIGHT);
}
代码示例来源:origin: com.vaadin/flow-server
/**
* Gets the height defined for the component.
* <p>
* Note that this does not return the actual size of the component but the
* height which has been set using {@link #setHeight(String)}.
*
* @return the height which has been set for the component
*/
default String getHeight() {
return getElement().getStyle().get(ElementConstants.STYLE_HEIGHT);
}
代码示例来源:origin: com.vaadin/flow-server
/**
* Gets the min-height defined for the component.
* <p>
* Note that this does not return the actual size of the component but the
* min-height which has been set using {@link #setMinHeight(String)}.
*
* @return the min-height which has been set for the component
*/
default String getMinHeight() {
return getElement().getStyle().get(ElementConstants.STYLE_MIN_HEIGHT);
}
代码示例来源:origin: com.vaadin/flow-server
/**
*
* Gets the max-width defined for the component.
* <p>
* Note that this does not return the actual size of the component but the
* max-width which has been set using {@link #setMaxWidth(String)}.
*
* @return the max-width which has been set for the component
*/
default String getMaxWidth() {
return getElement().getStyle().get(ElementConstants.STYLE_MAX_WIDTH);
}
代码示例来源:origin: com.vaadin/flow-data
private static void setVisible(HasText label, boolean visible) {
if (visible) {
label.getElement().getStyle().remove("display");
} else {
label.getElement().getStyle().set("display", "none");
}
}
代码示例来源:origin: appreciated/vaadin-app-layout
@Override
public void add(Component... components) {
Arrays.stream(components).forEach(component -> component.getElement().getStyle().set("flex-shrink", "0"));
menu.add(components);
}
代码示例来源:origin: com.vaadin/flow-server
/**
*
* Gets the min-width defined for the component.
* <p>
* Note that this does not return the actual size of the component but the
* min-width which has been set using {@link #setMinWidth(String)}.
*
* @return the min-width which has been set for the component
*/
default String getMinWidth() {
return getElement().getStyle().get(ElementConstants.STYLE_MIN_WIDTH);
}
代码示例来源:origin: com.vaadin/flow-component-demo-helpers
private Element getSpacer() {
Element spacer = ElementFactory.createDiv();
spacer.getStyle().set("marginTop", "10px");
return spacer;
}
}
代码示例来源:origin: com.vaadin/incubator-tooltip-flow
/**
* Default constructor.
*/
public Tooltip() {
getElement().getStyle().set("margin", "0px");
}
代码示例来源:origin: com.vaadin/flow-server
@Override
public String getAttribute(Element element) {
if (!hasAttribute(element)) {
return null;
}
Style style = element.getStyle();
return style.getNames().map(styleName -> {
return StyleUtil.stylePropertyToAttribute(styleName) + ":"
+ style.get(styleName);
}).collect(Collectors.joining(";"));
}
代码示例来源:origin: com.vaadin/flow-server
@Override
public void setAttribute(Element element, String attributeValue) {
Style style = element.getStyle();
style.clear();
parseStyles(attributeValue).forEach(style::set);
}
代码示例来源:origin: appreciated/vaadin-app-layout
public PaperTab(String caption, Icon icon) {
setId("my-paper-tab");
add(icon);
setText(caption);
getElement().getStyle().set("font-size", "var(--app-layout-font-size-app-bar)");
}
代码示例来源:origin: appreciated/vaadin-app-layout
public RoundImage(String icon, String width, String height) {
super(icon, "Icon");
setWidth(width);
setHeight(height);
getElement().getStyle().set("border-radius", "100%");
setId("menu-header-image");
}
}
代码示例来源:origin: appreciated/vaadin-app-layout
public AppMenuIconItem() {
setWidth("100%");
setHeight("var(--app-layout-menu-button-height)");
getElement().getStyle().set("line-height", "var(--app-layout-menu-button-height)");
getElement().addEventListener("click", domEvent -> {
if (this.listener != null) {
this.listener.onComponentEvent(new ClickEvent<>(this));
}
});
}
代码示例来源:origin: appreciated/vaadin-app-layout
public AppLayoutRouterLayout() {
appLayout = createAppLayoutInstance();
setLayoutToSession();
getContent().add(appLayout);
getContent().setSizeFull();
getContent().getElement().getStyle().set("overflow", "auto");
}
内容来源于网络,如有侵权,请联系作者删除!