@Override public void component(final MarkupContainer component, final IVisit<Component> visit) { if (component.getId().equals(thisId)) { visit.stop(component); } } });
@Override protected void onDetach() { super.onDetach(); modCounter++; removals_clear(); if (queue != null && !queue.isEmpty() && hasBeenRendered()) { throw new WicketRuntimeException( String.format("Detach called on component with id '%s' while it had a non-empty queue: %s", getId(), queue)); } }
@Override protected void onDetach() { super.onDetach(); modCounter++; removals_clear(); if (queue != null && !queue.isEmpty() && hasBeenRendered()) { throw new WicketRuntimeException( String.format("Detach called on component with id '%s' while it had a non-empty queue: %s", getId(), queue)); } }
/** * Performs the replacement, only if an actual replacement was constructed. * * @see org.apache.wicket.markup.html.link.Link#onClick() * @see #getReplacementFor(Component, String, Class) * @throws WicketRuntimeException * if a problem occurs in replacing the container. */ @Override public final void onClick() { Component replaceMe = getComponentToBeReplaced(); if (replaceMe == null) throw new WicketRuntimeException("unable to find child with id: " + containerId + " on parent: " + containerParent); Class<? extends MarkupContainer> myReplacementClass = getReplacementClass(); MarkupContainer replacement = getReplacementFor(replaceMe, containerId, myReplacementClass); if (replacement == null) return; // do nothing if (!containerId.equals(replacement.getId())) throw new WicketRuntimeException("The replacement does not have the specified id: " + containerId + ", but id: " + replacement.getId()); if (myReplacementClass.isAssignableFrom(replacement.getClass())) containerParent.replace(replacement); else throw new WicketRuntimeException("The replacement for " + containerId + " on " + containerParent + " is not assignable from " + myReplacementClass); }
/** * Performs the replacement, only if an actual replacement was constructed. * * @see org.apache.wicket.markup.html.link.Link#onClick() * @see #getReplacementFor(Component, String, Class) * @throws WicketRuntimeException * if a problem occurs in replacing the container. */ @Override public final void onClick() { Component replaceMe = getComponentToBeReplaced(); if (replaceMe == null) throw new WicketRuntimeException("unable to find child with id: " + containerId + " on parent: " + containerParent); Class<? extends MarkupContainer> myReplacementClass = getReplacementClass(); MarkupContainer replacement = getReplacementFor(replaceMe, containerId, myReplacementClass); if (replacement == null) return; // do nothing if (!containerId.equals(replacement.getId())) throw new WicketRuntimeException("The replacement does not have the specified id: " + containerId + ", but id: " + replacement.getId()); if (myReplacementClass.isAssignableFrom(replacement.getClass())) containerParent.replace(replacement); else throw new WicketRuntimeException("The replacement for " + containerId + " on " + containerParent + " is not assignable from " + myReplacementClass); }
public BSDropDownMenu appendLink(Component label, MarkupContainer link) { return appendTag("li", true, null, itemId -> new TemplatePanel(itemId, () -> "<a wicket:id='" + link.getId() + "'><span wicket:id='" + label.getId() + "'></span></a>") .add(link .add(label)) .setRenderBodyOnly(false)); } public BSDropDownMenu appendLink(Component link) {
public BSDropDownMenu appendLink(Component label, MarkupContainer link) { return appendTag("li", true, null, itemId -> new TemplatePanel(itemId, () -> "<a wicket:id='" + link.getId() + "'><span wicket:id='" + label.getId() + "'></span></a>") .add(link .add(label)) .setRenderBodyOnly(false)); } public BSDropDownMenu appendLink(Component link) {
Classes.simpleName(this.getClass()) + "(\"" + this.getId() + "\", ...) instead of add(...)";
Classes.simpleName(this.getClass()) + "(\"" + this.getId() + "\", ...) instead of add(...)";
"something like: " + container.getId() + ".add(getBodyContainer()); for the component hierarchy to " + "better reflect the markup hierarchy. For example, say that " +
"something like: " + container.getId() + ".add(getBodyContainer()); for the component hierarchy to " + "better reflect the markup hierarchy. For example, say that " +
IMarkupFragment resolverMarkup = containerMarkup.find(componentResolver.getId()); IMarkupFragment childMarkup = resolverMarkup != null ? resolverMarkup.find(child.getId()) : null;
IMarkupFragment resolverMarkup = containerMarkup.find(componentResolver.getId()); IMarkupFragment childMarkup = resolverMarkup != null ? resolverMarkup.find(child.getId()) : null;
if (confULContainer.getId().equals(containingLI.getParent().getId())) { confULContainer.add(new Behavior() {
@Before public void setUp() throws Exception { target = new EntityModel(EntityModel.Mode.VIEW, EntityModel.RenderingHint.REGULAR); mockParent = context.mock(MarkupContainer.class, "parent"); mockComponent1 = context.mock(Component.class, "component1"); mockComponent2 = context.mock(Component.class, "component2"); context.checking(new Expectations() {{ allowing(mockParent).getId(); will(returnValue("parent")); allowing(mockComponent1).getId(); will(returnValue("id1")); allowing(mockComponent2).getId(); will(returnValue("id2")); ignoring(mockComponent1); ignoring(mockComponent2); }}); mockComponent1.setParent(mockParent); mockComponent2.setParent(mockParent); }
@Before public void setUp() throws Exception { target = new EntityModel(); mockParent = context.mock(MarkupContainer.class, "parent"); mockComponent1 = context.mock(Component.class, "component1"); mockComponent2 = context.mock(Component.class, "component2"); context.checking(new Expectations() {{ allowing(mockParent).getId(); will(returnValue("parent")); allowing(mockComponent1).getId(); will(returnValue("id1")); allowing(mockComponent2).getId(); will(returnValue("id2")); ignoring(mockComponent1); ignoring(mockComponent2); }}); mockComponent1.setParent(mockParent); mockComponent2.setParent(mockParent); }