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

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


    @Override
    protected ApplicationAdvice appliesTo(final IModel<?> model) {
        if (!(model instanceof ActionModel)) {
            return ApplicationAdvice.DOES_NOT_APPLY;
        }
        final ActionModel actionModel = (ActionModel) model;

        final NoResultsHandler hasNoResultsHandler = actionModel.getNoResultsHandler();
        // fail fast if a NoResultsHandler has not been specified
        return appliesIf(hasNoResultsHandler != null);
    }
View Full Code Here


        return appliesIf(hasNoResultsHandler != null);
    }

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

        super(id, model);
        buildGui(id);
    }

    private void buildGui(final String id) {
        final ActionModel model = getModel();
        addOrReplace(new Button("ok", Model.of("OK")) { // TODO: i18n

            private static final long serialVersionUID = 1L;

            @Override
            public void onSubmit() {
                model.getNoResultsHandler().onNoResults(this);
            }
        });
    }
View Full Code Here

    @Override
    public void executeActionAndProcessResults() {

        final ObjectAdapter targetAdapter = getModel().getTargetAdapter();

        final ActionModel actionModel = getActionModel();
        final String invalidReasonIfAny = actionModel.getReasonInvalidIfAny();
        if (invalidReasonIfAny != null) {
            error(invalidReasonIfAny);
            return;
        }

        // executes the action
        ObjectAdapter resultAdapter = actionModel.getObject();
        if (resultAdapter == null) {
            // TODO: a void; should indicate somehow
            resultAdapter = targetAdapter;
        }
View Full Code Here

        return appliesIf(model instanceof ActionModel);
    }

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

    @Override
    public LinkAndLabel newLink(final ObjectAdapterMemento adapterMemento, final ObjectAction action,
        final String linkId) {
        final ActionMemento actionMemento = new ActionMemento(action);
        final ActionModel.Mode actionMode = ActionModel.determineMode(action);
        final ActionModel actionModel =
            ActionModel.create(adapterMemento, actionMemento, actionMode, SingleResultsMode.SELECT);

        actionModel.setSelectionHandler(new SelectionHandler() {
            private static final long serialVersionUID = 1L;

            @Override
            public void onSelected(final Component context, final ObjectAdapter selectedAdapter) {
                entityLink.onSelected(selectedAdapter);
            }
        });
        actionModel.setNoResultsHandler(new NoResultsHandler() {
            private static final long serialVersionUID = 1L;

            @Override
            public void onNoResults(final Component context) {
                entityLink.onNoResults();
View Full Code Here

            @Override
            public void onClick() {
                // TODO: seems like can't use REDIRECT, since won't
                // let multiple setResponsePage() calls once
                // committed to redirecting (I'm guessing)
                final ActionModel actionModel =
                    ActionModel.create(adapterMemento, actionMemento, actionMode, SingleResultsMode.INLINE);
                summaryPanel.onClick(actionModel);
            }
        };
    }
View Full Code Here

        private ActionModel getActionModel() {
            return (ActionModel) super.getModel();
        }

        private void addParameters() {
            final ActionModel actionModel = getActionModel();
            final ObjectAction objectAction = actionModel.getActionMemento().getAction();
           
            final List<ObjectActionParameter> parameters = objectAction.getParameters();
           
            final List<ActionParameterMemento> mementos = buildParameterMementos(parameters);
            for (final ActionParameterMemento apm1 : mementos) {
                actionModel.getArgumentModel(apm1);
            }
           
            final RepeatingView rv = new RepeatingView(ID_ACTION_PARAMETERS);
            add(rv);
           
            paramPanels.clear();
            for (final ActionParameterMemento apm : mementos) {
                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

        }

        @Override
        public void onUpdate(AjaxRequestTarget target, ScalarModelProvider provider) {

            final ActionModel actionModel = getActionModel();
           
            final ObjectAdapter[] pendingArguments = actionModel.getArgumentsAsArray();
           
            try {
                final ObjectAction action = actionModel.getActionMemento().getAction();
                final int numParams = action.getParameterCount();
                for (int i = 0; i < numParams; i++) {
                    final ScalarPanelAbstract paramPanel = paramPanels.get(i);
                    if(paramPanel != null) {
                        // this could throw a ConcurrencyException as we may have to reload the
View Full Code Here

        return appliesIf(model instanceof ActionModel);
    }

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

TOP

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

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.