org.apache.wicket.Component - java examples

Here are the examples of the java api org.apache.wicket.Component taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

155 Examples 7

19 View Complete Implementation : EnabledContainer.java
Copyright Apache License 2.0
Author : igloo-project
public EnabledContainer component(Component component) {
    components.add(component);
    return this;
}

19 View Complete Implementation : AbstractNavbarPanel.java
Copyright Apache License 2.0
Author : igloo-project
protected void addActiveClreplaced(Lisreplacedem<NavigationMenuItem> item, Clreplaced<? extends Page> clazz, Component component) {
    addActiveClreplaced(item.getModelObject()::isActive, clazz, component);
}

19 View Complete Implementation : AbstractLinkParameterMappingEntry.java
Copyright Apache License 2.0
Author : igloo-project
protected <T> IModel<T> wrap(IModel<T> model, Component component) {
    return Models.wrap(model, component);
}

19 View Complete Implementation : MultivaluedExpandBehavior.java
Copyright Apache License 2.0
Author : igloo-project
protected JsStatement statement(Component component) {
    return new JsStatement().$(component).chain(multivaluedExpand);
}

19 View Complete Implementation : BootstrapModalStatement.java
Copyright Apache License 2.0
Author : igloo-project
public static final JsStatement hide(Component modal) {
    return new JsStatement().$(modal).chain(BootstrapModal.hide()).append(";");
}

19 View Complete Implementation : BootstrapPopoverOptions.java
Copyright Apache License 2.0
Author : igloo-project
public BootstrapPopoverOptions replacedle(Component replacedleComponent) {
    this.replacedleComponent = replacedleComponent;
    return this;
}

19 View Complete Implementation : BootstrapModalStatement.java
Copyright Apache License 2.0
Author : igloo-project
public static final JsStatement show(Component modal, BootstrapModal options) {
    if (options == null) {
        return new JsStatement().$(modal).chain(BootstrapModal.modal()).append(";");
    } else {
        return new JsStatement().$(modal).chain(options).append(";");
    }
}

19 View Complete Implementation : DatePickerSync.java
Copyright Apache License 2.0
Author : igloo-project
private static String componentsToJSArray(Collection<? extends Component> components) {
    StringBuilder componentsSb = new StringBuilder(JS_ARRAY_START);
    for (Component component : components) {
        if (componentsSb.length() > JS_ARRAY_START.length()) {
            componentsSb.append(", ");
        }
        componentsSb.append(new JsStatement().$(component).render(false).toString());
    }
    componentsSb.append(JS_ARRAY_CLOSE);
    return componentsSb.toString();
}

19 View Complete Implementation : ComponentUtils.java
Copyright Apache License 2.0
Author : igloo-project
public static final Stream<Component> parents(Component component) {
    return Streams.stream(new ComponentParenreplacederator(component));
}

19 View Complete Implementation : FormProcessedListener.java
Copyright Apache License 2.0
Author : igloo-project
@Override
public void onAfterRender(Component component) {
    if (component instanceof Form) {
        // Nettoyage des metadonnées ajoutées par PROCESSING_LISTENER
        component.setMetaData(IS_PROCESSED, null);
    }
}

19 View Complete Implementation : AbstractAjaxInputPrerequisiteBehavior.java
Copyright Apache License 2.0
Author : igloo-project
// Visits.visit is screwed: it does not accept Components, but only Iterable<Component>, on contrary to Visits.visitPostOrder
private static final <T extends Component, R> R visit(Component component, IVisitor<T, R> visitor, IVisitFilter filter) {
    return Visits.visitChildren(Collections.<Component>singleton(component), visitor, filter);
}

19 View Complete Implementation : SeparatorContainer.java
Copyright Apache License 2.0
Author : igloo-project
public SeparatorContainer components(Component component1, Component component2) {
    components = new Pair<Component, Component>(component1, component2);
    return this;
}

