Search in sources :

Example 6 with SpanElement

use of elemental.html.SpanElement in project che by eclipse.

the class VariableTreeNodeRenderer method renderNodeContents.

/** {@inheritDoc} */
@Override
public SpanElement renderNodeContents(@NotNull MutableVariable data) {
    SpanElement root = Elements.createSpanElement(css.variableRoot());
    SpanElement label = Elements.createSpanElement(css.variableLabel());
    String content = data.getName() + ": " + data.getValue();
    label.setTextContent(content);
    root.appendChild(label);
    return root;
}
Also used : SpanElement(elemental.html.SpanElement)

Example 7 with SpanElement

use of elemental.html.SpanElement in project che by eclipse.

the class SignatureHelpView method renderDocumentation.

private void renderDocumentation(Element element, SignatureInfo signatureInfo, Optional<Integer> activeParameter) {
    if (signatureInfo.getDocumentation().isPresent()) {
        elemental.html.DivElement documentation = Elements.createDivElement(resources.css().documentation());
        documentation.setTextContent(signatureInfo.getDocumentation().get());
        element.appendChild(documentation);
    }
    if (signatureInfo.getParameters().isPresent() && activeParameter.isPresent() && signatureInfo.getParameters().get().size() > activeParameter.get()) {
        ParameterInfo parameterInfo = signatureInfo.getParameters().get().get(activeParameter.get());
        if (parameterInfo.getDocumentation().isPresent()) {
            elemental.html.DivElement parameter = Elements.createDivElement(resources.css().documentationParameter());
            SpanElement label = Elements.createSpanElement(resources.css().documentationParameter());
            label.setTextContent(parameterInfo.getLabel());
            SpanElement documentation = Elements.createSpanElement(resources.css().documentation());
            documentation.setTextContent(parameterInfo.getDocumentation().get());
            parameter.appendChild(label);
            parameter.appendChild(documentation);
            element.appendChild(parameter);
        }
    }
}
Also used : SpanElement(elemental.html.SpanElement) ParameterInfo(org.eclipse.che.ide.api.editor.signature.ParameterInfo)

Example 8 with SpanElement

use of elemental.html.SpanElement in project che by eclipse.

the class ReferenceTreeNodeRenderer method renderNodeContents.

/** {@inheritDoc} */
@Override
public SpanElement renderNodeContents(Reference data) {
    SpanElement root = Elements.createSpanElement(css.referenceRoot());
    SVGImage icon;
    if (data.getFullName().equals(MergePresenter.LOCAL_BRANCHES_TITLE)) {
        icon = new SVGImage(gitResources.checkoutReference());
    } else if (data.getFullName().equals(MergePresenter.REMOTE_BRANCHES_TITLE)) {
        icon = new SVGImage(gitResources.remote());
    } else {
        icon = new SVGImage(gitResources.branches());
    }
    SpanElement label = Elements.createSpanElement(css.referenceLabel());
    String content = data.getDisplayName();
    label.setTextContent(content);
    root.appendChild((Node) icon.getSvgElement().getElement());
    root.appendChild(label);
    return root;
}
Also used : SpanElement(elemental.html.SpanElement) SVGImage(org.vectomatic.dom.svg.ui.SVGImage)

Example 9 with SpanElement

use of elemental.html.SpanElement in project che by eclipse.

the class TreeNodeElement method create.

/**
     * Creates a TreeNodeElement from some data. Should only be called by
     * {@link Tree}.
     *
     * @param <D>
     *         the type of data
     * @param dataAdapter
     *         An {@link NodeDataAdapter} that allows us to visit the
     *         NodeData
     * @return a new {@link TreeNodeElement} created from the supplied data.
     */
static <D> TreeNodeElement<D> create(D data, NodeDataAdapter<D> dataAdapter, NodeRenderer<D> nodeRenderer, Tree.Css css, Tree.Resources resources) {
    @SuppressWarnings("unchecked") TreeNodeElement<D> treeNode = (TreeNodeElement<D>) Elements.createElement("li", css.treeNode());
    treeNode.setData(data);
    treeNode.setRenderer(nodeRenderer);
    // Associate the rendered node with the underlying model data.
    dataAdapter.setRenderedTreeNode(data, treeNode);
    // Attach the Tree node body.
    DivElement nodeBody = Elements.createDivElement(css.treeNodeBody());
    nodeBody.setAttribute("draggable", "true");
    treeNode.appendChild(nodeBody);
    // Attach expand node element
    DivElement expand = Elements.createDivElement();
    Elements.addClassName(css.expandControl(), expand);
    nodeBody.appendChild(expand);
    expand.setInnerHTML(resources.collapsedIcon().getSvg().getElement().getString() + resources.expandedIcon().getSvg().getElement().getString());
    ((Element) expand.getChildNodes().item(1)).getStyle().setDisplay("none");
    SpanElement nodeContent = nodeRenderer.renderNodeContents(data);
    Elements.addClassName(css.treeNodeLabel(), nodeContent);
    nodeBody.appendChild(nodeContent);
    // Attach the Tree node children.
    treeNode.ensureChildrenContainer(dataAdapter, css);
    return treeNode;
}
Also used : SpanElement(elemental.html.SpanElement) DivElement(elemental.html.DivElement)

Example 10 with SpanElement

use of elemental.html.SpanElement in project che by eclipse.

the class Elements method createSpanElement.

public static SpanElement createSpanElement(String... classNames) {
    SpanElement elem = getDocument().createSpanElement();
    addClassesToElement(elem, classNames);
    return elem;
}
Also used : SpanElement(elemental.html.SpanElement)

Aggregations

SpanElement (elemental.html.SpanElement)21 Element (elemental.dom.Element)7 Event (elemental.events.Event)6 EventListener (elemental.events.EventListener)6 SVGImage (org.vectomatic.dom.svg.ui.SVGImage)5 DivElement (elemental.html.DivElement)4 TreeNodeElement (org.eclipse.che.ide.ui.tree.TreeNodeElement)4 Node (elemental.dom.Node)3 CustomEvent (elemental.events.CustomEvent)2 Completion (org.eclipse.che.ide.api.editor.codeassist.Completion)2 CompletionProposal (org.eclipse.che.ide.api.editor.codeassist.CompletionProposal)2 LinearRange (org.eclipse.che.ide.api.editor.text.LinearRange)2 SVGResource (org.vectomatic.dom.svg.ui.SVGResource)2 Scheduler (com.google.gwt.core.client.Scheduler)1 DivElement (com.google.gwt.dom.client.DivElement)1 Style (com.google.gwt.dom.client.Style)1 KeyCodes (com.google.gwt.event.dom.client.KeyCodes)1 MatchResult (com.google.gwt.regexp.shared.MatchResult)1 Timer (com.google.gwt.user.client.Timer)1 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)1