/*
* 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.
*/
/**
* Serves as a common, helper superclass for the Win32 and X11 system
* Clipboards.
*
* @author Danila Sinopalnikov
* @author Alexander Gerasimov
*
* @since 1.3
*/
implements PropertyChangeListener {
/**
* A number of <code>FlavorListener</code>s currently registered
* on this clipboard across all <code>AppContext</code>s.
*/
/**
* A set of <code>DataFlavor</code>s that is available on
* this clipboard. It is used for tracking changes
* of <code>DataFlavor</code>s available on this clipboard.
*/
super(name);
}
// 4378007 : Toolkit.getSystemClipboard().setContents(null, null)
// should throw NPE
throw new NullPointerException("contents");
}
initContext();
try {
} finally {
public void run() {
}
});
}
}
}
private synchronized void initContext() {
if (contentsContext != context) {
// Need to synchronize on the AppContext to guarantee that it cannot
// be disposed after the check, but before the listener is added.
synchronized (context) {
if (context.isDisposed()) {
throw new IllegalStateException("Can't set contents from disposed AppContext");
}
(AppContext.DISPOSED_PROPERTY_NAME, this);
}
if (contentsContext != null) {
(AppContext.DISPOSED_PROPERTY_NAME, this);
}
}
}
return contents;
}
return new ClipboardTransferable(this);
}
/**
* @return the contents of this clipboard if it has been set from the same
* AppContext as it is currently retrieved or null otherwise
* @since 1.5
*/
}
/**
* @see java.awt.Clipboard#getAvailableDataFlavors
* @since 1.5
*/
return cntnts.getTransferDataFlavors();
}
long[] formats = getClipboardFormatsOpenClose();
return DataTransferer.getInstance().
}
/**
* @see java.awt.Clipboard#isDataFlavorAvailable
* @since 1.5
*/
throw new NullPointerException("flavor");
}
}
long[] formats = getClipboardFormatsOpenClose();
}
/**
* @see java.awt.Clipboard#getData
* @since 1.5
*/
throws UnsupportedFlavorException, IOException {
throw new NullPointerException("flavor");
}
}
long format = 0;
try {
long[] formats = getClipboardFormats();
throw new UnsupportedFlavorException(flavor);
}
}
} finally {
}
return DataTransferer.getInstance().
}
/**
* The clipboard must be opened.
*
* @since 1.5
*/
return null;
}
/**
* @throws IllegalStateException if the clipboard has not been opened
*/
public void closeClipboard() {}
public abstract long getID();
}
}
protected void lostOwnershipImpl() {
}
/**
* Clears the clipboard state (contents, owner and contents context) and
* notifies the current owner that ownership is lost. Does nothing if the
* argument is not <code>null</code> and is not equal to the current
* contents context.
*
* @param disposedContext the AppContext that is disposed or
* <code>null</code> if the ownership is lost because another
* application acquired ownership.
*/
return;
}
public void run() {
synchronized (sunClipboard) {
return;
}
} else {
return;
}
}
}
}
};
}
protected abstract void clearNativeContext();
/**
* @since 1.5
*/
protected long[] getClipboardFormatsOpenClose() {
try {
return getClipboardFormats();
} finally {
}
}
/**
* Returns zero-length array (not null) if the number of available formats is zero.
*
* @throws IllegalStateException if formats could not be retrieved
*/
protected abstract long[] getClipboardFormats();
}
return;
}
if (contextFlavorListeners == null) {
}
if (numberOfFlavorListeners++ == 0) {
long[] currentFormats = null;
try {
} catch (IllegalStateException exc) {
} finally {
}
}
}
return;
}
if (contextFlavorListeners == null){
//else we throw NullPointerException, but it is forbidden
return;
}
--numberOfFlavorListeners == 0) {
}
}
}
public boolean areFlavorListenersRegistered() {
return (numberOfFlavorListeners > 0);
}
protected abstract void registerClipboardViewerChecked();
protected abstract void unregisterClipboardViewerChecked();
/**
* Checks change of the <code>DataFlavor</code>s and, if necessary,
* posts notifications on <code>FlavorEvent</code>s to the
* AppContexts' EDTs.
* The parameter <code>formats</code> is null iff we have just
* failed to get formats available on the clipboard.
*
* @param formats data formats that have just been retrieved from
* this clipboard
*/
// we've been able to successfully get available on the clipboard
// DataFlavors this and previous time and they are coincident;
// don't notify
return;
}
class SunFlavorChangeNotifier implements Runnable {
private final FlavorListener flavorListener;
this.flavorListener = flavorListener;
}
public void run() {
if (flavorListener != null) {
}
}
};
continue;
}
if (flavorListeners != null) {
}
}
}
}
}