19 View Complete Implementation : MoreBehavior.java
Copyright Apache License 2.0
Author : igloo-project
@Override
public void renderHead(Component component, IHeaderResponse response) {
    super.renderHead(component, response);
    response.render(JavaScriptHeaderItem.forReference(MoreResourceReference.get()));
    response.render(OnDomReadyHeaderItem.forScript(new JsStatement().$(component).chain(more).render()));
}

19 View Complete Implementation : Condition.java
Copyright Apache License 2.0
Author : igloo-project
public static Condition componentsAnyVisible(Collection<? extends Component> targetComponents) {
    Condition condition = Condition.alwaysFalse();
    for (Component component : targetComponents) {
        condition = condition.or(visible(component));
    }
    return condition;
}

19 View Complete Implementation : Models.java
Copyright Apache License 2.0
Author : igloo-project
/**
 * @param model The model to be wrapped.
 * @param component The component to be used as a wrapping parameter.
 * @return The wrapped model, or the original model if it does not implement {@link IComponentreplacedignedModel}.
 */
public static <T> IModel<T> wrap(IModel<T> model, Component component) {
    if (model instanceof IComponentreplacedignedModel) {
        return ((IComponentreplacedignedModel<T>) model).wrapOnreplacedignment(component);
    } else {
        return model;
    }
}

19 View Complete Implementation : BootstrapPopoverOptions.java
Copyright Apache License 2.0
Author : igloo-project
public BootstrapPopoverOptions replacedle(Component replacedleComponent) {
    this.replacedleComponent = replacedleComponent;
    return this;
}

19 View Complete Implementation : BootstrapPopoverOptions.java
Copyright Apache License 2.0
Author : igloo-project
public BootstrapPopoverOptions content(Component contentComponent) {
    this.contentComponent = contentComponent;
    return this;
}

19 View Complete Implementation : AbstractUnauthorizedComponentInstantiationListener.java
Copyright Apache License 2.0
Author : igloo-project
protected void onUnauthorizedComponentInstantiation(Component component) {
    throw new UnauthorizedInstantiationException(component.getClreplaced());
}

19 View Complete Implementation : AbstractModalPopupPanel.java
Copyright Apache License 2.0
Author : igloo-project
/**
 * @param link
 * @param options - peut être null
 */
public void prepareLink(final Component link) {
    link.add(new ModalOpenOnClickBehavior(this) {

        private static final long serialVersionUID = 7578810529771850911L;

        @Override
        public JsStatement onModalStart() {
            return AbstractModalPopupPanel.this.onModalStart();
        }

        @Override
        public JsStatement onModalComplete() {
            return AbstractModalPopupPanel.this.onModalComplete();
        }

        @Override
        public JsStatement onModalShow() {
            return AbstractModalPopupPanel.this.onModalShow();
        }

        @Override
        public JsStatement onModalHide() {
            return AbstractModalPopupPanel.this.onModalHide();
        }
    });
}

19 View Complete Implementation : BootstrapButtonBehavior.java
Copyright Apache License 2.0
Author : igloo-project
public JsStatement statement(Component component) {
    return new JsStatement().$(component, ".btn").chain(BOOTSTRAP_BUTTON);
}

19 View Complete Implementation : AbstractAjaxInputPrerequisiteBehavior.java
Copyright Apache License 2.0
Author : igloo-project
private void resetFormComponents(Component attachedComponent) {
    visit(attachedComponent, resetFormComponentsVisitor, new ClreplacedVisitFilter(FormComponent.clreplaced));
}

19 View Complete Implementation : BootstrapAffixOptions.java
Copyright Apache License 2.0
Author : igloo-project
public BootstrapAffixOptions setEnclosing(Component enclosingComponent, int offset) {
    return setEnclosing(enclosingComponent, offset, offset);
}

