Example usage for org.apache.wicket.markup.html.link ExternalLink setPopupSettings

List of usage examples for org.apache.wicket.markup.html.link ExternalLink setPopupSettings

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.link ExternalLink setPopupSettings.

Prototype

public final ExternalLink setPopupSettings(final PopupSettings popupSettings) 

Source Link

Document

Sets the popup specification.

Usage

From source file:org.dcm4chee.web.war.folder.webviewer.WebviewerSelectionPage.java

License:LGPL

public WebviewerSelectionPage(AbstractDicomModel model, WebviewerLinkProvider[] providers,
        final ModalWindow modalWindow, final WebviewerLinkClickedCallback callback) {
    super();/*from www . j  a  va  2  s.  co  m*/
    add(new Label("header", new ResourceModel("webviewer.selection.header")));
    add(new Label("info", model.toString()));
    RepeatingView rv = new RepeatingView("repeater");
    add(rv);
    WebMarkupContainer mc;
    for (int i = 0; i < providers.length; i++) {
        final WebviewerLinkProvider provider = providers[i];
        final String url = Webviewer.getUrlForModel(model, provider);
        if (url != null) {
            mc = new WebMarkupContainer(rv.newChildId());
            ExternalLink link = new ExternalLink("link", url, provider.getName());
            if (!provider.hasOwnWindow()) {
                link.setPopupSettings(new PopupSettings(PageMap.forName(provider.getName()),
                        PopupSettings.RESIZABLE | PopupSettings.SCROLLBARS));
            }
            if (modalWindow != null || callback != null) {
                link.add(new AjaxEventBehavior("onclick") {
                    private static final long serialVersionUID = 1L;

                    @Override
                    protected void onEvent(AjaxRequestTarget target) {
                        if (modalWindow != null) {
                            modalWindow.close(target);
                        }
                        if (callback != null) {
                            callback.linkClicked(target);
                        }
                    }

                    @Override
                    protected CharSequence generateCallbackScript(CharSequence partialCall) {
                        CharSequence script = super.generateCallbackScript(partialCall);
                        if (provider.hasOwnWindow()) {
                            script = Webviewer.getSendHttpRequestJavascript(url) + script + "return false;";
                        }
                        return script;
                    }

                });
            }

            mc.add(link);
            rv.add(mc);
        }
    }
}

From source file:org.sakaiproject.wicket.markup.html.repeater.data.table.ExternalAction.java

License:Educational Community License

public Component newLink(String id, Object bean) {
    IModel labelModel = null;//  w  w  w.  j  a  v  a 2  s  .co  m
    if (displayModel != null) {
        labelModel = displayModel;
    } else {
        String labelValue = String.valueOf(PropertyResolver.getValue(labelPropertyExpression, bean));
        labelModel = new Model(labelValue);
    }

    String urlValue = String.valueOf(PropertyResolver.getValue(urlPropertyExpression, bean));

    ExternalLink link = new ExternalLink(id, new Model(urlValue), labelModel);

    if (popupWindowName != null)
        link.setPopupSettings(new PopupSettings(PopupSettings.RESIZABLE | PopupSettings.SCROLLBARS)
                .setWindowName(popupWindowName));

    link.setEnabled(isEnabled(bean));

    if (targetAttribute == null)
        link.add(new AttributeModifier("target", true, new Model(targetAttribute)));

    return link;
}