/// <summary> /// Serializes this <code>DragSource</code>. This method first performs /// default serialization. Next, it writes out this object's /// <code>FlavorMap</code> if and only if it can be serialized. If not, /// <code>null</code> is written instead. Next, it writes out /// <code>Serializable</code> listeners registered with this /// object. Listeners are written in a <code>null</code>-terminated sequence /// of 0 or more pairs. The pair consists of a <code>String</code> and an /// <code>Object</code>; the <code>String</code> indicates the type of the /// <code>Object</code> and is one of the following: /// <ul> /// <li><code>dragSourceListenerK</code> indicating a /// <code>DragSourceListener</code> object; /// <li><code>dragSourceMotionListenerK</code> indicating a /// <code>DragSourceMotionListener</code> object. /// </ul> /// /// @serialData Either a <code>FlavorMap</code> instance, or /// <code>null</code>, followed by a <code>null</code>-terminated /// sequence of 0 or more pairs; the pair consists of a /// <code>String</code> and an <code>Object</code>; the /// <code>String</code> indicates the type of the <code>Object</code> /// and is one of the following: /// <ul> /// <li><code>dragSourceListenerK</code> indicating a /// <code>DragSourceListener</code> object; /// <li><code>dragSourceMotionListenerK</code> indicating a /// <code>DragSourceMotionListener</code> object. /// </ul>. /// @since 1.4 /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException private void WriteObject(ObjectOutputStream s) { s.DefaultWriteObject(); s.WriteObject(SerializationTester.Test(FlavorMap_Renamed) ? FlavorMap_Renamed : null); DnDEventMulticaster.Save(s, DragSourceListenerK, Listener); DnDEventMulticaster.Save(s, DragSourceMotionListenerK, MotionListener); s.WriteObject(null); }
/// <summary> /// Removes the specified <code>DragSourceMotionListener</code> from this /// <code>DragSource</code>. /// If a <code>null</code> listener is specified, no action is taken and no /// exception is thrown. /// If the listener specified by the argument was not previously added to /// this <code>DragSource</code>, no action is taken and no exception /// is thrown. /// </summary> /// <param name="dsml"> the <code>DragSourceMotionListener</code> to remove /// </param> /// <seealso cref= #addDragSourceMotionListener </seealso> /// <seealso cref= #getDragSourceMotionListeners /// @since 1.4 </seealso> public virtual void RemoveDragSourceMotionListener(DragSourceMotionListener dsml) { if (dsml != null) { lock (this) { MotionListener = DnDEventMulticaster.Remove(MotionListener, dsml); } } }
/// <summary> /// Removes the specified <code>DragSourceListener</code> from this /// <code>DragSource</code>. /// If a <code>null</code> listener is specified, no action is taken and no /// exception is thrown. /// If the listener specified by the argument was not previously added to /// this <code>DragSource</code>, no action is taken and no exception /// is thrown. /// </summary> /// <param name="dsl"> the <code>DragSourceListener</code> to remove /// </param> /// <seealso cref= #addDragSourceListener </seealso> /// <seealso cref= #getDragSourceListeners /// @since 1.4 </seealso> public virtual void RemoveDragSourceListener(DragSourceListener dsl) { if (dsl != null) { lock (this) { Listener = DnDEventMulticaster.Remove(Listener, dsl); } } }
/// <summary> /// Gets all the objects currently registered as /// <code><em>Foo</em>Listener</code>s upon this <code>DragSource</code>. /// <code><em>Foo</em>Listener</code>s are registered using the /// <code>add<em>Foo</em>Listener</code> method. /// </summary> /// <param name="listenerType"> the type of listeners requested; this parameter /// should specify an interface that descends from /// <code>java.util.EventListener</code> </param> /// <returns> an array of all objects registered as /// <code><em>Foo</em>Listener</code>s on this /// <code>DragSource</code>, or an empty array if no such listeners /// have been added </returns> /// <exception cref="ClassCastException"> if <code>listenerType</code> /// doesn't specify a class or interface that implements /// <code>java.util.EventListener</code> /// </exception> /// <seealso cref= #getDragSourceListeners </seealso> /// <seealso cref= #getDragSourceMotionListeners /// @since 1.4 </seealso> public virtual T[] getListeners <T>(Class listenerType) where T : java.util.EventListener { EventListener l = null; if (listenerType == typeof(DragSourceListener)) { l = Listener; } else if (listenerType == typeof(DragSourceMotionListener)) { l = MotionListener; } return(DnDEventMulticaster.GetListeners(l, listenerType)); }