How to use the @nakedobjects/services.CollectionViewState.List 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 / cicero / src / cicero-commands / goto.ts View on Github external
return this.getObject().then((obj: Ro.DomainObjectRepresentation) => {
                if (this.isCollection()) {
                    const itemNo = this.argumentAsNumber(args, 0)!;
                    const openCollIds = this.ciceroRenderer.openCollectionIds(this.routeData());
                    const coll = obj.collectionMember(openCollIds[0]);
                    // Safe to assume always a List (Cicero doesn't support tables as such & must be open)
                    return this.context.getCollectionDetails(coll, CollectionViewState.List, false).then(details => this.attemptGotoLinkNumber(itemNo, details.value()));

                } else {
                    const matchingProps = this.matchingProperties(obj, arg0);
                    const matchingRefProps = filter(matchingProps, p => !p.isScalar());
                    const matchingColls = this.matchingCollections(obj, arg0);

                    switch (matchingRefProps.length + matchingColls.length) {
                        case 0:

                            return this.returnResult('', Usermessages.noRefFieldMatch(arg0));
                        case 1:
                            // TODO: Check for any empty reference
                            if (matchingRefProps.length > 0) {
                                const link = matchingRefProps[0].value().link();
                                if (link) {
                                    this.urlManager.setItem(link);
github NakedObjectsGroup / NakedObjectsFramework / Spa2 / nakedobjectsspa / view-models / src / list-view-model.ts View on Github external
readonly reset = (list: Ro.ListRepresentation, routeData: PaneRouteData) => {
        this.listRep = list;
        this.routeData = routeData;

        this.id = this.urlManager.getListCacheIndex(routeData.paneId, routeData.page, routeData.pageSize);

        this.page = this.listRep.pagination()!.page;
        this.pageSize = this.listRep.pagination()!.pageSize;
        this.numPages = this.listRep.pagination()!.numPages;

        this.state = this.listRep.hasTableData() ? CollectionViewState.Table : CollectionViewState.List;
        this.updateItems(list.value());
    }
github NakedObjectsGroup / NakedObjectsFramework / Spa2 / nakedobjectsspa / cicero / src / cicero-commands / page.ts View on Github external
private setPage(page: number) {
        const pageSize = this.routeData().pageSize;
        this.urlManager.setListPaging(page, pageSize, CollectionViewState.List);
    }
}
github NakedObjectsGroup / NakedObjectsFramework / Spa2 / nakedobjectsspa / gemini / src / list / list.component.ts View on Github external
constructor(
        private readonly activatedRoute: ActivatedRoute,
        private readonly urlManager: UrlManagerService,
        private readonly context: ContextService,
        private readonly viewModelFactory: ViewModelFactoryService,
        private readonly error: ErrorService,
        private readonly configService: ConfigService,
        private readonly loggerService: LoggerService,
        private readonly dragAndDrop: DragAndDropService
    ) {
    }

    collection: ListViewModel;
    title = '';
    currentState = CollectionViewState.List;
    selectedDialogId: string;

    private actionButton: IActionHolder = {
        value: 'Actions',
        doClick: () => this.toggleActionMenu(),
        show: () => true,
        disabled: () => this.disableActions(),
        tempDisabled: () => null,
        title: () => this.actionsTooltip,
        accesskey: 'a'
    };

    private reloadButton: IActionHolder = {
        value: 'Reload',
        doClick: () => this.reloadList(),
        show: () => true,
github NakedObjectsGroup / NakedObjectsFramework / Spa2 / nakedobjectsspa / view-models / src / list-view-model.ts View on Github external
readonly doList = () => {
        this.urlManager.setListState(CollectionViewState.List, this.onPaneId);
    }
github NakedObjectsGroup / NakedObjectsFramework / Spa2 / nakedobjectsspa / cicero / src / cicero-commands / show.ts View on Github external
private renderCollectionItems(coll: Ro.CollectionMember, startNo: number | null, endNo: number | null) {
        if (coll.value()) {
            return this.renderItems(coll, startNo, endNo);
        } else {
            return this.context.getCollectionDetails(coll, CollectionViewState.List, false).
                then(details => this.renderItems(details, startNo, endNo));
        }
    }