All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nakedobjects.headlessviewer.viewer.DomainObjectContainerHeadlessViewer Maven / Gradle / Ivy

The newest version!
package org.nakedobjects.headlessviewer.viewer;

import java.util.List;

import org.nakedobjects.applib.DomainObjectContainer;
import org.nakedobjects.applib.events.InteractionEvent;
import org.nakedobjects.headlessviewer.applib.HeadlessViewer;
import org.nakedobjects.headlessviewer.applib.listeners.InteractionListener;
import org.nakedobjects.headlessviewer.viewer.internal.HeadlessViewerImpl;
import org.nakedobjects.metamodel.runtimecontext.RuntimeContext;
import org.nakedobjects.metamodel.services.container.DomainObjectContainerDefault;


/**
 * A combined {@link DomainObjectContainer} and {@link HeadlessViewer}. 
 */
public class DomainObjectContainerHeadlessViewer extends DomainObjectContainerDefault implements HeadlessViewer {

    private HeadlessViewer headlessViewerDelegate;


    // /////////////////////////////////////////////////////////////
    // Views
    // /////////////////////////////////////////////////////////////

    public  T view(final T domainObject) {
    	return headlessViewerDelegate.view(domainObject);
    }

    public  T view(final T domainObject, ExecutionMode mode) {
    	return headlessViewerDelegate.view(domainObject, mode);
    }

    public boolean isView(final Object possibleView) {
    	return headlessViewerDelegate.isView(possibleView);
    }

    // /////////////////////////////////////////////////////////////
    // Listeners
    // /////////////////////////////////////////////////////////////

    public List getListeners() {
        return headlessViewerDelegate.getListeners();
    }

    public boolean addInteractionListener(final InteractionListener listener) {
        return headlessViewerDelegate.addInteractionListener(listener);
    }

    public boolean removeInteractionListener(final InteractionListener listener) {
        return headlessViewerDelegate.removeInteractionListener(listener);
    }

    public void notifyListeners(final InteractionEvent interactionEvent) {
    	headlessViewerDelegate.notifyListeners(interactionEvent);
    }

    
    
    // /////////////////////////////////////////////////////////////
    // Dependencies (due to *Aware)
    // /////////////////////////////////////////////////////////////

    /**
     * As per superclass, but also initializes the delegate {@link HeadlessViewer}.
     */
    @Override
    public void setRuntimeContext(RuntimeContext runtimeContext) {
    	super.setRuntimeContext(runtimeContext);
    	headlessViewerDelegate = new HeadlessViewerImpl(runtimeContext);
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy