<AWT Dev> [8] Request for review: 7075105: WIN: Provide a way to format HTML on drop
Denis S. Fokin
denis.fokin at oracle.com
Wed Mar 13 10:29:45 PDT 2013
Here is another attempt. I eliminated a confusing translateBytesOrStream
method. Actually, we definitely know whether data is stored in bytes or
in a stream so there is no need in such approach.
The main reason for eliminating the method was a difficult and ugly
resource management. For instance, sometimes we assigned a new stream to
the same reference without closing the previous one. The new approach
allows easily use Closable in our code.
http://cr.openjdk.java.net/~denis/7075105/webrev.05
I have run all JTreg tests and have not found new regressions for now.
At least, I have eliminated all that found.
Thank you,
Denis.
On 2/27/2013 9:47 PM, Denis S. Fokin wrote:
> Please take a look at the next fix.
>
> Bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7075105
> Webrev can be found at:
> http://cr.openjdk.java.net/~denis/7075105/webrev.03/
>
> I have executed a number of data transfer and drag and drop tests. No
> new failures have been found.
>
> The fix intended to introduce three data flavors to represent
> transferred via clipboard and drag and drop HTML data.
>
> The flavors are presented as fields in the DataFlavor class. The flavors
> are distinguishable by their mime-type parameters. So I have updated
> DataFlavor.equals(DataFlavor) implementation.
>
> We lazily build mapping between the native data transfer formats and
> java flavors in the SystemFlavorMap class. Before we stored values in
> flavorToNative and nativeToFlavor
> maps in a type independent way as objects and handled special cases
> for text flavors latter in the SystemFlavorMap.getFlavorsForNative
> method. This way we stored both strings and flavors in the same
> container. I have slightly refactored our code to generify it and
> introduce froeach loops. I also replaced (Set + LinkedList) approach
> with LinkedHashSet one which should work the same way.
>
> Conversion from java Transferable to the native data is enabled in
> WDataTransferer.translateTransferable().
>
> To be able to use a foreach approach instaed of (for + iterator) in
> convertMimeTypeToDataFlavors method I have changed
> DataTransferer.standardEncodings() return type.
>
> To be consistent with jdk7 model I have put some AutoCloseable instances
> in try clauses.
>
> I have also created a pair of tests. One is manual and another is
> automatic one.
>
> Thank you,
> Denis.
More information about the awt-dev
mailing list