Java Code Examples for com.google.gwt.user.client.DOM#appendChild()
The following examples show how to use
com.google.gwt.user.client.DOM#appendChild() .
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: SuggestionsContainer.java From cuba with Apache License 2.0 | 6 votes |
public SuggestionsContainer(CubaSuggestionFieldWidget suggestionFieldWidget) { this.suggestionFieldWidget = suggestionFieldWidget; container = DOM.createDiv(); final Element outer = FocusImpl.getFocusImplForPanel().createFocusable(); DOM.appendChild(outer, container); setElement(outer); sinkEvents(Event.ONCLICK | Event.ONMOUSEDOWN | Event.ONMOUSEOVER | Event.ONMOUSEOUT | Event.ONFOCUS | Event.ONKEYDOWN); addDomHandler(event -> selectItem(null), BlurEvent.getType()); setStylePrimaryName(STYLENAME); }
Example 2
Source File: CubaScrollTableWidget.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); final 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 3
Source File: CubaGroupTableWidget.java From cuba with Apache License 2.0 | 6 votes |
protected void addGroupCell(String text) { // String only content is optimized by not using Label widget Element tdElement = DOM.createTD(); final TableCellElement td = tdElement.cast(); initCellWithText(text, ALIGN_LEFT, "", false, true, null, td); // Enhance DOM for table cell Element container = (Element) td.getChild(0); String containerInnerHTML = container.getInnerHTML(); container.setInnerHTML(""); expander = DOM.createDiv(); expander.setInnerHTML(" "); expander.setClassName(CLASSNAME + "-group-cell-expander"); DOM.appendChild(container, expander); Element contentDiv = DOM.createDiv(); contentDiv.setInnerHTML(containerInnerHTML); contentDiv.setClassName(CLASSNAME + "-float"); DOM.appendChild(container, contentDiv); }
Example 4
Source File: WindowUtils.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public static void setFavicon(GUIInfo info) { try { Element link = DOM.getElementById("favicon"); Element parent = DOM.getParent(link); DOM.removeChild(parent, link); link = DOM.createElement("link"); link.setId("favicon"); link.setAttribute("rel", "shortcut icon"); link.setAttribute("type", "image/png"); link.setAttribute("href", info.getBranding().getFaviconSrc()); DOM.appendChild(parent, link); } catch (Throwable t) { } }
Example 5
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 6
Source File: CubaGroupTableWidget.java From cuba with Apache License 2.0 | 5 votes |
protected void addCellWithField(String text, char align, int colIndex) { isAggregationEditable = true; final TableCellElement td = DOM.createTD().cast(); initCellWithText(text, align, "", false, true, null, td); // Enhance DOM for table cell Element container = (Element) td.getChild(0); container.setInnerHTML(""); InputElement inputElement = DOM.createInputText().cast(); inputElement.setValue(text); inputElement.addClassName("v-textfield v-widget"); inputElement.addClassName("c-group-aggregation-textfield"); Style elemStyle = inputElement.getStyle(); elemStyle.setWidth(100, Style.Unit.PCT); DOM.appendChild(container, inputElement); if (inputsList == null) { inputsList = new ArrayList<>(); } inputsList.add(new AggregationInputFieldInfo(text, getColKeyByIndex(colIndex), inputElement, td)); DOM.sinkEvents(inputElement, Event.ONCHANGE | Event.ONKEYDOWN); Tools.textSelectionEnable(td, true); }
Example 7
Source File: TreeTable.java From core with GNU Lesser General Public License v2.1 | 5 votes |
public void setImage(AbstractImagePrototype image) { Element child = DOM.getFirstChild(this.image); if (child == null) { DOM.appendChild(this.image, image.createElement().<Element> cast()); } else { image.applyTo(child.<AbstractImagePrototype.ImagePrototypeElement> cast()); } }
Example 8
Source File: SvgArrowWidget.java From gantt with Apache License 2.0 | 5 votes |
public SvgArrowWidget() { Element predecessorArrow = createSVGElementNS("svg"); addStyleName(predecessorArrow, "arrow"); predecessorArrow.getStyle().setPosition(Position.ABSOLUTE); predecessorArrow.getStyle().setZIndex(2); predecessorArrow.getStyle().setProperty("pointerEvents", "none"); Element g = createSVGElementNS("g"); setAttributeNS(g, "stroke", "black"); setAttributeNS(g, "stroke-width", "1"); curve = createSVGElementNS("path"); addStyleName(curve, "curve-line"); setAttributeNS(curve, "fill", "none"); startingPoint = createSVGElementNS("circle"); startingPoint.getStyle().setProperty("pointerEvents", "visiblePainted"); addStyleName(startingPoint, "start-p"); setAttributeNS(startingPoint, "stroke-width", "2"); setAttributeNS(startingPoint, "r", "7"); setAttributeNS(startingPoint, "fill", "black"); endingPoint = createSVGElementNS("circle"); endingPoint.getStyle().setProperty("pointerEvents", "visiblePainted"); addStyleName(endingPoint, "end-p"); setAttributeNS(endingPoint, "stroke-width", "2"); setAttributeNS(endingPoint, "r", "5"); setAttributeNS(endingPoint, "fill", "black"); DOM.appendChild(g, curve); DOM.appendChild(g, startingPoint); DOM.appendChild(g, endingPoint); DOM.appendChild(predecessorArrow, g); setElement(predecessorArrow); }
Example 9
Source File: GanttWidget.java From gantt with Apache License 2.0 | 5 votes |
/** * @param child * Child widget. * @param container * Parent element. * @param beforeIndex * Target index of element in DOM. * @param domInsert * true: Insert at specific position. false: append at the end. */ @Override protected void insert(Widget child, Element container, int beforeIndex, boolean domInsert) { GWT.log("Count content elements: " + content.getChildCount() + " (" + getAdditionalNonWidgetContentElementCount() + " non-widget non-step elements, " + (getAdditonalContentElementCount() - getAdditionalNonWidgetContentElementCount()) + " non-step widgets.)"); // Validate index; adjust if the widget is already a child of this // panel. int adjustedBeforeStepIndex = adjustIndex(child, beforeIndex - getAdditionalNonWidgetContentElementCount()) - getAdditionalWidgetContentElementCount(); // Detach new child. Might also remove additional widgets like // predecessor arrows. May affect contentHeight. child.removeFromParent(); // Logical attach. getChildren().insert(child, adjustedBeforeStepIndex + getAdditionalWidgetContentElementCount()); // Physical attach. if (domInsert) { DOM.insertChild(container, child.getElement(), adjustedBeforeStepIndex + getAdditonalContentElementCount()); } else { DOM.appendChild(container, child.getElement()); } // Adopt. adopt(child); }
Example 10
Source File: UniTimeWidget.java From unitime with Apache License 2.0 | 5 votes |
@Override public void setAriaLabel(String text) { if (iWidget instanceof HasAriaLabel) { ((HasAriaLabel)iWidget).setAriaLabel(text); } else { if (iAriaLabel == null) { iAriaLabel = DOM.createLabel(); iAriaLabel.setId(DOM.createUniqueId()); iAriaLabel.setClassName("hidden-label"); DOM.appendChild(getElement(), iAriaLabel); Roles.getCheckboxRole().setAriaLabelledbyProperty(iWidget.getElement(), Id.of(iAriaLabel)); } iAriaLabel.setInnerText(text); } }
Example 11
Source File: AriaCheckBox.java From unitime with Apache License 2.0 | 5 votes |
public AriaCheckBox(Element elem) { super(elem); iAriaLabel = DOM.createLabel(); iAriaLabel.setId(DOM.createUniqueId()); iAriaLabel.setClassName("unitime-AriaLabel"); DOM.appendChild(getElement(), iAriaLabel); Roles.getCheckboxRole().setAriaLabelledbyProperty(elem, Id.of(iAriaLabel)); }
Example 12
Source File: SuggestionsContainer.java From cuba with Apache License 2.0 | 5 votes |
public void addItem(SuggestionItem item) { int idx = items.size(); items.add(idx, item); DOM.appendChild(container, item.getElement()); item.setSuggestionsContainer(this); item.updateSelection(false); }
Example 13
Source File: GroupBoxPanel.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * GroupBoxPanel */ public GroupBoxPanel() { Element fieldset = DOM.createFieldSet(); this.legend = DOM.createLegend(); DOM.appendChild(fieldset, legend); setElement(fieldset); }
Example 14
Source File: MockHVLayoutBase.java From appinventor-extensions with Apache License 2.0 | 5 votes |
private void ensureDividerInited() { if (dividerElement == null) { dividerElement = DOM.createDiv(); DOM.setStyleAttribute(dividerElement, "backgroundColor", DIVIDER_COLOR); setDividerVisible(false); DOM.appendChild(container.getRootPanel().getElement(), dividerElement); } }
Example 15
Source File: MockTableLayout.java From appinventor-extensions with Apache License 2.0 | 5 votes |
private void ensureDropTargetArea() { if (dropTargetArea == null) { dropTargetArea = DOM.createDiv(); setDropTargetAreaVisible(false); DOM.setStyleAttribute(dropTargetArea, "border", "2px solid " + DROP_TARGET_AREA_COLOR); DOM.appendChild(container.getRootPanel().getElement(), dropTargetArea); } }
Example 16
Source File: MiniProgressBar.java From appinventor-extensions with Apache License 2.0 | 5 votes |
/** * Create a progress bar within the given range starting at the specified * progress amount. * * @param minProgress the minimum progress * @param maxProgress the maximum progress * @param curProgress the current progress * @param textFormatter the text formatter */ public MiniProgressBar(double minProgress, double maxProgress, double curProgress, TextFormatter textFormatter) { this.minProgress = minProgress; this.maxProgress = maxProgress; this.curProgress = curProgress; setTextFormatter(textFormatter); // Create the outer shell setElement(DOM.createDiv()); DOM.setStyleAttribute(getElement(), "position", "relative"); setStyleName("gwt-ProgressBar-shell"); // Create the bar element barElement = DOM.createDiv(); DOM.appendChild(getElement(), barElement); DOM.setStyleAttribute(barElement, "height", "100%"); setBarStyleName("gwt-ProgressBar-bar"); // Create the text element textElement = DOM.createDiv(); DOM.appendChild(getElement(), textElement); DOM.setStyleAttribute(textElement, "position", "absolute"); DOM.setStyleAttribute(textElement, "top", "0px"); //Set the current progress setProgress(curProgress); }
Example 17
Source File: CubaTooltip.java From cuba with Apache License 2.0 | 4 votes |
public CubaTooltip() { contextHelpElement.setClassName("c-tooltip-context-help"); DOM.appendChild(getWidget().getElement(), contextHelpElement); tooltipEventHandler = new CubaTooltipEventHandler(); }
Example 18
Source File: CellPanel.java From consulo with Apache License 2.0 | 4 votes |
public CellPanel() { table = DOM.createTable(); body = DOM.createTBody(); DOM.appendChild(table, body); setElement(table); }