Example usage for org.apache.wicket.markup.html.image Image getMarkupId

List of usage examples for org.apache.wicket.markup.html.image Image getMarkupId

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html.image Image getMarkupId.

Prototype

public String getMarkupId() 

Source Link

Document

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

Usage

From source file:com.doculibre.constellio.wicket.panels.facets.FacetFoldableSectionPanel.java

License:Open Source License

@Override
protected WebMarkupContainer newToggleLink(String id) {
    WebMarkupContainer jsToggleLink = new WebMarkupContainer(id);
    jsToggleLink.add(new AttributeModifier("onclick", true, new LoadableDetachableModel() {
        @Override/*from w ww  .  ja va2  s .co m*/
        protected Object load() {
            WebMarkupContainer foldableSectionContainer = getFoldableSectionContainer();
            Image toggleImg = getToggleImg();
            String foldableSectionContainerId = foldableSectionContainer.getMarkupId();
            String toggleImgId = toggleImg.getMarkupId();
            CharSequence openedImgURL = urlFor(OPENED_IMG_RESOURCE_REFERENCE);
            CharSequence closedImgURL = urlFor(CLOSED_IMG_RESOURCE_REFERENCE);
            String cookieName = getCookieName();
            // function toggleSection(foldableSectionContainerId, toggleImgId, openedImgURL, closedImgURL,
            // cookieName)
            StringBuffer js = new StringBuffer();
            js.append("toggleSection('");
            js.append(foldableSectionContainerId);
            js.append("', '");
            js.append(toggleImgId);
            js.append("', '");
            js.append(openedImgURL);
            js.append("', '");
            js.append(closedImgURL);
            js.append("', '");
            js.append(cookieName);
            js.append("')");
            return js;
        }
    }));
    return jsToggleLink;
}

From source file:net.kornr.swit.site.Menu.java

License:Apache License

public Menu(String id) {
    super(id);//from   w ww  .jav  a  2 s .c om

    this.add(new ListView<Pair>("items", s_menus) {
        @Override
        protected void populateItem(ListItem<Pair> item) {
            Pair<String, Class> p = item.getModelObject();

            BookmarkablePageLink link = new BookmarkablePageLink("link", p.getSecond());
            item.add(link);

            Image img;
            if (p.getSecond().equals(m_selectedClass)) {
                link.add(img = ButtonResource.getImage("img", s_button_selected, p.getFirst()));
                link.setEnabled(false);
            } else
                link.add(img = ButtonResource.getImage("img", s_button, p.getFirst()));
            img.setOutputMarkupId(true);
            m_ids.put(p.getFirst(), img.getMarkupId());
        }

    });
}

From source file:org.sakaiproject.sitestats.tool.wicket.components.AjaxLazyLoadImage.java

License:Educational Community License

public Image renderImage(AjaxRequestTarget target, boolean fullRender) {
    if (returnPage != null || returnClass != null) {
        link.add(new AttributeModifier("title", new ResourceModel("click_to_max")));
        link.setEnabled(true);//from   w  w  w  .ja v  a2  s.  co  m
    }
    link.removeAll();
    Image img = null;
    if (!autoDetermineChartSizeByAjax) {
        img = createImage("content", getImageData());
    } else {
        img = createImage("content", getImageData(selectedWidth, selectedHeight));
    }
    img.add(AttributeModifier.replace("style", "display: none; margin: 0 auto;"));
    link.add(img);
    setState((byte) 1);
    if (fullRender) {
        if (target != null) {
            target.add(link);
            target.appendJavaScript("jQuery('#" + img.getMarkupId() + "').fadeIn();");
        }
        setState((byte) 2);
    }
    return img;
}