Browse Source
* commit 'd2842ea8f2e6b91b532aa3d2fd9804deb1311c25': KERNEL-13094 支持frm的组件copy到fvsfeature/x
superman
2 years ago
4 changed files with 122 additions and 12 deletions
@ -0,0 +1,18 @@ |
|||||||
|
package com.fr.design.designer.beans.models; |
||||||
|
|
||||||
|
public interface ClipboardProvider { |
||||||
|
|
||||||
|
/** |
||||||
|
* 剪切到剪贴板 |
||||||
|
* |
||||||
|
* @param o 剪切对象 |
||||||
|
*/ |
||||||
|
void cut2Clipboard(Object o); |
||||||
|
|
||||||
|
/** |
||||||
|
* 复制到剪贴板 |
||||||
|
* |
||||||
|
* @param o 复制对象 |
||||||
|
*/ |
||||||
|
void copy2Clipboard(Object o); |
||||||
|
} |
@ -0,0 +1,45 @@ |
|||||||
|
package com.fr.design.designer.beans.models; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 用来管理不同剪贴板,以及之间的数据同步 |
||||||
|
*/ |
||||||
|
public class DashboardClipboardManager { |
||||||
|
private static class Holder { |
||||||
|
private static final DashboardClipboardManager HOLDER = new DashboardClipboardManager(); |
||||||
|
} |
||||||
|
|
||||||
|
private static final List<ClipboardProvider> CLIPBOARD_LIST = new ArrayList<>(); |
||||||
|
|
||||||
|
|
||||||
|
public void registerDashboardClipboard(ClipboardProvider clipboard) { |
||||||
|
CLIPBOARD_LIST.add(clipboard); |
||||||
|
} |
||||||
|
|
||||||
|
public void removeDashboardClipboard(ClipboardProvider clipboard) { |
||||||
|
CLIPBOARD_LIST.remove(clipboard); |
||||||
|
} |
||||||
|
|
||||||
|
public static DashboardClipboardManager getInstance() { |
||||||
|
return Holder.HOLDER; |
||||||
|
} |
||||||
|
|
||||||
|
private DashboardClipboardManager() { |
||||||
|
} |
||||||
|
|
||||||
|
public void cut2Clipboard(Object o) { |
||||||
|
for (ClipboardProvider clipboard : CLIPBOARD_LIST) { |
||||||
|
//同步其他剪贴板
|
||||||
|
clipboard.cut2Clipboard(o); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void copy2Clipboard(Object o) { |
||||||
|
for (ClipboardProvider clipboard : CLIPBOARD_LIST) { |
||||||
|
//同步其他剪贴板
|
||||||
|
clipboard.copy2Clipboard(o); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,45 @@ |
|||||||
|
package com.fr.design.designer.beans.models; |
||||||
|
|
||||||
|
import com.fr.design.mainframe.FormSelection; |
||||||
|
|
||||||
|
public class FormSelectionClipboard implements ClipboardProvider { |
||||||
|
private static final FormSelection FRM_CLIPBOARD = new FormSelection(); |
||||||
|
|
||||||
|
static { |
||||||
|
DashboardClipboardManager.getInstance().registerDashboardClipboard(FormSelectionClipboard.getInstance()); |
||||||
|
} |
||||||
|
|
||||||
|
private static class Holder { |
||||||
|
private static final FormSelectionClipboard HOLDER = new FormSelectionClipboard(); |
||||||
|
} |
||||||
|
|
||||||
|
public static FormSelectionClipboard getInstance() { |
||||||
|
return Holder.HOLDER; |
||||||
|
} |
||||||
|
|
||||||
|
private FormSelectionClipboard() { |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public boolean isEmpty() { |
||||||
|
return FRM_CLIPBOARD.isEmpty(); |
||||||
|
} |
||||||
|
|
||||||
|
public FormSelection getClipboard() { |
||||||
|
return FRM_CLIPBOARD; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void cut2Clipboard(Object o) { |
||||||
|
if (o instanceof FormSelection) { |
||||||
|
((FormSelection) o).cut2ClipBoard(FRM_CLIPBOARD); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void copy2Clipboard(Object o) { |
||||||
|
if (o instanceof FormSelection) { |
||||||
|
((FormSelection) o).copy2ClipBoard(FRM_CLIPBOARD); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue