Search in sources :

Example 1 with REMOVE

use of org.jboss.hal.dmr.ModelDescriptionConstants.REMOVE in project console by hal.

the class PolicyElement method injectRemove.

private void injectRemove(Form<ModelNode> form, Callback callback) {
    // hacky way to inject the remove link into the form tools, depends on FormLink internals!
    String linksId = Ids.build(form.getId(), "links");
    Element formLinks = form.element().querySelector(HASH + linksId);
    if (formLinks != null) {
        HTMLLIElement removeLink = li().add(a().css(clickable).on(click, event -> callback.execute()).add(i().css(pfIcon("remove"))).data(OPERATION, REMOVE).add(span().css(formLinkLabel).textContent(resources.constants().remove()))).element();
        formLinks.insertBefore(removeLink, formLinks.lastElementChild);
    }
}
Also used : ModelNode(org.jboss.hal.dmr.ModelNode) Element(elemental2.dom.Element) IsElement(org.jboss.gwt.elemento.core.IsElement) OPERATION(org.jboss.hal.dmr.ModelDescriptionConstants.OPERATION) CSS.clickable(org.jboss.hal.resources.CSS.clickable) ModelNodeForm(org.jboss.hal.core.mbui.form.ModelNodeForm) HTMLElement(elemental2.dom.HTMLElement) EmptyState(org.jboss.hal.ballroom.EmptyState) HasPresenter(org.jboss.hal.core.mvp.HasPresenter) Metadata(org.jboss.hal.meta.Metadata) Names(org.jboss.hal.resources.Names) Ids(org.jboss.hal.resources.Ids) REMOVE(org.jboss.hal.dmr.ModelDescriptionConstants.REMOVE) CSS.pfIcon(org.jboss.hal.resources.CSS.pfIcon) EventType.click(org.jboss.gwt.elemento.core.EventType.click) CUSTOM_POLICY(org.jboss.hal.dmr.ModelDescriptionConstants.CUSTOM_POLICY) HTMLLIElement(elemental2.dom.HTMLLIElement) Callback(org.jboss.hal.spi.Callback) ModelDescriptionConstants(org.jboss.hal.dmr.ModelDescriptionConstants) Resources(org.jboss.hal.resources.Resources) Attachable(org.jboss.hal.ballroom.Attachable) HASH(org.jboss.hal.resources.UIConstants.HASH) CSS.formLinkLabel(org.jboss.hal.resources.CSS.formLinkLabel) JACC_POLICY(org.jboss.hal.dmr.ModelDescriptionConstants.JACC_POLICY) NamedNode(org.jboss.hal.dmr.NamedNode) Elements(org.jboss.gwt.elemento.core.Elements) Form(org.jboss.hal.ballroom.form.Form) Element(elemental2.dom.Element) IsElement(org.jboss.gwt.elemento.core.IsElement) HTMLElement(elemental2.dom.HTMLElement) HTMLLIElement(elemental2.dom.HTMLLIElement) HTMLLIElement(elemental2.dom.HTMLLIElement)

Aggregations

Element (elemental2.dom.Element)1 HTMLElement (elemental2.dom.HTMLElement)1 HTMLLIElement (elemental2.dom.HTMLLIElement)1 Elements (org.jboss.gwt.elemento.core.Elements)1 EventType.click (org.jboss.gwt.elemento.core.EventType.click)1 IsElement (org.jboss.gwt.elemento.core.IsElement)1 Attachable (org.jboss.hal.ballroom.Attachable)1 EmptyState (org.jboss.hal.ballroom.EmptyState)1 Form (org.jboss.hal.ballroom.form.Form)1 ModelNodeForm (org.jboss.hal.core.mbui.form.ModelNodeForm)1 HasPresenter (org.jboss.hal.core.mvp.HasPresenter)1 ModelDescriptionConstants (org.jboss.hal.dmr.ModelDescriptionConstants)1 CUSTOM_POLICY (org.jboss.hal.dmr.ModelDescriptionConstants.CUSTOM_POLICY)1 JACC_POLICY (org.jboss.hal.dmr.ModelDescriptionConstants.JACC_POLICY)1 OPERATION (org.jboss.hal.dmr.ModelDescriptionConstants.OPERATION)1 REMOVE (org.jboss.hal.dmr.ModelDescriptionConstants.REMOVE)1 ModelNode (org.jboss.hal.dmr.ModelNode)1 NamedNode (org.jboss.hal.dmr.NamedNode)1 Metadata (org.jboss.hal.meta.Metadata)1 CSS.clickable (org.jboss.hal.resources.CSS.clickable)1