/** * Listener method invoked on the ajax request generated when the user clicks the link * * @param target */ public void onClick(final AjaxRequestTarget target) { super.onClick(); }
link.setEnabled(enableLink); add(link); link.add(new Label("label", breadCrumbParticipant.getTitle()).setRenderBodyOnly(true));
/** * @see org.apache.wicket.markup.html.link.Link#onClick() */ @Override public void onClick() { // get the currently active particpant final IBreadCrumbParticipant active = breadCrumbModel.getActive(); if (active == null) { throw new IllegalStateException("The model has no active bread crumb. Before using " + this + ", you have to have at least one bread crumb in the model"); } // get the participant to set as active final IBreadCrumbParticipant participant = getParticipant(active.getComponent().getId()); // add back button support addStateChange(); // set the next participant as the active one breadCrumbModel.setActive(participant); }
@Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); if (isLinkEnabled()) { // disable any href attr in markup if (tag.getName().equalsIgnoreCase("a") || tag.getName().equalsIgnoreCase( "link") || tag.getName().equalsIgnoreCase("area")) { tag.put("href", "#"); } } else { disableLink(tag); } }
link.setEnabled(enableLink); add(link); link.add(new Label("label", breadCrumbParticipant.getTitle()).setRenderBodyOnly(true));
/** * @see org.apache.wicket.markup.html.link.Link#onClick() */ @Override public void onClick() { // get the currently active particpant final IBreadCrumbParticipant active = breadCrumbModel.getActive(); if (active == null) { throw new IllegalStateException("The model has no active bread crumb. Before using " + this + ", you have to have at least one bread crumb in the model"); } // get the participant to set as active final IBreadCrumbParticipant participant = getParticipant(active.getComponent().getId()); // add back button support addStateChange(new Change() { private static final long serialVersionUID = 1L; @Override public void undo() { breadCrumbModel.setActive(active); } }); // set the next participant as the active one breadCrumbModel.setActive(participant); }
public BreadCrumbComponent(String id, long index, IBreadCrumbModel breadCrumbModel, final IBreadCrumbParticipant participant, boolean enableLink) { super(id); HippoIcon icon = HippoIcon.fromSprite("sep", Icon.CHEVRON_RIGHT); icon.addCssClass("breadcrumbs-separator"); icon.setVisible(enableLink); add(icon); BreadCrumbLink link = new AjaxBreadCrumbLink("link", breadCrumbModel) { private static final long serialVersionUID = 1L; protected IBreadCrumbParticipant getParticipant(String componentId) { return participant; } }; link.setEnabled(enableLink); add(link); IModel<String> title; if (participant instanceof IPanelPluginParticipant) { title = ((IPanelPluginParticipant) participant).getTitle(this); } else { title = participant.getTitle(); } link.add(new Label("label", title).setRenderBodyOnly(true)); } }