Example usage for org.apache.wicket Component getMarkupId

List of usage examples for org.apache.wicket Component getMarkupId

Introduction

In this page you can find the example usage for org.apache.wicket Component getMarkupId.

Prototype

public String getMarkupId() 

Source Link

Document

Retrieves id by which this component is represented within the markup.

Usage

From source file:org.apache.isis.viewer.wicket.ui.panels.PromptFormAbstract.java

License:Apache License

@Override
protected void appendDefaultButtonField() {
    AppendingStringBuffer buffer = new AppendingStringBuffer();
    buffer.append(//from   w w  w  .  j  av  a  2 s .c o  m
            "<div style=\"width:0px;height:0px;position:absolute;left:-100px;top:-100px;overflow:hidden\">");
    buffer.append("<input type=\"text\" tabindex=\"-1\" autocomplete=\"off\"/>");
    Component submittingComponent = (Component) this.defaultSubmittingComponent();
    buffer.append("<input type=\"submit\" tabindex=\"-1\" name=\"");
    buffer.append(this.defaultSubmittingComponent().getInputName());
    buffer.append("\" onclick=\" var b=document.getElementById(\'");
    buffer.append(submittingComponent.getMarkupId());
    buffer.append(
            "\'); if (b!=null&amp;&amp;b.onclick!=null&amp;&amp;typeof(b.onclick) != \'undefined\') {  var r = Wicket.bind(b.onclick, b)(); if (r != false) b.click(); } else { b.click(); };  return false;\" ");
    buffer.append(" />");
    buffer.append("</div>");
    this.getResponse().write(buffer);
}

From source file:org.apache.solomax.AjaxDownload.java

License:Apache License

@Override
public void renderHead(Component component, IHeaderResponse response) {
    super.renderHead(component, response);
    response.render(JavaScriptHeaderItem.forReference(newResourceReference()));
    response.render(OnDomReadyHeaderItem.forScript(String.format("addDwnldIframe('%s', '%s');",
            component instanceof Page ? "" : component.getMarkupId(), iframeId)));
}

From source file:org.artifactory.addon.wicket.disabledaddon.AddonNeededBehavior.java

License:Open Source License

@Override
public void bind(Component component) {
    super.bind(component);
    component.setOutputMarkupId(true);/*from  ww w  .j a v  a 2  s.c  om*/
    if (targetId == null) {
        targetId = component.getMarkupId();
    }
}

From source file:org.artifactory.addon.wicket.disabledaddon.DisabledAddonBehavior.java

License:Open Source License

@Override
public void bind(Component component) {
    if (getTargetId() == null) {
        // If we have a titled border behavior, than place the disabled-addon icon within the border title
        for (Behavior b : component.getBehaviors()) {
            if (b instanceof TitledBorderBehavior) {
                if (!isEnabled()) {
                    component.remove(b);
                }/*from  w w  w.j  a  va  2s .  co m*/
                setTargetId(component.getMarkupId() + "-border-icon");
                ((TitledBorderBehavior) b).setCssClass("disabled-addon");
            }
        }
    }
    super.bind(component);
}

From source file:org.artifactory.common.wicket.behavior.DelegateEventBehavior.java

License:Open Source License

public DelegateEventBehavior(final String event, final Component delegate) {
    super(event, new AbstractReadOnlyModel() {
        @Override//  w w w  .  j av  a  2  s  .c  om
        public Object getObject() {
            return "dojo.byId('" + delegate.getMarkupId() + "')." + event + "(event);";
        }
    });
    delegate.setOutputMarkupId(true);
}

From source file:org.artifactory.common.wicket.component.modal.panel.BaseModalPanel.java

License:Open Source License

/**
 * Bind modal panel height to a given component.
 *
 * @param component//from   w  w  w. ja va2s .  c  o  m
 */
public void bindHeightTo(Component component) {
    component.setOutputMarkupId(true);
    bindHeightTo(component.getMarkupId());
}

From source file:org.artifactory.common.wicket.panel.defaultsubmit.DefaultSubmit.java

License:Open Source License

private String getScript(Component... submitButtons) {
    List<String> ids = new ArrayList<>();
    for (Component submitButton : submitButtons) {
        submitButton.setOutputMarkupId(true);
        ids.add(submitButton.getMarkupId());
    }/*from  w w  w. j  a  va  2s.  c o m*/
    return "return " + JavaScriptUtils.jsFunctionCall("DefaultSubmit.submit", ids);
}

From source file:org.artifactory.common.wicket.util.AjaxUtils.java

License:Open Source License

public static void render(Component component, String markupId) {
    final String componentId = component.getMarkupId();
    AjaxRequestTarget.get().add(component, markupId);
    component.setMarkupId(componentId);/*from  ww w .j a v  a 2s .  c om*/
}

From source file:org.artifactory.webapp.wicket.actionable.tree.ActionableItemsTree.java

License:Open Source License

private void showContextMenu(Component item, ActionableItemTreeNode node, AjaxRequestTarget target) {
    ActionsMenuPanel menuPanel = new ActionsMenuPanel("contextMenu", node);
    getParent().replace(menuPanel);/*from  www.  j a  v a2 s. co m*/
    target.add(menuPanel);
    target.appendJavaScript(format("ActionsMenuPanel.show('%s');", item.getMarkupId()));
}

From source file:org.cast.cwm.data.component.DisablingAjaxCallListener.java

License:Open Source License

private String generateSelector(Component component) {
    if (selector == null) {
        if (component instanceof IDisablingComponent) {
            Collection<? extends Component> blockedComponents = ((IDisablingComponent) component)
                    .getComponents();//from w w  w . j a  v a  2  s  .co m
            StringBuffer buffer = new StringBuffer();
            for (Component c : blockedComponents) {
                if (!c.getOutputMarkupId())
                    throw new IllegalArgumentException("Disabled components must have a markup ID");
                buffer.append("#" + c.getMarkupId() + ", ");
            }
            if (buffer.length() > 0)
                buffer.deleteCharAt(buffer.lastIndexOf(","));
            selector = buffer.toString().trim();
        } else {
            throw new IllegalStateException(
                    "This listener should only be attached to components that implement IDisablingComponent");
        }
    }
    return selector;
}