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;
}
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);
}
}
}
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;
}
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;
}
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;
}
Aggregations