Example usage for org.apache.wicket Component setMetaData

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

Introduction

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

Prototype

public final <M extends Serializable> Component setMetaData(final MetaDataKey<M> key, final M object) 

Source Link

Document

Sets the metadata for this component using the given key.

Usage

From source file:eu.uqasar.auth.strategies.metadata.MetaDataAuthorizationStrategy.java

License:Apache License

/**
 * Authorizes the given roles to perform the given action on the given
 * component.//from  w w  w  . ja  v a2s.co m
 *
 * @param component The component that is subject to the authorization
 * @param action The action to authorize
 * @param roles The roles to authorize
 */
private static void authorize(final Component component, final Action action, final Role... roles) {
    ActionPermissions permissions = component.getMetaData(ACTION_PERMISSIONS);
    if (permissions == null) {
        permissions = new ActionPermissions();
        component.setMetaData(ACTION_PERMISSIONS, permissions);
    }
    permissions.authorize(action, roles);
}

From source file:org.dcm4chee.web.common.secure.SecurityBehavior.java

License:LGPL

@Override
public void bind(Component component) {
    SecureComponentHelper.setSecurityCheck(component, new ComponentSecurityCheck(component));
    component.setMetaData(new ComponentHiveKey(String.class), hiveKey);
}

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

License:Apache License

public static SValidationFeedbackHandler bindTo(FeedbackFence fence) {
    Component component = fence.getMainContainer();
    if (isBound(component)) {
        return get(component);
    } else {// w  w w.ja v a  2  s  . co  m
        SValidationFeedbackHandler handler = new SValidationFeedbackHandler(fence);
        component.setMetaData(MDK, handler);
        return handler;
    }
}

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

License:Apache License

public static void setRootContainer(Component component, MarkupContainer rootContainer) {
    component.setMetaData(KEY_ROOT_CONTAINER, rootContainer);
}

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

License:Apache License

public static void setInstanceId(Component component, SInstance instance) {
    component.setMetaData(KEY_INSTANCE_ID, instance.getId());
}

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

License:Apache License

public static void setCellContainer(Component component, MarkupContainer container) {
    container.setOutputMarkupId(true);/*from  w ww  .j  a v a2  s  .c  om*/
    component.setMetaData(KEY_CELL_CONTAINER, container);
}

From source file:org.opensingular.lib.wicket.util.bootstrap.layout.BSControls.java

License:Apache License

public BSControls appendDatepicker(Component datepicker, Map<String, String> extraAttributes) {
    Map<String, String> attrs = new HashMap<String, String>();
    attrs.put("data-date-format", "dd/mm/yyyy");
    attrs.put("data-date-start-date", "01/01/1900");
    attrs.put("data-date-end-date", "31/12/2999");
    attrs.put("data-date-start-view", "days");
    attrs.put("data-date-min-view-mode", "days");
    if (extraAttributes != null)
        attrs.putAll(extraAttributes);//w ww.j a va 2 s  . c  om

    this.appendInputGroup(componentId -> {
        BSInputGroup inputGroup = newInputGroup();
        return (BSInputGroup) inputGroup.appendExtraClasses(" date ").appendExtraAttributes(attrs)
                .appendInputText(datepicker.setMetaData(BSDatepickerConstants.KEY_CONTAINER, inputGroup))
                .appendButtonAddon(Icone.CALENDAR).add(new DatePickerInitBehaviour());
    });
    return this;
}

From source file:org.wickedsource.wickedforms.wicket6.components.fields.AbstractFormElementPanel.java

License:Apache License

/**
 * Decorates a component of the form. Must be called by subclasses for each
 * component that represents a Wicked Charts model object (e.g. a subclass
 * panel that displays a text field must call this method with the
 * {@link TextField} component)./*from  w w w.  j  av a 2  s  .  c om*/
 * 
 * @param component
 *            the component to decorate.
 */
protected void decorateComponent(Component component) {
    component.setMetaData(COMPONENT_ID_KEY, model.getId());
}

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

License:Apache License

/**
 * Places a security check on a component. This uses the metadata of a component to store or
 * retrieve the {@link ISecurityCheck}.//ww w  . jav  a  2  s  .  c  om
 * 
 * @param component
 * @param securityCheck
 * @return the component or null if the component was null to begin with.
 */
public static Component setSecurityCheck(Component component, ISecurityCheck securityCheck) {
    if (component == null)
        return null;
    component.setMetaData(new WaspKey(), securityCheck);
    return component;
}