Search in sources :

Example 1 with DivElement

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;
}
Also used : DivElement(elemental.html.DivElement)

Example 2 with DivElement

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;
}
Also used : SpanElement(elemental.html.SpanElement) DivElement(elemental.html.DivElement)

Example 3 with DivElement

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;
}
Also used : DivElement(elemental.html.DivElement)

Example 4 with DivElement

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);
                    }
                });
            }
        }
    }
}
Also used : VirtualFile(org.eclipse.che.ide.api.resources.VirtualFile) AnchorElement(elemental.html.AnchorElement) Text(elemental.dom.Text) HasNotificationPanel(org.eclipse.che.ide.api.editor.texteditor.HasNotificationPanel) JarFileNode(org.eclipse.che.ide.ext.java.client.tree.library.JarFileNode) TextEditorPartView(org.eclipse.che.ide.api.editor.texteditor.TextEditorPartView) DivElement(elemental.html.DivElement) TextEditor(org.eclipse.che.ide.api.editor.texteditor.TextEditor) EditorOpenedEvent(org.eclipse.che.ide.api.editor.EditorOpenedEvent) Event(elemental.events.Event) FileContentUpdateEvent(org.eclipse.che.ide.api.event.FileContentUpdateEvent) EditorPartPresenter(org.eclipse.che.ide.api.editor.EditorPartPresenter) EventListener(elemental.events.EventListener)

Example 5 with DivElement

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;
}
Also used : DivElement(elemental.html.DivElement)

Aggregations

DivElement (elemental.html.DivElement)9 SpanElement (elemental.html.SpanElement)3 Element (elemental.dom.Element)2 TreeNodeElement (org.eclipse.che.ide.ui.tree.TreeNodeElement)2 SVGImage (org.vectomatic.dom.svg.ui.SVGImage)2 SVGResource (org.vectomatic.dom.svg.ui.SVGResource)2 Text (elemental.dom.Text)1 Event (elemental.events.Event)1 EventListener (elemental.events.EventListener)1 AnchorElement (elemental.html.AnchorElement)1 EditorOpenedEvent (org.eclipse.che.ide.api.editor.EditorOpenedEvent)1 EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)1 HasNotificationPanel (org.eclipse.che.ide.api.editor.texteditor.HasNotificationPanel)1 TextEditor (org.eclipse.che.ide.api.editor.texteditor.TextEditor)1 TextEditorPartView (org.eclipse.che.ide.api.editor.texteditor.TextEditorPartView)1 FileContentUpdateEvent (org.eclipse.che.ide.api.event.FileContentUpdateEvent)1 VirtualFile (org.eclipse.che.ide.api.resources.VirtualFile)1 JarFileNode (org.eclipse.che.ide.ext.java.client.tree.library.JarFileNode)1