Example usage for org.apache.wicket Component getMetaData

List of usage examples for org.apache.wicket Component getMetaData

Introduction

In this page you can find the example usage for org.apache.wicket Component getMetaData.

Prototype

public final <M extends Serializable> M getMetaData(final MetaDataKey<M> key) 

Source Link

Document

Gets metadata for this component using the given key.

Usage

From source file:org.opensingular.form.wicket.util.WicketFormUtils.java

License:Apache License

public static boolean isForInstance(Component component, SInstance instance) {
    return Objects.equal(component.getMetaData(KEY_INSTANCE_ID), instance.getId());
}

From source file:org.opensingular.form.wicket.util.WicketFormUtils.java

License:Apache License

public static boolean isMarkedAsCellContainer(Component container) {
    return Boolean.TRUE.equals(container.getMetaData(KEY_IS_CELL_CONTAINER));
}

From source file:org.opensingular.form.wicket.util.WicketFormUtils.java

License:Apache License

public static Optional<MarkupContainer> findCellContainer(Component component) {
    // ele mesmo/*from   w w  w. j  ava 2  s . c  om*/
    if (isMarkedAsCellContainer(component))
        return Optional.of((MarkupContainer) component);

    // referencia direta
    final MarkupContainer container = component.getMetaData(KEY_CELL_CONTAINER);
    if (container != null)
        return Optional.of(container);

    // busca nos ascendentes
    return streamAscendants(component).filter(WicketFormUtils::isMarkedAsCellContainer).findFirst();
}

From source file:org.opensingular.form.wicket.WicketBuildContext.java

License:Apache License

public static Optional<WicketBuildContext> find(Component comp) {
    return Optional.ofNullable(comp.getMetaData(METADATA_KEY));
}

From source file:org.opensingular.lib.wicket.util.bootstrap.datepicker.BSDatepickerInputGroup.java

License:Apache License

public static BSDatepickerInputGroup getFromTextfield(Component textfield) {
    return (BSDatepickerInputGroup) textfield.getMetaData(BSDatepickerConstants.KEY_CONTAINER);
}

From source file:org.wicketstuff.security.components.SecureComponentHelper.java

License:Apache License

/**
 * The security check placed on the component or null. This uses the metadata of a component to
 * store or retrieve the {@link ISecurityCheck}.
 * /*from w w  w.  j  a va 2  s.c  o  m*/
 * @param component
 *            if null, null will be returned
 * @return the security check or null if none was placed on the component
 */
public static ISecurityCheck getSecurityCheck(Component component) {
    if (component != null)
        return component.getMetaData(new WaspKey());
    return null;
}