All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.webswing.javafx.toolkit.WebFxDnD Maven / Gradle / Ivy

There is a newer version: 20.2.4
Show newest version
package org.webswing.javafx.toolkit;

import com.sun.glass.ui.SystemClipboard;
import org.webswing.dispatch.WebEventDispatcher;
import org.webswing.toolkit.util.Util;

import java.util.HashMap;
import java.util.concurrent.atomic.AtomicBoolean;

/**
 * Created by vikto on 07-Mar-17.
 */
public class WebFxDnD extends SystemClipboard {
	private HashMap data;
	private int actions = 0;

	public WebFxDnD(String clipboardName) {
		super(clipboardName);
	}

	@Override
	protected boolean isOwner() {
		return false;
	}

	@Override
	protected void pushToSystem(HashMap cacheData, int supportedActions) {
		this.data = cacheData;
		this.actions = supportedActions;
		WebEventDispatcher.javaFXdragStarted.getAndSet(true);
	}

	@Override
	protected void pushTargetActionToSystem(int actionDone) {

	}

	@Override
	protected Object popFromSystem(String mimeType) {
		if (data != null) {
			return data.get(mimeType);
		}
		return null;
	}

	@Override
	protected int supportedSourceActionsFromSystem() {
		return actions;
	}

	@Override
	protected String[] mimesFromSystem() {
		return data == null ? new String[0] : data.keySet().toArray(new String[data.keySet().size()]);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy