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

Examples of org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento


            }
        };
    }

    private void resetIfCurrentNotInChoices(final Select2Choice<ObjectAdapterMemento> select2Field, final List<ObjectAdapterMemento> choiceMementos) {
        final ObjectAdapterMemento curr = select2Field.getModelObject();
        if(curr == null) {
            select2Field.getModel().setObject(null);
            getModel().setObject(null);
            return;
        }
        if(!curr.containedIn(choiceMementos)) {
            if(!choiceMementos.isEmpty()) {
                final ObjectAdapterMemento newAdapterMemento = choiceMementos.get(0);
                select2Field.getModel().setObject(newAdapterMemento);
                getModel().setObject(newAdapterMemento.getObjectAdapter(ConcurrencyChecking.NO_CHECK));
            } else {
                select2Field.getModel().setObject(null);
                getModel().setObject(null);
            }
        }
View Full Code Here



    private void buildEntityActionsGui() {
        final EntityModel model = getModel();
        final ObjectAdapter adapter = model.getObject();
        final ObjectAdapterMemento adapterMemento = model.getObjectAdapterMemento();
        if (adapter != null) {
            final List<ObjectAction> topLevelActions = getTopLevelActions(adapter);

            if(!topLevelActions.isEmpty()) {
                final CssMenuBuilder cssMenuBuilder = new CssMenuBuilder(adapterMemento, getServiceAdapters(), topLevelActions, linkFactory);
View Full Code Here

        Assert.assertThat(mementos.size(), is(1));
        Assert.assertThat(mementos.iterator().next(), is(nullValue()));
    }

    private ObjectAdapterMemento mock(final String id) {
        final ObjectAdapterMemento mock = context.mock(ObjectAdapterMemento.class, id);
        context.checking(new Expectations() {{
            allowing(mock).asString();
            will(returnValue(id));
        }});
        return mock;
View Full Code Here

    }
   
    protected void addAdditionalLinksTo(final MarkupContainer labelIfRegular) {
        final List<LinkAndLabel> entityActions;
        if(scalarModel.getKind() == ScalarModel.Kind.PROPERTY) {
            final ObjectAdapterMemento parentMemento = scalarModel.getParentObjectAdapterMemento();
            final EntityModel parentEntityModel = new EntityModel(parentMemento);
            final ActionPromptProvider actionPromptProvider = ActionPromptProvider.Util.getFrom(this);
            entityActions = EntityActionUtil.entityActionsForAssociation(
                    parentEntityModel, scalarModel.getPropertyMemento().getProperty(), actionPromptProvider, getDeploymentType());
        } else {
View Full Code Here

            this.hasPending = false;
            this.pending = null;
        }

        private ObjectAdapter getPendingAdapter() {
            final ObjectAdapterMemento memento = getObject();
            return memento != null ? memento.getObjectAdapter(ConcurrencyChecking.NO_CHECK) : null;
        }
View Full Code Here

     * @param objectAdapter
     * @param action
     * @return
     */
    public static ActionModel create(ObjectAdapter objectAdapter, ObjectAction action) {
        final ObjectAdapterMemento serviceMemento = ObjectAdapterMemento.Functions.fromAdapter().apply(objectAdapter);
        final ActionMemento homePageActionMemento = ObjectAdapterMemento.Functions.fromAction().apply(action);
        final Mode mode = action.getParameterCount() > 0? Mode.PARAMETERS : Mode.RESULTS;
        return new ActionModel(serviceMemento, homePageActionMemento, mode);
    }
View Full Code Here

        return Lists.newArrayList(Lists.transform(choices, ObjectAdapterMemento.Functions.fromAdapter()));
    }

    // called by setProviderAndCurrAndPending
    private void resetIfCurrentNotInChoices(final Select2Choice<ObjectAdapterMemento> select2Field, final List<ObjectAdapterMemento> choiceMementos) {
        final ObjectAdapterMemento curr = select2Field.getModelObject();
        if(curr == null) {
            select2Field.getModel().setObject(null);
            getModel().setObject(null);
            return;
        }
       
        if(!curr.containedIn(choiceMementos)) {
            if(!choiceMementos.isEmpty()) {
                final ObjectAdapterMemento newAdapterMemento = choiceMementos.get(0);
                select2Field.getModel().setObject(newAdapterMemento);
                getModel().setObject(newAdapterMemento.getObjectAdapter(ConcurrencyChecking.NO_CHECK));
            } else {
                select2Field.getModel().setObject(null);
                getModel().setObject(null);
            }
        }
View Full Code Here

    // called by EntityLinkSelect2Panel
    void convertInput() {
        if(isEditableWithEitherAutoCompleteOrChoices()) {

            // flush changes to pending
            ObjectAdapterMemento convertedInput = select2Field.getConvertedInput();
           
            getModel().setPending(convertedInput);
            if(select2Field != null) {
                select2Field.getModel().setObject(convertedInput);
            }
           
            final ObjectAdapter adapter = convertedInput!=null?convertedInput.getObjectAdapter(ConcurrencyChecking.NO_CHECK):null;
            getModel().setObject(adapter);
        }
   
        final ObjectAdapter pendingAdapter = getModel().getPendingAdapter();
        entityLink.setConvertedInput(pendingAdapter);
View Full Code Here

                return memberOrderFacetComparator.compare(m1, m2);
            }});
       
        final ActionLinkFactory linkFactory = new EntityActionLinkFactory(entityModel);
   
        final ObjectAdapterMemento adapterMemento = entityModel.getObjectAdapterMemento();
        return Lists.transform(associatedActions, new Function<ObjectAction, LinkAndLabel>(){
   
            @Override
            public LinkAndLabel apply(ObjectAction objectAction) {
                return linkFactory.newLink(adapterMemento, objectAction, LinksSelectorPanelAbstract.ID_ADDITIONAL_LINK, actionPromptProvider);
View Full Code Here


    private void buildEntityActionsGui() {
        final EntityModel model = getModel();
        final ObjectAdapter adapter = model.getObject();
        final ObjectAdapterMemento adapterMemento = model.getObjectAdapterMemento();
        if (adapter != null) {
            final List<ObjectAction> topLevelActions = getTopLevelActions(adapter);

            if(!topLevelActions.isEmpty()) {
                final ActionPromptProvider actionPromptProvider = ActionPromptProvider.Util.getFrom(this);
View Full Code Here

TOP

Related Classes of org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento

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.