use of elemental.html.DivElement in project che by eclipse.
the class AnnotationGroupImpl method create.
public static final AnnotationGroupImpl create() {
final AnnotationGroupImpl result = new AnnotationGroupImpl();
final DivElement element = Elements.createDivElement();
element.getStyle().setPosition(STATIC);
result.mainElement = element;
element.getDataset().setAt(ELEMENT_ROLE_DATA_PROPERTY, ELEMENT_ROLE_VALUE_ANNOTATION);
return result;
}
use of elemental.html.DivElement 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.DivElement in project che by eclipse.
the class Elements method createDivElement.
public static DivElement createDivElement(String... classNames) {
DivElement elem = getDocument().createDivElement();
addClassesToElement(elem, classNames);
return elem;
}
use of elemental.html.DivElement in project che by eclipse.
the class ClassFileSourcesDownloader method onEditorOpened.
@Override
public void onEditorOpened(EditorOpenedEvent event) {
EditorPartPresenter editor = event.getEditor();
VirtualFile file = editor.getEditorInput().getFile();
if (file instanceof JarFileNode) {
final JarFileNode jarFileNode = (JarFileNode) file;
if (jarFileNode.isContentGenerated()) {
if (editor instanceof TextEditor) {
final TextEditor presenter = (TextEditor) editor;
TextEditorPartView view = presenter.getView();
final DivElement divElement = Elements.createDivElement();
divElement.setClassName(resources.css().editorInfoPanel());
Text textNode = Elements.createTextNode(constant.mavenClassDecompiled());
DivElement decompiledElement = Elements.createDivElement();
decompiledElement.appendChild(textNode);
decompiledElement.setClassName(resources.css().editorMessage());
divElement.appendChild(decompiledElement);
AnchorElement anchorElement = Elements.createAnchorElement();
anchorElement.appendChild(Elements.createTextNode(constant.mavenDownloadSources()));
anchorElement.setHref("#");
anchorElement.setClassName(resources.css().downloadLink());
divElement.appendChild(anchorElement);
final HasNotificationPanel.NotificationRemover remover = view.addNotification((Element) divElement);
anchorElement.setOnclick(new EventListener() {
@Override
public void handleEvent(Event evt) {
downloadSources(jarFileNode, remover);
}
});
}
}
}
}
use of elemental.html.DivElement in project che by eclipse.
the class DomUtils method appendDivWithTextContent.
public static DivElement appendDivWithTextContent(Element root, String className, String text) {
DivElement element = Elements.createDivElement(className);
element.setTextContent(text);
root.appendChild(element);
return element;
}
Aggregations