/** * Appends attribute onclick and changes the cursor to pointer. * * @return */ public IconPanel setOnClick(final String onclick) { appendAttribute("style", "cursor: pointer;"); appendAttribute("onclick", onclick); return this; }
/** * Appends attribute onclick and changes the cursor to pointer. onclick results in location.href. * * @param location url to go on click. * @param newWindow If true then a new browser with the given url is opened. * @return */ public IconPanel setOnClickLocation(final RequestCycle requestCycle, final String location, final boolean newWindow) { appendAttribute("style", "cursor: pointer;"); final String url = WicketUtils.getUrl(requestCycle, location, false); if (newWindow == true) { appendAttribute("onclick", "window.open('" + url + "'); return false;"); } else { appendAttribute("onclick", "location.href='" + url + "';"); } return this; }
/** * Enable Ajax onclick event. If clicked by the user {@link #onClick()} is called. */ @SuppressWarnings("serial") public IconPanel enableAjaxOnClick() { appendAttribute("style", "cursor: pointer;"); final AjaxEventBehavior behavior = new AjaxEventBehavior("click") { @Override protected void onEvent(final AjaxRequestTarget target) { IconPanel.this.onClick(); } }; div.add(behavior); return this; }
public IconPanel(final String id, final IconType type, final IModel<String> title, final IModel<String> tooltip) { super(id); div = new WebMarkupContainer("div"); add(div); appendAttribute("class", type.getClassAttrValue()); this.tooltipTitle = title; this.tooltipText = tooltip; this.color = getColor(type); }
icon.setMarkupId("showBusinessAssessment").setOutputMarkupId(true); repeater.add(icon); icon = new IconPanel(repeater.newChildId(), IconType.MINUS_SIGN).setOnClick("javascript:hideBusinessAssessment();").appendAttribute( "style", "display: none;"); icon.setMarkupId("hideBusinessAssessment").setOutputMarkupId(true);