Package org.apache.isis.viewer.dnd.view

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


        @Override
        public void execute(final Workspace workspace, final View view, final Location at) {
            save(view);
            // by recreating the view the transient border is removed
            final ViewSpecification spec = view.getSpecification();
            final View newView = spec.createView(view.getContent(), view.getViewAxes(), -1);
            workspace.replaceView(view, newView);
        }
View Full Code Here


    private View createFieldView(final View view, final Axes axes, final ObjectAdapter object, 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

    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

    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);
View Full Code Here

    @Override
    public void debugData(final DebugBuilder sb) {
        sb.append("RootsViews\n");
        Enumeration fields = rootViews.elements();
        while (fields.hasMoreElements()) {
            final ViewSpecification spec = (ViewSpecification) fields.nextElement();
            sb.append("  ");
            sb.append(spec);
            sb.append("\n");
        }
        sb.append("\n\n");

        sb.append("Subviews\n");
        fields = subviews.elements();
        while (fields.hasMoreElements()) {
            final ViewSpecification spec = (ViewSpecification) fields.nextElement();
            sb.append("  ");
            sb.append(spec);
            sb.append("\n");
        }
        sb.append("\n\n");
View Full Code Here

        return new MinimizedView(view);
    }

    @Override
    public View createView(final ViewRequirement requirement) {
        final ViewSpecification objectFieldSpecification = getSpecificationForRequirement(requirement);
        return createView(objectFieldSpecification, requirement.getContent());
    }
View Full Code Here

                    } 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

        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

        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

        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

TOP

Related Classes of org.apache.isis.viewer.dnd.view.ViewSpecification

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.