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

it.tidalwave.netbeans.visual.EnhancedSceneView Maven / Gradle / Ivy

The newest version!
/***********************************************************************************************************************
 *
 * OpenBlueSky - NetBeans Platform Enhancements
 * Copyright (C) 2006-2012 by Tidalwave s.a.s. (http://www.tidalwave.it)
 *
 ***********************************************************************************************************************
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations under the License.
 *
 ***********************************************************************************************************************
 *
 * WWW: http://openbluesky.java.net
 * SCM: https://bitbucket.org/tidalwave/openbluesky-src
 *
 **********************************************************************************************************************/
package it.tidalwave.netbeans.visual;

import javax.annotation.Nonnull;
import java.util.Collection;
import java.awt.Color;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.DropTargetDropEvent;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JLayeredPane;
import javax.swing.JScrollPane;
import org.openide.nodes.Node;
import it.tidalwave.netbeans.visual.impl.SceneDropTarget;
import it.tidalwave.netbeans.visual.impl.SatelliteViewPanel;

/***********************************************************************************************************************
 *
 * @deprecated  Use LayeredSceneView instead
 * 
 * @author  Fabrizio Giudici
 * @version $Id$
 *
 **********************************************************************************************************************/
@Deprecated
public class EnhancedSceneView extends JLayeredPane
  {

    /** The component which renders the scene. */
    @Nonnull
    private final JComponent view;

    /** The component which renders the satellite view. */
    @Nonnull
    private final SatelliteViewPanel satelliteView;

    /** The scroll pane for the view. */
    private final JScrollPane scrollPane = new JScrollPane();

    /** The handler of drop events. */
    @Nonnull
    private final SceneDropTarget dropTarget;

    /*******************************************************************************************************************
     *
     *
     ******************************************************************************************************************/
    public EnhancedSceneView (final @Nonnull NodeScene scene)
      {
        satelliteView = new SatelliteViewPanel(scene.createSatelliteView());
//  FIXME        setLayout(new FillLayout()); // FIXME: use OverlayLayout
        view = scene.createView();
        dropTarget = new SceneDropTarget(scene);
        view.setDropTarget(dropTarget);
        scrollPane.setViewportView(view);
        add(scrollPane, JLayeredPane.DEFAULT_LAYER);
        add(satelliteView, JLayeredPane.PALETTE_LAYER);
        scrollPane.setViewportBorder(BorderFactory.createEmptyBorder());
      }

    /*******************************************************************************************************************
     *
     * {@inheritDoc}
     *
     ******************************************************************************************************************/
    @Override
    public void setBackground (final @Nonnull Color color)
      {
        super.setBackground(color);
//        scene.setBackground(color);
//        view.setBackground(color);
//        scrollPane.setBackground(color);
//        scrollPane.getViewport().setBackground(color);
      }

    /*******************************************************************************************************************
     *
     * Registers a {@link DropAcceptor} for a given {@DataFlavor}.
     *
     * @param  dataFlavor    the {@code DataFlavor}
     * @param  dropAcceptor  the {@code DropAcceptor}
     *
     ******************************************************************************************************************/
    public void registerDropAcceptor (final @Nonnull DataFlavor dataFlavor,
                                      final @Nonnull DropAcceptor dropAcceptor)
      {
        dropTarget.registerDropAcceptor(dataFlavor, dropAcceptor);
      }
  }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy