com.google.gwt.dom.client.PreElement Java Examples

The following examples show how to use com.google.gwt.dom.client.PreElement. 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: VDragCaptionProvider.java    From cuba with Apache License 2.0 5 votes vote down vote up
public Element getDragCaptionElement(Widget w) {
    ComponentConnector component = Util.findConnectorFor(w);
    DDLayoutState state = ((DragAndDropAwareState) root.getState()).getDragAndDropState();
    DragCaptionInfo dci = state.dragCaptions.get(component);

    Document document = Document.get();

    Element dragCaptionImage = document.createDivElement();
    Element dragCaption = document.createSpanElement();

    String dragCaptionText = dci.caption;
    if (dragCaptionText != null) {
        if (dci.contentMode == ContentMode.TEXT) {
            dragCaption.setInnerText(dragCaptionText);
        } else if (dci.contentMode == ContentMode.HTML) {
            dragCaption.setInnerHTML(dragCaptionText);
        } else if (dci.contentMode == ContentMode.PREFORMATTED) {
            PreElement preElement = document.createPreElement();
            preElement.setInnerText(dragCaptionText);
            dragCaption.appendChild(preElement);
        }
    }

    String dragIconKey = state.dragCaptions.get(component).iconKey;
    if (dragIconKey != null) {
        String resourceUrl = root.getResourceUrl(dragIconKey);
        Icon icon = component.getConnection().getIcon(resourceUrl);
        dragCaptionImage.appendChild(icon.getElement());
    }

    dragCaptionImage.appendChild(dragCaption);

    return dragCaptionImage;
}
 
Example #2
Source File: CodeOutputImpl.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
public CodeOutputImpl() {
	this.setElement(Document.get().createElement(PreElement.TAG));
	StyleUtils.addStyle(this, CodeOutputImpl.STYLE_CODE_EDITOR);
	StyleUtils.addStyle(this, CodeOutputImpl.STYLE_PRE_SCROLLABLE);
}