本文整理了Java中com.google.gwt.dom.client.Style.setHeight()
方法的一些代码示例,展示了Style.setHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Style.setHeight()
方法的具体详情如下:
包路径:com.google.gwt.dom.client.Style
类名称:Style
方法名:setHeight
[英]Set the height css property.
[中]设置高度css属性。
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
public StylesBuilder height(double value, Unit unit) {
delegate.assertCanAddStyleProperty().setHeight(value, unit);
return this;
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void onUpdate(double progress) {
double delta = (endSize - startSize) * progress;
double newSize = startSize + delta;
borderElement.getStyle().setHeight(newSize, Unit.PX);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Set the height in pixels of the scrollable content that the scrollbar
* controls.
*
* <p>
* This is not the same as the maximum scroll top position. The maximum scroll
* position equals the <code>scrollHeight- offsetHeight</code>;
*
* @param height the size height pixels
*/
public void setScrollHeight(int height) {
contentDiv.getStyle().setHeight(height, Unit.PX);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void onComplete() {
if (endSize == 0) {
borderElement.getStyle().setDisplay(Display.NONE);
return;
}
borderElement.getStyle().setHeight(endSize, Unit.PX);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void onUpdate(double progress) {
if (opening) {
double curHeight = progress * height;
animFrame.getStyle().setHeight(curHeight, Unit.PX);
} else {
double curHeight = (1.0 - progress) * height;
animFrame.getStyle().setHeight(curHeight, Unit.PX);
}
// Remind IE6 that we want the overflow to be hidden.
animFrame.getStyle().setOverflow(Overflow.HIDDEN);
animFrame.getStyle().setPosition(Position.RELATIVE);
}
代码示例来源:origin: kaaproject/kaa
} else {
requiredFieldsNoteLabel.setVisible(false);
requiredFieldsNoteLabel.getElement().getParentElement().getStyle().setHeight(0, Unit.PX);
代码示例来源:origin: com.google.gwt/gwt-servlet
public void onResize(ResizeEvent event) {
Style style = glass.getStyle();
int winWidth = Window.getClientWidth();
int winHeight = Window.getClientHeight();
// Hide the glass while checking the document size. Otherwise it would
// interfere with the measurement.
style.setDisplay(Display.NONE);
style.setWidth(0, Unit.PX);
style.setHeight(0, Unit.PX);
int width = Document.get().getScrollWidth();
int height = Document.get().getScrollHeight();
// Set the glass size to the larger of the window's client size or the
// document's scroll size.
style.setWidth(Math.max(width, winWidth), Unit.PX);
style.setHeight(Math.max(height, winHeight), Unit.PX);
// The size is set. Show the glass again.
style.setDisplay(Display.BLOCK);
}
};
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void onStart() {
if (opening) {
animFrame.getStyle().setHeight(1.0, Unit.PX);
animFrame.getStyle().setPosition(Position.RELATIVE);
animFrame.getStyle().clearDisplay();
height = contentContainer.getScrollHeight();
} else {
height = contentContainer.getOffsetHeight();
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Update the layout.
*/
private void forceLayout() {
// No sense in doing layout if we aren't attached or have no content.
if (!isAttached() || content == null) {
return;
}
// Resize the content area to fit between the header and footer.
int remainingHeight = getElement().getClientHeight();
if (header != null) {
int height = Math.max(0, headerContainer.getOffsetHeight());
remainingHeight -= height;
contentContainer.getStyle().setTop(height, Unit.PX);
} else {
contentContainer.getStyle().setTop(0.0, Unit.PX);
}
if (footer != null) {
remainingHeight -= footerContainer.getOffsetHeight();
}
contentContainer.getStyle().setHeight(Math.max(0, remainingHeight), Unit.PX);
// Provide resize to child.
if (content instanceof RequiresResize) {
((RequiresResize) content).onResize();
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
protected static DivElement createRuler(Unit widthUnit, Unit heightUnit) {
DivElement ruler = Document.get().createDivElement();
ruler.setInnerHTML(" ");
Style style = ruler.getStyle();
style.setPosition(Position.ABSOLUTE);
style.setZIndex(-32767);
// Position the ruler off the top edge, double the size just to be
// extra sure it doesn't show up on the screen.
style.setTop(-20, heightUnit);
// Note that we are making the ruler element 10x10, because some browsers
// generate non-integral ratios (e.g., 1em == 13.3px), so we need a little
// extra precision.
style.setWidth(10, widthUnit);
style.setHeight(10, heightUnit);
style.setVisibility(Visibility.HIDDEN);
State.HIDDEN.set(ruler, true);
return ruler;
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Redraw the widget.
*/
public void redraw() {
SafeHtmlBuilder sb = new SafeHtmlBuilder();
cell.render(createContext(), value, sb);
getElement().setInnerSafeHtml(sb.toSafeHtml());
/*
* The rendered Cell should fill the root element so height and width styles
* applied to the widget also apply to the Cell. If there is exactly one
* child element, the height and width are set to 100% to fill the parent.
*/
Element child = getElement().getFirstChildElement();
if (child != null && child.getNextSiblingElement() == null) {
child.getStyle().setHeight(100, Unit.PCT);
child.getStyle().setWidth(100, Unit.PCT);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
int height = offsetHeight + 100;
int width = offsetWidth + 100;
expandableInner.getStyle().setHeight(height, Unit.PX);
expandableInner.getStyle().setWidth(width, Unit.PX);
expandable.setScrollTop(height);
代码示例来源:origin: net.wetheinter/gwt-user
@Override
protected void onUpdate(double progress) {
double delta = (endSize - startSize) * progress;
double newSize = startSize + delta;
borderElement.getStyle().setHeight(newSize, Unit.PX);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
scrollLock.getStyle().setLeft(0, Unit.PX);
scrollLock.getStyle().setHeight(1, Unit.PX);
scrollLock.getStyle().setWidth(1, Unit.PX);
getElement().appendChild(scrollLock);
代码示例来源:origin: com.google.gwt/gwt-servlet
expandable.getStyle().setVisibility(Visibility.HIDDEN);
expandable.getStyle().setPosition(Position.ABSOLUTE);
expandable.getStyle().setHeight(100.0, Unit.PCT);
expandable.getStyle().setWidth(100.0, Unit.PCT);
expandable.getStyle().setOverflow(Overflow.SCROLL);
collapsible.getStyle().setVisibility(Visibility.HIDDEN);
collapsible.getStyle().setPosition(Position.ABSOLUTE);
collapsible.getStyle().setHeight(100.0, Unit.PCT);
collapsible.getStyle().setWidth(100.0, Unit.PCT);
collapsible.getStyle().setOverflow(Overflow.SCROLL);
collapsibleInner = Document.get().createDivElement().cast();
collapsibleInner.getStyle().setWidth(200, Unit.PCT);
collapsibleInner.getStyle().setHeight(200, Unit.PCT);
collapsible.appendChild(collapsibleInner);
DOM.sinkEvents(collapsible, Event.ONSCROLL);
代码示例来源:origin: com.google.gwt/gwt-servlet
int height = Math.max(Window.getClientHeight(),
Document.get().getScrollHeight());
glassElem.getStyle().setHeight(height, Unit.PX);
glassElem.getStyle().setWidth(width, Unit.PX);
Document.get().getBody().appendChild(glassElem);
代码示例来源:origin: com.google.gwt/gwt-servlet
public HeaderPanel() {
// Create the outer element
Element elem = Document.get().createDivElement().cast();
elem.getStyle().setPosition(Position.RELATIVE);
elem.getStyle().setOverflow(Overflow.HIDDEN);
setElement(elem);
// Create a delegate to handle resize from the header and footer.
ResizeLayoutPanel.Impl.Delegate resizeDelegate = new ResizeLayoutPanel.Impl.Delegate() {
public void onResize() {
scheduledLayout();
}
};
// Create the header container.
headerContainer = createContainer();
headerContainer.getStyle().setTop(0.0, Unit.PX);
headerImpl.init(headerContainer, resizeDelegate);
elem.appendChild(headerContainer);
// Create the footer container.
footerContainer = createContainer();
footerContainer.getStyle().setBottom(0.0, Unit.PX);
footerImpl.init(footerContainer, resizeDelegate);
elem.appendChild(footerContainer);
// Create the content container.
contentContainer = createContainer();
contentContainer.getStyle().setOverflow(Overflow.HIDDEN);
contentContainer.getStyle().setTop(0.0, Unit.PX);
contentContainer.getStyle().setHeight(0.0, Unit.PX);
elem.appendChild(contentContainer);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Recalculate the height and width of a native scrollbar.
*/
private static void maybeRecalculateNativeScrollbarSize() {
// Check if the size has already been calculated.
if (nativeHeight > -1) {
return;
}
// Create a scrollable element and attach it to the body.
Element scrollable = Document.get().createDivElement();
scrollable.getStyle().setPosition(Position.ABSOLUTE);
scrollable.getStyle().setTop(-1000.0, Unit.PX);
scrollable.getStyle().setLeft(-1000.0, Unit.PX);
scrollable.getStyle().setHeight(100.0, Unit.PX);
scrollable.getStyle().setWidth(100.0, Unit.PX);
scrollable.getStyle().setOverflow(Overflow.SCROLL);
scrollable.getStyle().setProperty("direction", "rtl");
Document.get().getBody().appendChild(scrollable);
// Add some content.
Element content = Document.get().createDivElement();
content.setInnerText("content");
scrollable.appendChild(content);
// Measure the height and width.
nativeHeight = scrollable.getOffsetHeight() - scrollable.getClientHeight();
nativeWidth = scrollable.getOffsetWidth() - scrollable.getClientWidth();
nativeRtl = (content.getAbsoluteLeft() > scrollable.getAbsoluteLeft());
// Detach the scrollable element.
scrollable.removeFromParent();
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-vaadin-common-widgets
private void setHeight() {
// Calculate decoration size
base.getStyle().setHeight(0, Unit.PX);
base.getStyle().setOverflow(Overflow.HIDDEN);
int h = getElement().getOffsetHeight();
if (h < MIN_SIZE) {
h = MIN_SIZE;
}
base.getStyle().setHeight(h, Unit.PX);
base.getStyle().clearOverflow();
}
代码示例来源:origin: org.eclipse.che.core/che-core-ide-app
/** {@inheritDoc} */
@Override
protected void onAttach() {
super.onAttach();
Style style = getElement().getParentElement().getStyle();
style.setHeight(100, PCT);
style.setWidth(100, PCT);
}
内容来源于网络,如有侵权,请联系作者删除!