List of usage examples for com.google.gwt.user.client DOM setIntStyleAttribute
public static void setIntStyleAttribute(Element elem, String attr, int value)
From source file:asquare.gwt.sb.client.fw.CellRendererDefault.java
License:Apache License
public void prepareElement(Element viewElement, Object modelElement, CellProperties properties) { // set cell class name(s) StringBuilder styleName = new StringBuilder(); buildStyleName(styleName, modelElement, properties); if (!styleName.equals(DOM.getElementProperty(viewElement, "className"))) { DOM.setElementProperty(viewElement, "className", styleName.toString()); }/*from ww w . jav a 2 s. com*/ // set cell CSS properties if (m_styleRules != null) { for (int i = 0, size = m_styleRules.getSize(); i < size; i++) { String property = m_styleRules.getRendererProperty(i); if (property == null || properties.getBoolean(property)) { Object value = m_styleRules.getValue(i); if (value instanceof String) { DOM.setStyleAttribute(viewElement, m_styleRules.getName(i), (String) value); } else if (value instanceof Integer) { DOM.setIntStyleAttribute(viewElement, m_styleRules.getName(i), ((Integer) value).intValue()); } else { assert false; } } else { DOM.setStyleAttribute(viewElement, m_styleRules.getName(i), ""); } } } }
From source file:asquare.gwt.tk.client.util.DomUtil.java
License:Apache License
/** * Sets a CSS style property for the specified UIObject's element. * //from w w w.ja va2s.c o m * @param uio a UIObject * @param name a CSS style property name, in "camelCase" * @param value an int value */ public static void setIntStyleAttribute(UIObject uio, String name, int value) { DOM.setIntStyleAttribute(uio.getElement(), name, value); }
From source file:com.extjs.gxt.ui.client.widget.FramePanel.java
License:sencha.com license
/** * Sets the z-index of the panel.// w w w . ja v a 2 s . com * * @param index the z index */ public void setZIndex(int index) { index = Math.max(1, index); if (GXT.isIE) { setZIndexIE(index); } else { DOM.setIntStyleAttribute(getElement(), "zIndex", index); } }
From source file:com.google.livingstories.client.util.SquareImage.java
License:Apache License
private void addImage() { double aspectRatio = (double) originalWidth / originalHeight; if (aspectRatio < 1) { // Vertical image int newHeight = (int) (size / aspectRatio); image.setPixelSize(size, newHeight); int clipStart = (newHeight - size) / 2; DOM.setIntStyleAttribute(image.getElement(), "top", -clipStart); } else {//from w w w . ja v a 2 s . c o m int newWidth = (int) (size * aspectRatio); image.setPixelSize(newWidth, size); int clipStart = (newWidth - size) / 2; DOM.setIntStyleAttribute(image.getElement(), "left", -clipStart); } container.setWidget(image); }
From source file:com.googlecode.gchart.client.GChart.java
License:Apache License
private static void setFontSize(UIObject uio, int fontSize) { DOM.setIntStyleAttribute(uio.getElement(), "fontSize", fontSize); }
From source file:com.gwttest.client.test.Snippet.java
License:Open Source License
/** * Creates a ChartWidget with the specified z-index. * /*from www . ja va 2 s. c o m*/ * @param zIndex * @return */ public ChartWidget createChartWidget(int zIndex) { /* Create a ChartWidget */ ChartWidget chartWidget = new ChartWidget(); ChartData chartData = new ChartData(); XAxis x_axis = new XAxis(); chartData.setXAxis(x_axis); YAxis y_axis = new YAxis(); y_axis.setRange(0, 5, 1); chartData.setYAxis(y_axis); // Add a fake scatter chart BarChart sc = new BarChart(BarChart.BarStyle.GLASS); sc.setTooltip("Spoon {#val#}<br>Title Bar 2"); for (int i = 0; i < 10; i++) { // Generate a random value double randomValue = Random.nextDouble() * 5; // Add the generated value in the chart sc.addValues(randomValue); } ToolTip tooltip = new ToolTip(); tooltip.setStroke(0); tooltip.setTitlestyle("{font-size: 12px;font-weight: bold; color: #CC2A43;}"); tooltip.setBodystyle("{font-size: 10px; color: #123456; }"); tooltip.setColour("#ffffff"); tooltip.setBackgroundcolour("#888888"); chartData.setTooltipStyle(tooltip); chartData.addElements(sc); chartWidget.setChartData(chartData); DOM.setStyleAttribute(chartWidget.getElement(), "position", "absolute"); DOM.setStyleAttribute(chartWidget.getElement(), "width", "80%"); DOM.setStyleAttribute(chartWidget.getElement(), "height", "80%"); DOM.setStyleAttribute(chartWidget.getElement(), "top", "10%"); DOM.setStyleAttribute(chartWidget.getElement(), "left", "10%"); DOM.setIntStyleAttribute(chartWidget.getElement(), "zIndex", zIndex); return chartWidget; }
From source file:com.gwttest.client.test.Snippet.java
License:Open Source License
/** * Creates a SimplePanel which contains a GraphWidget. * /*from w w w.j av a 2 s. c o m*/ * @param widthel * @param height * @param top * @param left * @param backgroundColor * @param zIndex * @return */ public SimplePanel createSimplePanel(int width, int height, int top, int left, String backgroundColor, int zIndex) { SimplePanel simplePanel = new SimplePanel(); DOM.setStyleAttribute(simplePanel.getElement(), "position", "absolute"); DOM.setStyleAttribute(simplePanel.getElement(), "width", width + "px"); DOM.setStyleAttribute(simplePanel.getElement(), "height", height + "px"); DOM.setStyleAttribute(simplePanel.getElement(), "top", top + "px"); DOM.setStyleAttribute(simplePanel.getElement(), "left", left + "px"); DOM.setStyleAttribute(simplePanel.getElement(), "backgroundColor", backgroundColor); DOM.setIntStyleAttribute(simplePanel.getElement(), "zIndex", zIndex); // Add a GraphWidget into this panel with a z-index at panel's z-index + // 1 simplePanel.add(this.createChartWidget(zIndex + 1)); return simplePanel; }
From source file:com.lofidewanto.demo.client.common.AbstractMethodCallback.java
License:Apache License
public void setZindex(LoadingMessagePopupPanel loadingMessagePopupPanel) { // This brings the popup panel to front // http://stackoverflow.com/questions/10068633/popuppanel-show-up-beneath-the-widget DOM.setIntStyleAttribute(loadingMessagePopupPanel.getElement(), "zIndex", Z_INDEX); }
From source file:com.objetdirect.gwt.umlapi.client.contrib.PopupMenu.java
License:Apache License
/** * Constructor of PopupMenu//from ww w. j av a2s .c om * */ public PopupMenu() { super(true, false, "menuPopup", AnimationType.ONE_WAY_CORNER); this.menu = new MenuBar(true) { private boolean canClose = true; /* * (non-Javadoc) * * @see com.google.gwt.user.client.ui.MenuBar#onBrowserEvent(com.google.gwt.user.client.Event) */ @Override public void onBrowserEvent(final Event event) { switch (DOM.eventGetType(event)) { case Event.ONMOUSEOVER: { this.canClose = false; break; } case Event.ONMOUSEOUT: { this.canClose = true; break; } } super.onBrowserEvent(event); } @SuppressWarnings("deprecation") @Override public void onPopupClosed(final PopupPanel sender, final boolean autoClosed) { super.onPopupClosed(sender, autoClosed); // If the menu popup was not auto-closed, close popup menu.. if (!autoClosed) { if (this.canClose) { PopupMenu.this.hide(); } } } }; this.menu.setAutoOpen(true); this.add(this.menu); this.setAnimationEnabled(true); this.sinkEvents(Event.ONCLICK); this.setStyleName("gwt-MenuBarPopup"); // Issue 5 fix (ggeorg) DOM.setIntStyleAttribute(this.getElement(), "zIndex", Integer.MAX_VALUE); }
From source file:com.sencha.gxt.core.client.dom.XElement.java
License:sencha.com license
/** * Sets the element's z-index.//from w w w.j a va 2s. c o m * * @param zIndex the z-index value */ public final void setZIndex(int zIndex) { DOM.setIntStyleAttribute(this, "zIndex", Math.max(0, zIndex)); }