Package org.apache.isis.viewer.html.component

Examples of org.apache.isis.viewer.html.component.ComponentFactory


        for (int i = 0; i < crumbs.length; i++) {
            names[i] = crumbs[i].title();
        }

        final ComponentFactory factory = context.getComponentFactory();
        final Component breadCrumbs = factory.createBreadCrumbs(names, isLinked);

        page.setCrumbs(breadCrumbs);
    }
View Full Code Here


        final ObjectSpecification specification = object.getSpecification();
        final List<ObjectAssociation> visibleFields = specification.getAssociations(ObjectAssociationFilters.dynamicallyVisible(getAuthenticationSession(), object, where));
        for (int i = 0; i < visibleFields.size(); i++) {
            final ObjectAssociation field = visibleFields.get(i);

            final ComponentFactory factory = context.getComponentFactory();
            final Block fieldBlock = factory.createBlock("field", field.getDescription());
            fieldBlock.add(factory.createInlineBlock("label", field.getName(), null));
            fieldBlock.add(factory.createInlineBlock("separator", ":  ", null));

            getPersistenceSession().resolveField(object, field);

            // ordering is important here;
            // look at parseable fields before objects
            final ObjectAdapter associatedObject = field.get(object);
            Component component = null;
            if (field.getSpecification().isParseable()) {
                component = factory.createParseableField(field, associatedObject, false);
            } else if (field.isOneToOneAssociation()) {
                if (associatedObject == null) {
                    component = factory.createInlineBlock("value", "", null);
                    fieldBlock.add(component);
                } else {
                    // previously there was a called to resolveImmediately here
                    // on the
                    // associated object, but it has been removed (presumably we
                    // don't
                    // want to force eager loading).
                    final String elementId = context.mapObject(associatedObject);
                    component = factory.createObjectIcon(field, associatedObject, elementId, "value");
                }
            } else if (field.isOneToManyAssociation()) {
                component = factory.createCollectionIcon(field, associatedObject, id);
            } else {
                throw new UnknownTypeException(field);
            }
            fieldBlock.add(component);
View Full Code Here

        final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(collection);
        final List<ObjectAssociation> columnAssociations = elementType.getAssociations(Filters.and(WHEN_VISIBLE_IRRESPECTIVE_OF_WHERE, PROPERTIES));

        final int len = columnAssociations.size();

        final ComponentFactory factory = context.getComponentFactory();
        final Table table = factory.createTable(len, addSelector);
        table.setSummary(summary);

        for (final ObjectAssociation columnAssociation : columnAssociations) {
            table.addColumnHeader(columnAssociation.getName());
        }

        for (final ObjectAdapter rowAdapter : facet.iterable(collection)) {
            getPersistenceSession().resolveImmediately(rowAdapter);
            final String elementId = context.mapObject(rowAdapter);
            table.addRowHeader(factory.createObjectIcon(rowAdapter, elementId, "icon"));

            for (final ObjectAssociation columnAssociation : columnAssociations) {
                final ObjectAdapter columnAdapter = columnAssociation.get(rowAdapter);

                final ObjectSpecification columnSpec = columnAssociation.getSpecification();

                if (!columnAssociation.isVisible(getAuthenticationSession(), rowAdapter, where).isAllowed()) {
                    table.addEmptyCell();
                } else if (columnSpec.isParseable()) {
                    final MultiLineFacet multiline = columnSpec.getFacet(MultiLineFacet.class);
                    final boolean shouldTruncate = multiline != null && multiline.numberOfLines() > 1;
                    final String titleString = columnAdapter != null ? columnAdapter.titleString() : "";
                    table.addCell(titleString, shouldTruncate);
                } else if (columnAdapter == null) {
                    table.addEmptyCell();
                } else {
                    getPersistenceSession().resolveImmediately(columnAdapter);
                    final String objectId = context.mapObject(columnAdapter);
                    table.addCell(factory.createObjectIcon(columnAssociation, columnAdapter, objectId, "icon"));
                }
            }
            /*
             * if (addSelector) {
             * table.addCell(context.getFactory().createRemoveOption(id,
 
View Full Code Here

        final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(collection);
        final List<ObjectAssociation> columnAssociations = elementType.getAssociations(Filters.and(STATICALLY_VISIBLE_ASSOCIATIONS, PROPERTIES));

        final int len = columnAssociations.size();

        final ComponentFactory factory = context.getComponentFactory();
        final Table table = factory.createTable(len, addSelector);
        table.setSummary(summary);

        for (final ObjectAssociation columnAssociation : columnAssociations) {
            table.addColumnHeader(columnAssociation.getName());
        }

        for (final ObjectAdapter rowAdapter : facet.iterable(collection)) {
            getPersistenceSession().resolveImmediately(rowAdapter);
            final String elementId = context.mapObject(rowAdapter);
            table.addRowHeader(factory.createObjectIcon(rowAdapter, elementId, "icon"));

            for (final ObjectAssociation columnAssociation : columnAssociations) {
                final ObjectAdapter columnAdapter = columnAssociation.get(rowAdapter);

                final ObjectSpecification columnSpec = columnAssociation.getSpecification();
                if (!columnAssociation.isVisible(getAuthenticationSession(), rowAdapter).isAllowed()) {
                    table.addEmptyCell();
                } else if (columnSpec.isParseable()) {
                    final MultiLineFacet multiline = columnSpec.getFacet(MultiLineFacet.class);
                    final boolean shouldTruncate = multiline != null && multiline.numberOfLines() > 1;
                    final String titleString = columnAdapter != null ? columnAdapter.titleString() : "";
                    table.addCell(titleString, shouldTruncate);
                } else if (columnAdapter == null) {
                    table.addEmptyCell();
                } else {
                    getPersistenceSession().resolveImmediately(columnAdapter);
                    final String objectId = context.mapObject(columnAdapter);
                    table.addCell(factory.createObjectIcon(columnAssociation, columnAdapter, objectId, "icon"));
                }
            }
            /*
             * if (addSelector) {
             * table.addCell(context.getFactory().createRemoveOption(id,
 
View Full Code Here

        final ObjectSpecification specification = object.getSpecification();
        final List<ObjectAssociation> visibleFields = specification.getAssociations(ObjectAssociationFilters.dynamicallyVisible(getAuthenticationSession(), object));
        for (int i = 0; i < visibleFields.size(); i++) {
            final ObjectAssociation field = visibleFields.get(i);

            final ComponentFactory factory = context.getComponentFactory();
            final Block fieldBlock = factory.createBlock("field", field.getDescription());
            fieldBlock.add(factory.createInlineBlock("label", field.getName(), null));
            fieldBlock.add(factory.createInlineBlock("separator", ":  ", null));

            getPersistenceSession().resolveField(object, field);

            // ordering is important here;
            // look at parseable fields before objects
            final ObjectAdapter associatedObject = field.get(object);
            Component component = null;
            if (field.getSpecification().isParseable()) {
                component = factory.createParseableField(field, associatedObject, false);
            } else if (field.isOneToOneAssociation()) {
                if (associatedObject == null) {
                    component = factory.createInlineBlock("value", "", null);
                    fieldBlock.add(component);
                } else {
                    // previously there was a called to resolveImmediately here
                    // on the
                    // associated object, but it has been removed (presumably we
                    // don't
                    // want to force eager loading).
                    final String elementId = context.mapObject(associatedObject);
                    component = factory.createObjectIcon(field, associatedObject, elementId, "value");
                }
            } else if (field.isOneToManyAssociation()) {
                component = factory.createCollectionIcon(field, associatedObject, id);
            } else {
                throw new UnknownTypeException(field);
            }
            fieldBlock.add(component);
View Full Code Here

        for (int i = 0; i < crumbs.length; i++) {
            names[i] = crumbs[i].title();
        }

        final ComponentFactory factory = context.getComponentFactory();
        final Component breadCrumbs = factory.createBreadCrumbs(names, isLinked);

        page.setCrumbs(breadCrumbs);
    }
View Full Code Here

            specification.getAssociations(ObjectAssociationFilters.dynamicallyVisible(
                IsisContext.getAuthenticationSession(), object));
        for (int i = 0; i < visibleFields.size(); i++) {
            final ObjectAssociation field = visibleFields.get(i);

            final ComponentFactory factory = context.getComponentFactory();
            final Block fieldBlock = factory.createBlock("field", field.getDescription());
            fieldBlock.add(factory.createInlineBlock("label", field.getName(), null));
            fieldBlock.add(factory.createInlineBlock("separator", ":  ", null));

            IsisContext.getPersistenceSession().resolveField(object, field);

            // ordering is important here;
            // look at parseable fields before objects
            final ObjectAdapter associatedObject = field.get(object);
            Component component = null;
            if (field.getSpecification().isParseable()) {
                component = factory.createParseableField(field, associatedObject, false);
            } else if (field.isOneToOneAssociation()) {
                if (associatedObject == null) {
                    component = factory.createInlineBlock("value", "", null);
                    fieldBlock.add(component);
                } else {
                    // previously there was a called to resolveImmediately here on the
                    // associated object, but it has been removed (presumably we don't
                    // want to force eager loading).
                    final String elementId = context.mapObject(associatedObject);
                    component = factory.createObjectIcon(field, associatedObject, elementId, "value");
                }
            } else if (field.isOneToManyAssociation()) {
                component = factory.createCollectionIcon(field, associatedObject, id);
            } else {
                throw new UnknownTypeException(field);
            }
            fieldBlock.add(component);
View Full Code Here

        for (int i = 0; i < crumbs.length; i++) {
            names[i] = crumbs[i].title();
        }

        final ComponentFactory factory = context.getComponentFactory();
        final Component breadCrumbs = factory.createBreadCrumbs(names, isLinked);

        page.setCrumbs(breadCrumbs);
    }
View Full Code Here

        final List<ObjectAssociation> columnAssociations =
            elementType.getAssociations(Filters.and(STATICALLY_VISIBLE_ASSOCIATIONS, PROPERTIES));

        final int len = columnAssociations.size();

        final ComponentFactory factory = context.getComponentFactory();
        final Table table = factory.createTable(len, addSelector);
        table.setSummary(summary);

        for (final ObjectAssociation columnAssociation : columnAssociations) {
            table.addColumnHeader(columnAssociation.getName());
        }

        for (final ObjectAdapter rowAdapter : facet.iterable(collection)) {
            getPersistenceSession().resolveImmediately(rowAdapter);
            final String elementId = context.mapObject(rowAdapter);
            table.addRowHeader(factory.createObjectIcon(rowAdapter, elementId, "icon"));

            for (final ObjectAssociation columnAssociation : columnAssociations) {
                final ObjectAdapter columnAdapter = columnAssociation.get(rowAdapter);

                final ObjectSpecification columnSpec = columnAssociation.getSpecification();
                if (!columnAssociation.isVisible(getAuthenticationSession(), rowAdapter).isAllowed()) {
                    table.addEmptyCell();
                } else if (columnSpec.isParseable()) {
                    final MultiLineFacet multiline = columnSpec.getFacet(MultiLineFacet.class);
                    final boolean shouldTruncate = multiline != null && multiline.numberOfLines() > 1;
                    final String titleString = columnAdapter != null ? columnAdapter.titleString() : "";
                    table.addCell(titleString, shouldTruncate);
                } else if (columnAdapter == null) {
                    table.addEmptyCell();
                } else {
                    getPersistenceSession().resolveImmediately(columnAdapter);
                    final String objectId = context.mapObject(columnAdapter);
                    table.addCell(factory.createObjectIcon(columnAssociation, columnAdapter, objectId, "icon"));
                }
            }
            /*
             * if (addSelector) { table.addCell(context.getFactory().createRemoveOption(id, elementId,
             * collectionField.getId())); }
View Full Code Here

TOP

Related Classes of org.apache.isis.viewer.html.component.ComponentFactory

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.