/*
 * AnalyzerDropTarget.java
 *
 * Copyright (c) 2003, Oracle Corporation. All rights reserved. Oracle grants
 * you ("Licensee") a non-exclusive, royalty-free, worldwide license to use,
 * modify and redistribute this software in source and binary code form, provided
 * that (i) this copyright notice and license appear on all copies of the
 * software; (ii) Licensee does not utilize the software in a manner disparaging
 * to Oracle; and (iii) Licensee does not utilize the software in a manner that
 * violates the terms of any Licensee agreement with Oracle.
 */
package samples.javaclient.analyzer;
import java.awt.Component;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetListener;

import oracle.dss.dataView.Dataview;

/**
 * The AnalyzerDropTarget makes it easier to decipher drop targets that objects
 * are being dragged over. There are two drop targets for the application: 
 * <ol>
 * <li>Desktop: drop target for worksheets</li>
 * <li>Dataview: drop target for saved selections and dimension members</li>
 * </ol>
 */
public class AnalyzerDropTarget extends DropTarget  {
  Dataview m_dataview;
  Worksheet m_worksheet;
  int m_analyzerTarget;
  public static final int DATAVIEW = 0;
  public static final int DESKTOP = 1;

  /**
   * Constructor for the AnalyzerDropTarget class.
   */  
  public AnalyzerDropTarget() {
    super();
  }

  public AnalyzerDropTarget(Component component, int ops, DropTargetListener dtl) {
    super(component, ops, dtl);
  }

  /**
   * Get the Dataview for this DropTarget.  This method should only be called if
   * the DropTarget is a AnalyzerDropTarget.DATAVIEW
   * @return dataview The dataview drop target.
   */
  public Dataview getDataview() {
    return m_dataview;
  }

  /**
   * Set the Dataview for this DropTarget.  This method should only be called if
   * the DropTarget is a Dataview
   * @param dataview The dataview is a valid drop target.
   */
  public void setDataview(Dataview dataview) {
    m_dataview = dataview;
  }

  /**
   * Set the Worksheet for this DropTarget.  This method should only be called if
   * the DropTarget is a Dataview
   * @param worksheet The worksheet that contains the dataview (the Dataview is a DropTarget)
   */
  public void setWorksheet(Worksheet worksheet) {
    m_worksheet = worksheet;
  }

  /**
   * Returns the worksheet object associated with this dataview.  This is only
   * valid when the DropTarget is a Dataview
   * @return The worksheet associated with this dataview drop target
   */
  public Worksheet getWorksheet() {
    return m_worksheet;
  }

  /**
   * Get the Analyzer drop target.  There are two valid drop targets for the application:
   * the Desktop or a Dataview.  
   * @return an integer representing the drop target: AnalyzerDropTarget.DESKTOP or AnalyzerDropTarget.DATAVIEW
   */
  public int getAnalyzerTarget () {
    return m_analyzerTarget;
  }

  /**
   * Set the Analyzer drop target.  There are two valid drop targets for the application:
   * the Desktop or a Dataview
   * @param analyzerTarget The drop target for the application. Valid values are 
   *                       AnalyzerDropTarget.DATAVIEW or AnalyzerDropTarget.DESKTOP
   */
   public void setAnalyzerTarget(int analyzerTarget) {
     m_analyzerTarget = analyzerTarget;
   }
}