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

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


        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


public class DetailedMessageViewSpecification implements ViewSpecification {

    @Override
    public boolean canDisplay(final ViewRequirement requirement) {
        final Content content = requirement.getContent();
        return content instanceof MessageContent && ((MessageContent) content).getDetail() != null;
    }
View Full Code Here

        final DetailedMessageView messageView = new DetailedMessageView(content, this);
        return new ButtonBorder(actions, new ScrollBorder(messageView));
    }

    private String extract(final View view) {
        final Content content = view.getContent();
        final String message = ((MessageContent) content).getMessage();
        final String heading = ((MessageContent) content).title();
        final String detail = ((MessageContent) content).getDetail();

        final StringBuffer text = new StringBuffer();
View Full Code Here

        this.specification = builder;
    }

    @Override
    public void execute(final Workspace workspace, final View view, final Location at) {
        Content content = view.getContent();
        if (content.getAdapter() != null && !(content instanceof FieldContent)) {
            content = Toolkit.getContentFactory().createRootContent(content.getAdapter());
        }
        final View newView = specification.createView(content, view.getViewAxes(), -1);
        LOG.debug("open view " + newView);
        workspace.addWindow(newView, new Placement(view));
        workspace.markDamaged();
View Full Code Here

        assertTrue(viewSpecification.canDisplay(requirement));
    }

    @Test
    public void requiresClosedCollection() throws Exception {
        final Content objectContent = context.mock(Content.class, "object");
        context.checking(new Expectations() {
            {
                one(objectContent).isCollection();
                will(returnValue(false));
            }
View Full Code Here

        return listSpecification.createView(getContent(), viewAxes, -1);
    }

    @Override
    protected boolean isAvailable() {
        final Content content = getContent();
        if (content instanceof OneToOneField) {
            final OneToOneField oneToOneField = ((OneToOneField) content);
            return oneToOneField.isEditable().isAllowed();
        } else if (content instanceof ParameterContent) {
            return true;
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

    @Override
    public View createView(final Content content, final Axes axes, final int sequence) {
        final FieldContent fieldContent = (FieldContent) content;
        final ObjectAdapter parent = fieldContent.getParent();
        final Content parentContent = Toolkit.getContentFactory().createRootContent(parent);
        View view = new InternalFieldView(parentContent, fieldContent, axes, this);
        view = addBorder(parentContent, fieldContent, view);
        return view;
    }
View Full Code Here

   
    protected Map<ObjectAdapter, List<View>> viewListByAdapter = Maps.newHashMap();

    @Override
    public void add(final View view) {
        final Content content = view.getContent();
        if (content != null && content.isObject()) {
            final ObjectAdapter adapter = content.getAdapter();

            if (adapter != null) {
                List<View> viewsToNotify;

                if (viewListByAdapter.containsKey(adapter)) {
View Full Code Here

        return "Views for object details (observers)";
    }

    @Override
    public void remove(final View view) {
        final Content content = view.getContent();
        if (content == null || !content.isObject()) {
            // nothing to do
            return;
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("removing " + content + " for " + view);
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.