List of usage examples for org.apache.wicket Component getParent
@Override public final MarkupContainer getParent()
From source file:au.org.theark.core.web.form.AbstractWizardForm.java
License:Open Source License
public HistoryAjaxBehavior getHistoryAjaxBehavior() { // Start here Component current = getParent(); // Walk up containment hierarchy while (current != null) { // Is current an instance of this class? if (IHistoryAjaxBehaviorOwner.class.isInstance(current)) { return ((IHistoryAjaxBehaviorOwner) current).getHistoryAjaxBehavior(); }/*from w w w . j a v a2s . c om*/ // Check parent current = current.getParent(); } return null; }
From source file:com.aipo.mobycket.wicket.markup.html.navigation.paging.AjaxCursorPagingNavigator.java
License:Apache License
protected void onAjaxEvent(AjaxRequestTarget target) { // update the container (parent) of the pageable, this assumes that // the pageable is a component, and that it is a child of a web // markup container. Component container = ((Component) pageable); // no need for a nullcheck as there is bound to be a non-repeater // somewhere higher in the hierarchy while (container instanceof AbstractRepeater) { container = container.getParent(); }//from w ww. j av a 2 s . c o m target.addComponent(container); // in case the navigator is not contained by the container, we have // to add it to the response if (((MarkupContainer) container).contains(this, true) == false) { target.addComponent(this); } }
From source file:com.comcast.cdn.traffic_control.traffic_monitor.wicket.behaviors.AbstractMultiAjaxBehavior.java
License:Apache License
/** * Finds the markup id of the indicator. The default search order is: * component, behavior, component's parent hierarchy. * /*from www . jav a 2 s.c om*/ * @return markup id or <code>null</code> if no indicator found */ protected String findIndicatorId() { if (getComponent() instanceof IAjaxIndicatorAware) { return ((IAjaxIndicatorAware) getComponent()).getAjaxIndicatorMarkupId(); } if (this instanceof IAjaxIndicatorAware) { return ((IAjaxIndicatorAware) this).getAjaxIndicatorMarkupId(); } Component parent = getComponent().getParent(); while (parent != null) { if (parent instanceof IAjaxIndicatorAware) { return ((IAjaxIndicatorAware) parent).getAjaxIndicatorMarkupId(); } parent = parent.getParent(); } return null; }
From source file:com.doculibre.constellio.wicket.utils.WicketResourceUtils.java
License:Open Source License
public static Component findOutputMarkupIdParent(Component child) { Component matchingParent;//from w w w . j a v a2 s.c om Component firstParent = child.getParent(); if (firstParent != null) { if (firstParent.getOutputMarkupId()) { matchingParent = firstParent; } else { // Starts with current object despite what method name lets you think... matchingParent = (Component) firstParent.visitParents(Component.class, new IVisitor() { @Override public Object component(Component component) { if (component.getOutputMarkupId()) { return component; } else { return CONTINUE_TRAVERSAL; } } }); } } else { matchingParent = null; } return matchingParent; }
From source file:com.eltiland.ui.common.components.navigator.ELTAjaxPagingNavigator.java
License:Apache License
/** * Override this method to specify the markup container where your IPageable is part of. This * implementation is a default implementation that tries to find a parent markup container and * update that container. This is necessary as ListViews can't be updated themselves. * * @param target// w ww . ja v a2s. co m * the request target to add the components that need to be updated in the ajax * event. */ protected void onAjaxEvent(AjaxRequestTarget target) { // update the container (parent) of the pageable, this assumes that // the pageable is a component, and that it is a child of a web // markup container. Component container = ((Component) pageable); // no need for a nullcheck as there is bound to be a non-repeater // somewhere higher in the hierarchy while (container instanceof AbstractRepeater) { container = container.getParent(); } target.add(container); // in case the navigator is not contained by the container, we have // to add it to the response if (((MarkupContainer) container).contains(this, true) == false) { target.add(this); } }
From source file:com.evolveum.midpoint.web.component.data.paging.NavigatorPanel.java
License:Apache License
private void changeCurrentPage(AjaxRequestTarget target, long page) { pageable.setCurrentPage(page);// w ww. j a v a 2 s . c o m Component container = ((Component) pageable); while (container instanceof AbstractRepeater) { container = container.getParent(); } target.add(container); target.add(this); }
From source file:com.evolveum.midpoint.web.page.admin.users.component.OrgMemberPanel.java
License:Apache License
private void deleteManagerPerformed(final FocusType manager, final Component summary, AjaxRequestTarget target) {//from w w w.ja va 2 s .c o m ConfirmationPanel confirmDelete = new ConfirmationPanel(getPageBase().getMainPopupBodyId(), createStringResource("TreeTablePanel.menu.deleteManager.confirm")) { @Override public void yesPerformed(AjaxRequestTarget target) { OrgMemberPanel.this.deleteManagerConfirmPerformed(manager, target); summary.getParent().setVisible(false); target.add(OrgMemberPanel.this); } }; getPageBase().showMainPopup(confirmDelete, target); }
From source file:com.evolveum.midpoint.web.util.SchrodingerComponentInitListener.java
License:Apache License
private void writeDataAttribute(Component component, String key, String value) { if (!component.getRenderBodyOnly()) { component.add(AttributeModifier.append(ATTR_DATA_PREFIX + key, value)); return;//from w w w . j a v a 2s .co m } if ("title".equals(component.getId()) && component.getParent() instanceof Page) { // we don't want to alter <title> element return; } component.add(new Behavior() { @Override public void afterRender(Component component) { Response resp = component.getResponse(); resp.write("<schrodinger " + ATTR_DATA_PREFIX + key + "=\"" + value + "\"></schrodinger>"); } }); }
From source file:com.gitblit.wicket.panels.ObjectContainer.java
License:Apache License
protected String resolveResource(String src) { // if it's an absolute path, return it: if (src.startsWith("/") || src.startsWith("http://") || src.startsWith("https://")) return (src); // use the parent container class to resolve the resource reference Component parent = getParent(); if (parent instanceof Fragment) { // must check for fragment, otherwise we end up in Wicket namespace parent = parent.getParent(); }//from w w w . j av a 2 s . c o m if (parent != null) { PackageResourceReference resRef = new PackageResourceReference(parent.getClass(), src); return (urlFor(resRef, getPage().getPageParameters()).toString()); } return (src); }
From source file:com.googlecode.wicketelements.security.AnnotationAuthorizationStrategy.java
License:Apache License
public boolean isActionAuthorized(final Component componentParam, final Action actionParam) { PARAM_REQ.Object.requireNotNull(componentParam, "The component parameter must not be null."); PARAM_REQ.Object.requireNotNull(actionParam, "The action parameter must not be null."); final Class<? extends Component> componentClass = componentParam.getClass(); if (securityCheck.isSecurityAnnotatedComponent(componentClass)) { final IUser user = SecureSession.get().getUser(); if (user != null) { Class<? extends Annotation> securityAnnotationClass = null; List<Class<? extends SecurityConstraint>> constraints = null; if (Component.RENDER.equals(actionParam)) { securityAnnotationClass = RenderAction.class; constraints = securityCheck.findSecurityConstraintsForRender(componentParam); } else if (Component.ENABLE.equals(actionParam)) { securityAnnotationClass = EnableAction.class; if (!isActionAuthorized(componentParam.getParent(), actionParam)) { return false; } //else go on, check if the user has the permission constraints = securityCheck.findSecurityConstraintsForEnable(componentParam); }//from ww w. j a v a 2 s . co m if (securityAnnotationClass == null) { throw new IllegalStateException( "Action is unknown (Render or Enable expected).: " + actionParam); } final boolean constraintsSatisfied = securityCheck .isAllSecurityConstraintsSatisfiedForAction(componentParam, constraints); final Set<String> permissions = securityCheck.findImpliedPermissions(componentClass, securityAnnotationClass); final boolean userHasPermission = securityCheck.isAtLeastOnePermissionGivenToUser(permissions); return constraintsSatisfied && userHasPermission; } } else { LOGGER.debug("No security annotation on the component. Action is authorized."); return true; } return true; }