How to use the @nakedobjects/services.InteractionMode.Transient function in @nakedobjects/services

To help you get started, we’ve selected a few @nakedobjects/services examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NakedObjectsGroup / NakedObjectsFramework / Spa2 / nakedobjectsspa / view-models / src / collection-view-model.ts View on Github external
readonly reset = (routeData: PaneRouteData, resetting: boolean) => {

        let state = routeData.collections[this.collectionRep.collectionId()];

        // collections are always shown as summary on transient
        if (routeData.interactionMode === InteractionMode.Transient) {
            state = CollectionViewState.Summary;
        }

        function getDefaultTableState(exts: Ro.Extensions) {
            if (exts.renderEagerly()) {
                return exts.tableViewColumns() || exts.tableViewTitle() ? CollectionViewState.Table : CollectionViewState.List;
            }
            return CollectionViewState.Summary;
        }

        if (state == null) {
            state = getDefaultTableState(this.collectionRep.extensions());
        }

        this.editing = routeData.interactionMode === InteractionMode.Edit;
github NakedObjectsGroup / NakedObjectsFramework / Spa2 / nakedobjectsspa / gemini / src / object / object.component.ts View on Github external
.then((object: Ro.DomainObjectRepresentation) => {

                    // only change the object property if the object has changed
                    if (isChanging || wasDirty) {
                        this.object = this.viewModelFactory.domainObjectViewModel(object, routeData, wasDirty);
                    }

                    if (modeChanging || isChanging || wasDirty) {
                        if (this.mode === InteractionMode.Edit ||
                            this.mode === InteractionMode.Form ||
                            this.mode === InteractionMode.Transient) {
                            this.createForm(this.object!); // will never be null
                        }
                    }
                })
                .catch((reject: ErrorWrapper) => {
github NakedObjectsGroup / NakedObjectsFramework / Spa2 / nakedobjectsspa / view-models / src / domain-object-view-model.ts View on Github external
this.domainObject = obj;
        this.onPaneId = routeData.paneId;
        this.routeData = routeData;
        const iMode = this.domainObject.extensions().interactionMode();
        this.isInEdit = routeData.interactionMode !== InteractionMode.View || iMode === 'form' || iMode === 'transient';
        this.props = routeData.interactionMode !== InteractionMode.View ? this.contextService.getObjectCachedValues(this.domainObject.id(), routeData.paneId) : {};

        const actions = values(this.domainObject.actionMembers()) as Ro.ActionMember[];
        this.actions = map(actions, action => this.viewModelFactory.actionViewModel(action, this, this.routeData)).filter(avm => !avm.returnsScalar());

        this.menuItems = Helpers.createMenuItems(this.actions);

        this.properties = map(this.domainObject.propertyMembers(), (property, id) => this.viewModelFactory.propertyViewModel(property, id!, this.props[id!], this.onPaneId, this.propertyMap));
        this.collections = map(this.domainObject.collectionMembers(), collection => this.viewModelFactory.collectionViewModel(collection, this.routeData, resetting));

        this.unsaved = routeData.interactionMode === InteractionMode.Transient;

        this.title = this.unsaved ? `Unsaved ${this.domainObject.extensions().friendlyName()}` : this.domainObject.title();

        this.title = this.title + Helpers.dirtyMarker(this.contextService, this.configService, obj.getOid());

        this.friendlyName = this.domainObject.extensions().friendlyName();
        this.presentationHint = this.domainObject.extensions().presentationHint();
        this.domainType = this.domainObject.domainType()!;
        this.instanceId = this.domainObject.instanceId()!;
        this.draggableType = this.domainObject.domainType()!;

        const selfAsValue = (): Ro.Value | null => {
            const link = this.domainObject.selfLink();
            if (link) {
                // not transient - can't drag transients so no need to set up IDraggable members on transients
                link.setTitle(this.title);