From b5a7103d22ddb908582bbb8c353faeebe506d846 Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Dec 2018 11:10:24 +0800 Subject: [PATCH 01/18] =?UTF-8?q?REPORT-12850=2010.0mac=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=3D>=E5=85=AC=E5=BC=8F=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E7=AE=80=E5=8D=95=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/formula/FormulaPane.java | 71 +++++++++++-------- .../FormulaPaneWhenReserveFormula.java | 2 +- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index c2c69299d1..e994bc1053 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -63,21 +63,21 @@ import java.util.Locale; */ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { - protected VariableTreeAndDescriptionArea variableTreeAndDescriptionArea; - protected RSyntaxTextArea formulaTextArea; - protected UITextField keyWordTextField = new UITextField(18); - protected int currentPosition = 0; - protected int beginPosition = 0; - protected int insertPosition = 0; - protected JList tipsList; + private VariableTreeAndDescriptionArea variableTreeAndDescriptionArea; + private RSyntaxTextArea formulaTextArea; + private UITextField keyWordTextField = new UITextField(18); + private int currentPosition = 0; + private int beginPosition = 0; + private int insertPosition = 0; + private JList tipsList; protected DefaultListModel listModel = new DefaultListModel(); - protected int ifHasBeenWriten = 0; - protected DefaultListModel functionTypeListModel = new DefaultListModel(); - protected QuickList functionTypeList; - protected DefaultListModel functionNameModel; - protected JList functionNameList; + private int ifHasBeenWriten = 0; + private DefaultListModel functionTypeListModel = new DefaultListModel(); + private QuickList functionTypeList; + private DefaultListModel functionNameModel; + private JList functionNameList; - public FormulaPane() { + FormulaPane() { initComponents(); } @@ -184,6 +184,18 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { protected void initComponents() { this.setLayout(new BorderLayout(4, 4)); + + initTextPane(); + initTipsPane(); + initVariableTreeAndDescriptionArea(); + } + + private void initVariableTreeAndDescriptionArea() { + variableTreeAndDescriptionArea = new VariableTreeAndDescriptionArea(); + this.add(variableTreeAndDescriptionArea, BorderLayout.SOUTH); + } + + private void initTextPane() { // text JPanel textPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.add(textPane, BorderLayout.CENTER); @@ -199,7 +211,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { textPane.add(formulaTextAreaScrollPane, BorderLayout.CENTER); textPane.add(checkBoxandbuttonPane, BorderLayout.SOUTH); - initTipsPane(); UIButton checkValidButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Check_Valid")); checkValidButton.addActionListener(checkValidActionListener); @@ -209,8 +220,6 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { checkBoxandbuttonPane.add(checkBoxPane, BorderLayout.WEST); checkBoxandbuttonPane.add(checkValidButton, BorderLayout.EAST); extendCheckBoxPane(checkBoxPane); - variableTreeAndDescriptionArea = new VariableTreeAndDescriptionArea(); - this.add(variableTreeAndDescriptionArea, BorderLayout.SOUTH); } @@ -218,7 +227,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } - protected void configFormulaArea() { + private void configFormulaArea() { formulaTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_FORMULA); formulaTextArea.setAnimateBracketMatching(true); formulaTextArea.setAntiAliasingEnabled(true); @@ -313,7 +322,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } } - protected void fixFunctionNameList() { + private void fixFunctionNameList() { if (tipsList.getSelectedValue() != null) { int signOfContinue = 1; int indexOfFunction = 0; @@ -346,7 +355,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } - protected int getBeginPosition() { + private int getBeginPosition() { int i = currentPosition; String textArea = formulaTextArea.getText(); for (; i > 0; i--) { @@ -361,7 +370,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { return i; } - protected void firstStepToFindTips(int theBeginPosition) { + private void firstStepToFindTips(int theBeginPosition) { String textArea = formulaTextArea.getText(); if (currentPosition > 0 && theBeginPosition < currentPosition) { @@ -443,7 +452,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { /** * Apply text. */ - public void applyText(String text) { + private void applyText(String text) { if (text == null || text.length() <= 0) { return; } @@ -541,7 +550,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { } // check valid - protected ActionListener checkValidActionListener = new ActionListener() { + private ActionListener checkValidActionListener = new ActionListener() { public void actionPerformed(ActionEvent evt) { // Execute Formula default cell element. @@ -579,7 +588,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private JTree variablesTree; private UITextArea descriptionTextArea; - public VariableTreeAndDescriptionArea() { + VariableTreeAndDescriptionArea() { this.initComponents(); } @@ -802,13 +811,15 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private void initComponents() { this.setLayout(new BorderLayout(4, 4)); - // Function + initVariablesTree(); + initFunctionPane(); + } + + private void initFunctionPane() { JPanel functionPane = new JPanel(new BorderLayout(4, 4)); this.add(functionPane, BorderLayout.WEST); initFunctionTypeList(functionPane); initFunctionNameList(functionPane); - initVariablesTree(); - // 选择: functionTypeList.setSelectedIndex(0); } @@ -959,7 +970,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private Icon icon; private String[] subNodes = new String[0]; - public TextFolderUserObject(String text, Icon icon, String[] subNodes) { + TextFolderUserObject(String text, Icon icon, String[] subNodes) { this.text = text; this.icon = icon; this.subNodes = subNodes; @@ -986,11 +997,11 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { public static class TextUserObject { - public TextUserObject(String text) { + TextUserObject(String text) { this(text, text); } - public TextUserObject(String text, String displayText) { + TextUserObject(String text, String displayText) { this.text = text; this.displayText = displayText; } @@ -999,7 +1010,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { return this.text; } - public String getDisplayText() { + String getDisplayText() { return this.displayText; } diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java index e08f7e3b40..d689c54df9 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java @@ -18,7 +18,7 @@ public class FormulaPaneWhenReserveFormula extends FormulaPane { private UICheckBox reserveCheckBox4Result; private UICheckBox reserveCheckBox4Write; - public FormulaPaneWhenReserveFormula() { + FormulaPaneWhenReserveFormula() { super(); } From b9b04e753d832a343f4dfe5bde559997cb30118e Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Dec 2018 11:11:14 +0800 Subject: [PATCH 02/18] =?UTF-8?q?REPORT-12850=2010.0mac=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FunctionConstants.java | 64 +++++++++++-------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 4595b04ac0..0abc2f46e7 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -13,6 +13,7 @@ import com.fr.function.SUM; import com.fr.function.TIME; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.ExtraClassManager; import com.fr.stable.EncodeConstants; import com.fr.stable.OperatingSystem; @@ -225,39 +226,48 @@ public abstract class FunctionConstants { String pkgName = "com.fr.function"; Class iface = Function.class; ClassLoader classloader = iface.getClassLoader(); - URL url = classloader.getResource(pkgName.replace('.', '/')); - String classFilePath = url.getFile(); - - /* - * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 - * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 - */ + Enumeration urlEnumeration = null; try { - classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); - } catch (UnsupportedEncodingException e1) { - FRContext.getLogger().error(e1.getMessage(), e1); + urlEnumeration = classloader.getResources(pkgName.replace('.', '/')); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage()); } - FRContext.getLogger().info("ClassFilePath:" + classFilePath); - /* - * alex:如果是jar包中的class文件 - * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function - */ - for (String fileName : findClassNamesUnderFilePath(classFilePath)) { + while (urlEnumeration.hasMoreElements()) { + URL url = urlEnumeration.nextElement(); + String classFilePath = url.getFile(); + + /* + * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 + * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 + */ try { - Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); - if (StableUtils.classInstanceOf(cls, iface)) { - Function inst; - inst = (Function)cls.newInstance(); - for (int fi = 0; fi < EMBFUNCTIONS.length; fi++) { - if (EMBFUNCTIONS[fi].test(inst)) { - break; + classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); + } catch (UnsupportedEncodingException e1) { + FRContext.getLogger().error(e1.getMessage(), e1); + } + FRContext.getLogger().info("ClassFilePath:" + classFilePath); + /* + * alex:如果是jar包中的class文件 + * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function + */ + for (String fileName : findClassNamesUnderFilePath(classFilePath)) { + try { + Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); + System.out.println(pkgName + "." + fileName.substring(0, fileName.length() - 6)); + if (StableUtils.classInstanceOf(cls, iface)) { + Function inst; + inst = (Function)cls.newInstance(); + for (int fi = 0; fi < EMBFUNCTIONS.length; fi++) { + if (EMBFUNCTIONS[fi].test(inst)) { + break; + } } + } - + } catch (ClassNotFoundException e) { + } catch (InstantiationException e) { + } catch (IllegalAccessException e) { } - } catch (ClassNotFoundException e) { - } catch (InstantiationException e) { - } catch (IllegalAccessException e) { } } } From 4dccaabbbfc8a8c55cb996358a04c4d2b036d783 Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 7 Dec 2018 11:13:53 +0800 Subject: [PATCH 03/18] =?UTF-8?q?REPORT-13280=20=E3=80=90=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8=E3=80=91=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E5=90=8E=EF=BC=8C=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=8D=A1=E6=AD=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/CellElementPropertyPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java index 42d4f1d397..7324300eba 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/CellElementPropertyPane.java @@ -67,7 +67,7 @@ public class CellElementPropertyPane extends DockingView { } - public synchronized static CellElementPropertyPane getInstance() { + public static CellElementPropertyPane getInstance() { if (singleton == null) { synchronized (CellElementPropertyPane.class) { if (singleton == null) { From b8455e82a40a05e5030fc9f165ae0954ccc50f0d Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Dec 2018 13:53:04 +0800 Subject: [PATCH 04/18] =?UTF-8?q?REPORT-12850=2010.0mac=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=3D>FunctionConstants=20=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/formula/FunctionConstants.java | 315 ++++++++++-------- .../design/formula/FunctionConstantsTest.java | 40 +++ 2 files changed, 208 insertions(+), 147 deletions(-) create mode 100644 designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java index 0abc2f46e7..750df1bad1 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionConstants.java @@ -35,13 +35,75 @@ import java.util.zip.ZipFile; import javax.swing.DefaultListModel; -public abstract class FunctionConstants { - +public final class FunctionConstants { + + public static FunctionGroup PLUGIN = getPluginFunctionGroup(); + public static FunctionGroup CUSTOM = getCustomFunctionGroup(); + static NameAndFunctionList COMMON = getCommonFunctionList(); + static NameAndTypeAndFunctionList[] EMBFUNCTIONS = getEmbededFunctionListArray(); + public static FunctionGroup ALL = getAllFunctionGroup(); + + static { + loadEmbededFunctions(); + } + + /** + * Don't let anyone instantiate this class. + */ + private FunctionConstants() {} + + private static void loadEmbededFunctions() { + String pkgName = "com.fr.function"; + Class iface = Function.class; + ClassLoader classloader = iface.getClassLoader(); + Enumeration urlEnumeration = null; + try { + urlEnumeration = classloader.getResources(pkgName.replace('.', '/')); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage()); + return; + } + while (urlEnumeration.hasMoreElements()) { + URL url = urlEnumeration.nextElement(); + String classFilePath = url.getFile(); + + /* + * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 + * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 + */ + try { + classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); + } catch (UnsupportedEncodingException e1) { + FRContext.getLogger().error(e1.getMessage(), e1); + } + FRContext.getLogger().info("ClassFilePath:" + classFilePath); + /* + * alex:如果是jar包中的class文件 + * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function + */ + for (String fileName : findClassNamesUnderFilePath(classFilePath)) { + try { + Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); + if (StableUtils.classInstanceOf(cls, iface)) { + Function inst; + inst = (Function)cls.newInstance(); + for (NameAndTypeAndFunctionList EMBFUNCTION : EMBFUNCTIONS) { + if (EMBFUNCTION.test(inst)) { + break; + } + } + } + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ignore) { + } + } + } + } + /** * 将函数分组插件中的函数添加到对应的列表中 * @param listModel */ - public static void addFunctionGroupFromPlugins(DefaultListModel listModel){ + static void addFunctionGroupFromPlugins(DefaultListModel listModel){ //hugh:自定义函数分组 Set containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); if(!containers.isEmpty()){ @@ -75,107 +137,15 @@ public abstract class FunctionConstants { } }; } - - public static FunctionGroup PLUGIN = new FunctionGroup() { - @Override - public String getGroupName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Formula_Plugin"); - } - - @Override - public NameAndDescription[] getDescriptions() { - FunctionDef[] fs = ExtraClassManager.getInstance().getFunctionDef(); - int count = fs.length; - FunctionDefNAD[] nads = new FunctionDefNAD[count]; - for (int i = 0; i < count; i ++) { - nads[i] = new FunctionDefNAD(fs[i]); - } - return nads; - } - }; - - public static FunctionGroup CUSTOM = new FunctionGroup() { - @Override - public String getGroupName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Custom_Function"); - } - - @Override - public NameAndDescription[] getDescriptions() { - FunctionConfig funtionManager = FunctionConfig.getInstance(); - if (funtionManager != null) { - int functionDefCount = funtionManager.getFunctionDefCount(); - - FunctionDefNAD[] nads = new FunctionDefNAD[functionDefCount]; - for (int i = 0; i < functionDefCount; i++) { - nads[i] = new FunctionDefNAD(funtionManager.getFunctionDef(i)); - } - - return nads; - } - - return new NameAndDescription[0]; - } - }; - - public static NameAndFunctionList COMMON = new NameAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Most_Recently_Used"), new Function[] { - new SUM(), new COUNT(), new AVERAGE(), new CHAR(), new DATE(), new MAX(), new MIN(), new TIME(), new RANGE() - }); - - public static NameAndTypeAndFunctionList[] EMBFUNCTIONS = new NameAndTypeAndFunctionList[] { - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Math_&_Trig"), Function.MATH), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Text"), Function.TEXT), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Date_&_Time"), Function.DATETIME), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Logical"), Function.LOGIC), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Array"), Function.ARRAY), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Report"), Function.REPORT), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Other"), Function.OTHER), - new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_Type_Hierarchy"), Function.HA) - }; - - public static FunctionGroup ALL = new FunctionGroup() { - @Override - public String getGroupName() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_All"); - } - - @Override - public NameAndDescription[] getDescriptions() { - List all = new ArrayList(); - for (int i = 0; i < EMBFUNCTIONS.length; i++) { - all.addAll(Arrays.asList(EMBFUNCTIONS[i].getDescriptions())); - } - Collections.addAll(all, PLUGIN.getDescriptions()); - Collections.addAll(all, CUSTOM.getDescriptions()); - //hugh:自定义函数分组 - Set containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); - if(!containers.isEmpty()){ - for(Mutable container : containers){ - Collections.addAll(all,createFunctionGroup(((FunctionDefContainer)container)).getDescriptions()); - } - } - java.util.Collections.sort(all, NameAndDescriptionComparator); - - return all.toArray(new NameAndDescription[all.size()]); - } - }; - - private static Comparator NameAndDescriptionComparator = new Comparator() { - @Override - public int compare(NameAndDescription o1, NameAndDescription o2) { - return ComparatorUtils.compare(o1.getName(), o2.getName()); - } - }; - private static String[] findClassNamesUnderFilePath(String filePath) { java.util.List classNameList = new ArrayList(); /* * alex:如果是jar包中的class文件 * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function */ - if (filePath.indexOf("!/") >= 0) { + if (filePath.contains("!/")) { String[] arr = filePath.split("!/"); String jarPath = arr[0].substring(6); // alex:substring(6)去掉前面的file:/这六个字符 String classPath = arr[1]; @@ -198,7 +168,7 @@ public abstract class FunctionConstants { } String entryName = entry.getName(); - if (entryName.indexOf(classPath) < 0 || !entryName.endsWith(".class")) { + if (!entryName.contains(classPath) || !entryName.endsWith(".class")) { continue; } @@ -209,66 +179,117 @@ public abstract class FunctionConstants { } } else { File dir = new File(filePath); - - for (File f : dir.listFiles()) { - String fileName = f.getName(); - if (fileName.endsWith(".class")) { - classNameList.add(fileName); + File[] files = dir.listFiles(); + if (files != null) { + for (File f : files) { + String fileName = f.getName(); + if (fileName.endsWith(".class")) { + classNameList.add(fileName); + } } } } - return classNameList.toArray(new String[classNameList.size()]); + return classNameList.toArray(new String[0]); } - - // alex:读取com.fr.script.function包下面所有的Function类 - static { - String pkgName = "com.fr.function"; - Class iface = Function.class; - ClassLoader classloader = iface.getClassLoader(); - Enumeration urlEnumeration = null; - try { - urlEnumeration = classloader.getResources(pkgName.replace('.', '/')); - } catch (IOException e) { - FineLoggerFactory.getLogger().error(e.getMessage()); - } - while (urlEnumeration.hasMoreElements()) { - URL url = urlEnumeration.nextElement(); - String classFilePath = url.getFile(); - /* - * alex:url.getFile获取的地址中,如果有空格或中文会被URLEncoder.encode处理 - * 会变成%20这种%打头的东西,但是new File的时候%20是无法解析成空格,所以在此需要做URLDecoder.decode处理 - */ - try { - classFilePath = URLDecoder.decode(classFilePath, EncodeConstants.ENCODING_UTF_8); - } catch (UnsupportedEncodingException e1) { - FRContext.getLogger().error(e1.getMessage(), e1); + private static FunctionGroup getPluginFunctionGroup() { + return new FunctionGroup() { + @Override + public String getGroupName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Formula_Plugin"); } - FRContext.getLogger().info("ClassFilePath:" + classFilePath); - /* - * alex:如果是jar包中的class文件 - * file:/D:/opt/FineReport6.5/WebReport/WEB-INF/lib/fr-server-6.5.jar!/com/fr/rpt/script/function - */ - for (String fileName : findClassNamesUnderFilePath(classFilePath)) { - try { - Class cls = Class.forName(pkgName + "." + fileName.substring(0, fileName.length() - 6)); - System.out.println(pkgName + "." + fileName.substring(0, fileName.length() - 6)); - if (StableUtils.classInstanceOf(cls, iface)) { - Function inst; - inst = (Function)cls.newInstance(); - for (int fi = 0; fi < EMBFUNCTIONS.length; fi++) { - if (EMBFUNCTIONS[fi].test(inst)) { - break; - } - } + @Override + public NameAndDescription[] getDescriptions() { + FunctionDef[] fs = ExtraClassManager.getInstance().getFunctionDef(); + int count = fs.length; + FunctionDefNAD[] nads = new FunctionDefNAD[count]; + for (int i = 0; i < count; i ++) { + nads[i] = new FunctionDefNAD(fs[i]); + } + return nads; + } + }; + } + + private static FunctionGroup getCustomFunctionGroup() { + return new FunctionGroup() { + @Override + public String getGroupName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Custom_Function"); + } + + @Override + public NameAndDescription[] getDescriptions() { + FunctionConfig funtionManager = FunctionConfig.getInstance(); + if (funtionManager != null) { + int functionDefCount = funtionManager.getFunctionDefCount(); + + FunctionDefNAD[] nads = new FunctionDefNAD[functionDefCount]; + for (int i = 0; i < functionDefCount; i++) { + nads[i] = new FunctionDefNAD(funtionManager.getFunctionDef(i)); + } + + return nads; + } + + return new NameAndDescription[0]; + } + }; + } + + private static NameAndFunctionList getCommonFunctionList() { + return new NameAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Most_Recently_Used"), new Function[] { + new SUM(), new COUNT(), new AVERAGE(), new CHAR(), new DATE(), new MAX(), new MIN(), new TIME(), new RANGE() + }); + } + + private static NameAndTypeAndFunctionList[] getEmbededFunctionListArray() { + return new NameAndTypeAndFunctionList[] { + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Math_&_Trig"), Function.MATH), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Text"), Function.TEXT), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Date_&_Time"), Function.DATETIME), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Logical"), Function.LOGIC), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Array"), Function.ARRAY), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Report"), Function.REPORT), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Other"), Function.OTHER), + new NameAndTypeAndFunctionList(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Function_Type_Hierarchy"), Function.HA) + }; + } + + private static FunctionGroup getAllFunctionGroup() { + return new FunctionGroup() { + @Override + public String getGroupName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_All"); + } + + @Override + public NameAndDescription[] getDescriptions() { + List all = new ArrayList(); + for (int i = 0; i < EMBFUNCTIONS.length; i++) { + all.addAll(Arrays.asList(EMBFUNCTIONS[i].getDescriptions())); + } + Collections.addAll(all, PLUGIN.getDescriptions()); + Collections.addAll(all, CUSTOM.getDescriptions()); + //hugh:自定义函数分组 + Set containers = ExtraClassManager.getInstance().getArray(FunctionDefContainer.MARK_STRING); + if(!containers.isEmpty()){ + for(Mutable container : containers){ + Collections.addAll(all,createFunctionGroup(((FunctionDefContainer)container)).getDescriptions()); } - } catch (ClassNotFoundException e) { - } catch (InstantiationException e) { - } catch (IllegalAccessException e) { } + + Collections.sort(all, new Comparator() { + @Override + public int compare(NameAndDescription o1, NameAndDescription o2) { + return ComparatorUtils.compare(o1.getName(), o2.getName()); + } + }); + + return all.toArray(new NameAndDescription[0]); } - } + }; } } diff --git a/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java b/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java new file mode 100644 index 0000000000..33cfd577da --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/formula/FunctionConstantsTest.java @@ -0,0 +1,40 @@ +package com.fr.design.formula; + +import org.junit.Test; + +import static junit.framework.Assert.fail; +import static junit.framework.TestCase.assertEquals; +import static junit.framework.TestCase.assertTrue; + +/** + * Created by plough on 2018/12/7. + */ +public class FunctionConstantsTest { + @Test + public void testNewInstanceFail() throws Exception { + try { + FunctionConstants.class.newInstance(); + fail("Not allowed to instantiate FunctionConstants!"); + } catch (IllegalAccessException e) { + assertTrue(true); + } + } + + @Test + public void testEmbedFuntionsAfterStaticInit() { + NameAndTypeAndFunctionList[] embFunctionLists = FunctionConstants.EMBFUNCTIONS; + // 一共有 8 个分类 + assertEquals(8, embFunctionLists.length); + for (NameAndTypeAndFunctionList embFunctionsList : embFunctionLists) { + // 每个分类下都有函数 + NameAndDescription[] nameAndDescriptions = embFunctionsList.getDescriptions(); + assertTrue(nameAndDescriptions.length > 0); + } + } + + @Test + public void testCommonFuntionsAfterStaticInit() { + NameAndFunctionList commonFunctionList = FunctionConstants.COMMON; + assertEquals(9, commonFunctionList.getDescriptions().length); + } +} From 8559c8ee12f8d9b86963d53b124899f4792512d4 Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 7 Dec 2018 15:14:19 +0800 Subject: [PATCH 05/18] =?UTF-8?q?REPORT-13018=20=E5=A4=A7=E8=B5=9B?= =?UTF-8?q?=E5=90=8E=E7=BB=AD=E5=BC=80=E4=B8=A4=E4=B8=AA=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20,=E5=8F=B3=E9=94=AE=E8=8F=9C=E5=8D=95=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=90=8C=E6=AD=A510.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fun/RightSelectionHandlerProvider.java | 55 +++++++++++++++++++ ...AbstractRightSelectionHandlerProvider.java | 45 +++++++++++++++ .../com/fr/design/mainframe/JTemplate.java | 2 +- .../form/parameter/FormParaDesigner.java | 8 ++- .../com/fr/design/mainframe/FormDesigner.java | 29 ++++++++-- .../java/com/fr/design/mainframe/JForm.java | 2 +- .../cell/clipboard/CellElementsClip.java | 48 ++++++++++++++-- .../fr/design/mainframe/ElementCasePane.java | 2 +- .../java/com/fr/grid/selection/Selection.java | 27 +++++++-- 9 files changed, 199 insertions(+), 19 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java create mode 100644 designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java diff --git a/designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java b/designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java new file mode 100644 index 0000000000..5e7d414236 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/RightSelectionHandlerProvider.java @@ -0,0 +1,55 @@ +package com.fr.design.fun; + +import com.fr.design.actions.UpdateAction; +import com.fr.design.designer.TargetComponent; +import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.mainframe.BaseFormDesigner; +import com.fr.design.selection.SelectableElement; +import com.fr.stable.fun.mark.Mutable; + +import java.util.List; + +/** + * 设计器右键菜单接口 + */ +public interface RightSelectionHandlerProvider extends Mutable { + + int CURRENT_LEVEL = 1; + + String XML_TAG = "RightSelectionHandlerProvider"; + + + /** + * 对单元格或者悬浮元素的右键菜单项进行增删改 + * + * @param ePane 选择的元素 + * @param popupMenu 右键主菜单 + */ + void dmlMenu(TargetComponent ePane, UIPopupMenu popupMenu); + + + /** + * 当前实现是否可以作用于当前元素 + * + * @param selectableElement 当前选中元素分为CellSelection和FloatSelection(单元格和悬浮元素) + * @return + */ + boolean accept(SelectableElement selectableElement); + + + /** + * 对表单,参数面板内置的右键选项进行增删改处理 + * + * @param actions 默认的action集合 注意:主体代码要求这边的action必须是UndoableAction 的子类而非updateAction + */ + void dmlUpdateActions(BaseFormDesigner formDesigner, List actions); + + /** + * 当前实现是否可以作用于当前元素 + * + * @param formDesigner 当前选中元素分为表单编辑器和参数面板(表单组件元素以及各种控件) + * @return + */ + boolean accept(BaseFormDesigner formDesigner); + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java new file mode 100644 index 0000000000..6ec8282ed8 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractRightSelectionHandlerProvider.java @@ -0,0 +1,45 @@ +package com.fr.design.fun.impl; + +import com.fr.design.actions.UpdateAction; +import com.fr.design.designer.TargetComponent; +import com.fr.design.fun.RightSelectionHandlerProvider; +import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.mainframe.BaseFormDesigner; +import com.fr.design.selection.SelectableElement; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +import java.util.List; + +@API(level = RightSelectionHandlerProvider.CURRENT_LEVEL) +public abstract class AbstractRightSelectionHandlerProvider extends AbstractProvider implements RightSelectionHandlerProvider { + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } + + @Override + public void dmlUpdateActions(BaseFormDesigner formDesigner, List actions) { + + } + + @Override + public boolean accept(BaseFormDesigner formDesigner) { + return false; + } + + @Override + public void dmlMenu(TargetComponent ePane, UIPopupMenu popupMenu) { + + } + + @Override + public boolean accept(SelectableElement selectableElement) { + return false; + } +} \ No newline at end of file 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 c2557a5b9c..fa9b181a57 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 @@ -419,7 +419,7 @@ public abstract class JTemplate> fireSuperTargetModified(); } - protected boolean accept(Object o) { + public boolean accept(Object o) { return true; } diff --git a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java index 0895d4c1dc..62cea356d6 100644 --- a/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java +++ b/designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java @@ -11,6 +11,7 @@ import java.awt.Image; import java.awt.Insets; import java.awt.Rectangle; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import javax.swing.BorderFactory; @@ -324,10 +325,11 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP */ public UpdateAction[] getActions() { if (designerActions == null) { - designerActions = new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), - new FormDeleteAction(this)}; + designerActions = new ArrayList(Arrays.asList(new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), + new FormDeleteAction(this)})); + dmlActions(designerActions); } - return designerActions; + return designerActions.toArray(new UpdateAction[designerActions.size()]); } private boolean searchQueryCreators(XLayoutContainer rootContainer) { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index b313bc1433..fd0de4b257 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1,9 +1,11 @@ package com.fr.design.mainframe; +import com.fr.base.FRContext; import com.fr.base.Parameter; import com.fr.base.ScreenResolution; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.TargetComponent; @@ -39,6 +41,7 @@ import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.util.XCreatorConstants; +import com.fr.design.fun.RightSelectionHandlerProvider; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.menu.MenuDef; import com.fr.design.menu.ShortCut; @@ -89,6 +92,7 @@ import java.lang.reflect.Proxy; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Set; /** * 设计界面组件。该组件是界面设计工具的核心,主要负责的是被设计界面的显示,界面设计操作状态的 显示,编辑状态的显示等等。 @@ -132,7 +136,7 @@ public class FormDesigner extends TargetComponent
implements TreeSelection private int resolution = ScreenResolution.getScreenResolution(); // 编辑状态的事件表 private CreatorEventListenerTable edit; - protected UpdateAction[] designerActions; + protected List designerActions; private FormDesignerModeForSpecial desigerMode; private Action switchAction; private FormElementCaseContainerProvider elementCaseContainer; @@ -1180,11 +1184,28 @@ public class FormDesigner extends TargetComponent implements TreeSelection */ public UpdateAction[] getActions() { if (designerActions == null) { - designerActions = new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), + designerActions = new ArrayList(Arrays.asList(new UpdateAction[]{new CutAction(this), new CopyAction(this), new PasteAction(this), new FormDeleteAction(this), new MoveToTopAction(this), new MoveToBottomAction(this), - new MoveUpAction(this), new MoveDownAction(this)}; + new MoveUpAction(this), new MoveDownAction(this)})); + dmlActions(designerActions); + } + return designerActions.toArray(new UpdateAction[designerActions.size()]); + } + /** + * 扩展菜单项 + * @param actions + */ + public void dmlActions(List actions) { + try { + Set selectionHandlerProviders = ExtraDesignClassManager.getInstance().getArray(RightSelectionHandlerProvider.XML_TAG); + for (RightSelectionHandlerProvider handler : selectionHandlerProviders) { + if (handler.accept(this)) { + handler.dmlUpdateActions(this,actions); + } + } + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); } - return designerActions; } // 当前选中控件可以上移一层吗? diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index ec8020fd21..cc3ba96f5c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -160,7 +160,7 @@ public class JForm extends JTemplate implements BaseJForm { } @Override - protected boolean accept(Object o) { + public boolean accept(Object o) { return !(o instanceof FloatElementsProvider); } diff --git a/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java b/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java index 2579e37c2e..84edad71fb 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java +++ b/designer-realize/src/main/java/com/fr/design/cell/clipboard/CellElementsClip.java @@ -3,9 +3,6 @@ */ package com.fr.design.cell.clipboard; -import java.util.Arrays; -import java.util.Iterator; - import com.fr.base.FRContext; import com.fr.grid.selection.CellSelection; import com.fr.report.cell.CellElement; @@ -15,6 +12,9 @@ import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.StringUtils; import com.fr.stable.unit.FU; +import java.util.Arrays; +import java.util.Iterator; + /** * The clip of CellElement. */ @@ -39,7 +39,47 @@ public class CellElementsClip implements Cloneable, java.io.Serializable { this.clips = clips; } - public String compateExcelPaste() { + public int getColumnSpan() { + return columnSpan; + } + + public void setColumnSpan(int columnSpan) { + this.columnSpan = columnSpan; + } + + public int getRowSpan() { + return rowSpan; + } + + public void setRowSpan(int rowSpan) { + this.rowSpan = rowSpan; + } + + public FU[] getColumnWidth() { + return columnWidth; + } + + public void setColumnWidth(FU[] columnWidth) { + this.columnWidth = columnWidth; + } + + public FU[] getRowHeight() { + return rowHeight; + } + + public void setRowHeight(FU[] rowHeight) { + this.rowHeight = rowHeight; + } + + public TemplateCellElement[] getClips() { + return clips; + } + + public void setClips(TemplateCellElement[] clips) { + this.clips = clips; + } + + public String compateExcelPaste() { Arrays.sort(this.clips, CellElementComparator.getRowFirstComparator()); // 排序 diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java index c47b142c1c..4112ac6c44 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java @@ -663,7 +663,7 @@ public abstract class ElementCasePane extends Tar } } - private Object getClipObject() { + public Object getClipObject() { // 需要检查是否可以编辑。 Clipboard clipboard = DesignerContext.getClipboard(this.getGrid()); Transferable clipData = clipboard.getContents(this); diff --git a/designer-realize/src/main/java/com/fr/grid/selection/Selection.java b/designer-realize/src/main/java/com/fr/grid/selection/Selection.java index 6787e36a5c..1d7a8b3fcf 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/Selection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/Selection.java @@ -1,19 +1,22 @@ package com.fr.grid.selection; -import java.io.Serializable; - -import javax.swing.JPopupMenu; - import com.fr.base.FRContext; +import com.fr.design.ExtraDesignClassManager; import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.FloatElementsClip; +import com.fr.design.fun.RightSelectionHandlerProvider; +import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.ElementCasePane; -import com.fr.report.elementcase.TemplateElementCase; import com.fr.design.selection.SelectableElement; +import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.ColumnRow; import com.fr.stable.FCloneable; +import javax.swing.JPopupMenu; +import java.io.Serializable; +import java.util.Set; + /* * TODO ALEX_SEP Selection是跟ElementCasePane绑定的,能不能把ElementCasePane保存在Selection里面呢? * @@ -65,6 +68,20 @@ public abstract class Selection implements FCloneable, Serializable , Selectable // ///////////////////////////////popup//////////////////////////////// public abstract JPopupMenu createPopupMenu(ElementCasePane ePane); + /** + * 添加插件菜单(增删改都可以) + * @param ePane + * @param popupMenu + */ + public void addExtraMenu(ElementCasePane ePane, UIPopupMenu popupMenu) { + Set selectionHandlerProviders = ExtraDesignClassManager.getInstance().getArray(RightSelectionHandlerProvider.XML_TAG); + for (RightSelectionHandlerProvider handler : selectionHandlerProviders) { + if (handler.accept(this)) { + handler.dmlMenu(ePane, popupMenu); + } + } + } + // ///////////////////////////////clear//////////////////////////////// public abstract boolean clear(ElementCasePane.Clear type, ElementCasePane ePane); From 350665eab47b8b6e853aef73c270e36cae2f29da Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 7 Dec 2018 15:16:49 +0800 Subject: [PATCH 06/18] rt --- .../src/main/java/com/fr/grid/selection/Selection.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/grid/selection/Selection.java b/designer-realize/src/main/java/com/fr/grid/selection/Selection.java index 1d7a8b3fcf..6adcd49643 100644 --- a/designer-realize/src/main/java/com/fr/grid/selection/Selection.java +++ b/designer-realize/src/main/java/com/fr/grid/selection/Selection.java @@ -27,10 +27,8 @@ import java.util.Set; public abstract class Selection implements FCloneable, Serializable , SelectableElement { public abstract boolean isSelectedOneCell(ElementCasePane ePane); - // ///////////////////////////////copy///////////////////////////////// public abstract void asTransferable(ElementsTransferable transferable, ElementCasePane ePane); - // ///////////////////////////////paste//////////////////////////////// public boolean pasteFloatElementClip(FloatElementsClip feClip, ElementCasePane ePane) { FloatElementsClip floatElementClip; try { @@ -56,7 +54,6 @@ public abstract class Selection implements FCloneable, Serializable , Selectable public abstract boolean pasteOtherType(Object ob, ElementCasePane ePane); - // ///////////////////////////////merge//////////////////////////////// public abstract boolean canMergeCells(ElementCasePane ePane); public abstract boolean mergeCells(ElementCasePane ePane); @@ -65,7 +62,6 @@ public abstract class Selection implements FCloneable, Serializable , Selectable public abstract boolean unMergeCells(ElementCasePane ePane); - // ///////////////////////////////popup//////////////////////////////// public abstract JPopupMenu createPopupMenu(ElementCasePane ePane); /** @@ -82,15 +78,12 @@ public abstract class Selection implements FCloneable, Serializable , Selectable } } - // ///////////////////////////////clear//////////////////////////////// public abstract boolean clear(ElementCasePane.Clear type, ElementCasePane ePane); - // //////////////////////////////////////////////////////////////////// public abstract int[] getSelectedRows(); public abstract int[] getSelectedColumns(); - // //////////////////////////////move////////////////////////////////// public abstract void moveLeft(ElementCasePane ePane); public abstract void moveRight(ElementCasePane ePane); @@ -99,10 +92,8 @@ public abstract class Selection implements FCloneable, Serializable , Selectable public abstract void moveDown(ElementCasePane ePane); - // //////////////////////////DeleteAction/////////////////////////////// public abstract boolean triggerDeleteAction(ElementCasePane ePane); - // //////////////////////////Just4CellSelection/////////////////////////////// public abstract boolean containsColumnRow(ColumnRow cr); public abstract void populatePropertyPane(ElementCasePane ePane); From 474aafec64d445e69dcfe5b4e46efae2a3c6042d Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 7 Dec 2018 16:46:04 +0800 Subject: [PATCH 07/18] =?UTF-8?q?REPORT-12850=2010.0mac=E5=85=AC=E5=BC=8F?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=3D>=E8=B0=83=E6=95=B4=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/formula/FormulaPane.java | 2 +- .../com/fr/design/formula/FormulaPaneWhenReserveFormula.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index e994bc1053..bff2080e46 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -77,7 +77,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { private DefaultListModel functionNameModel; private JList functionNameList; - FormulaPane() { + public FormulaPane() { initComponents(); } diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java index d689c54df9..e08f7e3b40 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java @@ -18,7 +18,7 @@ public class FormulaPaneWhenReserveFormula extends FormulaPane { private UICheckBox reserveCheckBox4Result; private UICheckBox reserveCheckBox4Write; - FormulaPaneWhenReserveFormula() { + public FormulaPaneWhenReserveFormula() { super(); } From 3c0a90601d03b25ae3819c7ffee9514b5c830698 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 7 Dec 2018 16:47:20 +0800 Subject: [PATCH 08/18] =?UTF-8?q?MOBILE-18551=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E3=80=8B=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8=E3=80=8B?= =?UTF-8?q?tab=E6=A0=B7=E5=BC=8F=E5=A4=9A=E6=A0=B7=E5=8C=96=E3=80=8B?= =?UTF-8?q?=E8=AE=BE=E7=BD=AEtab=E7=9A=84=E5=AD=97=E7=AC=A6=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E3=80=81=E6=96=9C=E4=BD=93=E9=A2=9C=E8=89=B2=E6=97=A0?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/mobile/ui/MobileTemplateStyleDefinePane.java | 4 +++- .../mainframe/mobile/ui/StyleDefinePaneWithSelectConf.java | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java index b499e18d78..feb19463da 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java @@ -208,8 +208,10 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane Date: Fri, 7 Dec 2018 17:49:45 +0800 Subject: [PATCH 09/18] =?UTF-8?q?REPORT-13176=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E5=B1=9E=E6=80=A7=E3=80=8Btab=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=A4=9A=E6=A0=B7=E5=8C=96=E3=80=8B=E9=BB=98=E8=AE=A4=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E3=80=8B=E9=A2=84=E8=A7=88=E5=A4=84=E5=AD=97=E4=BD=93?= =?UTF-8?q?=E5=A4=AA=E5=B0=8F=EF=BC=8C=E5=A6=82=E6=88=AA=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/mobile/ui/DefaultMobileStyleDefinePane.java | 2 ++ .../fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java | 2 ++ .../fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java | 2 ++ .../fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java | 2 ++ 4 files changed, 8 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index 6b2ecec669..2a14bea078 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -12,6 +12,7 @@ import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane { @@ -84,6 +85,7 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane int panelWidth = dimension.width; int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FRFont frFont = DefaultMobileTemplateStyle.DEFAULT_TAB_FONT.getFont(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java index 1a0472cbb5..70499f3028 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java @@ -27,6 +27,7 @@ import java.awt.FlowLayout; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; import java.awt.Stroke; import java.util.ArrayList; @@ -151,6 +152,7 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { int panelWidth = dimension.width; int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FRFont frFont = this.getTabFontConfig().getFont(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = DownMenuStyleDefinePane.this.getTagLayout(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java index a4cf4e3339..a3c1382130 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java @@ -24,6 +24,7 @@ import java.awt.FlowLayout; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane { private NewColorSelectBox initDotColor; @@ -131,6 +132,7 @@ public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane { Dimension dimension = this.getSize(); int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FRFont frFont = this.getTabFontConfig().getFont(); g2d.setFont(frFont); g2d.setColor(frFont.getForeground()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java index ea0dba6590..003dd04bf7 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java @@ -27,6 +27,7 @@ import java.awt.Dimension; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; +import java.awt.RenderingHints; import java.awt.Stroke; public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { @@ -171,6 +172,7 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { int panelWidth = dimension.width; int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); FRFont frFont = UpMenuStyleDefinePane.this.fontConfPane.update(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = UpMenuStyleDefinePane.this.getTagLayout(); From 4e40e10c53650cdaedbb01d2eab453e0b6055b22 Mon Sep 17 00:00:00 2001 From: kerry Date: Sat, 8 Dec 2018 10:45:38 +0800 Subject: [PATCH 10/18] =?UTF-8?q?REPORT-13340=20=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E5=B1=9E=E6=80=A7=E3=80=8Btab=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=A4=9A=E6=A0=B7=E5=8C=96=E3=80=8B=E6=BB=91=E5=8A=A8=E5=BC=8F?= =?UTF-8?q?=E5=92=8C=E4=B8=8A=E8=8F=9C=E5=8D=95=E5=BC=8F=20=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E5=8C=BA=E5=9F=9F=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/mobile/ui/DefaultMobileStyleDefinePane.java | 2 +- .../fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java index 2a14bea078..7ffd0abe21 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java @@ -86,7 +86,7 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - FRFont frFont = DefaultMobileTemplateStyle.DEFAULT_TAB_FONT.getFont(); + FRFont frFont = this.getTabFontConfig().getFont(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout(); int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java index 003dd04bf7..ddd4c202d0 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java @@ -173,7 +173,7 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf { int panelHeight = dimension.height; Graphics2D g2d = (Graphics2D) g.create(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - FRFont frFont = UpMenuStyleDefinePane.this.fontConfPane.update(); + FRFont frFont = this.getTabFontConfig().getFont(); FontMetrics fm = GraphHelper.getFontMetrics(frFont); WCardTagLayout cardTagLayout = UpMenuStyleDefinePane.this.getTagLayout(); int eachWidth = panelWidth / cardTagLayout.getWidgetCount(); From e5d23733bacfea9711f85d80deb170830c4eea4f Mon Sep 17 00:00:00 2001 From: abel Date: Sat, 8 Dec 2018 11:00:15 +0800 Subject: [PATCH 11/18] =?UTF-8?q?REPORT-13029=20JNDI=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/data/datapane/connect/JNDIDefPane.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java index 32bc4d4b71..e99d99ca4d 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/JNDIDefPane.java @@ -125,7 +125,7 @@ public class JNDIDefPane extends JPanel { } // Properties. - Hashtable contextHashtable = jndiDatabase.getContextHashtable(); + Map contextHashtable = jndiDatabase.getContextHashtable(); Object INITIAL_CONTEXT_FACTORY = contextHashtable.get(Context.INITIAL_CONTEXT_FACTORY); this.JNDIFactoryComboBox.setSelectedItem(INITIAL_CONTEXT_FACTORY == null ? "" : INITIAL_CONTEXT_FACTORY); @@ -148,7 +148,7 @@ public class JNDIDefPane extends JPanel { populateContextAttributes(contextHashtable, this.APPLET_TF, Context.APPLET); } - private void populateContextAttributes(Hashtable properties, UITextField textField, String contextAttr) { + private void populateContextAttributes(Map properties, UITextField textField, String contextAttr) { String PROVIDER_URL = properties.get(contextAttr); if (PROVIDER_URL != null) { textField.setText(PROVIDER_URL); @@ -160,7 +160,7 @@ public class JNDIDefPane extends JPanel { jndiDatabase.setJNDIName(this.jndiNameTextField.getText()); - Hashtable contextHashtable = jndiDatabase.getContextHashtable(); + Map contextHashtable = jndiDatabase.getContextHashtable(); String factoryString = (String)this.JNDIFactoryComboBox.getEditor().getItem(); if (factoryString != null && factoryString.trim().length() > 0) { @@ -186,7 +186,7 @@ public class JNDIDefPane extends JPanel { return jndiDatabase; } - private void updateContextAttributes(Hashtable contextHashtable, UITextField textField, String contextAttr) { + private void updateContextAttributes(Map contextHashtable, UITextField textField, String contextAttr) { String tValue = textField.getText(); if (tValue != null && tValue.trim().length() > 0) { contextHashtable.put(contextAttr, tValue); From 30de22f58db92499d5be7c30ea44511a0d74d32a Mon Sep 17 00:00:00 2001 From: Hades Date: Sat, 8 Dec 2018 15:30:29 +0800 Subject: [PATCH 12/18] =?UTF-8?q?REPORT-13310=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=9D=A5=E5=9B=9E=E5=88=87=E6=8D=A2=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?,=20=E9=9D=9E=E5=B8=B8=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/imenu/UIBasicMenuItemUI.java | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java b/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java index 74c65e8eed..61587beef2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java @@ -667,18 +667,10 @@ public class UIBasicMenuItemUI extends MenuItemUI { } private void installFont(final String prefix, final JComponent menuItem) { - Thread thread = new Thread(new Runnable() { - @Override - public void run() { - if (menuItem == null) { - return; - } - LookAndFeel.installColorsAndFont(menuItem, prefix + ".background", prefix + ".foreground", prefix + ".font"); - } - }); - thread.setName("UIBasicMenuItemUI"); - thread.setDaemon(true); - thread.start(); + if (menuItem == null) { + return; + } + LookAndFeel.installColorsAndFont(menuItem, prefix + ".background", prefix + ".foreground", prefix + ".font"); } protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, From de75ef5d1f0ad1acfad68e88897a2c12cfa5584b Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Sat, 8 Dec 2018 15:43:19 +0800 Subject: [PATCH 13/18] =?UTF-8?q?REPORT-12854=20=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=20=E4=BA=A4=E4=BA=92=E4=BF=AE=E6=94=B9=20bug?= =?UTF-8?q?=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../connect/DatabaseConnectionPane.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 0f52a4c5c7..0b37855c92 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -17,6 +17,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; +import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; @@ -36,8 +37,8 @@ public abstract class DatabaseConnectionPane Date: Sat, 8 Dec 2018 16:00:43 +0800 Subject: [PATCH 14/18] rt --- .../fr/design/data/datapane/connect/DatabaseConnectionPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index 0b37855c92..fc2045161c 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -73,7 +73,7 @@ public abstract class DatabaseConnectionPane Date: Sat, 8 Dec 2018 16:29:56 +0800 Subject: [PATCH 15/18] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/data/datapane/connect/DatabaseConnectionPane.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java index fc2045161c..fc666f15fd 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java @@ -85,7 +85,6 @@ public abstract class DatabaseConnectionPane Date: Sat, 8 Dec 2018 16:44:40 +0800 Subject: [PATCH 16/18] =?UTF-8?q?REPORT-12916=20=E5=8F=A6=E5=AD=98?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9=E5=AF=B9=E8=AF=9D=E6=A1=86?= =?UTF-8?q?=E8=A2=AB=E5=8F=A6=E5=AD=98=E6=96=87=E4=BB=B6icon=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=94=81=E5=AE=9A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/itree/filetree/EnvFileTree.java | 4 +--- .../fr/design/gui/itree/filetree/FileTreeIcon.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java index 550ba715e5..d5a9044d5e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java @@ -69,10 +69,8 @@ public class EnvFileTree extends RefreshableJTree { if (treeNode.hasFullAuthority()) { if (lock != null && !node.getUserID().equals(lock)) { name = name + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked", "(", ")"); - this.setIcon(FileTreeIcon.getIcon(node)); - } else { - this.setIcon(FileTreeIcon.getIcon(node, false)); } + this.setIcon(FileTreeIcon.getIcon(node)); } else { this.setIcon(FileTreeIcon.getFolderHalfImageIcon()); } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java index 130240aead..b0e26cc80e 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java @@ -3,6 +3,7 @@ package com.fr.design.gui.itree.filetree; import com.fr.base.BaseUtils; import com.fr.design.icon.LockIcon; import com.fr.file.filetree.FileNode; +import com.fr.general.ComparatorUtils; import com.fr.stable.StableUtils; import com.fr.workspace.WorkContext; @@ -125,8 +126,16 @@ public class FileTreeIcon { return FOLDER_HALF_IMAGE_ICON; } + /** + * 获取文件节点对应的图标 + * + * @param node 文件节点 + * @return 文件节点的图标 + */ public static Icon getIcon(FileNode node) { - return getIcon(node, node.getLock() != null); + // 如果文件节点锁不为空且不是当前用户锁定的该模板,那么模板ICON 提示用户当前文件节点被锁 + boolean showLock = node.getLock() != null && !ComparatorUtils.equals(node.getUserID(), node.getLock()); + return getIcon(node, showLock); } public static Icon getIcon(FileNode node, boolean isShowLock) { From 3f3bb397cc785c97acc079dccce95d3d789bafc4 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Sat, 8 Dec 2018 20:10:18 +0800 Subject: [PATCH 17/18] =?UTF-8?q?=E4=B8=8D=E6=98=AF=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E5=86=85=E7=9A=84=E6=96=87=E4=BB=B6=E4=B8=8D=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E8=A7=A3=E9=94=81=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/file/MutilTempalteTabPane.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index b6f18a1882..2a00df0720 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -206,8 +206,7 @@ public class MutilTempalteTabPane extends JComponent { openedTemplate.remove(jTemplate); closeFormat(jTemplate); HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate); - // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(jTemplate.getPath()); + closeAndFreeLock(jTemplate); } } JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); @@ -221,7 +220,6 @@ public class MutilTempalteTabPane extends JComponent { if (openedTemplate.size() == 1) { closeOther.setEnabled(false); } - return closeOther; } @@ -698,11 +696,19 @@ public class MutilTempalteTabPane extends JComponent { private void closeTpl(@Nonnull JTemplate specifiedTemplate, @Nonnull String fileName) { HistoryTemplateListCache.getInstance().closeSelectedReport(specifiedTemplate); - // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(specifiedTemplate.getPath()); + closeAndFreeLock(specifiedTemplate); activeTemplate(fileName); } + private void closeAndFreeLock(@Nonnull JTemplate template) { + FILE file = template.getEditingFILE(); + // 只有是环境内的文件,才执行释放锁 + if (file != null && file.isEnvFile()) { + // release lock + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(template.getPath()); + } + } + /** * 关闭模板 * From fa38f5327954c87da6e0d1a73a76864de0b9fb2f Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Sat, 8 Dec 2018 21:11:42 +0800 Subject: [PATCH 18/18] =?UTF-8?q?REPORT-12916=20=E5=8F=A6=E5=AD=98?= =?UTF-8?q?=E4=B8=BA=E6=97=B6=E7=9A=84=E6=96=87=E4=BB=B6=E9=94=81=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/file/MutilTempalteTabPane.java | 2 +- .../com/fr/design/mainframe/JTemplate.java | 29 +++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 2a00df0720..ab4f2aae32 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -705,7 +705,7 @@ public class MutilTempalteTabPane extends JComponent { // 只有是环境内的文件,才执行释放锁 if (file != null && file.isEnvFile()) { // release lock - WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(template.getPath()); + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath()); } } 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 fa9b181a57..7b80c3fd74 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 @@ -32,6 +32,7 @@ import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.itree.filetree.TemplateFileTree; +import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.templateinfo.TemplateInfoCollector; import com.fr.design.mainframe.templateinfo.TemplateProcessInfo; @@ -56,6 +57,8 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.core.UUID; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.lock.TplOperator; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -587,6 +590,8 @@ public abstract class JTemplate> if (isCancelOperation(chooseResult)) { return false; } + // 源文件 + FILE sourceFile = editingFILE; if (isOkOperation(chooseResult)) { boolean access = false; @@ -596,13 +601,33 @@ public abstract class JTemplate> FineLoggerFactory.getLogger().error(e.getMessage(), e); } if (!access) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.WARNING_MESSAGE); + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + "!", + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), + JOptionPane.WARNING_MESSAGE); return false; } + // 目标文件 editingFILE = fileChooser.getSelectedFILE(); } - return saveNewFile(editingFILE, oldName); + boolean lockedTarget = WorkContext.getCurrent().get(TplOperator.class).saveAs(editingFILE.getPath()); + if (lockedTarget) { + boolean saved = saveNewFile(editingFILE, oldName); + // 目标文件保存成功并且源文件不一致的情况下,把源文件锁释放掉 + if (saved && !ComparatorUtils.equals(editingFILE.getPath(), sourceFile.getPath())) { + WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(sourceFile.getPath()); + } + return saved; + } else { + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Toolkit.i18nText("Fine-Design_Basic_Template_Status_Locked"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), + JOptionPane.WARNING_MESSAGE); + return false; + } } protected boolean saveNewFile(FILE editingFILE, String oldName) {