Java Code Examples for com.google.gwt.dom.client.Element#setClassName()
The following examples show how to use
com.google.gwt.dom.client.Element#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: CubaTreeTableWidget.java From cuba with Apache License 2.0 | 6 votes |
@Override protected void initCellWithText(String text, char align, String style, boolean textIsHTML, boolean sorted, String description, TableCellElement td) { super.initCellWithText(text, align, style, textIsHTML, sorted, description, td); Element tdElement = td.cast(); Tools.textSelectionEnable(tdElement, _delegate.textSelectionEnabled); if ((_delegate.clickableColumns != null && _delegate.clickableColumns.contains(currentColumnKey)) || (_delegate.clickableTableColumns != null && _delegate.clickableTableColumns.contains(currentColumnKey))) { tdElement.addClassName(CUBA_TABLE_CLICKABLE_CELL_CONTENT); Element wrapperElement = tdElement.getFirstChildElement(); final Element clickableSpan = DOM.createSpan().cast(); clickableSpan.setClassName(CUBA_TABLE_CLICKABLE_CELL_STYLE); clickableSpan.setInnerText(wrapperElement.getInnerText()); wrapperElement.removeAllChildren(); DOM.appendChild(wrapperElement, clickableSpan); } if (_delegate.multiLineCells) { Style wrapperStyle = tdElement.getFirstChildElement().getStyle(); wrapperStyle.setWhiteSpace(Style.WhiteSpace.PRE_LINE); } }
Example 2
Source File: Caption.java From incubator-retired-wave with Apache License 2.0 | 6 votes |
/** * Registers subclass with ContentElement */ public static void register(ElementHandlerRegistry registry) { registry.registerEventHandler(TAGNAME, CAPTION_EVENT_HANDLER); ParagraphRenderer renderer = new ParagraphRenderer( new DefaultParagraphHtmlRenderer("div") { @Override protected Element createNodelet(Renderable element) { Element e = super.createNodelet(element); e.setClassName("w-caption"); return e; } }); registry.registerMutationHandler(TAGNAME, renderer); // TODO(danilatos): Stop using non-html tags registry.registerRenderer(TAGNAME, renderer); }
Example 3
Source File: Caption.java From swellrt with Apache License 2.0 | 6 votes |
/** * Registers subclass with ContentElement */ public static void register(ElementHandlerRegistry registry) { registry.registerEventHandler(TAGNAME, CAPTION_EVENT_HANDLER); ParagraphRenderer renderer = new ParagraphRenderer( new DefaultParagraphHtmlRenderer("div") { @Override protected Element createNodelet(Renderable element) { Element e = super.createNodelet(element); e.setClassName("w-caption"); return e; } }); registry.registerMutationHandler(TAGNAME, renderer); // TODO(danilatos): Stop using non-html tags registry.registerRenderer(TAGNAME, renderer); }
Example 4
Source File: CubaTooltip.java From cuba with Apache License 2.0 | 6 votes |
protected void checkRequiredIndicatorVisible() { if (requiredIndicatorVisible == null) { Element requiredIndicatorFake = DOM.createDiv(); requiredIndicatorFake.setClassName(REQUIRED_INDICATOR); requiredIndicatorFake.getStyle().setPosition(Style.Position.ABSOLUTE); String rootPanelId = ac.getConfiguration().getRootPanelId(); Element rootPanel = Document.get().getElementById(rootPanelId); rootPanel.appendChild(requiredIndicatorFake); String display = new ComputedStyle(requiredIndicatorFake).getProperty("display"); requiredIndicatorVisible = !"none".equals(display); rootPanel.removeChild(requiredIndicatorFake); } }
Example 5
Source File: ToplevelToolbarWidget.java From swellrt with Apache License 2.0 | 5 votes |
public ToplevelToolbarWidget() { initWidget(BINDER.createAndBindUi(this)); overflowButton.setWidget(overflowSubmenu.hackGetWidget()); overflowSubmenu.addDebugClass("more"); // Build the "..." icon. Element icon = DOM.createDiv(); icon.setClassName(res.css().overflowButtonIcon()); overflowSubmenu.setVisualElement(icon); overflowSubmenu.setShowDivider(true); // Attach overflow logic. overflowLogic = new OverflowPanelUpdater(this); }
Example 6
Source File: GwtMockitoTest.java From gwtmockito with Apache License 2.0 | 5 votes |
@Test public void shouldReturnMocksFromNativeMethods() throws Exception { class SomeClass { private native Element getDocument() /*-{ return $doc; }-*/; } Element document = new SomeClass().getDocument(); document.setClassName("clazz"); verify(document).setClassName("clazz"); }
Example 7
Source File: ToplevelToolbarWidget.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
public ToplevelToolbarWidget() { initWidget(BINDER.createAndBindUi(this)); overflowButton.setWidget(overflowSubmenu.hackGetWidget()); overflowSubmenu.addDebugClass("more"); // Build the "..." icon. Element icon = DOM.createDiv(); icon.setClassName(res.css().overflowButtonIcon()); overflowSubmenu.setVisualElement(icon); overflowSubmenu.setShowDivider(true); // Attach overflow logic. overflowLogic = new OverflowPanelUpdater(this); }
Example 8
Source File: Editors.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
/** * Creates an editor. * * @return New Editor instance */ public static Editor create() { Element e = Document.get().createDivElement(); e.setClassName("editor"); return UserAgent.isMobileWebkit() ? // \u2620 new EditorImplWebkitMobile(true, e) : new EditorImpl(true, e); }
Example 9
Source File: AgentAdapter.java From incubator-retired-wave with Apache License 2.0 | 5 votes |
@Override public Element createDomImpl(Renderable element) { Element unknown = Document.get().createDivElement(); unknown.setClassName(css.unknown()); unknown.setInnerText("<" + element.getTagName() + ">"); DomHelper.setContentEditable(unknown, false, false); DomHelper.makeUnselectable(unknown); return unknown; }
Example 10
Source File: NavTreeWidgetView.java From dashbuilder with Apache License 2.0 | 5 votes |
protected void addItem(String iconClass, String id, String name, String description, Command onClicked) { Element nameEl = onClicked != null ? Document.get().createAnchorElement() : Document.get().createSpanElement(); nameEl.setInnerText(name); nameEl.setClassName(onClicked != null ? "uf-navtree-widget-non-clicked" : "uf-navtree-widget-non-clickable"); if (description != null && !description.equals(name)) { nameEl.setTitle(description); } SpanElement iconSpan = Document.get().createSpanElement(); iconSpan.setClassName("uf-navtree-widget-icon " + iconClass); DivElement div = Document.get().createDivElement(); div.appendChild(iconSpan); div.appendChild(nameEl); navWidget.appendChild((Node) div); itemMap.put(id, nameEl); if (onClicked != null) { Event.sinkEvents(nameEl, Event.ONCLICK); Event.setEventListener(nameEl, event -> { if (Event.ONCLICK == event.getTypeInt()) { onClicked.execute(); } }); } }
Example 11
Source File: Editors.java From swellrt with Apache License 2.0 | 5 votes |
/** * Creates an editor. * * @return New Editor instance */ public static Editor create() { Element e = Document.get().createDivElement(); e.setClassName("editor"); return UserAgent.isMobileWebkit() ? // \u2620 new EditorImplWebkitMobile(true, e) : new EditorImpl(true, e); }
Example 12
Source File: AgentAdapter.java From swellrt with Apache License 2.0 | 5 votes |
@Override public Element createDomImpl(Renderable element) { Element unknown = Document.get().createDivElement(); unknown.setClassName(css.unknown()); unknown.setInnerText("<" + element.getTagName() + ">"); DomHelper.setContentEditable(unknown, false, false); DomHelper.makeUnselectable(unknown); return unknown; }
Example 13
Source File: ContentBox.java From core with GNU Lesser General Public License v2.1 | 5 votes |
private void setIconClassname(String styleName) { NodeList<Element> i = dp.getElement().getElementsByTagName("i"); if (i.getLength() == 1) { Element iconElem = i.getItem(0); iconElem.setClassName(styleName); } }
Example 14
Source File: CubaTreeTableWidget.java From cuba with Apache License 2.0 | 5 votes |
public CubaTreeTableTableHead() { Element iconElement = presentationsEditIcon.getElement(); iconElement.setClassName("c-table-prefs-icon"); iconElement.getStyle().setDisplay(Style.Display.NONE); Element columnSelector = (Element) getElement().getLastChild(); DOM.insertChild(getElement(), iconElement, DOM.getChildIndex(getElement(), columnSelector)); DOM.sinkEvents(iconElement, Event.ONCLICK); }
Example 15
Source File: CubaFieldGroupLayoutComponentSlot.java From cuba with Apache License 2.0 | 5 votes |
protected Element createRightCaption() { Element rightCaption = DOM.createDiv(); getLayoutManager().registerDependency((ManagedLayout) getChild().getParent(), rightCaption); rightCaption.setClassName(VCaption.CLASSNAME); rightCaption.addClassName(INDICATORS_CLASSNAME); rightCaption.getStyle().setDisplay(Style.Display.INLINE_BLOCK); rightCaption.getStyle().setPosition(Style.Position.ABSOLUTE); return rightCaption; }
Example 16
Source File: ToolbarButtonViewBuilder.java From swellrt with Apache License 2.0 | 4 votes |
/** * Creates an icon Element from the CSS of the icon. */ private Element createIcon(String css) { Element sprite = DOM.createDiv(); sprite.setClassName(css); return sprite; }
Example 17
Source File: LabelRenderingMutationHandler.java From incubator-retired-wave with Apache License 2.0 | 4 votes |
@Override public Element createDomImpl(Renderable element) { Element label = Document.get().createLabelElement(); label.setClassName(css.label()); return element.setAutoAppendContainer(label); }
Example 18
Source File: LabelRenderingMutationHandler.java From swellrt with Apache License 2.0 | 4 votes |
@Override public Element createDomImpl(Renderable element) { Element label = Document.get().createLabelElement(); label.setClassName(css.label()); return element.setAutoAppendContainer(label); }
Example 19
Source File: AceEditorConnector.java From cuba with Apache License 2.0 | 4 votes |
@Override public void onStateChanged(StateChangeEvent stateChangeEvent) { super.onStateChanged(stateChangeEvent); setTextChangeEventMode(getState().changeMode); setTextChangeTimeout(getState().changeTimeout); ClientSideDocDiff.dmp.setDiff_EditCost(getState().diff_editCost); // TODO: are these needed? // widget.setHideErrors(getState().hideErrors); // widget.setRequired(getState().required); // widget.setModified(getState().modified); boolean firstTime = !getWidget().isInitialized(); if (firstTime) { // To make sure Ace config is applied before the editor is created, // we delay the initialization till then first call to onStateChanged, // not initializing in createWidget() right away. applyConfig(getState().config); getWidget().initialize(); } getWidget().setMode(getState().mode); getWidget().setTheme(getState().theme); listenToSelectionChanges = getState().listenToSelectionChanges; listenToFocusChanges = getState().listenToFocusChanges; getWidget().setUseWorker(getState().useWorker); getWidget().setWordwrap(getState().wordwrap); getWidget().setShowGutter(getState().showGutter); getWidget().setShowPrintMargin(getState().showPrintMargin); getWidget().setHighlightActiveLineEnabled(getState().highlightActiveLine); getWidget().setEnabled(getState().enabled); // getWidget().setPropertyReadOnly(getState().propertyReadOnly); getWidget().setTabIndex(getState().tabIndex); getWidget().setReadOnly(getState().readOnly); if (stateChangeEvent.hasPropertyChanged("fontSize")) { String fontSize = getState().fontSize; if ("auto".equals(fontSize)) { // detect font size from CSS Element fontSizeMeasureElement = Document.get().createDivElement(); fontSizeMeasureElement.setClassName("ace_editor"); fontSizeMeasureElement.getStyle().setPosition(Style.Position.FIXED); fontSizeMeasureElement.getStyle().setVisibility(Style.Visibility.HIDDEN); getWidget().getElement().appendChild(fontSizeMeasureElement); ComputedStyle cs = new ComputedStyle(fontSizeMeasureElement); fontSize = cs.getProperty("fontSize"); getWidget().getElement().removeChild(fontSizeMeasureElement); } getWidget().setFontSize(fontSize); } getWidget().setHighlightSelectedWord(getState().highlightSelectedWord); getWidget().setShowInvisibles(getState().showInvisibles); getWidget().setDisplayIndentGuides(getState().displayIndentGuides); getWidget().setUseSoftTabs(getState().softTabs); getWidget().setTabSize(getState().tabSize); // TODO: How should we deal with immediateness. Since there's already textChangeEventMode... //immediate = getState().immediate; if (firstTime) { shadow = AceDoc.fromTransport(getState().initialValue); getWidget().setDoc(shadow); } if (getState().selection != null) { AceRange sel = AceRange.fromTransport(getState().selection); if (firstTime) { getWidget().setSelection(sel); } else { selectionAfterApplyingDiff = sel; } } if (getState().scrollToRow != -1) { if (firstTime) { getWidget().scrollToRow(getState().scrollToRow); } else { scrollToRowAfterApplyingDiff = getState().scrollToRow; } } }
Example 20
Source File: ToolbarButtonViewBuilder.java From incubator-retired-wave with Apache License 2.0 | 4 votes |
/** * Creates an icon Element from the CSS of the icon. */ private Element createIcon(String css) { Element sprite = DOM.createDiv(); sprite.setClassName(css); return sprite; }