Examples of ViewSpecification


Examples of org.apache.isis.viewer.dnd.view.ViewSpecification

                    } else if (content instanceof ObjectContent && requirement.isObject() && requirement.isOpen()) {
                        spec = Properties.getDefaultObjectViewOptions();
                    }
                }
                if (spec != null) {
                    final ViewSpecification lookSpec = lookupSpecByName(spec);
                    if (lookSpec != null && lookSpec.canDisplay(requirement)) {
                        return lookSpec;
                    }
                }
            }
            for (final ViewSpecification viewSpecification : viewSpecifications) {
View Full Code Here

Examples of org.apache.isis.viewer.dnd.view.ViewSpecification

        return new Bounds(location, size);
    }

    private ViewSpecification loadSpecification(final String name, final Class<?> cls) {
        final String factoryName = IsisContext.getConfiguration().getString(SPECIFICATION_BASE + name);
        ViewSpecification spec;
        if (factoryName != null) {
            spec = InstanceUtil.createInstance(factoryName, ViewSpecification.class);
        } else {
            spec = InstanceUtil.createInstance(cls.getName(), ViewSpecification.class);
        }
View Full Code Here

Examples of org.apache.isis.viewer.dnd.view.ViewSpecification

        final ObjectAssociation field, final ObjectAdapter value) {
        if (field == null) {
            throw new NullPointerException();
        }
        final GlobalViewFactory factory = Toolkit.getViewFactory();
        ViewSpecification cellSpec;
        Content content;
        if (field instanceof OneToManyAssociation) {
            throw new UnexpectedCallException("no collections allowed");
        } else if (field instanceof OneToOneAssociation) {

            final ObjectSpecification fieldSpecification = field.getSpecification();
            if (fieldSpecification.isParseable()) {
                content = new TextParseableFieldImpl(object, value, (OneToOneAssociation) field);
                // REVIEW how do we deal with IMAGES?
                if (content.getAdapter() instanceof ImageValueFacet) {
                    return new BlankView(content);
                }

                if (!field.isVisible(IsisContext.getAuthenticationSession(), object).isAllowed()) {
                    return new BlankView(content);
                }
                if (((TextParseableContent) content).getNoLines() > 0) {
                    /*
                     * TODO remove this after introducing constraints into view specs that allow the parent view to
                     * specify what kind of subviews it can deal
                     */

                    if (fieldSpecification.containsFacet(BooleanValueFacet.class)) {
                        cellSpec = new CheckboxField.Specification();
                    } else {
                        cellSpec = new UnlinedTextFieldSpecification();
                    }
                } else {
                    return factory.createView(new ViewRequirement(content, ViewRequirement.CLOSED));
                }
            } else {
                content = new OneToOneFieldImpl(object, value, (OneToOneAssociation) field);
                if (!field.isVisible(IsisContext.getAuthenticationSession(), object).isAllowed()) {
                    return new BlankView(content);
                }
                return factory
                    .createView(new ViewRequirement(content, ViewRequirement.CLOSED | ViewRequirement.SUBVIEW));

            }

        } else {
            throw new UnknownTypeException(field);
        }

        return cellSpec.createView(content, axes, -1);
    }
View Full Code Here

Examples of org.apache.isis.viewer.dnd.view.ViewSpecification

        return new Bounds(location, size);
    }

    private ViewSpecification loadSpecification(final String name, final Class<?> cls) {
        final String factoryName = IsisContext.getConfiguration().getString(SPECIFICATION_BASE + name);
        ViewSpecification spec;
        if (factoryName != null) {
            spec = InstanceUtil.createInstance(factoryName, ViewSpecification.class);
        } else {
            spec = InstanceUtil.createInstance(cls.getName(), ViewSpecification.class);
        }
View Full Code Here

Examples of org.apache.isis.viewer.dnd.view.ViewSpecification

    @Override
    public void loadOptions(final Options viewOptions) {
        super.loadOptions(viewOptions);
        final String elementsClass = viewOptions.getString("elements");
        if (elementsClass != null) {
            ViewSpecification specification;
            if (elementsClass.startsWith("user:")) {
                final String name = elementsClass.substring("user:".length());
                final String wrappedSpecificationClass =
                    Properties.getUserViewSpecificationOptions(name).getString("wrapped-specification");
                final ViewSpecification wrappedSpectification =
                    (ViewSpecification) InstanceUtil.createInstance(wrappedSpecificationClass);
                specification = new UserViewSpecification(wrappedSpectification, name);
            } else {
                specification = (ViewSpecification) InstanceUtil.createInstance(elementsClass);
            }
View Full Code Here

Examples of org.apache.isis.viewer.dnd.view.ViewSpecification

    // TODO copied from AbstractView
    protected void replaceOptions(final Enumeration possibleViews, final UserActionSet options) {
        if (possibleViews.hasMoreElements()) {
            final UserActionSet suboptions = options.addNewActionSet("Replace with");
            while (possibleViews.hasMoreElements()) {
                final ViewSpecification specification = (ViewSpecification) possibleViews.nextElement();

                if (specification != getSpecification()) {
                    final UserAction viewAs = new ReplaceViewOption(specification) {
                        @Override
                        protected void replace(final View view, final View withReplacement) {
View Full Code Here

Examples of org.apache.isis.viewer.dnd.view.ViewSpecification

    }

    public void addView(final Content content, final Position position) {
        final ViewRequirement requirement =
            new ViewRequirement(content, ViewRequirement.OPEN | ViewRequirement.SUBVIEW);
        final ViewSpecification viewSpecification = Toolkit.getViewFactory().availableViews(requirement).nextElement();
        addView(content, viewSpecification, position);
    }
View Full Code Here

Examples of org.apache.isis.viewer.dnd.view.ViewSpecification

    protected static class ElementFactory implements ViewFactory {
        @Override
        public View createView(final Content content, final Axes axes, final int sequence) {
            final GlobalViewFactory factory = Toolkit.getViewFactory();

            final ViewSpecification elementSpecification =
                axes.getAxis(ConfigurationAxis.class).getElementSpecification();
            if (elementSpecification == null) {
                final int defaultRequirement = ViewRequirement.CLOSED | ViewRequirement.SUBVIEW;
                final ViewRequirement viewRequirement = new ViewRequirement(content, defaultRequirement);
                return factory.createView(viewRequirement);
            } else {
                return elementSpecification.createView(content, axes, sequence);
            }
        }
View Full Code Here

Examples of org.apache.isis.viewer.dnd.view.ViewSpecification

    public void addSpecification(final ViewSpecification specification) {
        viewSpecifications.add(specification);
    }

    public void addSpecification(final String specClassName) {
        ViewSpecification spec;
        spec = (ViewSpecification) InstanceUtil.createInstance(specClassName);
        LOG.info("adding view specification: " + spec);
        addSpecification(spec);
    }
View Full Code Here

Examples of org.apache.isis.viewer.dnd.view.ViewSpecification

    public View createDialog(final Content content) {
        return createView(dialogSpec, content);
    }

    private View createView(final ViewSpecification specification, final Content content) {
        ViewSpecification spec;
        if (specification == null) {
            LOG.warn("no suitable view for " + content + " using fallback view");
            spec = new FallbackView.Specification();
        } else {
            spec = specification;
        }
        // TODO this should be passed in so that factory created views can be related to the views that ask
        // for them
        final Axes axes = new Axes();
        View createView = spec.createView(content, axes, -1);

        /*
         * ObjectSpecification contentSpecification = content.getSpecification(); if (contentSpecification != null) {
         * Options viewOptions = Properties.getViewConfigurationOptions(spec); createView.loadOptions(viewOptions); }
         */
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.