diff --git a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java index 1fc6e14440..bb4ba4cccc 100644 --- a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java @@ -180,9 +180,15 @@ public abstract class UpdateAction extends ShortCut implements Action { * 如果a_disabled.svg或者a_pressed.svg缺失,则不会被设置成灰化状态或者按压状态图标 * 如果a_normal.svg缺失,则会读到a.png,这也就不是一个SVGIcon了 * 如果连 a.png 也不存在,那么这个action的图标就是空白的 - * @param resource + * + * 如果想让这个Action没有图标,可以传入"" + * @param resource 图标资源路径 */ public void setSmallIcon(String resource) { + if (StringUtils.equals(resource, StringUtils.EMPTY)) { + this.putValue(Action.SMALL_ICON, null); + return; + } this.putValue(Action.SMALL_ICON, IconUtils.readIcon(resource)); this.putValue(UpdateAction.DISABLED_ICON, IconUtils.readSVGIcon(resource, IconUtils.ICON_TYPE_DISABLED)); } diff --git a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java index 8887f79866..fdc92a9371 100644 --- a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java +++ b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java @@ -4,11 +4,14 @@ package com.fr.design.constants; import com.fr.base.svg.IconUtils; +import com.fr.base.svg.SVGIcon; import com.fr.general.IOUtils; import com.fr.stable.Constants; +import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.Icon; +import javax.swing.ImageIcon; import javax.swing.border.Border; import java.awt.BasicStroke; import java.awt.Color; @@ -26,6 +29,7 @@ public interface UIConstants { public static final Icon CPT_ICON = IOUtils.readIcon("/com/fr/base/images/oem/cpt.png"); public static final Icon BLACK_ICON = IOUtils.readIcon("/com/fr/base/images/cell/blank.gif"); + public static final String EMPTY_ICON = StringUtils.EMPTY; public static final Image APPFIT_V0 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/V0.png"); public static final Image APPFIT_V1 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/V1.png"); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java index 1cba4df966..7f5d083004 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java @@ -1 +1,194 @@ -package com.fr.design.data.datapane.sqlpane; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.TableProcedure; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import javax.swing.JPopupMenu; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import java.awt.Point; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetAdapter; import java.awt.dnd.DropTargetContext; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.awt.event.ActionEvent; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-5-2 * Time: 上午11:09 */ public class SQLEditPane extends RSyntaxTextArea { public static final boolean REQUEST_DROPTARGET = true; public static final boolean UNREQUEST_DROPTARGET = false; public SQLEditPane() { this(REQUEST_DROPTARGET); } public SQLEditPane(boolean requestDroptarget) { super(); setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); setAnimateBracketMatching(true); setAntiAliasingEnabled(true); setAutoIndentEnabled(true); setCodeFoldingEnabled(true); setUseSelectedTextColor(true); setCloseCurlyBraces(true); setBracketMatchingEnabled(true); setAntiAliasingEnabled(true); setCloseMarkupTags(true); setLineWrap(true); if (requestDroptarget) { new SQLPaneDropTarget(this); } } private static class SQLPaneDropTarget extends DropTargetAdapter { private TableProcedure sqlTable; public SQLPaneDropTarget(SQLEditPane sqlTextPane) { new DropTarget(sqlTextPane, this); } public void dragEnter(DropTargetDragEvent dtde) { dtde.acceptDrag(dtde.getDropAction()); } public void dragOver(DropTargetDragEvent dtde) { dtde.acceptDrag(dtde.getDropAction()); } public void drop(DropTargetDropEvent dtde) { Point p = dtde.getLocation(); DropTargetContext dtc = dtde.getDropTargetContext(); SQLEditPane jTextPane = (SQLEditPane) dtc.getComponent(); try { Transferable tr = dtde.getTransferable(); DataFlavor[] flavors = tr.getTransferDataFlavors(); for (int i = 0; i < flavors.length; i++) { if (!tr.isDataFlavorSupported(flavors[i])) { continue; } dtde.acceptDrop(dtde.getDropAction()); Object userObj = tr.getTransferData(flavors[i]); if (userObj instanceof TableProcedure) { this.sqlTable = (TableProcedure) userObj; JPopupMenu popupMenu = new JPopupMenu(); popupMenu.add(new NameAction(jTextPane, sqlTable).createMenuItem()); if (ComparatorUtils.equals(sqlTable.getType(), TableProcedure.PROCEDURE)) { popupMenu.add(new CallAction(jTextPane, sqlTable).createMenuItem()); } else { popupMenu.add(new SelectAction(jTextPane, sqlTable).createMenuItem()); } GUICoreUtils.showPopupMenu(popupMenu, jTextPane, (int) p.getX() + 1, (int) p.getY() + 1); } dtde.dropComplete(true); } dtde.rejectDrop(); } catch (Exception e) { dtde.rejectDrop(); } } class NameAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public NameAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name")); this.setMnemonic('N'); this.setSmallIcon(UIConstants.BLACK_ICON); } public void actionPerformed(ActionEvent evt) { if (sqlTable != null) { insertStringTo(sqlTextPane, sqlTable.toString()); } } } class SelectAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public SelectAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName("SELECT *"); this.setMnemonic('s'); this.setSmallIcon(UIConstants.BLACK_ICON); } public void actionPerformed(ActionEvent evt) { //daniel: 添加参数 insertStringTo(sqlTextPane, DataCoreUtils.createSelectSQL(sqlTable.getSchema(), sqlTable.getName(), sqlTable.getDialect())); } } class CallAction extends UpdateAction { private SQLEditPane sqlTextPane; private TableProcedure sqlTable; public CallAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { this.sqlTextPane = sqlTextPane; this.sqlTable = sqlTable; this.setName("CALL PROCEDURE "); this.setMnemonic('s'); this.setSmallIcon(UIConstants.BLACK_ICON); } public void actionPerformed(ActionEvent evt) { StringBuffer sBuf = new StringBuffer(); sBuf.append("{call "); if (sqlTable != null) { sBuf.append(sqlTable.toString()).append("()"); } sBuf.append('}'); insertStringTo(sqlTextPane, sBuf.toString()); } } private void insertStringTo(SQLEditPane sqlTextPane, String str) { Document document = sqlTextPane.getDocument(); try { document.insertString(sqlTextPane.getCaretPosition(), str, null); } catch (BadLocationException badLocationException) { FineLoggerFactory.getLogger().error(badLocationException.getMessage(), badLocationException); } sqlTextPane.requestFocus(); } } } \ No newline at end of file +package com.fr.design.data.datapane.sqlpane; + +import com.fr.data.core.DataCoreUtils; +import com.fr.data.core.db.TableProcedure; +import com.fr.design.actions.UpdateAction; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; +import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; + +import javax.swing.Icon; +import javax.swing.JPopupMenu; +import javax.swing.text.BadLocationException; +import javax.swing.text.Document; +import java.awt.Point; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetAdapter; +import java.awt.dnd.DropTargetContext; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.event.ActionEvent; + +/** + * Created by IntelliJ IDEA. + * Author : Richer + * Version: 7.0.3 + * Date: 13-5-2 + * Time: 上午11:09 + */ +public class SQLEditPane extends RSyntaxTextArea { + public static final boolean REQUEST_DROPTARGET = true; + public static final boolean UNREQUEST_DROPTARGET = false; + + public SQLEditPane() { + this(REQUEST_DROPTARGET); + } + + public SQLEditPane(boolean requestDroptarget) { + super(); + + setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL); + + setAnimateBracketMatching(true); + setAntiAliasingEnabled(true); + setAutoIndentEnabled(true); + setCodeFoldingEnabled(true); + setUseSelectedTextColor(true); + setCloseCurlyBraces(true); + setBracketMatchingEnabled(true); + setAntiAliasingEnabled(true); + setCloseMarkupTags(true); + setLineWrap(true); + if (requestDroptarget) { + new SQLPaneDropTarget(this); + } + + } + + + private static class SQLPaneDropTarget extends DropTargetAdapter { + private TableProcedure sqlTable; + + public SQLPaneDropTarget(SQLEditPane sqlTextPane) { + new DropTarget(sqlTextPane, this); + } + + public void dragEnter(DropTargetDragEvent dtde) { + dtde.acceptDrag(dtde.getDropAction()); + } + + public void dragOver(DropTargetDragEvent dtde) { + dtde.acceptDrag(dtde.getDropAction()); + } + + public void drop(DropTargetDropEvent dtde) { + Point p = dtde.getLocation(); + DropTargetContext dtc = dtde.getDropTargetContext(); + SQLEditPane jTextPane = (SQLEditPane) dtc.getComponent(); + + try { + Transferable tr = dtde.getTransferable(); + DataFlavor[] flavors = tr.getTransferDataFlavors(); + for (int i = 0; i < flavors.length; i++) { + if (!tr.isDataFlavorSupported(flavors[i])) { + continue; + } + dtde.acceptDrop(dtde.getDropAction()); + Object userObj = tr.getTransferData(flavors[i]); + + if (userObj instanceof TableProcedure) { + this.sqlTable = (TableProcedure) userObj; + + JPopupMenu popupMenu = new JPopupMenu(); + popupMenu.add(new NameAction(jTextPane, sqlTable).createMenuItem()); + if (ComparatorUtils.equals(sqlTable.getType(), TableProcedure.PROCEDURE)) { + popupMenu.add(new CallAction(jTextPane, sqlTable).createMenuItem()); + } else { + popupMenu.add(new SelectAction(jTextPane, sqlTable).createMenuItem()); + } + + GUICoreUtils.showPopupMenu(popupMenu, jTextPane, + (int) p.getX() + 1, (int) p.getY() + 1); + } + + dtde.dropComplete(true); + } + + dtde.rejectDrop(); + } catch (Exception e) { + dtde.rejectDrop(); + } + } + + class NameAction extends UpdateAction { + private SQLEditPane sqlTextPane; + private TableProcedure sqlTable; + + public NameAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { + this.sqlTextPane = sqlTextPane; + this.sqlTable = sqlTable; + + this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name")); + this.setMnemonic('N'); + this.setSmallIcon(UIConstants.EMPTY_ICON); + } + + public void actionPerformed(ActionEvent evt) { + if (sqlTable != null) { + insertStringTo(sqlTextPane, sqlTable.toString()); + } + + } + } + + class SelectAction extends UpdateAction { + private SQLEditPane sqlTextPane; + private TableProcedure sqlTable; + + public SelectAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { + this.sqlTextPane = sqlTextPane; + this.sqlTable = sqlTable; + + this.setName("SELECT *"); + this.setMnemonic('s'); + this.setSmallIcon(UIConstants.EMPTY_ICON); + } + + public void actionPerformed(ActionEvent evt) { + //daniel: 添加参数 + insertStringTo(sqlTextPane, DataCoreUtils.createSelectSQL(sqlTable.getSchema(), sqlTable.getName(), sqlTable.getDialect())); + } + } + + class CallAction extends UpdateAction { + private SQLEditPane sqlTextPane; + private TableProcedure sqlTable; + + public CallAction(SQLEditPane sqlTextPane, TableProcedure sqlTable) { + this.sqlTextPane = sqlTextPane; + this.sqlTable = sqlTable; + + this.setName("CALL PROCEDURE "); + this.setMnemonic('s'); + this.setSmallIcon(UIConstants.EMPTY_ICON); + } + + public void actionPerformed(ActionEvent evt) { + StringBuffer sBuf = new StringBuffer(); + sBuf.append("{call "); + if (sqlTable != null) { + sBuf.append(sqlTable.toString()).append("()"); + } + sBuf.append('}'); + + insertStringTo(sqlTextPane, sBuf.toString()); + } + } + + private void insertStringTo(SQLEditPane sqlTextPane, String str) { + Document document = sqlTextPane.getDocument(); + try { + document.insertString(sqlTextPane.getCaretPosition(), str, null); + } catch (BadLocationException badLocationException) { + FineLoggerFactory.getLogger().error(badLocationException.getMessage(), badLocationException); + } + + sqlTextPane.requestFocus(); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java index 06bfd3cf74..f6b8f07d52 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java @@ -5,11 +5,11 @@ import com.fr.base.io.BaseBook; import com.fr.design.DesignerEnvManager; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.data.DesignTableDataManager; +import com.fr.design.file.filter.ClassFilter; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.JTemplate; -import com.fr.design.mainframe.JTemplateFactory; import com.fr.design.mainframe.JVirtualTemplate; import com.fr.design.module.DesignModuleFactory; import com.fr.design.ui.util.UIUtil; @@ -474,7 +474,7 @@ public class HistoryTemplateListCache implements CallbackEvent { String name = template.getEditingFILE().getName(); String pluginId = context.getID(); long start = System.currentTimeMillis(); - Set set = ClassHelper.getClassLoaders(baseBook); + Set set = ClassHelper.getClassLoadersByFilter(baseBook, ClassFilter.getInstance()); FineLoggerFactory.getLogger().info("{} find plugin classloader spend: {} ms", name, (System.currentTimeMillis() - start)); if (set != null) { for (ClassLoader classLoader : set) { diff --git a/designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java b/designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java new file mode 100644 index 0000000000..d89c546a98 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java @@ -0,0 +1,34 @@ +package com.fr.design.file.filter; + +import com.fr.stable.Filter; +import java.util.HashSet; +import java.util.Set; + +/** + * 过滤无需遍历的jdk class + * + * @author hades + * @version 10.0 + * Created by hades on 2021/1/7 + */ +public class ClassFilter implements Filter { + + + private static final Set FILTER_SET = new HashSet<>(); + + private static final Filter INSTANCE = new ClassFilter(); + + public static Filter getInstance() { + return INSTANCE; + } + + static { + FILTER_SET.add("java.awt.image.BufferedImage"); + FILTER_SET.add("sun.awt.AppContext"); + } + + @Override + public boolean accept(String s) { + return FILTER_SET.contains(s); + } +} diff --git a/designer-base/src/main/java/com/fr/design/fun/MobileParamUIProvider.java b/designer-base/src/main/java/com/fr/design/fun/MobileParamUIProvider.java index a8d8acc4e0..e76d24209d 100644 --- a/designer-base/src/main/java/com/fr/design/fun/MobileParamUIProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/MobileParamUIProvider.java @@ -26,7 +26,7 @@ public interface MobileParamUIProvider extends Mutable { * 移动端参数面板中扩展项的面板 * @return */ - Class> classForMobileParamAppearance(); + Class> classForMobileParamAppearance(); /** * 扩展项的名称描述 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 66a77e1c2d..8827d6a857 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -99,7 +99,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public enum PropertyMode { REPORT, // 报表 - REPORT_PARA, // 报表参数面板 + REPORT_PARA_WIDGET, //报表参数面板中的控件 + REPORT_PARA(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 报表参数面板 REPORT_FLOAT, // 报表悬浮元素 FORM(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 表单 FORM_REPORT, // 表单报表块 @@ -272,27 +273,27 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemMap = new LinkedHashMap<>(); // 有序map // 单元格元素 PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Element"), - "cellelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, + "cellelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); // 单元格属性 PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Attributes"), - "cellattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, + "cellattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); // 悬浮元素 PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Float_Element"), - "floatelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, + "floatelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT}); // 控件设置 PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings"), - "widgetsettings", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY}, - new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART}); + "widgetsettings", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY}, + new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART}); // 条件属性 PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Condition_Attributes"), - "conditionattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, + "conditionattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); // 超级链接 PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Hyperlink"), - "hyperlink", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, + "hyperlink", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT}); // 组件库 PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Library"), diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index f540cdbc64..4007be8a31 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -341,7 +341,7 @@ public abstract class JTemplate> public void refreshResource(FILE file) { try { - this.template = JTemplateFactory.asIOFile(file); + this.template = JTemplateFactory.asIOFile(file, this.suffix()); setTarget(this.template); // 先移除旧的。 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java index 678b9bf841..5e75cc64be 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java @@ -3,11 +3,12 @@ package com.fr.design.mainframe; import com.fr.base.io.BaseBook; import com.fr.file.FILE; import com.fr.stable.CoreConstants; -import com.fr.third.javax.annotation.Nonnull; -import com.fr.third.javax.annotation.Nullable; +import com.fr.stable.StringUtils; import java.util.ArrayList; import java.util.List; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public final class JTemplateFactory { private static final List> ALL_APP = new ArrayList>(); @@ -21,8 +22,7 @@ public final class JTemplateFactory { * @param file 包含了模板名称,类型以及内容的文件 * @return 设计器编辑的模板对象 */ - @Nullable - public static JTemplate createJTemplate(@Nonnull FILE file) { + public static JTemplate createJTemplate(@NotNull FILE file) { String fileName = file.getName(); int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT); @@ -43,15 +43,19 @@ public final class JTemplateFactory { } return null; } - - public static T asIOFile(@Nonnull FILE file) { - - String fileName = file.getName(); - int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT); + + @Nullable + public static T asIOFile(@NotNull FILE file, String fileNameOrSuffix) { + + if (StringUtils.isEmpty(fileNameOrSuffix)) { + return null; + } + + int indexOfLastDot = fileNameOrSuffix.lastIndexOf(CoreConstants.DOT); if (indexOfLastDot < 0) { return null; } - String fileExtension = fileName.substring(indexOfLastDot + 1); + String fileExtension = fileNameOrSuffix.substring(indexOfLastDot + 1); for (App app : ALL_APP) { String[] defaultAppExtensions = app.defaultExtensions(); for (String defaultAppExtension : defaultAppExtensions) { @@ -66,6 +70,12 @@ public final class JTemplateFactory { return null; } + @Nullable + public static T asIOFile(@NotNull FILE file) { + return asIOFile(file, file.getName()); + } + + /** * 注册app. diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java index d2a358c192..7f1d270af5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java @@ -12,6 +12,7 @@ import com.fr.form.ui.mobile.MobileParamStyle; import com.fr.general.ComparatorUtils; import com.fr.report.ExtraReportClassManager; import com.fr.report.fun.MobileParamStyleProvider; +import com.fr.report.mobile.EmptyMobileParamStyle; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; @@ -103,7 +104,10 @@ public class MobileParamSettingPane extends BasicPane { if (ComparatorUtils.equals(mobileParamStyle.disPlayName(), provider.displayName())) { String displayName = provider.displayName(); paramStyleList.setSelectedIndex(i); - map.get(displayName).populateBean(mobileParamStyle); + // 如果是兼容空类型 无须填充面板 + if (!(mobileParamStyle instanceof EmptyMobileParamStyle)) { + map.get(displayName).populateBean(mobileParamStyle); + } card.show(right, displayName); return; } diff --git a/designer-base/src/main/java/com/fr/design/present/dict/DictionaryPane.java b/designer-base/src/main/java/com/fr/design/present/dict/DictionaryPane.java index 3f42732f19..94e4b3f0ff 100644 --- a/designer-base/src/main/java/com/fr/design/present/dict/DictionaryPane.java +++ b/designer-base/src/main/java/com/fr/design/present/dict/DictionaryPane.java @@ -27,10 +27,6 @@ public class DictionaryPane extends UIComboBoxPane implements DataCr public DictionaryPane() { } - public DictionaryPane(boolean needTableDataChange) { - this.tableDataDictPane.setNeedTableDataChange(needTableDataChange); - } - @Override protected void initLayout() { this.setLayout(new BorderLayout(0, 4)); diff --git a/designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java b/designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java index 5eb6c28737..5ebd426593 100644 --- a/designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java +++ b/designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java @@ -64,7 +64,6 @@ public class TableDataDictPane extends FurtherBasicBeanPane private ItemListener itemListener; private UIObserverListener uiObserverListener; private FormulaEditor localFormulaEditor = new FormulaEditor(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_Formula")); - private boolean needTableDataChange = true; public TableDataDictPane() { initBasicComponets(); @@ -72,14 +71,6 @@ public class TableDataDictPane extends FurtherBasicBeanPane iniListener(); } - /** - * 设置为true后,一旦触发TableDataComboBox的itemChange,就会通过数据连接,更换当前数据字典的列名List - * @param needTableDataChange - */ - public void setNeedTableDataChange(boolean needTableDataChange) { - this.needTableDataChange = needTableDataChange; - } - public static void main(String[] args) { JFrame jf = new JFrame("test"); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -169,58 +160,38 @@ public class TableDataDictPane extends FurtherBasicBeanPane if (tableDataWrappe == null) { return; } - if (itemListener != null) { - itemListener.itemStateChanged(e); - localFormulaEditor.addChangeListener(event -> itemListener.itemStateChanged(e)); - } - if (isNeedTableDataChange()) { - changeColumnsName(); + List namelist = tableDataWrappe.calculateColumnNameList(); + String[] columnNames = null; + if (!namelist.isEmpty()) { + columnNames = namelist.toArray(ArrayUtils.EMPTY_STRING_ARRAY); + } else { + columnNames = new String[]{StringUtils.EMPTY}; } - } - - private void changeColumnsName() { - TableDataWrapper tableDataWrappe = this.tableDataNameComboBox.getSelectedItem(); - SwingWorker, Object> worker = new SwingWorker, Object>() { - @Override - protected List doInBackground() { - if (tableDataWrappe == null) { - return new ArrayList<>(); - } - return tableDataWrappe.calculateColumnNameList(); - } + // 实际值列名 + ColumnNameEditor actualColumnNameEditor = new ColumnNameEditor(columnNames); + actualColumnNameEditor.addItemListener(itemListener); + // 实际值列序号 + ColumnIndexEditor actualColumnIndexEditor = new ColumnIndexEditor(columnNames.length); + actualColumnIndexEditor.addItemListener(itemListener); + keyColumnPane.setEditors(new Editor[]{actualColumnNameEditor, actualColumnIndexEditor}, columnNames[0]); - @Override - protected void done() { - try { - List namelist = get(); - String[] columnNames = null; - if (!namelist.isEmpty()) { - columnNames = namelist.toArray(ArrayUtils.EMPTY_STRING_ARRAY); - } else { - columnNames = new String[]{StringUtils.EMPTY}; - } - // 实际值列名 - ColumnNameEditor actualColumnNameEditor = new ColumnNameEditor(columnNames); - actualColumnNameEditor.addItemListener(itemListener); - // 实际值列序号 - ColumnIndexEditor actualColumnIndexEditor = new ColumnIndexEditor(columnNames.length); - actualColumnIndexEditor.addItemListener(itemListener); - keyColumnPane.setEditors(new Editor[]{actualColumnNameEditor, actualColumnIndexEditor}, columnNames[0]); - - localFormulaEditor.setEnabled(true); - // 显示值列名 - ColumnNameEditor displayColumnNameEditor = new ColumnNameEditor(columnNames); - displayColumnNameEditor.addItemListener(itemListener); - // 显示值列序号 - ColumnIndexEditor displayColumnIndexEditor = new ColumnIndexEditor(columnNames.length); - displayColumnIndexEditor.addItemListener(itemListener); - valueDictPane.setEditors(new Editor[]{displayColumnNameEditor, displayColumnIndexEditor, localFormulaEditor}, columnNames[0]); - } catch (InterruptedException | ExecutionException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + FormulaEditor formulaEditor = new FormulaEditor(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_Formula")); + formulaEditor.setEnabled(true); + formulaEditor.addChangeListener(ee -> { + if (itemListener != null) { + itemListener.itemStateChanged(e); } - }; - worker.execute(); + }); + // 显示值列名 + ColumnNameEditor displayColumnNameEditor = new ColumnNameEditor(columnNames); + displayColumnNameEditor.addItemListener(itemListener); + // 显示值列序号 + ColumnIndexEditor displayColumnIndexEditor = new ColumnIndexEditor(columnNames.length); + displayColumnIndexEditor.addItemListener(itemListener); + valueDictPane.setEditors(new Editor[]{displayColumnNameEditor, displayColumnIndexEditor, formulaEditor}, columnNames[0]); + if (itemListener != null) { + itemListener.itemStateChanged(e); + } } @Override @@ -404,8 +375,4 @@ public class TableDataDictPane extends FurtherBasicBeanPane public void registerDSChangeListener() { tableDataNameComboBox.registerGlobalDSChangeListener(); } - - public boolean isNeedTableDataChange() { - return needTableDataChange; - } } diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_disabled.svg new file mode 100644 index 0000000000..f3936e1539 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_disabled.svg @@ -0,0 +1,8 @@ + + + icon_NewFolderIcon_disable + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_normal.svg new file mode 100644 index 0000000000..85f41e26a7 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/new_folder_normal.svg @@ -0,0 +1,8 @@ + + + icon_NewFolderIcon_normal + + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/refresh_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/refresh_normal.svg new file mode 100644 index 0000000000..4e3fd9c147 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/refresh_normal.svg @@ -0,0 +1,7 @@ + + + icon_刷新_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_disabled.svg new file mode 100644 index 0000000000..1245fbd4e3 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_disabled.svg @@ -0,0 +1,7 @@ + + + icon_删除_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_normal.svg new file mode 100644 index 0000000000..69a3011faf --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/remove_normal.svg @@ -0,0 +1,7 @@ + + + icon_删除_normal copy + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_disabled.svg new file mode 100644 index 0000000000..953e12eaa9 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_disabled.svg @@ -0,0 +1,7 @@ + + + icon_重命名_disable + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_normal.svg new file mode 100644 index 0000000000..a2c287789d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/rename_normal.svg @@ -0,0 +1,7 @@ + + + icon_重命名_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_disabled.svg new file mode 100644 index 0000000000..b88ee0998e --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_disabled.svg @@ -0,0 +1,7 @@ + + + icon_版本管理_disabled + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_normal.svg new file mode 100644 index 0000000000..ebfca43899 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/vcs_list_normal.svg @@ -0,0 +1,7 @@ + + + icon_版本管理_normal + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_disabled.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_disabled.svg new file mode 100644 index 0000000000..376d372d41 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_disabled.svg @@ -0,0 +1,7 @@ + + + icon_打开文件_disable + + + + \ No newline at end of file diff --git a/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_normal.svg b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_normal.svg new file mode 100644 index 0000000000..42ae6cbd3d --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/images/FileDealerPaneIcon/view_folder_normal.svg @@ -0,0 +1,7 @@ + + + icon_所在文件夹_normal + + + + \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPieValueLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPieValueLabelDetailPane.java index 707f6f5fd8..43f6da1e94 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPieValueLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPieValueLabelDetailPane.java @@ -13,6 +13,7 @@ import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.pie.style.VanChartPieValueLabelContentPane; import javax.swing.JPanel; +import java.awt.BorderLayout; import java.awt.Component; /** @@ -34,6 +35,14 @@ public class VanChartPieValueLabelDetailPane extends VanChartPlotLabelDetailPane return panel; } + protected JPanel createBorderAndBackgroundPane() { + JPanel jPanel = new JPanel(); + jPanel.setLayout(new BorderLayout(0, 10)); + jPanel.add(createLabelBorderPane(), BorderLayout.NORTH); + jPanel.add(createLabelBackgroundPane(), BorderLayout.CENTER); + return jPanel; + } + protected JPanel createLabelBorderPane() { VanChartBorderWithShapePane borderPane = new VanChartBorderWithShapePane() { @Override @@ -58,6 +67,18 @@ public class VanChartPieValueLabelDetailPane extends VanChartPlotLabelDetailPane protected JPanel createLabelBackgroundPane() { VanChartBackgroundWithOutImagePane backgroundPane = new VanChartBackgroundWithOutImagePane() { + + @Override + protected JPanel initContentPanel() { + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; + double[] columnSize = {f, e}; + double[] rowSize = {p, p, p}; + return TableLayout4VanChartHelper.createGapTableLayoutPane(getPaneComponents(), rowSize, columnSize); + } + + @Override protected Component[][] getPaneComponents() { return new Component[][]{ new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Utils_Background")), typeComboBox}, diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java index 624e6c879e..0467fe3f5e 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java @@ -23,6 +23,7 @@ import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutI import com.fr.van.chart.designer.component.border.VanChartBorderWithShapePane; import com.fr.van.chart.designer.style.VanChartStylePane; +import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; @@ -242,6 +243,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { if (plot.isSupportLeadLine()) { tractionLine = new UIToggleButton(Toolkit.i18nText("Fine-Design_Chart_Show_Guideline")); tractionLinePane = TableLayout4VanChartHelper.createGapTableLayoutPane("", tractionLine); + tractionLinePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); panel.add(tractionLinePane, BorderLayout.SOUTH); initPositionListener(); } else if (PlotFactory.plotAutoAdjustLabelPosition(plot)) { @@ -350,7 +352,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } private void checkPosition() { - tractionLine.setSelected(position.getSelectedItem() == Constants.OUTSIDE); + tractionLine.setSelected(position.getSelectedItem() != null && position.getSelectedItem() == Constants.OUTSIDE); checkPositionEnabled(); } @@ -364,7 +366,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { } private void checkPositionEnabled() { - tractionLinePane.setVisible(position.getSelectedItem() == Constants.OUTSIDE); + tractionLinePane.setVisible(position.getSelectedItem() != null && position.getSelectedItem() == Constants.OUTSIDE); } protected void checkPane() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java index db98069094..a3a34a0619 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/WidgetBasicPropertyPaneFactory.java @@ -1,21 +1,37 @@ package com.fr.design.mainframe.widget.ui; import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XWParameterLayout; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.mainframe.EastRegionContainerPane; +import com.fr.design.mainframe.JForm; /** * Created by kerry on 2017/9/30. */ public class WidgetBasicPropertyPaneFactory { - public static FormBasicPropertyPane createBasicPropertyPane(XCreator xCreator){ - if(xCreator.supportSetVisible() && xCreator.supportSetEnable()){ + public static FormBasicPropertyPane createBasicPropertyPane(XCreator xCreator) { + freshPropertyMode(xCreator); + if (xCreator.supportSetVisible() && xCreator.supportSetEnable()) { return new FormBasicWidgetPropertyPane(); } - if(xCreator.supportSetVisible()){ + if (xCreator.supportSetVisible()) { return new BasicSetVisiblePropertyPane(); - }else{ + } else { return new FormBasicPropertyPane(); } } + + private static void freshPropertyMode(XCreator xCreator) { + if (!(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() instanceof JForm)) { + if (xCreator instanceof XWParameterLayout) { + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA); + } else { + EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA_WIDGET); + } + } + } + } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java index 022afc6105..74819ae452 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java @@ -28,8 +28,7 @@ public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane