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

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


    @Override
    public void drop(final ContentDrag drag) {
        getState().clearViewIdentified();
        markDamaged();
        final ObjectAdapter target = ((ObjectContent) getParent().getContent()).getObject();
        final Content sourceContent = drag.getSourceContent();
        if (sourceContent instanceof ObjectContent) {
            final ObjectAdapter source = ((ObjectContent) sourceContent).getObject();
            setField(target, source);
        }
    }
View Full Code Here


    @Override
    public void build(final View view, final Axes axes) {
        Assert.assertEquals("ensure the view is complete decorated view", view.getView(), view);

        final Content content = view.getContent();
        final ObjectAdapter object = ((ObjectContent) content).getObject();

        if (view.getSubviews().length == 0) {
            initialBuild(object, view, axes);
        } else {
View Full Code Here

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

    @Override
    public void build(final View view, final Axes axes) {
        Assert.assertEquals(view.getView(), view);

        final Content content = view.getContent();
        final OneToManyAssociation field = content instanceof OneToManyField ? ((OneToManyField) content).getOneToManyAssociation() : null;

        LOG.debug("rebuild view " + view + " for " + content);

        final CollectionContent collectionContent = ((CollectionContent) content);
        Enumeration elements;
        elements = collectionContent.allElements();

        // addViewAxes(view);

        /*
         * remove all subviews from the view and then work through the elements
         * of the collection adding in a view for each element. Where a subview
         * for the that element already exists it should be reused.
         */
        final View[] subviews = view.getSubviews();
        final ObjectAdapter[] existingElements = new ObjectAdapter[subviews.length];
        for (int i = 0; i < subviews.length; i++) {
            view.removeView(subviews[i]);
            existingElements[i] = subviews[i].getContent().getAdapter();
        }

        int elementNumber = 0;
        while (elements.hasMoreElements()) {
            final ObjectAdapter element = (ObjectAdapter) elements.nextElement();
            View elementView = null;
            for (int i = 0; i < subviews.length; i++) {
                if (existingElements[i] == element) {
                    elementView = subviews[i];
                    existingElements[i] = null;
                    break;
                }
            }
            if (elementView == null) {
                Content elementContent;
                if (field == null) {
                    elementContent = new CollectionElement(element);
                } else {
                    final ObjectAdapter obj = ((OneToManyField) view.getContent()).getParent();
                    // ObjectAdapter obj =
View Full Code Here

        LOG.debug("rebuild view " + view + " for " + actionContent);
        final View[] subviews = view.getSubviews();

        for (int i = 0; i < subviews.length; i++) {
            final View subview = subviews[i];
            final Content content = subview.getContent();

            final ObjectAdapter subviewsObject = subview.getContent().getAdapter();
            final ObjectAdapter invocationsObject = ((ActionContent) view.getContent()).getParameterObject(i);

            if (content instanceof ObjectParameter) {
View Full Code Here

        final ViewSpecification objectFieldSpecification = getSpecificationForRequirement(requirement);
        return createView(objectFieldSpecification, requirement.getContent());
    }

    public ViewSpecification getSpecificationForRequirement(final ViewRequirement requirement) {
        final Content content = requirement.getContent();
        final ObjectSpecification specification = content.getSpecification();
        final boolean isValue = specification != null && specification.containsFacet(ValueFacet.class);
        if (content.isObject() && !isValue && content.getAdapter() == null) {
            return getEmptyFieldSpecification();
        } else {
            if (specification != null) {
                final Options viewOptions = Properties.getDefaultViewOptions(specification);
                String spec = viewOptions.getString("spec");
View Full Code Here

        super.update(object);
        canOpen();
    }

    private void canOpen() {
        final Content content = getContent();
        if (content.isCollection()) {
            canOpen = canOpenCollection(content);
        } else if (content.isObject()) {
            canOpen = canOpenObject(content);
        }
    }
View Full Code Here

        }
    }

    @Override
    public View addWindowFor(final ObjectAdapter object, final Placement placement) {
        final Content content = Toolkit.getContentFactory().createRootContent(object);
        final View view = Toolkit.getViewFactory().createView(new ViewRequirement(content, ViewRequirement.OPEN));
        addWindow(view, placement);
        getViewManager().setKeyboardFocus(view);
        return view;
    }
View Full Code Here

        return view;
    }

    @Override
    public View addIconFor(final ObjectAdapter object, final Placement placement) {
        final Content content = Toolkit.getContentFactory().createRootContent(object);
        final View icon = Toolkit.getViewFactory().createView(new ViewRequirement(content, ViewRequirement.CLOSED | ViewRequirement.ROOT));
        add(iconViews, icon);
        placement.position(this, icon);
        return icon;
    }
View Full Code Here

        placement.position(this, icon);
        return icon;
    }

    public void addServiceIconFor(final ObjectAdapter service) {
        final Content content = new ServiceObject(service);
        final View serviceIcon = Toolkit.getViewFactory().createView(new ViewRequirement(content, ViewRequirement.CLOSED | ViewRequirement.SUBVIEW));
        add(serviceViews, serviceIcon);
    }
View Full Code Here

TOP

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

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.