/** * Adds a child component to this container. * * @param child * The child * @throws IllegalArgumentException * Thrown if a child with the same id is replaced by the add operation. * @return This */ public final MarkupContainer add(final Component child) { checkHierarchyChange(child); if (child == null) { throw new IllegalArgumentException("argument child may not be null"); } if (log.isDebugEnabled()) { log.debug("Add " + child.getId() + " to " + this); } // Add to map addedComponent(child); if (put(child) != null) { throw new IllegalArgumentException(exceptionMessage("A child with id '" + child.getId() + "' already exists")); } return this; }
if (put(child) != null) throw new IllegalArgumentException(exceptionMessage("A child with id '" + child.getId() + "' already exists"));
exceptionMessage("Markup of type '" + getMarkupType().getExtension() + "' for component '" + getClass().getName() + "' not found." + " Enable debug messages for org.apache.wicket.util.resource to get a list of all filenames tried"),
exceptionMessage("Markup of type '" + getMarkupType().getExtension() + "' for component '" + getClass().getName() + "' not found." + " Enable debug messages for org.apache.wicket.util.resource to get a list of all filenames tried"),
/** * Gets a fresh markup stream that contains the (immutable) markup resource for this class. * * @param throwException * If true, throw an exception, if markup could not be found * @return A stream of MarkupElement elements */ public MarkupStream getAssociatedMarkupStream(final boolean throwException) { try { return getApplication().getMarkupSettings().getMarkupCache().getMarkupStream(this, false, throwException); } catch (MarkupException ex) { // re-throw it. The exception contains already all the information // required. throw ex; } catch (WicketRuntimeException ex) { // throw exception since there is no associated markup throw new MarkupNotFoundException( exceptionMessage("Markup of type '" + getMarkupType() + "' for component '" + getClass().getName() + "' not found." + " Enable debug messages for org.apache.wicket.util.resource to get a list of all filenames tried"), ex); } }
exceptionMessage("Trying to add this component to itself.")); exceptionMessage("A child '" + previousChild.getClass().getSimpleName() + "' with id '" + child.getId() + "' already exists"));
/** * Get the markup stream for this component. * * @return The markup stream for this component, or if it doesn't have one, the markup stream * for the nearest parent which does have one */ protected final MarkupStream findMarkupStream() { // Start here MarkupContainer c = this; // Walk up hierarchy until markup found while (c.getMarkupStream() == null) { // Check parent c = c.getParent(); // Are we at the top of the hierarchy? if (c == null) { // Failed to find markup stream throw new WicketRuntimeException(exceptionMessage("No markup found")); } } return c.getMarkupStream(); }
/** * Get the markup stream for this component. * * @return The markup stream for this component, or if it doesn't have one, the markup stream * for the nearest parent which does have one */ @Override protected final MarkupStream findMarkupStream() { // Start here MarkupContainer c = this; // Walk up hierarchy until markup found while (c.getMarkupStream() == null) { // Check parent c = c.getParent(); // Are we at the top of the hierarchy? if (c == null) { // Failed to find markup stream throw new WicketRuntimeException(exceptionMessage("No markup found")); } } return c.getMarkupStream(); }
exceptionMessage("Trying to add this component to itself.")); exceptionMessage("A child '" + previousChild.getClass().getSimpleName() + "' with id '" + child.getId() + "' already exists"));
exceptionMessage("Markup of type '" + getMarkupType() + "' for component '" + getClass().getName() + "' not found." + " Enable debug messages for org.apache.wicket.util.resource to get a list of all filenames tried"),
exceptionMessage("Cannot replace a component which has not been added: id='" + child.getId() + "', component=" + child));
exceptionMessage("Cannot replace a component which has not been added: id='" + child.getId() + "', component=" + child));
exceptionMessage("Cannot replace a component which has not been added: id='" + child.getId() + "', component=" + child));
exceptionMessage("Cannot replace a component which has not been added: id='" + child.getId() + "', component=" + child));