55 * Note that we intentionally introduce the JTextComponentAccessor, 56 * and not the JComponentAccessor because the needed methods 57 * aren't override methods. 58 */ 59 public interface JTextComponentAccessor { 60 61 /** 62 * Calculates a custom drop location for the text component, 63 * representing where a drop at the given point should insert data. 64 */ 65 TransferHandler.DropLocation dropLocationForPoint(JTextComponent textComp, Point p); 66 67 /** 68 * Called to set or clear the drop location during a DnD operation. 69 */ 70 Object setDropLocation(JTextComponent textComp, TransferHandler.DropLocation location, 71 Object state, boolean forDrop); 72 } 73 74 /** 75 * The javax.swing.text.JTextComponent class accessor object. 76 */ 77 private static JTextComponentAccessor jtextComponentAccessor; 78 79 /** 80 * Set an accessor object for the javax.swing.text.JTextComponent class. 81 */ 82 public static void setJTextComponentAccessor(JTextComponentAccessor jtca) { 83 jtextComponentAccessor = jtca; 84 } 85 86 /** 87 * Retrieve the accessor object for the javax.swing.text.JTextComponent class. 88 */ 89 public static JTextComponentAccessor getJTextComponentAccessor() { 90 if (jtextComponentAccessor == null) { 91 unsafe.ensureClassInitialized(JTextComponent.class); 92 } 93 94 return jtextComponentAccessor; 95 } 96 } | 55 * Note that we intentionally introduce the JTextComponentAccessor, 56 * and not the JComponentAccessor because the needed methods 57 * aren't override methods. 58 */ 59 public interface JTextComponentAccessor { 60 61 /** 62 * Calculates a custom drop location for the text component, 63 * representing where a drop at the given point should insert data. 64 */ 65 TransferHandler.DropLocation dropLocationForPoint(JTextComponent textComp, Point p); 66 67 /** 68 * Called to set or clear the drop location during a DnD operation. 69 */ 70 Object setDropLocation(JTextComponent textComp, TransferHandler.DropLocation location, 71 Object state, boolean forDrop); 72 } 73 74 /** 75 * An accessor for the sun.swing.JLightweightFrame class 76 */ 77 public interface JLightweightFrameAccessor { 78 79 /* 80 * Returns the content LightweightContent for the frame 81 */ 82 LightweightContent getLightweightContent(JLightweightFrame frame); 83 } 84 85 /** 86 * The javax.swing.text.JTextComponent class accessor object. 87 */ 88 private static JTextComponentAccessor jtextComponentAccessor; 89 /** 90 * The sun.swing.JLightweightFrame class accessor object 91 */ 92 private static JLightweightFrameAccessor jLightweightFrameAccessor; 93 94 /** 95 * Set an accessor object for the javax.swing.text.JTextComponent class. 96 */ 97 public static void setJTextComponentAccessor(JTextComponentAccessor jtca) { 98 jtextComponentAccessor = jtca; 99 } 100 101 /** 102 * Retrieve the accessor object for the javax.swing.text.JTextComponent class. 103 */ 104 public static JTextComponentAccessor getJTextComponentAccessor() { 105 if (jtextComponentAccessor == null) { 106 unsafe.ensureClassInitialized(JTextComponent.class); 107 } 108 109 return jtextComponentAccessor; 110 } 111 112 /** 113 * Set an accessor object for sun.swing.JLightweightFrame class 114 */ 115 public static void setJLightweightFrameAccessor(JLightweightFrameAccessor accessor) { 116 jLightweightFrameAccessor = accessor; 117 } 118 119 /** 120 * Retrieve an accessor object for sun.swing.JLightweightFrame class 121 */ 122 public static JLightweightFrameAccessor getJLightweightFrameAccessor() { 123 return jLightweightFrameAccessor; 124 } 125 } |