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

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


        this.actionPromptIfAny = model.getActionPrompt();
        buildGui();
    }

    private void buildGui() {
        ActionModel model = getModel();
        // in case previously used, eg prompt displayed then cancelled
        model.clearArguments();
       
        add(new ActionParameterForm("inputForm", model));
    }
View Full Code Here


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

        private void addParameters() {
            final ActionModel actionModel = getActionModel();
            List<ActionParameterMemento> parameterMementos = actionModel.primeArgumentModels();
           
            final RepeatingView rv = new RepeatingView(ID_ACTION_PARAMETERS);
            add(rv);
           
            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

        }

        @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

        this.actionPromptIfAny = model.getActionPrompt();
        buildGui();
    }

    private void buildGui() {
        ActionModel model = getModel();
        // in case previously used, eg prompt displayed then cancelled
        model.clearArguments();
       
        add(new ActionParameterForm("inputForm", model));
    }
View Full Code Here

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

        private void addParameters() {
            final ActionModel actionModel = getActionModel();
            List<ActionParameterMemento> parameterMementos = actionModel.primeArgumentModels();
           
            final RepeatingView rv = new RepeatingView(ID_ACTION_PARAMETERS);
            add(rv);
           
            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

        }

        @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

    private boolean executeActionOnTargetAndProcessResults(
            final ObjectAdapter targetAdapter,
            final AjaxRequestTarget target,
            final Form<?> feedbackForm) {
       
        final ActionModel actionModel = getActionModel();
       
        // validate the action parameters (if any)
        final String invalidReasonIfAny = actionModel.getReasonInvalidIfAny();
       
        if (invalidReasonIfAny != null) {
            raiseWarning(target, feedbackForm, invalidReasonIfAny);
            return false;
        }
       
        final CommandContext commandContext = getServicesInjector().lookupService(CommandContext.class);
        final Command command;
        if (commandContext != null) {
            command = commandContext.getCommand();
            command.setExecutor(Executor.USER);
        } else {
            command = null;
        }
       
       
        // the object store could raise an exception (eg uniqueness constraint)
        // so we handle it here.
        try {
            // could be programmatic flushing, so must include in the try... finally
            final ObjectAdapter resultAdapter = executeActionHandlingApplicationExceptions();
     
            // flush any queued changes, so concurrency or violation exceptions (if any)
            // will be thrown here
            getTransactionManager().flushTransaction();
           
            ActionResultResponse resultResponse = ActionResultResponseType.determineAndInterpretResult(this.getActionModel(), target, resultAdapter);
            resultResponse.getHandlingStrategy().handleResults(this, resultResponse);

            if (actionModel.isBookmarkable()) {
                bookmarkPage(actionModel);
            }
           
            if(actionPrompt != null) {
                actionPrompt.closePrompt(target);
                // cos will be reused next time, so mustn't cache em.
                actionModel.clearArguments();
            }

            return true;

        } catch (RuntimeException ex) {
View Full Code Here

     *
     * <p>
     * Any other types of exception will be ignored (to be picked up higher up in the callstack)
     */
    private ObjectAdapter executeActionHandlingApplicationExceptions() {
        final ActionModel actionModel = getActionModel();
        try {
            ObjectAdapter resultAdapter = actionModel.getObject();
            return resultAdapter;

        } catch (RuntimeException ex) {

            // TODO: some duplication between this code and ActionLinkFactoryAbstract
View Full Code Here

        addBookmarkedPages();
       
    }

    private static String actionNameFrom(final ValueModel valueModel) {
        ActionModel actionModel = valueModel.getActionModelHint();
        if(actionModel != null) {
            return actionModel.getActionMemento().getAction().getName();
        }
        return "Results"; // fallback, probably not required because hint should always exist on the model.
    }
View Full Code Here

        addBookmarkedPages();
    }

    private static String actionNameFrom(final EntityCollectionModel model) {
        ActionModel actionModel = model.getActionModelHint();
        if(actionModel != null) {
            return actionModel.getActionMemento().getAction().getName();
        }
        return "Results"; // fallback, probably not required because hint should always exist on the model.
    }
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.