/*
 * Licensed Materials - Property of Perforce Software, Inc. 
 * © Copyright Perforce Software, Inc. 2014, 2021 
 * © Copyright IBM Corp. 2009, 2014
 * © Copyright ILOG 1996, 2009
 * All Rights Reserved.
 *
 * Note to U.S. Government Users Restricted Rights:
 * The Software and Documentation were developed at private expense and
 * are "Commercial Items" as that term is defined at 48 CFR 2.101,
 * consisting of "Commercial Computer Software" and
 * "Commercial Computer Software Documentation", as such terms are
 * used in 48 CFR 12.212 or 48 CFR 227.7202-1 through 227.7202-4,
 * as applicable.
 */

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

import ilog.views.IlvGraphic;
import ilog.views.IlvManager;
import ilog.views.IlvManagerView;
import ilog.views.interactor.IlvSelectInteractor;
//import ilog.views.util.IlvProductUtil;

/**
 * This example shows a marker that has a special marker interactor.
 */
public class Main
{ 
  public static void main(String[] args)
  {
    // This sample uses JViews Diagrammer features. When deploying an
    // application that includes this code, you need to be in possession
    // of a Perforce JViews Diagrammer Deployment license.
//    IlvProductUtil.DeploymentLicenseRequired(
//        IlvProductUtil.JViews_Diagrammer_Deployment);

    // Sun recommends that to put the entire GUI initialization into the
    // AWT thread
    SwingUtilities.invokeLater(
      new Runnable() {
        Override
        public void run() {
          JFrame f = new JFrame("Marker Interactor Sample");
          f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          f.setSize(new Dimension(300, 300));
          IlvManager mgr = new IlvManager();

          IlvGraphic g = new MyMarker();
          g.move(20,20);
          mgr.addObject(g, false);

          g = new MyMarker();
          g.move(20,100);
          mgr.addObject(g, false);

          g = new MyMarker();
          g.move(100,20);
          mgr.addObject(g, false);

          g = new MyMarker();
          g.move(100,100);
          mgr.addObject(g, false);
          
          IlvManagerView v = new IlvManagerView(mgr);

          // Install View Interactor
          IlvSelectInteractor inter = new IlvSelectInteractor();
          inter.setOpaqueMove(true);
          inter.setOpaqueResize(true);
          v.setInteractor(inter);

          f.getContentPane().setLayout(new BorderLayout());
          f.getContentPane().add("Center", v);
          f.setVisible(true);
        }
      });
  }
}