List of usage examples for com.google.gwt.dom.client Style setHeight
public void setHeight(double value, Unit unit)
From source file:com.vaadin.client.VUIDLBrowser.java
License:Apache License
static void highlight(ComponentConnector paintable) { if (paintable != null) { Widget w = paintable.getWidget(); Style style = highlight.getStyle(); style.setTop(w.getAbsoluteTop(), Unit.PX); style.setLeft(w.getAbsoluteLeft(), Unit.PX); style.setWidth(w.getOffsetWidth(), Unit.PX); style.setHeight(w.getOffsetHeight(), Unit.PX); RootPanel.getBodyElement().appendChild(highlight); }//from ww w . j a va2s . com }
From source file:com.vaadin.client.widgets.JsniWorkaround.java
License:Apache License
/** * Creates a new Escalator widget instance. *//*from www .j av a2 s . c o m*/ public Escalator() { detectAndApplyPositionFunction(); getLogger().info("Using " + position.getClass().getSimpleName() + " for position"); final Element root = DOM.createDiv(); setElement(root); setupScrollbars(root); tableWrapper = DivElement.as(DOM.createDiv()); root.appendChild(tableWrapper); final Element table = DOM.createTable(); tableWrapper.appendChild(table); table.appendChild(headElem); table.appendChild(bodyElem); table.appendChild(footElem); Style hCornerStyle = headerDeco.getStyle(); hCornerStyle.setWidth(verticalScrollbar.getScrollbarThickness(), Unit.PX); hCornerStyle.setDisplay(Display.NONE); root.appendChild(headerDeco); Style fCornerStyle = footerDeco.getStyle(); fCornerStyle.setWidth(verticalScrollbar.getScrollbarThickness(), Unit.PX); fCornerStyle.setDisplay(Display.NONE); root.appendChild(footerDeco); Style hWrapperStyle = horizontalScrollbarDeco.getStyle(); hWrapperStyle.setDisplay(Display.NONE); hWrapperStyle.setHeight(horizontalScrollbar.getScrollbarThickness(), Unit.PX); root.appendChild(horizontalScrollbarDeco); setStylePrimaryName("v-escalator"); spacerDecoContainer.setAttribute("aria-hidden", "true"); // init default dimensions setHeight(null); setWidth(null); }
From source file:com.vaadin.terminal.gwt.client.ui.VAudio.java
License:Open Source License
@Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { if (client.updateComponent(this, uidl, true)) { return;// www. j a v a 2 s .co m } super.updateFromUIDL(uidl, client); Style style = audio.getStyle(); // Make sure that the controls are not clipped if visible. if (shouldShowControls(uidl) && (style.getHeight() == null || "".equals(style.getHeight()))) { if (BrowserInfo.get().isChrome()) { style.setHeight(32, Unit.PX); } else { style.setHeight(25, Unit.PX); } } }
From source file:com.vaadin.terminal.gwt.client.ui.VMenuBar.java
License:Open Source License
private int adjustPopupHeight(int top, final int shadowSpace) { // Check that the popup will fit the screen int availableHeight = RootPanel.getBodyElement().getOffsetHeight() - top - shadowSpace; int missingHeight = popup.getOffsetHeight() - availableHeight; if (missingHeight > 0) { // First move the top of the popup to get more space // Don't move above top of screen, don't move more than needed int moveUpBy = Math.min(top - shadowSpace, missingHeight); // Update state top -= moveUpBy;//from ww w. ja v a 2s .com missingHeight -= moveUpBy; availableHeight += moveUpBy; if (missingHeight > 0) { int contentWidth = visibleChildMenu.getOffsetWidth(); // If there's still not enough room, limit height to fit and add // a scroll bar Style style = popup.getElement().getStyle(); style.setHeight(availableHeight, Unit.PX); style.setOverflowY(Overflow.SCROLL); // Make room for the scroll bar by adjusting the width of the // popup style.setWidth(contentWidth + Util.getNativeScrollbarSize(), Unit.PX); popup.updateShadowSizeAndPosition(); } } return top; }
From source file:com.vaadin.terminal.gwt.client.VDebugConsole.java
License:Open Source License
public void init() { panel = new FlowPanel(); if (!quietMode) { DOM.appendChild(getContainerElement(), caption); setWidget(panel);/*from w ww . j a va 2 s . c o m*/ caption.setClassName("v-debug-console-caption"); setStyleName("v-debug-console"); getElement().getStyle().setZIndex(20000); getElement().getStyle().setOverflow(Overflow.HIDDEN); sinkEvents(Event.ONDBLCLICK); sinkEvents(Event.MOUSEEVENTS); panel.setStyleName("v-debug-console-content"); caption.setInnerHTML("Debug window"); caption.getStyle().setHeight(25, Unit.PX); caption.setTitle(help); show(); setToDefaultSizeAndPos(); actions = new HorizontalPanel(); Style style = actions.getElement().getStyle(); style.setPosition(Position.ABSOLUTE); style.setBackgroundColor("#666"); style.setLeft(135, Unit.PX); style.setHeight(25, Unit.PX); style.setTop(0, Unit.PX); actions.add(clear); actions.add(restart); actions.add(forceLayout); actions.add(analyzeLayout); actions.add(highlight); highlight.setTitle( "Select a component and print details about it to the server log and client side console."); actions.add(savePosition); savePosition.setTitle("Saves the position and size of debug console to a cookie"); actions.add(autoScroll); actions.add(hostedMode); if (Location.getParameter("gwt.codesvr") != null) { hostedMode.setValue(true); } hostedMode.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { if (hostedMode.getValue()) { addHMParameter(); } else { removeHMParameter(); } } private void addHMParameter() { UrlBuilder createUrlBuilder = Location.createUrlBuilder(); createUrlBuilder.setParameter("gwt.codesvr", "localhost:9997"); Location.assign(createUrlBuilder.buildString()); } private void removeHMParameter() { UrlBuilder createUrlBuilder = Location.createUrlBuilder(); createUrlBuilder.removeParameter("gwt.codesvr"); Location.assign(createUrlBuilder.buildString()); } }); autoScroll.setTitle("Automatically scroll so that new messages are visible"); panel.add(actions); panel.add(new HTML("<i>" + help + "</i>")); clear.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { int width = panel.getOffsetWidth(); int height = panel.getOffsetHeight(); panel = new FlowPanel(); panel.setPixelSize(width, height); panel.setStyleName("v-debug-console-content"); panel.add(actions); setWidget(panel); } }); restart.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { String queryString = Window.Location.getQueryString(); if (queryString != null && queryString.contains("restartApplications")) { Window.Location.reload(); } else { String url = Location.getHref(); String separator = "?"; if (url.contains("?")) { separator = "&"; } if (!url.contains("restartApplication")) { url += separator; url += "restartApplication"; } if (!"".equals(Location.getHash())) { String hash = Location.getHash(); url = url.replace(hash, "") + hash; } Window.Location.replace(url); } } }); forceLayout.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { // TODO for each client in appconf force layout // VDebugConsole.this.client.forceLayout(); } }); analyzeLayout.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { List<ApplicationConnection> runningApplications = ApplicationConfiguration .getRunningApplications(); for (ApplicationConnection applicationConnection : runningApplications) { applicationConnection.analyzeLayouts(); } } }); analyzeLayout.setTitle("Analyzes currently rendered view and " + "reports possible common problems in usage of relative sizes." + "Will cause server visit/rendering of whole screen and loss of" + " all non committed variables form client side."); savePosition.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { String pos = getAbsoluteLeft() + "," + getAbsoluteTop() + "," + getOffsetWidth() + "," + getOffsetHeight() + "," + autoScroll.getValue(); Cookies.setCookie(POS_COOKIE_NAME, pos); } }); highlight.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { final Label label = new Label("--"); log("<i>Use mouse to select a component or click ESC to exit highlight mode.</i>"); panel.add(label); highlightModeRegistration = Event.addNativePreviewHandler(new HighlightModeHandler(label)); } }); } log("Starting Vaadin client side engine. Widgetset: " + GWT.getModuleName()); log("Widget set is built on version: " + ApplicationConfiguration.VERSION); logToDebugWindow("<div class=\"v-theme-version v-theme-version-" + ApplicationConfiguration.VERSION.replaceAll("\\.", "_") + "\">Warning: widgetset version " + ApplicationConfiguration.VERSION + " does not seem to match theme version </div>", true); }
From source file:com.vaadin.terminal.gwt.client.VUIDLBrowser.java
License:Open Source License
static void highlight(Paintable paintable) { Widget w = (Widget) paintable;//from w w w.ja v a 2s . co m if (w != null) { Style style = highlight.getStyle(); style.setTop(w.getAbsoluteTop(), Unit.PX); style.setLeft(w.getAbsoluteLeft(), Unit.PX); style.setWidth(w.getOffsetWidth(), Unit.PX); style.setHeight(w.getOffsetHeight(), Unit.PX); RootPanel.getBodyElement().appendChild(highlight); } }
From source file:com.vaadin.v7.client.widgets.JsniWorkaround.java
License:Apache License
/** * Creates a new Escalator widget instance. *///from w ww. j a va2 s . c om public Escalator() { detectAndApplyPositionFunction(); getLogger().info("Using " + position.getClass().getSimpleName() + " for position"); final Element root = DOM.createDiv(); setElement(root); setupScrollbars(root); tableWrapper = DivElement.as(DOM.createDiv()); root.appendChild(tableWrapper); final Element table = DOM.createTable(); tableWrapper.appendChild(table); table.appendChild(headElem); table.appendChild(bodyElem); table.appendChild(footElem); Style hCornerStyle = headerDeco.getStyle(); hCornerStyle.setWidth(verticalScrollbar.getScrollbarThickness(), Unit.PX); hCornerStyle.setDisplay(Display.NONE); root.appendChild(headerDeco); Style fCornerStyle = footerDeco.getStyle(); fCornerStyle.setWidth(verticalScrollbar.getScrollbarThickness(), Unit.PX); fCornerStyle.setDisplay(Display.NONE); root.appendChild(footerDeco); Style hWrapperStyle = horizontalScrollbarDeco.getStyle(); hWrapperStyle.setDisplay(Display.NONE); hWrapperStyle.setHeight(horizontalScrollbar.getScrollbarThickness(), Unit.PX); root.appendChild(horizontalScrollbarDeco); setStylePrimaryName("v-escalator"); spacerDecoContainer.setAttribute("aria-hidden", "true"); // init default dimensions setHeight(null); setWidth(null); publishJSHelpers(root); }
From source file:edu.bsu.storygame.html.HtmlNativeTextField.java
License:Open Source License
@Override public void setBounds(IRectangle bounds) { Style style = element.getStyle(); style.setLeft(bounds.x(), Style.Unit.PX); style.setTop(bounds.y(), Style.Unit.PX); style.setWidth(bounds.width(), Style.Unit.PX); style.setHeight(bounds.height(), Style.Unit.PX); }
From source file:fi.jasoft.dragdroplayouts.client.ui.gridlayout.VDDGridLayout.java
License:Apache License
/** * Emphasizes a component container when user is hovering a dragged component over the container. * /*from w w w. j av a 2s . c om*/ * @param container The container * @param event */ protected void emphasis(CellDetails cell, VDragEvent event) { Style shadowStyle = dragShadow.getElement().getStyle(); shadowStyle.setPosition(Position.ABSOLUTE); shadowStyle.setWidth(cell.width, Unit.PX); shadowStyle.setHeight(cell.height, Unit.PX); shadowStyle.setLeft(cell.x, Unit.PX); shadowStyle.setTop(cell.y, Unit.PX); // Remove any existing empasis deEmphasis(); // Ensure we are not dragging ourself into ourself ComponentConnector draggedConnector = (ComponentConnector) event.getTransferable() .getData(Constants.TRANSFERABLE_DETAIL_COMPONENT); if (draggedConnector != null && draggedConnector.getWidget() == VDDGridLayout.this) { return; } HorizontalDropLocation hl = getHorizontalDropLocation(cell, event); VerticalDropLocation vl = getVerticalDropLocation(cell, event); // Apply over style UIObject.setStyleName(dragShadow.getElement(), OVER, true); // Add vertical location dependent style UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + vl.toString().toLowerCase(), true); // Add horizontal location dependent style UIObject.setStyleName(dragShadow.getElement(), OVER + "-" + hl.toString().toLowerCase(), true); }
From source file:forplay.html.HtmlImageLayerDom.java
License:Apache License
private void applySize() { Style style = element().getStyle(); style.setWidth(widthSet ? width : htmlImage.img.getWidth(), Unit.PX); style.setHeight(heightSet ? height : htmlImage.img.getHeight(), Unit.PX); if (sourceRectSet) { applyBackgroundSize();/* www. j av a2s .co m*/ } }