001/* 002 * Copyright (c) 2010-2016 The Regents of the University of California. 003 * All rights reserved. 004 * 005 * '$Author$' 006 * '$Date$' 007 * '$Revision$' 008 * 009 * Permission is hereby granted, without written agreement and without 010 * license or royalty fees, to use, copy, modify, and distribute this 011 * software and its documentation for any purpose, provided that the above 012 * copyright notice and the following two paragraphs appear in all copies 013 * of this software. 014 * 015 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY 016 * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 017 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF 018 * THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF 019 * SUCH DAMAGE. 020 * 021 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, 022 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE 024 * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF 025 * CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, 026 * ENHANCEMENTS, OR MODIFICATIONS. 027 * 028 */ 029 030package ptolemy.vergil.basic; 031 032import java.io.Serializable; 033 034import diva.graph.JGraph; 035import ptolemy.kernel.util.IllegalActionException; 036import ptolemy.kernel.util.NamedObj; 037 038/** 039 * This class provides default extensions points which are overridden in the 040 * Kepler Comad module. 041 * 042 * @author Sven Koehler, Christopher Brooks. 043 * @version $Id$ 044 * @since Ptolemy II 10.0 045 * @Pt.ProposedRating Red (cxh) 046 * @Pt.AcceptedRating Red (cxh) 047 */ 048@SuppressWarnings("serial") 049public class BasicGraphFrameExtension implements Serializable { 050 051 // From the 2010-11-04 comment that added this class: 052 053 // "Added an extension for a different Drag and Drop behavior. 054 // Currently this is only activated in Comad. Once an Actor is 055 // dragged from the Library over another actor on the canvas it 056 // will replace this actor and Ports are reconeected. Also 057 // Parameter values are used for parameters of the new actor if 058 // they have the same name. 059 // 060 // If an actor is dragged over a link this actor will be inserted 061 // there. Currently this only works in Comad, where all actors 062 // have an "input" and one "output" port." 063 064 private BasicGraphFrameExtension() { 065 } 066 067 /** Delete the Ptolemy objects represented by the selection. 068 * This method is typically called by BasicGraphFrame.delete(). 069 * @param selection The objects to be deleted. 070 * @param graphModel The graphical model. 071 * @param container The container in which the Ptolemy objects reside 072 * @exception IllegalActionException If there is a problem deleting. 073 */ 074 public static void alternateDelete(Object[] selection, 075 AbstractBasicGraphModel graphModel, NamedObj container) 076 throws IllegalActionException { 077 } 078 079 /** Paste the Ptolemy objects represented by the value of the 080 * moml argument into the container. 081 * @param container The container in to which the Ptolemy objects are pasted. 082 * @param moml The moml used to create the objects. 083 * @exception IllegalActionException If there is a problem pasting. 084 */ 085 public static void alternatePasteMomlModification(NamedObj container, 086 StringBuffer moml) throws IllegalActionException { 087 } 088 089 /** Paste the Ptolemy objects represented by the value of the 090 * moml argument into the container. 091 * @param container The container in to which the Ptolemy objects are pasted. 092 * @param moml The moml used to create the objects. 093 * @exception IllegalActionException If there is a problem pasting. 094 */ 095 public static void alternatePaste(NamedObj container, StringBuffer moml) 096 throws IllegalActionException { 097 // FIXME: How is this different from the alternatePasteMomlModification? 098 } 099 100 /** Filter the array of objects selected for deletion. 101 * @param graphModel The graphical model. 102 * @param selection The objects to be deleted. 103 * @return a new array that contains objects to be deleted. 104 */ 105 public static Object[] filterDeletedObjects( 106 AbstractBasicGraphModel graphModel, Object[] selection) { 107 return selection; 108 } 109 110 /** Filter the moml to be deleted. 111 * @param graphModel The graphical model. 112 * @param selection The objects to be deleted. 113 * @param moml The moml to be filtered. 114 */ 115 public static void filterDeleteMoml(AbstractBasicGraphModel graphModel, 116 Object[] selection, StringBuffer moml) { 117 } 118 119 /** Return the drop target for a JGraph. 120 * @param jGraph The Jgraph of interest 121 * @return The drop target. 122 */ 123 public static EditorDropTarget getDropTarget(JGraph jGraph) { 124 return new EditorDropTarget(jGraph); 125 } 126}