19 View Complete Implementation : FactoryRepeatingView.java
Copyright Apache License 2.0
Author : igloo-project
/**
 * Wraps the components before adding them to the view, so the uniqueness of their ID is no longer relevant.
 * <p>This allows to add components to this view without worrying at all about what their ID should be.
 */
public void addWrapped(Component... components) {
    for (Component componentToWrap : components) {
        Wrapper wrapper = new Wrapper(newChildId());
        wrapper.add(componentToWrap);
        add(wrapper);
    }
}

19 View Complete Implementation : Condition.java
Copyright Apache License 2.0
Author : igloo-project
public static Condition componentVisible(Component component) {
    return visible(component);
}

19 View Complete Implementation : BootstrapModalStatement.java
Copyright Apache License 2.0
Author : igloo-project
public static final JsStatement show(Component modal) {
    return show(modal, null);
}

19 View Complete Implementation : BootstrapAffixOptions.java
Copyright Apache License 2.0
Author : igloo-project
public BootstrapAffixOptions setTarget(Component target) {
    put("target", new JsStatement().$(target).render(false).toString());
    return this;
}

19 View Complete Implementation : ClipboardBehavior.java
Copyright Apache License 2.0
Author : igloo-project
@Override
public void renderHead(Component component, IHeaderResponse response) {
    response.render(JavaScriptReferenceHeaderItem.forReference(ClipboardJavaScriptResourceReference.get()));
    response.render(OnDomReadyHeaderItem.forScript("new ClipboardJS('[" + DATA_CLIPBOARD + "]')"));
}

19 View Complete Implementation : AbstractAjaxInputPrerequisiteBehavior.java
Copyright Apache License 2.0
Author : igloo-project
private Component getAjaxTarget(Component componentToRender) {
    if (refreshParent) {
        return componentToRender.getParent();
    } else {
        return componentToRender;
    }
}

19 View Complete Implementation : CorePageLinkDescriptorImpl.java
Copyright Apache License 2.0
Author : igloo-project
@Override
public IPageLinkDescriptor wrap(Component component) {
    return new CorePageLinkDescriptorImpl(Models.wrap(pageClreplacedModel, component), parametersMapping.wrapOnreplacedignment(component), parametersValidator);
}

19 View Complete Implementation : AjaxListeners.java
Copyright Apache License 2.0
Author : igloo-project
/**
 * @return A listener that will trigger the refresh of every given component.
 */
public static AjaxRequestTarget.IListener refresh(Component first, Component... rest) {
    final List<Component> list = Lists.asList(first, rest);
    return new SerializableListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void onBeforeRespond(Map<String, Component> map, AjaxRequestTarget target) {
            for (Component component : list) {
                target.add(component);
            }
        }
    };
}

19 View Complete Implementation : BootstrapPopoverOptions.java
Copyright Apache License 2.0
Author : igloo-project
public BootstrapPopoverOptions content(Component contentComponent) {
    this.contentComponent = contentComponent;
    return this;
}

19 View Complete Implementation : BootstrapPopoverOptions.java
Copyright Apache License 2.0
Author : igloo-project
public BootstrapPopoverOptions container(Component containerComponent) {
    this.containerComponent = containerComponent;
    return this;
}

19 View Complete Implementation : BootstrapScrollSpyBehavior.java
Copyright Apache License 2.0
Author : igloo-project
public JsStatement statement(Component component) {
    return new JsStatement().$(component).chain(bootstrapScrollspy);
}

19 View Complete Implementation : ComponentPageModel.java
Copyright Apache License 2.0
Author : igloo-project
public clreplaced ComponentPageModel implements IModel<Page> {

    private static final long serialVersionUID = 6402816198383449645L;

    private final Component component;

    public ComponentPageModel(Component component) {
        this.component = component;
        replacedert.notNull(component, "[replacedertion failed] - this argument is required; it must not be null");
    }

    @Override
    public Page getObject() {
        return component.getPage();
    }
}

19 View Complete Implementation : MoreBehavior.java
Copyright Apache License 2.0
Author : igloo-project
@Override
public void detach(Component component) {
    super.detach(component);
    if (moreLabelModel != null) {
        moreLabelModel.detach();
    }
}

19 View Complete Implementation : MoreBehavior.java
Copyright Apache License 2.0
Author : igloo-project
@Override
public void onComponentTag(Component component, ComponentTag tag) {
    super.onComponentTag(component, tag);
    IModel<String> model = Models.wrap(moreLabelModel, component);
    String moreLabel = model.getObject();
    if (moreLabel != null) {
        tag.put(More.ATTRIBUTE_LABEL, moreLabel);
    }
}

19 View Complete Implementation : AbstractNavbarPanel.java
Copyright Apache License 2.0
Author : igloo-project
protected void addActiveClreplaced(IPageLinkGenerator pageLinkGenerator, Clreplaced<? extends Page> clazz, Component component) {
    addActiveClreplaced(pageLinkGenerator::isActive, clazz, component);
}

19 View Complete Implementation : BootstrapPopoverOptions.java
Copyright Apache License 2.0
Author : igloo-project
private JsScope getreplacedleFunction(final Component component, final JsStatement replacedleComponentStatement) {
    return new JsScope() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void execute(JsScopeContext scopeContext) {
            if (Boolean.TRUE.equals(closableModel.getObject())) {
                scopeContext.append("var replacedleHtml = " + replacedleComponentStatement.render()).append("replacedleHtml = replacedleHtml.concat(").append(JsUtils.quotes("<a clreplaced=\"close\"" + // Note : c'est moche, mais au moins ça marche. On renvoie bien du *html* ici,
                // ajouter des bindings jquery n'aura aucun effet.
                " onclick=\"new function() {" + new JsStatement().$(component).chain("popover", "'hide'").render() + " return false;" + "}\"" + ">×</a>", true)).append(");");
            }
            scopeContext.append("return replacedleHtml;");
        }
    };
}

19 View Complete Implementation : ComponentUtils.java
Copyright Apache License 2.0
Author : igloo-project
public static final boolean anyParent(Component component, SerializablePredicate2<? super Component> predicate) {
    return parents(component).anyMatch(predicate);
}

19 View Complete Implementation : InternalInlineEnclosureContainer.java
Copyright Apache License 2.0
Author : igloo-project
private void checkChildComponent(final Component controller, final String childId) {
    if (controller == null) {
        throw new WicketRuntimeException("Could not find child with id: " + childId + " in the wicket:enclosure-container");
    } else if (controller == this) {
        throw new WicketRuntimeException("Programming error: childComponent == enclose component; endless loop");
    }
}

19 View Complete Implementation : BootstrapPopoverOptions.java
Copyright Apache License 2.0
Author : igloo-project
public BootstrapPopoverOptions container(Component containerComponent) {
    this.containerComponent = containerComponent;
    return this;
}

19 View Complete Implementation : InternalInlineEnclosureContainer.java
Copyright Apache License 2.0
Author : igloo-project
private Component getChildComponent(final MarkupStream markupStream, MarkupContainer enclosureParent, String childId) {
    String fullChildId = childId.toString();
    Component controller = enclosureParent.get(fullChildId);
    if (controller == null) {
        int orgIndex = markupStream.getCurrentIndex();
        try {
            while (markupStream.isCurrentIndexInsideTheStream()) {
                markupStream.next();
                if (markupStream.skipUntil(ComponentTag.clreplaced)) {
                    ComponentTag tag = markupStream.getTag();
                    if ((tag != null) && (tag.isOpen() || tag.isOpenClose())) {
                        String tagId = tag.getId();
                        if (fullChildId.equals(tagId)) {
                            ComponentTag fullComponentTag = new ComponentTag(tag);
                            fullComponentTag.setId(childId.toString());
                            controller = ComponentResolvers.resolve(enclosureParent, markupStream, fullComponentTag, new ResolverFilter() {

                                @Override
                                public boolean ignoreResolver(final IComponentResolver resolver) {
                                    return resolver instanceof EnclosureHandler;
                                }
                            });
                            break;
                        } else if (fullChildId.startsWith(tagId + PATH_SEPARATOR)) {
                            fullChildId = Strings.afterFirst(fullChildId, PATH_SEPARATOR);
                        }
                    }
                }
            }
        } finally {
            markupStream.setCurrentIndex(orgIndex);
        }
    }
    checkChildComponent(controller, childId);
    return controller;
}

