/*
 * @(#)Viewer.java  1.1  2002-02-10
 *
 * Copyright (c) 1999 Werner Randelshofer, Immensee, Switzerland.
 * All rights reserved.
 *
 * You may not use, copy or modify this file, except in compliance with the
 * license agreement you entered into with Werner Randelshofer.
 * For details see accompanying license terms.
 */
package ch.randelshofer.view;

import java.awt.dnd.*;
import ch.randelshofer.util.PropertyModel;
import javax.activation.CommandObject;
import javax.swing.JMenu;
import org.jhotdraw.app.Disposable;

/**
 * Interface for viewers.
 *
 * Objects implementing this interface must be a subclass of java.awt.Component.
 *
 * @author  Werner Randelshofer, Hausmatt 10, CH-6405 Immensee, Switzerland
 * @version 1.1 2002-02-10 Method setDropTarget added.
 * <br>1.0  1999-09-19
 */
public interface View extends CommandObject, Disposable {
    public final static String REQUEST_INFO_UPDATE_PROPERTY="requestInfoUpdate";
    
    /**
     * Merges menu items of this viewer into the "View" menu
     * of the container of this viewer.
     *
     * When the viewer is added to a container with a
     * JMenuBar. Then the container asks the viewer to
     * add his menu items to the "View" menu of the container.
     */
    public void mergeViewMenuItems(JMenu viewMenu);
    
    /**
     * Merges menu items of this viewer into the "Settings" menu
     * of the container of this viewer.
     *
     * When the viewer is added to a container with a
     * JMenuBar. Then the container asks the viewer to
     * add his menu items to the "Settings" menu of the container.
     */
    public void mergeSettingsMenuItems(JMenu m);
    
    /** Sets the model object for shared view properties. */
    public void setViewProperties(PropertyModel model);
    /** Sets the model object for shared application properties. */
    public void setApplicationProperties(PropertyModel model);
    
    /**
     * Returns true if this viewer has a scrollpane of its own.
     * The container that contains this viewers uses this method to
     * determine if it should wrap a scrollpane around the viewer
     * or not.
     *
     * @return  true if this viewer has a scrollpane of its own.
     */
    public boolean hasScrollPane();
    
    /**
     * This method must be called after the view has been added to
     * the parent component.
     * This method is basically a hack to make QuickTime for Java
     * work on OS X 10.1.
     */
    public void init();
    
    /**
     * This method adds the given drop target listener to
     * all components of the viewer.
     */
    public void addDropTargetListener(DropTargetListener listener);
    
    /**
     * Disposes all resources allocated by this viewer.
     * The viewer must not be used after this method has been called.
     */
    public void dispose();
}
