Browse Source

Merge branch 'release/9.0' of http://cloud.finedevelop.com:2015/scm/~neil/design into release/9.0

master
neil 7 years ago
parent
commit
68de8fe783
  1. 34
      designer/src/com/fr/design/module/DesignerModule.java
  2. 89
      designer_base/src/com/fr/design/actions/core/ActionFactory.java
  3. BIN
      designer_base/src/com/fr/design/images/edit/format.png
  4. 49
      designer_base/src/com/fr/design/javascript/JSContentPane.java
  5. 1
      designer_base/src/com/fr/design/locale/designer.properties
  6. 1
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  7. 1
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  8. 1
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  9. 1
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  10. 1
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  11. 2
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  12. 5
      designer_base/src/com/fr/design/mainframe/JTemplate.java

34
designer/src/com/fr/design/module/DesignerModule.java

@ -141,22 +141,22 @@ public class DesignerModule extends DesignModule {
*/
private void registerCellEditor() {
ActionFactory.registerCellEditor(String.class, new CellStringQuickEditor());
ActionFactory.registerCellEditor(Number.class, new CellStringQuickEditor());
ActionFactory.registerCellEditor(BaseFormula.class, new CellFormulaQuickEditor());
ActionFactory.registerCellEditor(SubReport.class, new CellSubReportEditor());
ActionFactory.registerCellEditor(RichText.class, new CellRichTextEditor());
ActionFactory.registerCellEditor(DSColumn.class, new CellDSColumnEditor());
ActionFactory.registerCellEditor(Image.class, new CellImageQuickEditor());
ActionFactory.registerCellEditor(BiasTextPainter.class, new CellBiasTextPainterEditor());
ActionFactory.registerCellEditor(BufferedImage.class, new CellImageQuickEditor());
ActionFactory.registerChartCellEditorInEditor(new BasicChartQuickEditor());
ActionFactory.registerCellEditorClass(String.class, CellStringQuickEditor.class);
ActionFactory.registerCellEditorClass(Number.class, CellStringQuickEditor.class);
ActionFactory.registerCellEditorClass(BaseFormula.class, CellFormulaQuickEditor.class);
ActionFactory.registerCellEditorClass(SubReport.class, CellSubReportEditor.class);
ActionFactory.registerCellEditorClass(RichText.class, CellRichTextEditor.class);
ActionFactory.registerCellEditorClass(DSColumn.class, CellDSColumnEditor.class);
ActionFactory.registerCellEditorClass(Image.class, CellImageQuickEditor.class);
ActionFactory.registerCellEditorClass(BiasTextPainter.class, CellBiasTextPainterEditor.class);
ActionFactory.registerCellEditorClass(BufferedImage.class, CellImageQuickEditor.class);
ActionFactory.registerChartCellEditorInEditor(BasicChartQuickEditor.class);
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);
for (ElementUIProvider provider : providers) {
try {
ActionFactory.registerCellEditor(provider.targetObjectClass(), provider.quickEditor().newInstance());
ActionFactory.registerCellEditorClass(provider.targetObjectClass(), provider.quickEditor());
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage(), e);
}
@ -174,12 +174,12 @@ public class DesignerModule extends DesignModule {
*/
private void registerFloatEditor() {
ActionFactory.registerFloatEditor(String.class, new FloatStringQuickEditor());
ActionFactory.registerFloatEditor(Formula.class, new FloatStringQuickEditor());
ActionFactory.registerFloatEditor(Image.class, new FloatImageQuickEditor());
ActionFactory.registerFloatEditor(BufferedImage.class, new FloatImageQuickEditor());
ActionFactory.registerFloatEditorClass(String.class, FloatStringQuickEditor.class);
ActionFactory.registerFloatEditorClass(Formula.class, FloatStringQuickEditor.class);
ActionFactory.registerFloatEditorClass(Image.class, FloatImageQuickEditor.class);
ActionFactory.registerFloatEditorClass(BufferedImage.class, FloatImageQuickEditor.class);
ActionFactory.registerChartFloatEditorInEditor(new FloatChartQuickEditor());
ActionFactory.registerChartFloatEditorInEditor(FloatChartQuickEditor.class);
}
/**

89
designer_base/src/com/fr/design/actions/core/ActionFactory.java

@ -30,15 +30,25 @@ import java.util.concurrent.ConcurrentMap;
public class ActionFactory {
private static LinkedHashSet<Class<?>> actionClasses = new LinkedHashSet<>();
private static LinkedHashSet<Class<?>> floatActionClasses = new LinkedHashSet<>();
private static Class chartCollectionClass = null;
/**
* 悬浮元素编辑器
* 无需每次实例化的悬浮元素编辑器
*/
private static ConcurrentMap<Class, QuickEditor> floatEditor = new ConcurrentHashMap<>();
private static Class chartCollectionClass = null;
/**
* 单元格元素编辑器
* 无需每次实例化的单元格元素编辑器
*/
private static ConcurrentMap<Class, QuickEditor> cellEditor = new ConcurrentHashMap<>();
/**
* 需要每次实例化的悬浮元素编辑器
*/
private static ConcurrentMap<Class, Class<? extends QuickEditor>> floatEditorClass = new ConcurrentHashMap<>();
/**
* 需要每次实例化的单元格元素编辑器
*/
private static ConcurrentMap<Class, Class<? extends QuickEditor>> cellEditorClass = new ConcurrentHashMap<>();
private static UpdateAction chartPreStyleAction = null;
private static UpdateAction chartMapEditorAction = null;
@ -46,7 +56,7 @@ public class ActionFactory {
}
/**
* 注册单元格编辑器
* 注册无需每次实例化的单元格元素编辑器
*
* @param clazz 单元格属性类型
* @param editor 单元格编辑器实例
@ -57,7 +67,7 @@ public class ActionFactory {
/**
* 注册悬浮元素编辑器
* 注册无需每次实例化的悬浮元素编辑器
*
* @param clazz 悬浮元素类型
* @param editor 悬浮元素编辑器实例
@ -66,6 +76,28 @@ public class ActionFactory {
floatEditor.put(clazz, editor);
}
/**
* 注册需要每次实例化的单元格元素编辑器
*
* @param clazz 单元格属性类型
* @param editorClass 单元格编辑器类
*/
public static void registerCellEditorClass(Class clazz, Class<? extends QuickEditor> editorClass) {
cellEditorClass.put(clazz, editorClass);
}
/**
* 注册需要每次实例化的悬浮元素编辑器
*
* @param clazz 悬浮元素类型
* @param editorClass 悬浮元素编辑器类
*/
public static void registerFloatEditorClass(Class clazz, Class<? extends QuickEditor> editorClass) {
floatEditorClass.put(clazz, editorClass);
}
/**
* kunsnat: 图表注册 悬浮元素编辑器 , 因为ChartCollecion和ChartQuickEditor一个在Chart,一个在Designer, 所以分开注册.
*
@ -97,22 +129,22 @@ public class ActionFactory {
/**
* kunsnat: 图表注册 悬浮元素编辑器 , 因为ChartCollection和ChartQuickEditor一个在Chart,一个在Designer, 所以分开注册.
*
* @param editor 待说明
* @param editorClass 悬浮元素图表编辑器类
*/
public static void registerChartFloatEditorInEditor(QuickEditor editor) {
public static void registerChartFloatEditorInEditor(Class<? extends QuickEditor> editorClass) {
if (chartCollectionClass != null) {
floatEditor.put(chartCollectionClass, editor);
registerFloatEditorClass(chartCollectionClass, editorClass);
}
}
/**
* kunsnat: 图表注册 悬浮元素编辑器 , 因为ChartCollecion和ChartQuickEditor一个在Chart,一个在Designer, 所以分开注册.
* kunsnat: 图表注册 单元格元素编辑器 , 因为ChartCollecion和ChartQuickEditor一个在Chart,一个在Designer, 所以分开注册.
*
* @param editor 待说明
* @param editorClass 单元格元素图表编辑器类
*/
public static void registerChartCellEditorInEditor(QuickEditor editor) {
public static void registerChartCellEditorInEditor(Class<? extends QuickEditor> editorClass) {
if (chartCollectionClass != null) {
cellEditor.put(chartCollectionClass, editor);
registerCellEditorClass(chartCollectionClass, editorClass);
}
}
@ -153,7 +185,7 @@ public class ActionFactory {
* @return 编辑器实例
*/
public static QuickEditor getFloatEditor(Class clazz) {
return createEditor(clazz, floatEditor);
return createEditor(clazz, floatEditor, floatEditorClass);
}
/**
@ -163,7 +195,7 @@ public class ActionFactory {
* @return 编辑器实例
*/
public static QuickEditor getCellEditor(Class clazz) {
return createEditor(clazz, cellEditor);
return createEditor(clazz, cellEditor, cellEditorClass);
}
public static UpdateAction createAction(Class clazz) {
@ -299,17 +331,40 @@ public class ActionFactory {
return actions.toArray(new UpdateAction[actions.size()]);
}
private static QuickEditor createEditor(Class clazz, Map<Class, QuickEditor> editorMap) {
QuickEditor c = findQuickEditorClass(clazz, editorMap);
private static QuickEditor createEditor(Class clazz, Map<Class, QuickEditor> editorMap, Map<Class, Class<? extends QuickEditor>> editorClassMap) {
QuickEditor c = findQuickEditor(clazz, editorMap);
if (c == null) {
Class<? extends QuickEditor> cClazz = findQuickEditorClass(clazz, editorClassMap);
if (cClazz == null) {
FRLogger.getLogger().error("No Such Editor");
return null;
}
try {
Constructor<? extends QuickEditor> constructor = cClazz.getDeclaredConstructor();
constructor.setAccessible(true);
return constructor.newInstance();
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
return null;
}
return c;
}
private static QuickEditor findQuickEditorClass(Class clazz, Map<Class, QuickEditor> editorMap) {
private static QuickEditor findQuickEditor(Class clazz, Map<Class, QuickEditor> editorMap) {
QuickEditor c = editorMap.get(clazz);
if (c == null) {
Class superClazz = clazz.getSuperclass();
if (superClazz == null) {
return null;
}
return findQuickEditor(superClazz, editorMap);
}
return c;
}
private static Class<? extends QuickEditor> findQuickEditorClass(Class clazz, Map<Class, Class<? extends QuickEditor>> editorMap) {
Class<? extends QuickEditor> c = editorMap.get(clazz);
if (c == null) {
Class superClazz = clazz.getSuperclass();
if (superClazz == null) {

BIN
designer_base/src/com/fr/design/images/edit/format.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

49
designer_base/src/com/fr/design/javascript/JSContentPane.java

@ -1,17 +1,27 @@
package com.fr.design.javascript;
import com.fr.design.constants.KeyWords;
import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.autocomplete.*;
import com.fr.design.constants.KeyWords;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.autocomplete.AutoCompletion;
import com.fr.design.gui.autocomplete.BasicCompletion;
import com.fr.design.gui.autocomplete.CompletionProvider;
import com.fr.design.gui.autocomplete.DefaultCompletionProvider;
import com.fr.design.gui.autocomplete.ShorthandCompletion;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.javascript.beautify.JavaScriptFormatHelper;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
public class JSContentPane extends BasicPane {
@ -24,7 +34,36 @@ public class JSContentPane extends BasicPane {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
funNameLabel = new UILabel();
this.setFunctionTitle(args);
this.add(funNameLabel, BorderLayout.NORTH);
UILabel label = new UILabel(Inter.getLocText("FR-Designer_Format_JavaScript"), IOUtils.readIcon("com/fr/design/images/edit/format.png"), SwingConstants.LEFT);
label.setCursor(new Cursor(Cursor.HAND_CURSOR));
label.setToolTipText(Inter.getLocText("FR-Designer_Format_JavaScript"));
label.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
new SwingWorker<String, Void>() {
@Override
protected String doInBackground() throws Exception {
return JavaScriptFormatHelper.beautify(contentTextArea.getText());
}
@Override
protected void done() {
try {
String text = get();
contentTextArea.setText(text);
} catch (Exception ignore) {
}
}
}.execute();
}
});
this.add(GUICoreUtils.createBorderLayoutPane(
funNameLabel, BorderLayout.WEST,
label, BorderLayout.EAST
), BorderLayout.NORTH);
contentTextArea = new RSyntaxTextArea();
contentTextArea.setCloseCurlyBraces(true);
@ -84,7 +123,7 @@ public class JSContentPane extends BasicPane {
for (String s : args) {
list.add(s);
}
titles = (String[])list.toArray(new String[list.size()]);
titles = (String[]) list.toArray(new String[list.size()]);
}
setFunctionTitle(titles);
}

1
designer_base/src/com/fr/design/locale/designer.properties

@ -2148,3 +2148,4 @@ FR-Designer_Sheet_Label_Page_Display_Position=
FR-Designer_Provide_Choose_All=
FR-Designer_Decimal_Places=
FR-Designer_Env_Des_Https=If HTTPS is enabled or the HTTPS configuration (certificate path, HTTPS key) is modified, you must restart the designer to take effect.
FR-Designer_Format_JavaScript=Format Code

1
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -2147,3 +2147,4 @@ FR-Designer_Sheet_Label_Page_Display_Position=
FR-Designer_Provide_Choose_All=
FR-Designer_Decimal_Places=
FR-Designer_Env_Des_Https=If HTTPS is enabled or the HTTPS configuration (certificate path, HTTPS key) is modified, you must restart the designer to take effect.
FR-Designer_Format_JavaScript=Format Code

1
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -2148,3 +2148,4 @@ FR-Designer_Provide_Choose_All=\u5168\u9078\u629E\u53EF\u80FD
FR-Designer_Decimal_Places=\u5C0F\u6570\u67A0\u6570:
FR-Base-Load_Resource_File=\u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB\u30ED\u30FC\u30C9
FR-Designer_Env_Des_Https=
FR-Designer_Format_JavaScript=Format Code

1
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -2148,3 +2148,4 @@ FR-Base-Load_Resource_File=\uB85C\uB529\uAD6C\uC131\uD30C\uC77C
FR-Designer_Export_Background=
FR-Designer_Print_Background=
FR-Designer_Env_Des_Https=
FR-Designer_Format_JavaScript=Format Code

1
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -2148,3 +2148,4 @@ FR-Designer_Sheet_Label_Page_Display_Position=
FR-Designer_Provide_Choose_All=
FR-Designer_Decimal_Places=
FR-Designer_Env_Des_Https=\u82E5\u542F\u7528https\u6216\u4FEE\u6539https\u914D\u7F6E\uFF08\u8BC1\u4E66\u8DEF\u5F84\u3001https\u79D8\u94A5\uFF09\uFF0C\u5FC5\u987B\u91CD\u542F\u8BBE\u8BA1\u5668\u624D\u80FD\u751F\u6548\u3002
FR-Designer_Format_JavaScript=\u683C\u5F0F\u5316\u4EE3\u7801

1
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -2147,3 +2147,4 @@ FR-Designer_Sheet_Label_Page_Display_Position=
FR-Designer_Provide_Choose_All=
FR-Designer_Decimal_Places=
FR-Designer_Env_Des_Https=\u82E5\u555F\u7528https\u6216\u4FEE\u6539https\u914D\u7F6E\uFF08\u8B49\u66F8\u8DEF\u5F91\u3001https\u7955\u9470\uFF09\uFF0C\u5FC5\u9808\u91CD\u555F\u8A2D\u8A08\u5668\u624D\u80FD\u751F\u6548\u3002
FR-Designer_Format_JavaScript=Format Code

2
designer_base/src/com/fr/design/mainframe/DesignerFrame.java

@ -918,7 +918,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
if (tplFile instanceof FileFILE) {
fullName = tplFile.getPath();
}
fullName = fullName.replaceAll("/", "\\\\");
fullName = OperatingSystem.isWindows() ? fullName.replaceAll("/", "\\\\") : fullName.replaceAll("\\\\", "/");
int index = HistoryTemplateListPane.getInstance().contains(fullName);
if (index != -1) {
this.activateJTemplate(HistoryTemplateListPane.getInstance().getHistoryList().get(index));

5
designer_base/src/com/fr/design/mainframe/JTemplate.java

@ -45,6 +45,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.stable.core.UUID;
@ -196,7 +197,11 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
if (editingFileName.startsWith(ProjectConstants.REPORTLETS_NAME)) {
editingFileName = ((FileNodeFILE) getEditingFILE()).getEnvPath() + File.separator + editingFileName;
}
if (OperatingSystem.isWindows()) {
return editingFileName.replaceAll("/", "\\\\");
} else {
return editingFileName.replaceAll("\\\\", "/");
}
}
protected abstract JComponent createCenterPane();

Loading…
Cancel
Save