/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* A transferable implementation for the default data transfer of some Swing
* components.
*
* @author Timothy Prinzing
*/
static {
try {
} catch (ClassNotFoundException cle) {
}
}
}
/**
* Returns an array of DataFlavor objects indicating the flavors the data
* can be provided in. The array should be ordered according to preference
* for providing the data (from most richly descriptive to least descriptive).
* @return an array of data flavors in which this data can be transferred
*/
// fill in the array
int nDone = 0;
if (nRicher > 0) {
}
if (nHTML > 0) {
}
if (nPlain > 0) {
}
if (nString > 0) {
}
return flavors;
}
/**
* Returns whether or not the specified data flavor is supported for
* this object.
* @param flavor the requested flavor for the data
* @return boolean indicating whether or not the data flavor is supported
*/
return true;
}
}
return false;
}
/**
* Returns an object which represents the data to be transferred. The class
* of the object returned is defined by the representation class of the flavor.
*
* @param flavor the requested flavor for the data
* @see DataFlavor#getRepresentationClass
* @exception IOException if the data is no longer available
* in the requested flavor.
* @exception UnsupportedFlavorException if the requested data flavor is
* not supported.
*/
if (isRicherFlavor(flavor)) {
return getRicherData(flavor);
} else if (isHTMLFlavor(flavor)) {
return data;
return new StringReader(data);
return new StringBufferInputStream(data);
}
// fall through to unsupported
} else if (isPlainFlavor(flavor)) {
return data;
return new StringReader(data);
return new StringBufferInputStream(data);
}
// fall through to unsupported
} else if (isStringFlavor(flavor)) {
return data;
}
throw new UnsupportedFlavorException(flavor);
}
// --- richer subclass flavors ----------------------------------------------
for (int i = 0; i < nFlavors; i++) {
return true;
}
}
return false;
}
/**
* Some subclasses will have flavors that are more descriptive than HTML
* or plain text. If this method returns a non-null value, it will be
* placed at the start of the array of supported flavors.
*/
return null;
}
return null;
}
// --- html flavors ----------------------------------------------------------
/**
* Returns whether or not the specified data flavor is an HTML flavor that
* is supported.
* @param flavor the requested flavor for the data
* @return boolean indicating whether or not the data flavor is supported
*/
return true;
}
}
return false;
}
/**
* Should the HTML flavors be offered? If so, the method
* getHTMLData should be implemented to provide something reasonable.
*/
protected boolean isHTMLSupported() {
}
/**
*/
return htmlData;
}
// --- plain text flavors ----------------------------------------------------
/**
* Returns whether or not the specified data flavor is an plain flavor that
* is supported.
* @param flavor the requested flavor for the data
* @return boolean indicating whether or not the data flavor is supported
*/
return true;
}
}
return false;
}
/**
* Should the plain text flavors be offered? If so, the method
* getPlainData should be implemented to provide something reasonable.
*/
protected boolean isPlainSupported() {
}
/**
*/
return plainData;
}
// --- string flavorss --------------------------------------------------------
/**
* Returns whether or not the specified data flavor is a String flavor that
* is supported.
* @param flavor the requested flavor for the data
* @return boolean indicating whether or not the data flavor is supported
*/
return true;
}
}
return false;
}
}