jeo
5 years ago
187 changed files with 4738 additions and 1446 deletions
@ -0,0 +1,50 @@
|
||||
package com.fr.design.base.clipboard; |
||||
|
||||
import com.fr.design.ExtraDesignClassManager; |
||||
import com.fr.design.fun.ClipboardHandlerProvider; |
||||
import com.fr.plugin.injectable.PluginModule; |
||||
|
||||
import java.util.Set; |
||||
|
||||
/** |
||||
* created by Harrison on 2020/05/14 |
||||
**/ |
||||
@SuppressWarnings({"rawtypes", "unchecked"}) |
||||
public abstract class ClipboardFilter { |
||||
|
||||
public static <T> T cut(T selection) { |
||||
|
||||
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); |
||||
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); |
||||
for (ClipboardHandlerProvider provider : providers) { |
||||
if (provider.support(selection)) { |
||||
selection = ((ClipboardHandlerProvider<T>) provider).cut(selection); |
||||
} |
||||
} |
||||
return selection; |
||||
} |
||||
|
||||
public static <T> T copy(T selection) { |
||||
|
||||
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); |
||||
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); |
||||
for (ClipboardHandlerProvider provider : providers) { |
||||
if (provider.support(selection)) { |
||||
selection = ((ClipboardHandlerProvider<T>) provider).copy(selection); |
||||
} |
||||
} |
||||
return selection; |
||||
} |
||||
|
||||
public static <T> T paste(T selection) { |
||||
|
||||
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); |
||||
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); |
||||
for (ClipboardHandlerProvider provider : providers) { |
||||
if (provider.support(selection)) { |
||||
selection = ((ClipboardHandlerProvider<T>) provider).paste(selection); |
||||
} |
||||
} |
||||
return selection; |
||||
} |
||||
} |
@ -0,0 +1,68 @@
|
||||
package com.fr.design.base.clipboard; |
||||
|
||||
import java.awt.datatransfer.Clipboard; |
||||
import java.awt.datatransfer.ClipboardOwner; |
||||
import java.awt.datatransfer.DataFlavor; |
||||
import java.awt.datatransfer.FlavorListener; |
||||
import java.awt.datatransfer.Transferable; |
||||
import java.awt.datatransfer.UnsupportedFlavorException; |
||||
import java.io.IOException; |
||||
|
||||
/** |
||||
* created by Harrison on 2020/05/11 |
||||
**/ |
||||
public class DesignerClipboard extends Clipboard { |
||||
|
||||
private Clipboard clipboard; |
||||
|
||||
public DesignerClipboard(Clipboard clipboard) { |
||||
super(clipboard.getName()); |
||||
this.clipboard = clipboard; |
||||
} |
||||
|
||||
@Override |
||||
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { |
||||
//处理 contents/owner
|
||||
Transferable filtered = ClipboardFilter.copy(contents); |
||||
clipboard.setContents(filtered, owner); |
||||
} |
||||
|
||||
@Override |
||||
public synchronized Transferable getContents(Object requestor) { |
||||
Transferable contents = clipboard.getContents(requestor); |
||||
//处理 contents
|
||||
Transferable filtered = ClipboardFilter.paste(contents); |
||||
return filtered; |
||||
} |
||||
|
||||
@Override |
||||
public DataFlavor[] getAvailableDataFlavors() { |
||||
return clipboard.getAvailableDataFlavors(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean isDataFlavorAvailable(DataFlavor flavor) { |
||||
return clipboard.isDataFlavorAvailable(flavor); |
||||
} |
||||
|
||||
@Override |
||||
public Object getData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { |
||||
return clipboard.getData(flavor); |
||||
} |
||||
|
||||
@Override |
||||
public synchronized void addFlavorListener(FlavorListener listener) { |
||||
clipboard.addFlavorListener(listener); |
||||
} |
||||
|
||||
@Override |
||||
public synchronized void removeFlavorListener(FlavorListener listener) { |
||||
clipboard.removeFlavorListener(listener); |
||||
} |
||||
|
||||
@Override |
||||
public synchronized FlavorListener[] getFlavorListeners() { |
||||
return clipboard.getFlavorListeners(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.design.data; |
||||
|
||||
import com.fr.design.dialog.FineJOptionPane; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/4/27 |
||||
*/ |
||||
public abstract class BasicTableDataUtils { |
||||
|
||||
private static final int LEN = 2; |
||||
|
||||
|
||||
public static boolean checkName(String name) { |
||||
if (isInValidName(name)) { |
||||
FineJOptionPane.showMessageDialog(null, |
||||
Toolkit.i18nText("Fine-Design_Basic_DataSet_Rename_Warning", name), |
||||
Toolkit.i18nText("Fine-Design_Basic_Alert"), |
||||
FineJOptionPane.WARNING_MESSAGE); |
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
public static boolean isInValidName(String name) { |
||||
String[] values = name.split("\\."); |
||||
if (values.length == LEN) { |
||||
return (StringUtils.isNotEmpty(values[0]) && StringUtils.isNotEmpty(values[1])) |
||||
|| (StringUtils.isEmpty(values[0]) && StringUtils.isNotEmpty(values[1])); |
||||
} |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
import com.fr.stable.fun.mark.Mutable; |
||||
|
||||
/** |
||||
* @author yaohwu |
||||
* created by yaohwu at 2020/4/26 15:50 |
||||
*/ |
||||
public interface CellExpandAttrPanelProvider extends Mutable { |
||||
|
||||
String MARK_STRING = "CellExpandAttrPanelProvider"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
/** |
||||
* @return 创建单元格属性-扩展设置中的额外面板 |
||||
*/ |
||||
BasicBeanPane<TemplateCellElement> createPanel(); |
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.stable.fun.mark.Mutable; |
||||
|
||||
/** |
||||
* created by Harrison on 2020/05/14 |
||||
**/ |
||||
public interface ClipboardHandlerProvider<T> extends Mutable { |
||||
|
||||
String XML_TAG = "ClipboardHandlerProvider"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
/** |
||||
* 剪切 |
||||
* |
||||
* @param selection 选中 |
||||
* @return 处理后的内容 |
||||
*/ |
||||
T cut(T selection); |
||||
|
||||
/** |
||||
* 复制 |
||||
* |
||||
* @param selection 选中 |
||||
* @return 处理后的内容 |
||||
*/ |
||||
T copy(T selection); |
||||
|
||||
/** |
||||
* 粘贴 |
||||
* |
||||
* @param selection 选中 |
||||
* @return 处理后的内容 |
||||
*/ |
||||
T paste(T selection); |
||||
|
||||
/** |
||||
* 支持的类型 |
||||
* |
||||
* @param selection 内容 |
||||
* @return 是否 |
||||
*/ |
||||
boolean support(Object selection); |
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.stable.fun.mark.Mutable; |
||||
import com.fr.start.BaseDesigner; |
||||
|
||||
/** |
||||
* 设计器启动类替换接口 |
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/5/7 |
||||
*/ |
||||
|
||||
public interface DesignerStartClassProcessor extends Mutable { |
||||
|
||||
String MARK_STRING = "DesignerStartClassProcessor"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
|
||||
Class<? extends BaseDesigner> transform(); |
||||
|
||||
} |
@ -0,0 +1,39 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.fun.CellExpandAttrPanelProvider; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
import com.fr.stable.fun.mark.API; |
||||
|
||||
/** |
||||
* @author yaohwu |
||||
* created by yaohwu at 2020/4/26 16:08 |
||||
*/ |
||||
@API(level = CellExpandAttrPanelProvider.CURRENT_LEVEL) |
||||
public class AbstractCellExpandAttrPanelProvider implements CellExpandAttrPanelProvider { |
||||
|
||||
/** |
||||
* 当前接口的API等级,用于判断是否需要升级插件 |
||||
* |
||||
* @return API等级 |
||||
*/ |
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CellExpandAttrPanelProvider.CURRENT_LEVEL; |
||||
} |
||||
|
||||
/** |
||||
* 获取当前provider的标记(可以使用类路径保证唯一)以避免provider的重复加载 |
||||
* |
||||
* @return 当前provider的标记 |
||||
*/ |
||||
@Override |
||||
public String mark4Provider() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public BasicBeanPane<TemplateCellElement> createPanel() { |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
import com.fr.design.fun.ClipboardHandlerProvider; |
||||
import com.fr.stable.fun.impl.AbstractProvider; |
||||
import com.fr.stable.fun.mark.API; |
||||
|
||||
/** |
||||
* created by Harrison on 2020/05/14 |
||||
**/ |
||||
@API(level = ClipboardHandlerProvider.CURRENT_LEVEL) |
||||
public abstract class AbstractClipboardHandlerProvider<T> extends AbstractProvider implements ClipboardHandlerProvider<T> { |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return ClipboardHandlerProvider.CURRENT_LEVEL; |
||||
} |
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
import com.fr.design.fun.DesignerStartClassProcessor; |
||||
import com.fr.stable.fun.mark.API; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/5/7 |
||||
*/ |
||||
@API(level = DesignerStartClassProcessor.CURRENT_LEVEL) |
||||
public abstract class AbstractDesignerStartClassProcessorProcessor implements DesignerStartClassProcessor { |
||||
|
||||
@Override |
||||
public String mark4Provider() { |
||||
return getClass().getName(); |
||||
} |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
} |
@ -0,0 +1,103 @@
|
||||
package com.fr.design.gui.ifilechooser; |
||||
|
||||
import javax.swing.filechooser.FileFilter; |
||||
import java.awt.*; |
||||
import java.io.File; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/3/31 |
||||
*/ |
||||
public abstract class AbstractFileChooser { |
||||
|
||||
/** |
||||
* 返回当前目录 |
||||
* |
||||
*/ |
||||
public abstract File getCurrentDirectory(); |
||||
|
||||
/** |
||||
* 返回当前的文件选择过滤器 |
||||
* |
||||
*/ |
||||
public abstract FileFilter getFileFilter(); |
||||
|
||||
/** |
||||
* 返回选择的文件 |
||||
* |
||||
*/ |
||||
public abstract File getSelectedFile(); |
||||
|
||||
/** |
||||
* 多文件选择模式下 返回选择的多个文件 |
||||
* |
||||
*/ |
||||
public abstract File[] getSelectedFiles(); |
||||
|
||||
/** |
||||
* 是否可以选择多个文件 |
||||
* |
||||
*/ |
||||
public abstract boolean isMultiSelectionEnabled(); |
||||
|
||||
/** |
||||
* 设置当前选择的目录 |
||||
* |
||||
*/ |
||||
public abstract void setCurrentDirectory(File dir); |
||||
|
||||
/** |
||||
* 设置左上角标题 |
||||
* |
||||
*/ |
||||
public abstract void setDialogTitle(String title); |
||||
|
||||
/** |
||||
* 设置当前的文件过滤器 |
||||
* |
||||
*/ |
||||
public abstract void setFileFilter(final FileFilter filter); |
||||
|
||||
/** |
||||
* 设置文件选择器模式 |
||||
* |
||||
* JFileChooser.FILES_ONLY |
||||
* JFileChooser.DIRECTORIES_ONLY |
||||
* JFileChooser.FILES_AND_DIRECTORIES |
||||
*/ |
||||
public abstract void setFileSelectionMode(int selectionMode); |
||||
|
||||
/** |
||||
* 设置是否允许选择多个文件 |
||||
* |
||||
*/ |
||||
public abstract void setMultiSelectionEnabled(boolean multiple); |
||||
|
||||
/** |
||||
* 设置选择的文件 用于showSaveDialog |
||||
* |
||||
*/ |
||||
public abstract void setSelectedFile(File file); |
||||
|
||||
/** |
||||
* 弹出文件选择器 打开文件 |
||||
* |
||||
*/ |
||||
public abstract int showOpenDialog(Component parent); |
||||
|
||||
/** |
||||
* 弹出文件选择器 保存文件 |
||||
* |
||||
*/ |
||||
public abstract int showSaveDialog(Component parent); |
||||
|
||||
|
||||
/** |
||||
* https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4031440
|
||||
* |
||||
* 设置文件名后缀 起到文件过滤的作用 形如 "*.jpg;*.jpeg" |
||||
* |
||||
*/ |
||||
public abstract void setExtensionFilter(String file); |
||||
} |
@ -0,0 +1,153 @@
|
||||
package com.fr.design.gui.ifilechooser; |
||||
|
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.stable.os.OperatingSystem; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.filechooser.FileFilter; |
||||
import java.awt.*; |
||||
import java.io.File; |
||||
import java.io.FilenameFilter; |
||||
|
||||
|
||||
/** |
||||
* 系统原生风格的文件选择器 |
||||
* |
||||
* jdk问题: |
||||
* https://bugs.openjdk.java.net/browse/JDK-4811090 不支持文件扩展选择
|
||||
* https://stackoverflow.com/questions/40713398/filter-not-working-in-filedialog windows下 setFilenameFilter不work
|
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/3/31 |
||||
*/ |
||||
public class UINativeFileChooser extends AbstractFileChooser { |
||||
|
||||
private final FileDialog fileDialog; |
||||
private FileFilter fileFilter; |
||||
private int selectionMode; |
||||
|
||||
public UINativeFileChooser(File file) { |
||||
fileDialog = new FileDialog(DesignerContext.getDesignerFrame()); |
||||
if (file != null) { |
||||
fileDialog.setDirectory(file.getAbsolutePath()); |
||||
fileDialog.setFile(file.toString()); |
||||
} |
||||
} |
||||
|
||||
public UINativeFileChooser() { |
||||
this(null); |
||||
} |
||||
|
||||
@Override |
||||
public File getCurrentDirectory() { |
||||
return new File(fileDialog.getDirectory()); |
||||
} |
||||
|
||||
@Override |
||||
public FileFilter getFileFilter() { |
||||
return fileFilter; |
||||
} |
||||
|
||||
@Override |
||||
public File getSelectedFile() { |
||||
return new File(fileDialog.getDirectory() + fileDialog.getFile()); |
||||
} |
||||
|
||||
@Override |
||||
public File[] getSelectedFiles() { |
||||
return fileDialog.getFiles(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean isMultiSelectionEnabled() { |
||||
return fileDialog.isMultipleMode(); |
||||
} |
||||
|
||||
@Override |
||||
public void setCurrentDirectory(File f) { |
||||
fileDialog.setDirectory(f.toString()); |
||||
} |
||||
|
||||
@Override |
||||
public void setDialogTitle(String title) { |
||||
fileDialog.setTitle(title); |
||||
} |
||||
|
||||
@Override |
||||
public void setFileFilter(final FileFilter cff) { |
||||
FilenameFilter filter = new FilenameFilter() { |
||||
@Override |
||||
public boolean accept(File Directory, String fileName) { |
||||
return cff.accept(new File(Directory.getAbsolutePath() + fileName)); |
||||
} |
||||
}; |
||||
fileDialog.setFilenameFilter(filter); |
||||
fileFilter = cff; |
||||
} |
||||
|
||||
@Override |
||||
public void setFileSelectionMode(int selectionMode) { |
||||
this.selectionMode = selectionMode; |
||||
} |
||||
|
||||
@Override |
||||
public void setMultiSelectionEnabled(boolean multiple) { |
||||
fileDialog.setMultipleMode(multiple); |
||||
} |
||||
|
||||
@Override |
||||
public void setSelectedFile(File file) { |
||||
fileDialog.setDirectory(file.getAbsolutePath()); |
||||
fileDialog.setFile(file.getName()); |
||||
} |
||||
|
||||
@Override |
||||
public int showOpenDialog(Component parent) { |
||||
boolean appleProperty = OperatingSystem.isMacos() && selectionMode == JFileChooser.DIRECTORIES_ONLY; |
||||
if (appleProperty) { |
||||
System.setProperty("apple.awt.fileDialogForDirectories", "true"); |
||||
} |
||||
try { |
||||
fileDialog.setLocale(JComponent.getDefaultLocale()); |
||||
fileDialog.setMode(FileDialog.LOAD); |
||||
fileDialog.setVisible(true); |
||||
return fileDialog.getFile() == null ? JFileChooser.CANCEL_OPTION : JFileChooser.APPROVE_OPTION; |
||||
} finally { |
||||
if (appleProperty) { |
||||
System.setProperty("apple.awt.fileDialogForDirectories", "false"); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public int showSaveDialog(Component parent) { |
||||
fileDialog.setLocale(JComponent.getDefaultLocale()); |
||||
fileDialog.setMode(FileDialog.SAVE); |
||||
fileDialog.setVisible(true); |
||||
return fileDialog.getFile() == null ? JFileChooser.CANCEL_OPTION : JFileChooser.APPROVE_OPTION; |
||||
} |
||||
|
||||
@Override |
||||
public void setExtensionFilter(String file) { |
||||
fileDialog.setFile(file); |
||||
} |
||||
|
||||
/** |
||||
* 确认本地文件选择器是否支持选择模式 |
||||
* @param selectionMode 选择模式 |
||||
* @return 是否支持选择模式 |
||||
*/ |
||||
public static boolean supportsSelectionMode(int selectionMode) { |
||||
switch (selectionMode) { |
||||
case JFileChooser.FILES_AND_DIRECTORIES: |
||||
return false; |
||||
case JFileChooser.DIRECTORIES_ONLY: |
||||
return OperatingSystem.isMacos(); |
||||
case JFileChooser.FILES_ONLY: |
||||
default: |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,122 @@
|
||||
package com.fr.design.mainframe.mobile.ui; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.gui.ibutton.UIToggleButton; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.icombobox.UIComboBoxRenderer; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.stable.Constants; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.DefaultComboBoxModel; |
||||
import javax.swing.JLabel; |
||||
import javax.swing.JList; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.awt.FlowLayout; |
||||
import java.awt.Font; |
||||
import java.util.Vector; |
||||
|
||||
public class MobileStyleFontConfigPane extends JPanel { |
||||
public static final int FONT_NONE = 0; |
||||
private static final int MAX_FONT_SIZE = 18; |
||||
private static final int MIN_FONT_SIZE = 12; |
||||
private static final Dimension BUTTON_SIZE = new Dimension(20, 18); |
||||
|
||||
public static Vector<Integer> getFontSizes() { |
||||
Vector<Integer> FONT_SIZES = new Vector<Integer>(); |
||||
for (int i = MIN_FONT_SIZE; i <= MAX_FONT_SIZE; i++) { |
||||
FONT_SIZES.add(i); |
||||
} |
||||
return FONT_SIZES; |
||||
} |
||||
|
||||
private UIComboBox fontSizeComboBox; |
||||
private UIColorButton color; |
||||
private UIToggleButton italic; |
||||
private UIToggleButton bold; |
||||
|
||||
public MobileStyleFontConfigPane() { |
||||
this.initComponent(); |
||||
} |
||||
|
||||
private void initComponent() { |
||||
|
||||
fontSizeComboBox = new UIComboBox(); |
||||
fontSizeComboBox.setModel(new DefaultComboBoxModel(getFontSizes())); |
||||
fontSizeComboBox.setSelectedItem(16); |
||||
fontSizeComboBox.setPreferredSize(new Dimension(60, 20)); |
||||
fontSizeComboBox.setRenderer(new LineCellRenderer()); |
||||
color = new UIColorButton(); |
||||
italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); |
||||
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); |
||||
|
||||
this.setButtonsTips(); |
||||
this.setButtonsSize(BUTTON_SIZE); |
||||
|
||||
Component[] components_font = new Component[]{ |
||||
fontSizeComboBox, color, italic, bold |
||||
}; |
||||
|
||||
JPanel buttonPane = new JPanel(new BorderLayout()); |
||||
buttonPane.add(GUICoreUtils.createFlowPane(components_font, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE)); |
||||
|
||||
this.setLayout(new BorderLayout(0,0)); |
||||
this.add(buttonPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private void setButtonsTips() { |
||||
color.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Foreground")); |
||||
italic.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Italic")); |
||||
bold.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bold")); |
||||
} |
||||
|
||||
private void setButtonsSize(Dimension size) { |
||||
color.setPreferredSize(size); |
||||
italic.setPreferredSize(size); |
||||
bold.setPreferredSize(size); |
||||
} |
||||
|
||||
|
||||
public void populateBean(FRFont frFont) { |
||||
fontSizeComboBox.setSelectedItem(frFont.getSize()); |
||||
color.setColor(frFont.getForeground()); |
||||
bold.setSelected(frFont.isBold()); |
||||
italic.setSelected(frFont.isItalic()); |
||||
} |
||||
|
||||
public FRFont updateBean() { |
||||
int style = Font.PLAIN; |
||||
style += this.bold.isSelected() ? Font.BOLD : Font.PLAIN; |
||||
style += this.italic.isSelected() ? Font.ITALIC : Font.PLAIN; |
||||
return FRFont.getInstance( |
||||
FRFont.DEFAULT_FONTNAME, |
||||
style, |
||||
Float.parseFloat(fontSizeComboBox.getSelectedItem().toString()), |
||||
color.getColor(), |
||||
Constants.LINE_NONE |
||||
); |
||||
} |
||||
|
||||
private class LineCellRenderer extends UIComboBoxRenderer { |
||||
public LineCellRenderer() { |
||||
super(); |
||||
} |
||||
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
||||
JLabel renderer =(JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
||||
int currentValue = ((Integer) value).intValue(); |
||||
if (currentValue == MobileStyleFontConfigPane.FONT_NONE) { |
||||
renderer.setText(StringUtils.BLANK + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None")); |
||||
} |
||||
return renderer; |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fr.design.mainframe.template.info; |
||||
|
||||
import com.fr.json.JSONObject; |
||||
|
||||
/** |
||||
* Created by kerry on 2020-05-08 |
||||
*/ |
||||
public interface TemplateOperate { |
||||
/** |
||||
* 获取模板操作类型 |
||||
* @return 操作类型 |
||||
*/ |
||||
String getOperateType(); |
||||
|
||||
/** |
||||
* 将模板操作信息转换成json格式 |
||||
* @return jsonObject |
||||
*/ |
||||
JSONObject toJSONObject(); |
||||
} |
@ -0,0 +1,62 @@
|
||||
package com.fr.design.base.clipboard; |
||||
|
||||
import com.fr.design.ExtraDesignClassManager; |
||||
import com.fr.design.fun.ClipboardHandlerProvider; |
||||
import com.fr.plugin.injectable.PluginModule; |
||||
import com.fr.stable.fun.mark.Mutable; |
||||
import org.easymock.EasyMock; |
||||
import org.junit.After; |
||||
import org.junit.Assert; |
||||
import org.junit.Before; |
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
import org.powermock.api.easymock.PowerMock; |
||||
import org.powermock.core.classloader.annotations.PrepareForTest; |
||||
import org.powermock.modules.junit4.PowerMockRunner; |
||||
|
||||
import java.util.HashSet; |
||||
import java.util.Set; |
||||
|
||||
@PrepareForTest(PluginModule.class) |
||||
@RunWith(PowerMockRunner.class) |
||||
public class ClipboardFilterTest { |
||||
|
||||
|
||||
@Before |
||||
public void setUp() throws Exception { |
||||
|
||||
Set<Mutable> providers = new HashSet<>(); |
||||
providers.add(new TestClipboardHandlerProvider<Object>()); |
||||
|
||||
ExtraDesignClassManager designClassManager = EasyMock.mock(ExtraDesignClassManager.class); |
||||
EasyMock.expect(designClassManager.getArray(ClipboardHandlerProvider.XML_TAG)) |
||||
.andReturn(providers) |
||||
.anyTimes(); |
||||
EasyMock.replay(designClassManager); |
||||
|
||||
PowerMock.mockStatic(PluginModule.class); |
||||
EasyMock.expect(PluginModule.getAgent(PluginModule.ExtraDesign)) |
||||
.andReturn(designClassManager) |
||||
.anyTimes(); |
||||
PowerMock.replayAll(); |
||||
} |
||||
|
||||
@After |
||||
public void tearDown() throws Exception { |
||||
|
||||
PowerMock.resetAll(); |
||||
} |
||||
|
||||
@Test |
||||
public void testClipboard() { |
||||
|
||||
ClipboardFilter.cut("cut"); |
||||
String paste1 = ClipboardFilter.paste("paste"); |
||||
Assert.assertNull(paste1); |
||||
|
||||
ClipboardFilter.copy("copy"); |
||||
String paste2 = ClipboardFilter.paste("paste"); |
||||
Assert.assertNull(paste2); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,75 @@
|
||||
package com.fr.design.base.clipboard; |
||||
|
||||
import com.fr.design.fun.ClipboardHandlerProvider; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.dnd.ArrayListTransferable; |
||||
import com.fr.form.main.ExtraFormClassManager; |
||||
import com.fr.plugin.injectable.PluginModule; |
||||
import com.fr.stable.fun.mark.Mutable; |
||||
import com.fr.third.guava.collect.Lists; |
||||
import org.easymock.EasyMock; |
||||
import org.junit.After; |
||||
import org.junit.Assert; |
||||
import org.junit.Before; |
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
import org.powermock.api.easymock.PowerMock; |
||||
import org.powermock.core.classloader.annotations.PowerMockIgnore; |
||||
import org.powermock.core.classloader.annotations.PrepareForTest; |
||||
import org.powermock.modules.junit4.PowerMockRunner; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.datatransfer.Clipboard; |
||||
import java.awt.datatransfer.DataFlavor; |
||||
import java.awt.datatransfer.Transferable; |
||||
import java.util.ArrayList; |
||||
import java.util.HashSet; |
||||
import java.util.Set; |
||||
|
||||
@PrepareForTest(PluginModule.class) |
||||
@RunWith(PowerMockRunner.class) |
||||
@PowerMockIgnore("javax.swing.*") |
||||
public class DesignerClipboardTest { |
||||
|
||||
@Before |
||||
public void setUp() throws Exception { |
||||
|
||||
Set<Mutable> providers = new HashSet<>(); |
||||
|
||||
ExtraFormClassManager formClassManager = EasyMock.mock(ExtraFormClassManager.class); |
||||
EasyMock.expect(formClassManager.getArray(ClipboardHandlerProvider.XML_TAG)) |
||||
.andReturn(providers) |
||||
.anyTimes(); |
||||
EasyMock.replay(formClassManager); |
||||
|
||||
PowerMock.mockStatic(PluginModule.class); |
||||
EasyMock.expect(PluginModule.getAgent(PluginModule.ExtraForm)) |
||||
.andReturn(formClassManager) |
||||
.anyTimes(); |
||||
PowerMock.replayAll(); |
||||
} |
||||
|
||||
@After |
||||
public void tearDown() throws Exception { |
||||
|
||||
PowerMock.resetAll(); |
||||
} |
||||
|
||||
@Test |
||||
public void testClipboard() throws Exception { |
||||
|
||||
JPanel panel = new JPanel(); |
||||
Clipboard clipboard = DesignerContext.getClipboard(panel); |
||||
|
||||
ArrayList<String> transferData = Lists.newArrayList("test", "test2"); |
||||
ArrayListTransferable transferable = new ArrayListTransferable(transferData); |
||||
clipboard.setContents(transferable, null); |
||||
|
||||
Transferable filterTransferable = clipboard.getContents(null); |
||||
DataFlavor[] flavors = transferable.getTransferDataFlavors(); |
||||
ArrayList<String> transferData2 = (ArrayList<String>) filterTransferable.getTransferData(flavors[0]); |
||||
|
||||
Assert.assertEquals(transferData.get(0), transferData2.get(0)); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.fr.design.base.clipboard; |
||||
|
||||
import com.fr.design.fun.impl.AbstractClipboardHandlerProvider; |
||||
|
||||
/** |
||||
* created by Harrison on 2020/05/15 |
||||
**/ |
||||
class TestClipboardHandlerProvider<T> extends AbstractClipboardHandlerProvider<T> { |
||||
|
||||
@Override |
||||
public T cut(T selection) { |
||||
return selection; |
||||
} |
||||
|
||||
@Override |
||||
public T copy(T selection) { |
||||
return selection; |
||||
} |
||||
|
||||
@Override |
||||
public T paste(T selection) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public boolean support(Object selection) { |
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,44 @@
|
||||
package com.fr.design.data; |
||||
|
||||
import junit.framework.TestCase; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/4/27 |
||||
*/ |
||||
public class BasicTableDataUtilsTest extends TestCase { |
||||
|
||||
@Test |
||||
public void testIsInValidName() { |
||||
|
||||
boolean result1 = BasicTableDataUtils.isInValidName("a.b"); |
||||
boolean result2 = BasicTableDataUtils.isInValidName("a.b.c"); |
||||
boolean result3 = BasicTableDataUtils.isInValidName("a..b"); |
||||
boolean result4 = BasicTableDataUtils.isInValidName("a."); |
||||
boolean result5 = BasicTableDataUtils.isInValidName("a.b."); |
||||
boolean result6 = BasicTableDataUtils.isInValidName("abc"); |
||||
boolean result7 = BasicTableDataUtils.isInValidName(".abc"); |
||||
boolean result8 = BasicTableDataUtils.isInValidName(".ab.c"); |
||||
boolean result9 = BasicTableDataUtils.isInValidName("ab.c."); |
||||
boolean result10 = BasicTableDataUtils.isInValidName(".abc."); |
||||
boolean result11 = BasicTableDataUtils.isInValidName(".ab.c."); |
||||
boolean result12 = BasicTableDataUtils.isInValidName(".."); |
||||
|
||||
Assert.assertTrue(result1); |
||||
Assert.assertFalse(result2); |
||||
Assert.assertFalse(result3); |
||||
Assert.assertFalse(result4); |
||||
Assert.assertTrue(result5); |
||||
Assert.assertFalse(result6); |
||||
Assert.assertTrue(result7); |
||||
Assert.assertFalse(result8); |
||||
Assert.assertTrue(result9); |
||||
Assert.assertTrue(result10); |
||||
Assert.assertFalse(result11); |
||||
Assert.assertFalse(result12); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,25 @@
|
||||
package com.fr.design.formula; |
||||
|
||||
import junit.framework.TestCase; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
import java.util.Arrays; |
||||
|
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/5/20 |
||||
*/ |
||||
public class FormulaPaneTest extends TestCase { |
||||
|
||||
@Test |
||||
public void testSimilarComparator() { |
||||
String[] strs = new String[] {"ScriptEval", "SPLIT", "SUMPRECISE"}; |
||||
String[] result = new String[] {"SPLIT", "ScriptEval", "SUMPRECISE"}; |
||||
Arrays.sort(strs, new FormulaPane.SimilarComparator("sp")); |
||||
Assert.assertArrayEquals(result, strs); |
||||
} |
||||
|
||||
} |
@ -1,35 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<TplInfo xmlVersion="20170720" releaseVersion="10.0.0"> |
||||
<DesignerOpenHistory> |
||||
<![CDATA[2019-04-08,2019-04-03,2019-03-29]]></DesignerOpenHistory> |
||||
<![CDATA[2020-05-07,2020-05-06,2020-04-30]]></DesignerOpenHistory> |
||||
<TemplateInfoList> |
||||
<TemplateInfo templateID="16a988ce-8529-42f5-b17c-2ee849355071" day_count="9"> |
||||
<processMap process="" float_count="0" widget_count="0" cell_count="1" block_count="0" report_type="0"/> |
||||
<consumingMap activitykey="2e0ea413-fa9c241e0-9723-4354fce51e81" jar_time="不是安装版本" create_time="2019-03-26 16:13" uuid="476ca2cc-f789-4c5d-8e89-ef146580775c" time_consume="129" version="10.0" username="plough"/> |
||||
<TemplateInfo templateID="e5d7dbb2-d1df-43d4-b974-67acb5ecbffa" day_count="0" test_template="true"> |
||||
<processMap process="" float_count="0" widget_count="2" cell_count="0" block_count="0" report_type="2" paraApply="1" components_info="[{"componentID":"60e291c2-be60-4908-83ef-08b4a79d5f03","componentName":"button1","componentType":"Widget","createTime":1588843627801,"deleteTime":0},{"componentID":"fcf77ee3-05f0-4219-8fd2-d2a9ec95477e","componentName":"button0","componentType":"Widget","createTime":1588843624940,"deleteTime":0}]"/> |
||||
<consumingMap create_time="2020-05-07 17:25" uuid="6b6699ff-ec63-43b0-9deb-b580a5f10411" uid="71113" saveRecord="{"time":1588843629000,"consume":81}"/> |
||||
</TemplateInfo> |
||||
<TemplateInfo templateID="23817e4f-64b6-438e-b23b-91c1a4d0b254" day_count="9"> |
||||
<processMap process="" float_count="0" widget_count="0" cell_count="231" block_count="0" report_type="0"/> |
||||
<consumingMap activitykey="2e0ea413-fa9c241e0-9723-4354fce51e81" jar_time="不是安装版本" create_time="2019-03-26 16:52" uuid="476ca2cc-f789-4c5d-8e89-ef146580775c" time_consume="91" version="10.0" username="plough"/> |
||||
<TemplateInfo templateID="2521d03c-b238-41a5-9a1d-2498efff3a97" originID="aac1139e-018b-4481-867a-a18fc6d6f3e6" day_count="0" test_template="true"> |
||||
<processMap process="" float_count="0" widget_count="0" cell_count="3" block_count="0" report_type="0" paraApply="0" components_info="[]"/> |
||||
<consumingMap create_time="2020-05-07 17:45" uuid="6b6699ff-ec63-43b0-9deb-b580a5f10411" uid="71113" saveRecord="{"time":1588844751000,"consume":1058}"/> |
||||
</TemplateInfo> |
||||
<TemplateInfo templateID="31319947-5ce7-4d82-97e4-3cfea825df9c" day_count="9"> |
||||
<processMap process="" float_count="0" widget_count="0" cell_count="3" block_count="0" report_type="0"/> |
||||
<consumingMap activitykey="2e0ea413-fa9c241e0-9723-4354fce51e81" jar_time="不是安装版本" create_time="2019-03-26 16:49" uuid="476ca2cc-f789-4c5d-8e89-ef146580775c" time_consume="160" version="10.0" username="plough"/> |
||||
<TemplateInfo templateID="e5d7dbb2-d1df-43d4-b974-67acb5ecbffa" day_count="0" test_template="true"> |
||||
<processMap process="" float_count="0" widget_count="2" cell_count="0" block_count="0" report_type="2" paraApply="1" components_info="[{"componentID":"e28e24af-a01a-42cd-aa06-e14dd7990621","componentName":"button1","componentType":"Widget","createTime":1588843526090,"deleteTime":0},{"componentID":"0e7ce6df-f19b-40a9-a4d9-d47bdc097e31","componentName":"button0","componentType":"Widget","createTime":1588843525059,"deleteTime":0}]"/> |
||||
<consumingMap create_time="2020-05-07 17:25" uuid="6b6699ff-ec63-43b0-9deb-b580a5f10411" uid="71113" saveRecord="{"time":1588843530000,"consume":6}"/> |
||||
</TemplateInfo> |
||||
<TemplateInfo templateID="43bdd914-a3f7-405c-ad96-2feaf28bed74" day_count="8"> |
||||
<processMap process="" float_count="0" widget_count="0" cell_count="1" block_count="0" report_type="0"/> |
||||
<consumingMap activitykey="2e0ea413-fa9c241e0-9723-4354fce51e81" jar_time="2019.01.04.18.06.01.38" create_time="2019-03-27 16:17" uuid="476ca2cc-f789-4c5d-8e89-ef146580775c" time_consume="1426" version="10.0" username="plough"/> |
||||
<TemplateInfo templateID="aac1139e-018b-4481-867a-a18fc6d6f3e6" day_count="0" test_template="true"> |
||||
<processMap process="" float_count="0" widget_count="0" cell_count="3" block_count="0" report_type="0" paraApply="0" components_info="[]"/> |
||||
<consumingMap create_time="2020-05-07 17:28" uuid="6b6699ff-ec63-43b0-9deb-b580a5f10411" uid="71113" saveRecord="{"time":1588843693000,"consume":4}"/> |
||||
</TemplateInfo> |
||||
<TemplateInfo templateID="cd527ae5-06e4-48fb-a73e-e9a06c9e7c58" day_count="12"> |
||||
<processMap process="" float_count="0" widget_count="0" cell_count="3" block_count="0" report_type="0"/> |
||||
<consumingMap activitykey="2e0ea413-fa9c241e0-9723-4354fce51e81" jar_time="2019.01.04.18.06.01.38" create_time="2019-03-15 10:02" uuid="476ca2cc-f789-4c5d-8e89-ef146580775c" time_consume="430" version="10.0" username="plough"/> |
||||
<TemplateInfo templateID="e5d7dbb2-d1df-43d4-b974-67acb5ecbffa" day_count="0" test_template="true"> |
||||
<processMap process="" float_count="0" widget_count="1" cell_count="0" block_count="0" report_type="2" paraApply="1" components_info="[{"componentID":"60e291c2-be60-4908-83ef-08b4a79d5f03","componentName":"button1","componentType":"Widget","createTime":0,"deleteTime":1588843630822}]"/> |
||||
<consumingMap create_time="2020-05-07 17:25" uuid="6b6699ff-ec63-43b0-9deb-b580a5f10411" uid="71113" saveRecord="{"time":1588843631000,"consume":2}"/> |
||||
</TemplateInfo> |
||||
<TemplateInfo templateID="08f9c404-8124-4615-a34c-735dcabee137" day_count="9"> |
||||
<processMap process="" float_count="0" widget_count="0" cell_count="2" block_count="0" report_type="0"/> |
||||
<consumingMap activitykey="2e0ea413-fa9c241e0-9723-4354fce51e81" jar_time="不是安装版本" create_time="2019-03-25 17:22" uuid="476ca2cc-f789-4c5d-8e89-ef146580775c" time_consume="1497" version="10.0" username="plough"/> |
||||
<TemplateInfo templateID="e5d7dbb2-d1df-43d4-b974-67acb5ecbffa" day_count="0" test_template="true"> |
||||
<processMap process="" float_count="0" widget_count="0" cell_count="0" block_count="0" report_type="2" paraApply="1" components_info="[{"componentID":"fcf77ee3-05f0-4219-8fd2-d2a9ec95477e","componentName":"button0","componentType":"Widget","createTime":0,"deleteTime":1588843641882}]"/> |
||||
<consumingMap create_time="2020-05-07 17:25" uuid="6b6699ff-ec63-43b0-9deb-b580a5f10411" uid="71113" saveRecord="{"time":1588843642000,"consume":10}"/> |
||||
</TemplateInfo> |
||||
<TemplateInfo templateID="981314a5-9c5b-4831-97d8-15e76735f9e2" day_count="1"> |
||||
<processMap process="" float_count="0" widget_count="0" cell_count="3" block_count="0" report_type="0"/> |
||||
<consumingMap activitykey="2e0ea413-fa9c241e0-9723-4354fce51e81" jar_time="不是安装版本" create_time="2019-04-17 16:24" uuid="476ca2cc-f789-4c5d-8e89-ef146580775c" time_consume="155" version="10.0" username="plough"/> |
||||
<TemplateInfo templateID="e5d7dbb2-d1df-43d4-b974-67acb5ecbffa" day_count="0" test_template="true"> |
||||
<processMap process="" float_count="0" widget_count="1" cell_count="0" block_count="0" report_type="2" paraApply="1" components_info="[]"/> |
||||
<consumingMap create_time="2020-05-07 17:25" uuid="6b6699ff-ec63-43b0-9deb-b580a5f10411" uid="71113" saveRecord="{"time":1588843548000,"consume":17}"/> |
||||
</TemplateInfo> |
||||
</TemplateInfoList> |
||||
</TplInfo> |
||||
|
@ -0,0 +1,11 @@
|
||||
package com.fr.van.chart.designer.component; |
||||
|
||||
import com.fr.plugin.chart.type.LineType; |
||||
|
||||
public class VanChartLineTypePaneWithoutDashed extends VanChartLineTypePane{ |
||||
|
||||
@Override |
||||
protected LineTypeComboBox createLineType() { |
||||
return new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID}); |
||||
} |
||||
} |
@ -1,22 +1,16 @@
|
||||
package com.fr.van.chart.designer.component; |
||||
|
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
|
||||
import java.awt.Component; |
||||
|
||||
/** |
||||
* 线型+线宽+空值断开 |
||||
*/ |
||||
public class VanChartLineWidthPane extends VanChartLineTypePane { |
||||
public class VanChartLineWidthPane extends VanChartLineTypePaneWithoutDashed { |
||||
private static final long serialVersionUID = 4537158946119294689L; |
||||
|
||||
@Override |
||||
protected Component[][] createContentComponent(Component[] lineStyleComponent, Component[] nullValueBreakComponent) { |
||||
return new Component[][]{ |
||||
//线型支持虚线 恢复用注释。下面2行删除。
|
||||
new Component[]{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), lineWidth}, |
||||
nullValueBreakComponent |
||||
}; |
||||
} |
||||
|
@ -0,0 +1,16 @@
|
||||
package com.fr.van.chart.designer.other.condition.item; |
||||
|
||||
import com.fr.design.condition.ConditionAttributesPane; |
||||
import com.fr.van.chart.designer.component.VanChartLineTypePane; |
||||
import com.fr.van.chart.designer.component.VanChartLineTypePaneWithoutDashed; |
||||
|
||||
public class VanChartLineTypeConditionPaneWithoutDashed extends VanChartLineTypeConditionPane { |
||||
|
||||
public VanChartLineTypeConditionPaneWithoutDashed(ConditionAttributesPane conditionAttributesPane) { |
||||
super(conditionAttributesPane); |
||||
} |
||||
|
||||
protected VanChartLineTypePane createLinePane() { |
||||
return new VanChartLineTypePaneWithoutDashed(); |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue