Java Code Examples for com.google.gwt.dom.client.DivElement#setClassName()
The following examples show how to use
com.google.gwt.dom.client.DivElement#setClassName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CajolerFacade.java From swellrt with Apache License 2.0 | 6 votes |
private void appendToDocument(HTML target, PluginContext pluginContext, CajolerResponse response) { DivElement domitaVdocElement = Document.get().createDivElement(); domitaVdocElement.setClassName("innerHull"); target.getElement().setInnerHTML(""); target.getElement().setClassName("outerHull"); target.getElement().appendChild(domitaVdocElement); initializeDoodadEnvironment( cajaFrame, domitaVdocElement, pluginContext.getJSOInterface()); // Render HTML domitaVdocElement.setInnerHTML(response.getHtml()); // Inject JS Document cajaFrameDoc = cajaFrame.getContentDocument(); cajaFrameDoc.getBody().appendChild(cajaFrameDoc.createScriptElement(response.getJs())); }
Example 2
Source File: DomLogger.java From swellrt with Apache License 2.0 | 6 votes |
/** * Appends an entry to the log panel. * @param formatted * @param level */ public static void appendEntry(String formatted, Level level) { DivElement entry = Document.get().createDivElement(); entry.setClassName(RESOURCES.css().entry()); entry.setInnerHTML(formatted); // Add the style name associated with the log level. switch (level) { case ERROR: entry.addClassName(RESOURCES.css().error()); break; case FATAL: entry.addClassName(RESOURCES.css().fatal()); break; case TRACE: entry.addClassName(RESOURCES.css().trace()); break; } // Make fatals detectable by WebDriver, so that tests can early out on // failure: if (level.equals(Level.FATAL)) { latestFatalError = formatted; } writeOrCacheOutput(entry); }
Example 3
Source File: DomLogger.java From incubator-retired-wave with Apache License 2.0 | 6 votes |
/** * Appends an entry to the log panel. * @param formatted * @param level */ public static void appendEntry(String formatted, Level level) { DivElement entry = Document.get().createDivElement(); entry.setClassName(RESOURCES.css().entry()); entry.setInnerHTML(formatted); // Add the style name associated with the log level. switch (level) { case ERROR: entry.addClassName(RESOURCES.css().error()); break; case FATAL: entry.addClassName(RESOURCES.css().fatal()); break; case TRACE: entry.addClassName(RESOURCES.css().trace()); break; } // Make fatals detectable by WebDriver, so that tests can early out on // failure: if (level.equals(Level.FATAL)) { latestFatalError = formatted; } writeOrCacheOutput(entry); }
Example 4
Source File: CajolerFacade.java From incubator-retired-wave with Apache License 2.0 | 6 votes |
private void appendToDocument(HTML target, PluginContext pluginContext, CajolerResponse response) { DivElement domitaVdocElement = Document.get().createDivElement(); domitaVdocElement.setClassName("innerHull"); target.getElement().setInnerHTML(""); target.getElement().setClassName("outerHull"); target.getElement().appendChild(domitaVdocElement); initializeDoodadEnvironment( cajaFrame, domitaVdocElement, pluginContext.getJSOInterface()); // Render HTML domitaVdocElement.setInnerHTML(response.getHtml()); // Inject JS Document cajaFrameDoc = cajaFrame.getContentDocument(); cajaFrameDoc.getBody().appendChild(cajaFrameDoc.createScriptElement(response.getJs())); }
Example 5
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 5 votes |
private int calculateResolutionMinWidth() { boolean removeResolutionDiv = false; if (!resolutionDiv.hasParentElement()) { removeResolutionDiv = true; getElement().appendChild(resolutionDiv); } DivElement resBlockMeasure = DivElement.as(DOM.createDiv()); if (resolution == Resolution.Week) { // configurable with '.col.w.measure' selector resBlockMeasure.setClassName(STYLE_COL + " " + STYLE_WEEK + " " + STYLE_MEASURE); } else { // measure for text 'MM' resBlockMeasure.setInnerText("MM"); // configurable with '.col.measure' selector resBlockMeasure.setClassName(STYLE_COL + " " + STYLE_MEASURE); } resolutionDiv.appendChild(resBlockMeasure); int width = resBlockMeasure.getClientWidth(); if (resolution == Resolution.Week) { // divide given width by number of days in week width = width / DAYS_IN_WEEK; } width = (width < resolutionWeekDayblockWidth) ? resolutionWeekDayblockWidth : width; resBlockMeasure.removeFromParent(); if (removeResolutionDiv) { resolutionDiv.removeFromParent(); } return width; }
Example 6
Source File: PerspectivesExplorerView.java From dashbuilder with Apache License 2.0 | 5 votes |
private DivElement createItemDiv(Element[] items) { DivElement mi = Document.get().createDivElement(); mi.setClassName("list-view-pf-main-info"); mi.getStyle().setPaddingTop(5, Style.Unit.PX); mi.getStyle().setPaddingBottom(5, Style.Unit.PX); for (Element item : items) { mi.appendChild(item); } DivElement gi = Document.get().createDivElement(); gi.setClassName("list-group-item"); gi.appendChild(mi); return gi; }
Example 7
Source File: AbstractStepWidget.java From gantt with Apache License 2.0 | 5 votes |
public AbstractStepWidget() { DivElement bar = DivElement.as(DOM.createDiv()); bar.setClassName(STYLE_BAR); setElement(bar); caption = DivElement.as(DOM.createDiv()); caption.setClassName(STYLE_BAR_LABEL); bar.appendChild(caption); // hide by default bar.getStyle().setVisibility(Visibility.HIDDEN); }
Example 8
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 5 votes |
private DivElement createSpacerBlock(String className) { DivElement block = DivElement.as(DOM.createDiv()); block.setClassName(STYLE_ROW + " " + STYLE_YEAR); block.addClassName(STYLE_SPACER); block.setInnerText(" "); block.getStyle().setDisplay(Display.NONE); // not visible by default spacerBlocks.add(block); return block; }
Example 9
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 5 votes |
private DivElement createTimelineBlock(String key, String text, String styleSuffix, BlockRowData rowData) { DivElement div = DivElement.as(DOM.createDiv()); div.setClassName(STYLE_ROW + " " + styleSuffix); div.setInnerText(text); rowData.setBlockLength(key, 1); rowData.setBlock(key, div); return div; }
Example 10
Source File: MobileUniversalPopup.java From incubator-retired-wave with Apache License 2.0 | 4 votes |
/** Helper function to create a DivElement with a given style name */ private Element createDiv(String style) { DivElement x = Document.get().createDivElement(); x.setClassName(style); return (Element) Element.as(x); }
Example 11
Source File: VPopupButton.java From cuba with Apache License 2.0 | 4 votes |
public VPopupButton() { super(); DivElement e = Document.get().createDivElement(); e.setClassName(POPUP_INDICATOR_CLASSNAME); getElement().getFirstChildElement().appendChild(e); }
Example 12
Source File: TimelineWidget.java From gantt with Apache License 2.0 | 4 votes |
private DivElement createResolutionBlock() { DivElement resBlock = DivElement.as(DOM.createDiv()); resBlock.setClassName("col"); return resBlock; }
Example 13
Source File: OverlayExample.java From gwt-ol with Apache License 2.0 | 4 votes |
@Override public void show(String exampleId) { // create a OSM-layer XyzOptions osmSourceOptions = OLFactory.createOptions(); Osm osmSource = new Osm(osmSourceOptions); LayerOptions osmLayerOptions = OLFactory.createOptions(); osmLayerOptions.setSource(osmSource); Tile osmLayer = new Tile(osmLayerOptions); // create a view View view = new View(); Coordinate centerCoordinate = OLFactory.createCoordinate(2.3, 51.507222); Coordinate transformedCenterCoordinate = Projection.transform(centerCoordinate, DemoConstants.EPSG_4326, DemoConstants.EPSG_3857); view.setCenter(transformedCenterCoordinate); view.setZoom(10); // create the map MapOptions mapOptions = OLFactory.createOptions(); mapOptions.setTarget(exampleId); mapOptions.setView(view); Map map = new Map(mapOptions); map.addLayer(osmLayer); // add some controls map.addControl(OLFactory.createScaleLine()); DemoUtils.addDefaultControls(map.getControls()); Attribution attribution = new Attribution(); attribution.setCollapsed(true); map.addControl(attribution); // add some interactions map.addInteraction(OLFactory.createKeyboardPan()); map.addInteraction(OLFactory.createKeyboardZoom()); DivElement overlay = Document.get().createDivElement(); overlay.setClassName("overlay-font"); overlay.setInnerText("Created with GWT SDK " + GWT.getVersion()); OverlayOptions overlayOptions = OLFactory.createOptions(); overlayOptions.setElement(overlay); overlayOptions.setPosition(transformedCenterCoordinate); overlayOptions.setOffset(OLFactory.createPixel(-300, 0)); map.addOverlay(new Overlay(overlayOptions)); }
Example 14
Source File: MobileUniversalPopup.java From swellrt with Apache License 2.0 | 4 votes |
/** Helper function to create a DivElement with a given style name */ private Element createDiv(String style) { DivElement x = Document.get().createDivElement(); x.setClassName(style); return (Element) Element.as(x); }
Example 15
Source File: VSliderPanel.java From vaadin-sliderpanel with MIT License | 4 votes |
public VSliderPanel() { super(); // main wrapper of the component this.wrapperNode = Document.get() .createDivElement(); this.wrapperNode.setClassName(VSliderPanel.CLASSNAME + "-wrapper"); getElement().appendChild(this.wrapperNode); // container that holds the content this.contentNode = Document.get() .createDivElement(); this.contentNode.setClassName(VSliderPanel.CLASSNAME + "-content"); this.contentNode.getStyle() .setDisplay(Display.BLOCK); this.wrapperNode.appendChild(this.contentNode); // wrapper for collapsed content line, tab with caption and icon this.navigationElem = Document.get() .createDivElement(); this.navigationElem.setClassName(VSliderPanel.CLASSNAME + "-navigator"); this.tabElem = Document.get() .createDivElement(); this.tabElem.setClassName(VSliderPanel.CLASSNAME + "-tab"); this.navigationElem.appendChild(this.tabElem); this.captionNode = Document.get() .createDivElement(); this.captionNode.setClassName(VSliderPanel.CLASSNAME + "-caption"); this.tabElem.appendChild(this.captionNode); DivElement toggleLabel = Document.get() .createDivElement(); toggleLabel.setClassName(VSliderPanel.CLASSNAME + "-icon"); this.tabElem.appendChild(toggleLabel); DOM.sinkEvents(this.tabElem, Event.ONCLICK); this.wrapperNode.appendChild(this.navigationElem); Event.addNativePreviewHandler(this); }
Example 16
Source File: DomHelper.java From swellrt with Apache License 2.0 | 2 votes |
/** * Create a div with the given style name set. Convenience method because * this is such a common task * @param styleName * @return The created div element */ public static DivElement createDivWithStyle(String styleName) { DivElement d = Document.get().createDivElement(); d.setClassName(styleName); return d; }
Example 17
Source File: DomHelper.java From incubator-retired-wave with Apache License 2.0 | 2 votes |
/** * Create a div with the given style name set. Convenience method because * this is such a common task * @param styleName * @return The created div element */ public static DivElement createDivWithStyle(String styleName) { DivElement d = Document.get().createDivElement(); d.setClassName(styleName); return d; }