19 View Complete Implementation : BootstrapConfirmStatement.java
Copyright Apache License 2.0
Author : igloo-project
public static final JsStatement confirm(Component component) {
    return new JsStatement().$(component).chain(BootstrapConfirm.confirm()).append(";");
}

19 View Complete Implementation : BootstrapAffixOptions.java
Copyright Apache License 2.0
Author : igloo-project
public BootstrapAffixOptions setEnclosing(Component enclosingComponent) {
    return setEnclosing(enclosingComponent, 0);
}

19 View Complete Implementation : BootstrapPopoverOptions.java
Copyright Apache License 2.0
Author : igloo-project
private JsScope getreplacedleFunction(final Component component, final JsStatement replacedleComponentStatement) {
    return new JsScope() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void execute(JsScopeContext scopeContext) {
            if (Boolean.TRUE.equals(closableModel.getObject())) {
                scopeContext.append("var replacedleHtml = " + replacedleComponentStatement.render()).append("replacedleHtml = replacedleHtml.concat(").append(JsUtils.quotes("<a clreplaced=\"close\"" + // Note : c'est moche, mais au moins ça marche. On renvoie bien du *html* ici,
                // ajouter des bindings jquery n'aura aucun effet.
                " onclick=\"new function() {" + new JsStatement().$(component).chain("popover", "'hide'").render() + " return false;" + "}\"" + ">×</a>", true)).append(");");
            }
            scopeContext.append("return replacedleHtml;");
        }
    };
}

19 View Complete Implementation : ClipboardBehavior.java
Copyright Apache License 2.0
Author : igloo-project
public ClipboardBehavior target(Component component) {
    return target(new IModel<String>() {

        private static final long serialVersionUID = 1L;

        @Override
        public String getObject() {
            return component != null ? "#" + component.getMarkupId() : null;
        }
    });
}

19 View Complete Implementation : InternalInlineEnclosureContainer.java
Copyright Apache License 2.0
Author : igloo-project
protected final Component getChild(String childId) {
    Component childComponent = childrenComponent.get(childId);
    if (childComponent != null) {
        return childComponent;
    }
    // try to find child when queued
    childComponent = resolveChild(this, childId);
    if (childComponent == null) {
        // try to find child when resolved
        childComponent = getChildComponent(new MarkupStream(getMarkup()), getEnclosureParent(), childId);
    }
    return childComponent;
}

19 View Complete Implementation : ClipboardBehavior.java
Copyright Apache License 2.0
Author : igloo-project
@Override
public void onComponentTag(Component component, ComponentTag tag) {
    tag.append(DATA_CLIPBOARD, "", " ");
    dataAttributesValues.forEach((k, v) -> {
        if (StringUtils.hasText(v.getObject())) {
            tag.append(k, v.getObject(), " ");
        }
    });
    super.onComponentTag(component, tag);
}

19 View Complete Implementation : BootstrapPopoverBehavior.java
Copyright Apache License 2.0
Author : igloo-project
public JsStatement statement(Component component) {
    return new JsStatement().$(component).chain(BOOTSTRAP_POPOVER, options.getJavaScriptOptions(component));
}

19 View Complete Implementation : BootstrapScrollSpy.java
Copyright Apache License 2.0
Author : igloo-project
public BootstrapScrollSpy targetComponent(Component targetComponent) {
    this.targetComponent = targetComponent;
    return this;
}