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

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


        final CheckBox checkBox = new CheckBox(id, new Model<Boolean>() {
            private static final long serialVersionUID = 1L;

            @Override
            public Boolean getObject() {
                final ScalarModel model = getModel();
                final ObjectAdapter adapter = model.getObject();
                return adapter != null? (Boolean) adapter.getObject(): false;
            }

            @Override
            public void setObject(final Boolean object) {
View Full Code Here


            paramPanels.clear();
            for (final ActionParameterMemento apm : parameterMementos) {
                final WebMarkupContainer container = new WebMarkupContainer(rv.newChildId());
                rv.add(container);

                final ScalarModel argumentModel = actionModel.getArgumentModel(apm);
                argumentModel.setActionArgsHint(actionModel.getArgumentsAsArray());
                final Component component = getComponentFactoryRegistry().addOrReplaceComponent(container, ComponentType.SCALAR_NAME_AND_VALUE, argumentModel);
                final ScalarPanelAbstract paramPanel = component instanceof ScalarPanelAbstract ? (ScalarPanelAbstract) component : null;
                paramPanels.add(paramPanel);
                if(paramPanel != null) {
                    paramPanel.setOutputMarkupId(true);
View Full Code Here

            setRequired(getScalarModel().isRequired());
            select2Field = Select2ChoiceUtil.newSelect2Choice(ID_AUTO_COMPLETE, model, getScalarModel());
            setProviderAndCurrAndPending(select2Field, getScalarModel().getActionArgsHint());
            if(!getScalarModel().hasChoices()) {
                final Settings settings = select2Field.getSettings();
                ScalarModel scalarModel = getScalarModel();
                final int minLength = scalarModel.getAutoCompleteMinLength();
                settings.setMinimumInputLength(minLength);
                settings.setPlaceholder(scalarModel.getName());
            }
            addOrReplace(select2Field);
        } else {
            //
            // the select2Field already exists, so the widget has been rendered before.  If it is
View Full Code Here

            private static final long serialVersionUID = 1L;
           
            @Override
            protected List<ObjectAdapterMemento> obtainMementos(String term) {
                final List<ObjectAdapter> autoCompleteChoices = Lists.newArrayList();
                final ScalarModel scalarModel = (ScalarModel) entityModel;
                if(scalarModel.hasAutoComplete()) {
                    autoCompleteChoices.addAll(scalarModel.getAutoComplete(term));
                }
                // take a copy otherwise is only lazily evaluated
                return Lists.newArrayList(Lists.transform(autoCompleteChoices, ObjectAdapterMemento.Functions.fromAdapter()));
            }
           
View Full Code Here

    }
   
    private List<ObjectAdapterMemento> getChoiceMementos(final ObjectAdapter[] argsIfAvailable) {
       
        final List<ObjectAdapter> choices = Lists.newArrayList();
        final ScalarModel scalarModel = (ScalarModel) getScalarModel();;
        if(scalarModel.hasChoices()) {
            choices.addAll(scalarModel.getChoices(argsIfAvailable));
        }
        // take a copy otherwise is only lazily evaluated
        return Lists.newArrayList(Lists.transform(choices, MementoFunctions.fromAdapter()));
    }
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;
        final ObjectSpecification specification = scalarModel.getTypeOfSpecification();
        return appliesIf(specification != null && !specification.containsFacet(ValueFacet.class));
    }
View Full Code Here

        return appliesIf(specification != null && !specification.containsFacet(ValueFacet.class));
    }

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

        entityLink.add(new AttributeModifier("title", Model.of(titleAttribute)));
    }

    @Override
    protected FormComponentLabel addComponentForRegular() {
        final ScalarModel scalarModel = getModel();
        final String name = scalarModel.getName();
       
        entityLink = (EntityLinkSelect2Panel) getComponentFactoryRegistry().createComponent(ComponentType.ENTITY_LINK, getModel());
       
        setOutputMarkupId(true);
        entityLink.setOutputMarkupId(true);
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

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.