Package org.apache.isis.viewer.wicket.model.models

Examples of org.apache.isis.viewer.wicket.model.models.ScalarModel


    @Override
    public ApplicationAdvice appliesTo(final IModel<?> model) {
        if (!(model instanceof ScalarModel)) {
            return ApplicationAdvice.DOES_NOT_APPLY;
        }
        final ScalarModel scalarModel = (ScalarModel) model;
        final ValueFacet facet = scalarModel.getTypeOfSpecification().getFacet(ValueFacet.class);
        return appliesIf(facet != null);
    }
View Full Code Here


        return appliesIf(facet != null);
    }

    @Override
    public Component createComponent(final String id, final IModel<?> model) {
        final ScalarModel scalarModel = (ScalarModel) model;
        return new ValuePanel(id, scalarModel);
    }
View Full Code Here

    @Override
    public ApplicationAdvice appliesTo(final IModel<?> model) {
        if (!(model instanceof ScalarModel)) {
            return ApplicationAdvice.DOES_NOT_APPLY;
        }
        final ScalarModel scalarModel = (ScalarModel) model;
        return appliesIf(scalarModel.isScalarTypeAnyOf(scalarTypes));
    }
View Full Code Here

        return appliesIf(scalarModel.isScalarTypeAnyOf(scalarTypes));
    }

    @Override
    public final Component createComponent(final String id, final IModel<?> model) {
        final ScalarModel scalarModel = (ScalarModel) model;
        return createComponent(id, scalarModel);
    }
View Full Code Here

        entityLink.syncFindUsingVisibility();
    }

    @Override
    protected FormComponentLabel addComponentForRegular() {
        final ScalarModel scalarModel = getModel();
        final String name = scalarModel.getName();

        entityLink = (EntityLink) getComponentFactoryRegistry().createComponent(ComponentType.ENTITY_LINK, getModel());

        entityLink.setOutputMarkupId(true);
        entityLink.setLabel(Model.of(name));
View Full Code Here

    protected void addStandardSemantics() {
        setRequiredIfSpecified();
    }

    private void setRequiredIfSpecified() {
        final ScalarModel scalarModel = getModel();
        final boolean required = scalarModel.isRequired();
        entityLink.setRequired(required);
    }
View Full Code Here

        addObjectAdapterValidator();
    }

    private void addObjectAdapterValidator() {
        final ScalarModel scalarModel = getModel();

        entityLink.add(new IValidator<ObjectAdapter>() {

            private static final long serialVersionUID = 1L;

            @Override
            public void validate(final IValidatable<ObjectAdapter> validatable) {
                final ObjectAdapter proposedAdapter = validatable.getValue();
                final String reasonIfAny = scalarModel.validate(proposedAdapter);
                if (reasonIfAny != null) {
                    final ValidationError error = new ValidationError();
                    error.setMessage(reasonIfAny);
                    validatable.error(error);
                }
View Full Code Here

        addMaxLengthValidator();
        addObjectAdapterValidator();
    }

    private void addMaxLengthValidator() {
        final ScalarModel scalarModel = getModel();
        final TextField<String> textField = getTextField();

        final ObjectSpecification facetHolder = scalarModel.getTypeOfSpecification();

        final MaxLengthFacet maxLengthFacet = facetHolder.getFacet(MaxLengthFacet.class);
        if (maxLengthFacet != null) {
            textField.add(StringValidator.maximumLength(maxLengthFacet.value()));
        }
View Full Code Here

            textField.add(StringValidator.maximumLength(maxLengthFacet.value()));
        }
    }

    private void addObjectAdapterValidator() {
        final ScalarModel scalarModel = getModel();
        final TextField<String> textField = getTextField();

        textField.add(new IValidator<String>() {
            private static final long serialVersionUID = 1L;

            @Override
            public void validate(final IValidatable<String> validatable) {
                final String proposedValue = validatable.getValue();
                final String reasonIfAny = scalarModel.parseAndValidate(proposedValue);
                if (reasonIfAny != null) {
                    final ValidationError error = new ValidationError();
                    error.setMessage(reasonIfAny);
                    validatable.error(error);
                }
View Full Code Here

    }

    private IModel<List<? extends ObjectAdapterMemento>> getChoicesModel() {
        final EntityModel entityModel = getEntityModel();
        if (entityModel instanceof ScalarModel) {
            final ScalarModel scalarModel = (ScalarModel) entityModel;
            final List<ObjectAdapter> choices = scalarModel.getChoices();
            if (choices.size() == 0) {
                return null;
            }
            // take a copy otherwise is only lazily evaluated
            final List<ObjectAdapterMemento> choicesMementos =
View Full Code Here

TOP

Related Classes of org.apache.isis.viewer.wicket.model.models.ScalarModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.