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

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


    }

    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 = Lists.newArrayList(Lists.transform(choices, Mementos.fromAdapter()));
View Full Code Here


        addObjectAdapterValidator();
    }

    private void addObjectAdapterValidator() {
        final ScalarModel scalarModel = getModel();
        final TextField<java.util.Date> textField = getTextField();

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

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

        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 (Boolean) adapter.getObject();
            }

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

        final ObjectAdapter adapter = rowModel.getObject();
        final EntityModel model = new EntityModel(adapter);
        final OneToOneAssociation property = (OneToOneAssociation) adapter.getSpecification().getAssociation(propertyExpression);
        final PropertyMemento pm = new PropertyMemento(property);
        final ScalarModel scalarModel = model.getPropertyModel(pm);

        final ComponentFactory componentFactory = findComponentFactory(ComponentType.SCALAR_NAME_AND_VALUE, scalarModel);
        final Component component = componentFactory.createComponent(id, scalarModel);
        if (component instanceof ScalarPanelAbstract) {
            final ScalarPanelAbstract scalarPanel = (ScalarPanelAbstract) component;
            scalarPanel.setFormat(Format.COMPACT);
            scalarModel.toViewMode();
        }
        return component;
    }
View Full Code Here

        setRequiredIfSpecified();
        // setSizeIfSpecified();
    }

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

            valueField.add(new AttributeModifier("size", true, new Model<String>("" + size)));
        }
    }

    private int determineSize() {
        final ScalarModel scalarModel = getModel();
        final ObjectSpecification noSpec = scalarModel.getTypeOfSpecification();

        final TypicalLengthFacet typicalLengthFacet = noSpec.getFacet(TypicalLengthFacet.class);
        if (typicalLengthFacet != null) {
            return typicalLengthFacet.value();
        }
View Full Code Here

        final List<PropertyMemento> mementos = buildPropertyMementos(properties);
        for (final PropertyMemento pm : mementos) {
            final WebMarkupContainer container = new WebMarkupContainer(rv.newChildId());
            rv.add(container);

            final ScalarModel scalarModel = entityModel.getPropertyModel(pm);
            getComponentFactoryRegistry().addOrReplaceComponent(container, idProperty, ComponentType.SCALAR_NAME_AND_VALUE, scalarModel);
        }
    }
View Full Code Here

        final List<PropertyMemento> mementos = buildPropertyMementos(properties);
        for (final PropertyMemento pm : mementos) {
            final WebMarkupContainer container = new WebMarkupContainer(rv.newChildId());
            rv.add(container);

            final ScalarModel scalarModel = entityModel.getPropertyModel(pm);
            getComponentFactoryRegistry().addOrReplaceComponent(container, idProperty,
                ComponentType.SCALAR_NAME_AND_VALUE, scalarModel);
        }
    }
View Full Code Here

            final List<ActionParameterMemento> mementos = buildParameterMementos(parameters);
            for (final ActionParameterMemento apm : mementos) {
                final WebMarkupContainer container = new WebMarkupContainer(rv.newChildId());
                rv.add(container);

                final ScalarModel argumentModel = actionModel.getArgumentModel(apm);
                getComponentFactoryRegistry().addOrReplaceComponent(container, ComponentType.SCALAR_NAME_AND_VALUE,
                    argumentModel);
            }
        }
View Full Code Here

    @Override
    protected void onBeforeRender() {
        if (!hasBeenRendered()) {
            buildGui();
        }
        final ScalarModel scalarModel = getModel();
        if (scalarModel.isViewMode()) {
            onBeforeRenderWhenViewMode();
        } else {
            final String disableReasonIfAny = scalarModel.disable();
            if (disableReasonIfAny != null) {
                onBeforeRenderWhenDisabled(disableReasonIfAny);
            } else {
                onBeforeRenderWhenEnabled();
            }
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.