diff --git a/designer-base/src/main/java/com/fr/design/dialog/UIDialog.java b/designer-base/src/main/java/com/fr/design/dialog/UIDialog.java index 7380bb58f1..193a5ea07e 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/UIDialog.java +++ b/designer-base/src/main/java/com/fr/design/dialog/UIDialog.java @@ -73,7 +73,7 @@ public abstract class UIDialog extends JDialog { } this.setName(pane.title4PopupWindow()); this.setModal(true); - this.pack(); + GUICoreUtils.centerWindow(this); } @@ -90,12 +90,10 @@ public abstract class UIDialog extends JDialog { //取消 addCancelButton(buttonsPane); - this.getRootPane().setDefaultButton(okButton); - return controlPane; } - protected void addCustomButton(JPanel buttonsPane){ + protected void addCustomButton(JPanel buttonsPane) { } @@ -110,6 +108,18 @@ public abstract class UIDialog extends JDialog { doCancel(); } }); + JPanel defaultPane = (JPanel) this.getContentPane(); + InputMap inputMapAncestor = defaultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); + ActionMap actionMap = defaultPane.getActionMap(); + + // transfer focus to CurrentEditor + inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "dialogOK"); + actionMap.put("dialogOK", new AbstractAction() { + + public void actionPerformed(ActionEvent evt) { + doOK(); + } + }); } private void addOkButton(JPanel buttonsPane) { @@ -130,7 +140,6 @@ public abstract class UIDialog extends JDialog { * 添加监听器 * * @param l 监听器 - * */ public void addDialogActionListener(DialogActionListener l) { listeners.add(l); @@ -138,7 +147,6 @@ public abstract class UIDialog extends JDialog { /** * 清除所有监听器 - * */ public void clearDialogActionListeners() { listeners.clear(); @@ -146,7 +154,6 @@ public abstract class UIDialog extends JDialog { /** * 确定操作 - * */ public void doOK() { try { @@ -177,7 +184,6 @@ public abstract class UIDialog extends JDialog { /** * 取消操作 - * */ public void doCancel() { @@ -224,7 +230,6 @@ public abstract class UIDialog extends JDialog { /** * 检测结果是否合法 - * */ public abstract void checkValid() throws Exception; diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java index 073c4fd1d5..a51735f641 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java @@ -1,16 +1,154 @@ package com.fr.design.file; +import com.fr.base.chart.chartdata.CallbackEvent; +import com.fr.design.mainframe.JTemplate; +import com.fr.file.FILE; +import com.fr.file.FileNodeFILE; + +import java.util.List; + /** * 历史模板缓存 - * + *

* 为可能存在的插件做兼容处理 * * @see HistoryTemplateListCache * @deprecated use HistoryTemplateListCache instead */ @Deprecated -public class HistoryTemplateListPane { - public static HistoryTemplateListCache getInstance() { +public class HistoryTemplateListPane implements CallbackEvent { + + + private static volatile HistoryTemplateListPane THIS; + + public static HistoryTemplateListPane getInstance() { + if (THIS == null) { + synchronized (HistoryTemplateListPane.class) { + if (THIS == null) { + THIS = new HistoryTemplateListPane(); + } + } + } + return THIS; + } + + private static HistoryTemplateListCache instead() { return HistoryTemplateListCache.getInstance(); } + + + /** + * 关闭选择的文件 + * + * @param selected 选择的 + */ + public void closeSelectedReport(JTemplate selected) { + instead().closeSelectedReport(selected); + } + + /** + * 临时关闭选择的文件 + * + * @param selected 选择的 + */ + public void closeVirtualSelectedReport(JTemplate selected) { + instead().closeVirtualSelectedReport(selected); + } + + + public JTemplate getCurrentEditingTemplate() { + return instead().getCurrentEditingTemplate(); + } + + public void setCurrentEditingTemplate(JTemplate jt) { + instead().setCurrentEditingTemplate(jt); + + } + + /** + * 添加历史记录 + */ + public void addHistory() { + instead().addHistory(); + } + + + public List> getHistoryList() { + return instead().getHistoryList(); + } + + + /** + * 清空历史记录 + */ + public void removeAllHistory() { + instead().removeAllHistory(); + } + + public int getHistoryCount() { + return instead().getHistoryCount(); + } + + + public JTemplate get(int index) { + return instead().get(index); + } + + + public JTemplate getTemplate(int index) { + return instead().getTemplate(index); + } + + /** + * 获取模板的index + * + * @param jt 模板 + * @return 位置 + */ + public int contains(JTemplate jt) { + return instead().contains(jt); + } + + + /** + * 判断是否打开过该模板 + * + * @param filename 文件名 + * @return 文件位置 + */ + public int contains(String filename) { + return instead().contains(filename); + } + + /** + * 是否是当前编辑的文件 + * + * @param filename 文件名 + * @return 是则返回TRUE + */ + public boolean isCurrentEditingFile(String filename) { + return instead().isCurrentEditingFile(filename); + } + + + @Override + public void callback() { + instead().callback(); + } + + /** + * 打开new模板的同时关闭old模板,优先关已保存的、先打开的 + */ + public void closeOverLineTemplate() { + instead().closeOverLineTemplate(); + } + + + public void deleteFile(FileNodeFILE file) { + instead().deleteFile(file); + } + + public boolean rename(FILE tplFile, String from, String to) { + return instead().rename(tplFile, from, to); + } } diff --git a/designer-base/src/main/java/com/fr/design/fun/ConnectionProvider.java b/designer-base/src/main/java/com/fr/design/fun/ConnectionProvider.java index 766f7d4147..8e5aed5b87 100644 --- a/designer-base/src/main/java/com/fr/design/fun/ConnectionProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/ConnectionProvider.java @@ -10,32 +10,36 @@ import com.fr.stable.fun.mark.Mutable; */ public interface ConnectionProvider extends Mutable { - public static final String XML_TAG = "ConnectionProvider"; + String XML_TAG = "ConnectionProvider"; // 2016-12-14 1 -> 2 , 增加connection.feature方法导致不兼容. int CURRENT_LEVEL = 2; /** * 数据连接弹出菜单的名字 + * * @return 名字 */ - public String nameForConnection(); + String nameForConnection(); /** * 数据连接弹出菜单的图标 + * * @return 图标路径 */ - public String iconPathForConnection(); + String iconPathForConnection(); /** * 数据连接的类型 + * * @return 连接类型 */ - public Class classForConnection(); + Class classForConnection(); /** * 数据连接的设计界面 + * * @return 设计界面 */ - public Class> appearanceForConnection(); + Class> appearanceForConnection(); } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java index 77e16e3122..cd6e01df35 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java @@ -28,6 +28,7 @@ import java.util.ArrayList; public class JSContentPane extends BasicPane { private RSyntaxTextArea contentTextArea; private UILabel funNameLabel; + private AutoCompletion ac; private int titleWidth = 180; @@ -78,14 +79,6 @@ public class JSContentPane extends BasicPane { contentTextArea.setCodeFoldingEnabled(true); contentTextArea.setAntiAliasingEnabled(true); - CompletionProvider provider = createCompletionProvider(); - - AutoCompletion ac = new AutoCompletion(provider); - String shortCuts = DesignerEnvManager.getEnvManager().getAutoCompleteShortcuts(); - - ac.setTriggerKey(convert2KeyStroke(shortCuts)); - ac.install(contentTextArea); - UIScrollPane sp = new UIScrollPane(contentTextArea); this.add(sp, BorderLayout.CENTER); @@ -104,13 +97,31 @@ public class JSContentPane extends BasicPane { } public void populate(String js) { + if (ac == null) { + CompletionProvider provider = createCompletionProvider(); + ac = new AutoCompletion(provider); + String shortCuts = DesignerEnvManager.getEnvManager().getAutoCompleteShortcuts(); + + ac.setTriggerKey(convert2KeyStroke(shortCuts)); + ac.install(contentTextArea); + } + this.contentTextArea.setText(js); } public String update() { + if (ac != null) { + this.ac.uninstall(); + ac = null; + } + return this.contentTextArea.getText(); } + public void reset() { + this.contentTextArea.setText(null); + } + public void setFunctionTitle(String[] args) { funNameLabel.setText(createFunctionTitle(args)); } diff --git a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java index 23a33976b2..8806d6853c 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java @@ -138,6 +138,9 @@ public class JavaScriptImplPane extends AbstractHyperLinkPane { public void populateBean(JavaScriptImpl javaScriptImpl) { if (javaScriptImpl == null) { javaScriptImpl = new JavaScriptImpl(); + jsPane.reset(); + }else{ + jsPane.populate(javaScriptImpl.getContent()); } int rowCount = javaScriptImpl.getJSImportSize(); @@ -147,7 +150,6 @@ public class JavaScriptImplPane extends AbstractHyperLinkPane { } importedJsPane.populate(value); parameterPane.populate(javaScriptImpl.getParameters()); - jsPane.populate(javaScriptImpl.getContent()); if (itemNameTextField != null) { itemNameTextField.setText(javaScriptImpl.getItemName()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index be2695815c..7d9a3d749d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -155,6 +155,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta // 右边的虚线 private DottedLine rightDottedLine; + //用于判断设计器是否打开了 + private boolean designerOpened = false; + private int contentWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth()); private int contentHeight = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight()); @@ -351,7 +354,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta */ public void addDesignerOpenedListener(DesignerOpenedListener listener) { - designerOpenedListenerList.add(listener); + if (!designerOpened) { + designerOpenedListenerList.add(listener); + } } /** @@ -362,6 +367,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta for (DesignerOpenedListener listener : designerOpenedListenerList) { listener.designerOpened(); } + + designerOpened = true; + //使用完清除监听 + designerOpenedListenerList.clear(); } protected DesktopCardPane getCenterTemplateCardPane() { 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 737b5ba16b..d14a066e53 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 @@ -780,7 +780,7 @@ public abstract class JTemplate> ((JTemplateActionListener) listeners[i + 1]).templateClosed(this); } } - + this.undoState = null; this.repaint(30); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 8f20583abd..b46719efe4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -148,6 +148,9 @@ public abstract class ToolBarMenuDock { }; private static final String FINEREPORT = "FineReport"; private static final int MENUBAR_HEIGHT = 22; + + private static final List PLUGIN_LISTENERS = new ArrayList<>(); + private MenuDef[] menus; private ToolBarDef toolBarDef; private List shortCutsList; @@ -218,6 +221,8 @@ public abstract class ToolBarMenuDock { } public MenuDef[] menus(final ToolBarMenuDockPlus plus) { + //删除之前创建的插件菜单监听 + clearPluginListeners(); java.util.List menuList = new java.util.ArrayList(); // 添加文件菜单 menuList.add(createFileMenuDef(plus)); @@ -248,6 +253,15 @@ public abstract class ToolBarMenuDock { return menuList.toArray(new MenuDef[menuList.size()]); } + //清空监听 + private static synchronized void clearPluginListeners() { + + for (PluginEventListener listener : PLUGIN_LISTENERS) { + GeneralContext.stopListenPlugin(listener); + } + PLUGIN_LISTENERS.clear(); + } + /** * 获取所有actionmodel * @@ -644,7 +658,7 @@ public abstract class ToolBarMenuDock { } }; - GeneralContext.listenPlugin(PluginEventType.BeforeStop, new PluginEventListener() { + PluginEventListener beforeStop = new PluginEventListener() { @Override public void on(PluginEvent event) { @@ -652,8 +666,9 @@ public abstract class ToolBarMenuDock { Set menuHandlers = runtime.get(MenuHandler.MARK_STRING); removeExtraMenus(menuDef, anchor, action, menuHandlers); } - }, filter); - GeneralContext.listenPlugin(PluginEventType.AfterRun, new PluginEventListener() { + }; + + PluginEventListener afterRun = new PluginEventListener() { @Override public void on(PluginEvent event) { @@ -662,7 +677,13 @@ public abstract class ToolBarMenuDock { Set menuHandlers = runtime.get(MenuHandler.MARK_STRING); addExtraMenus(menuDef, anchor, action, menuHandlers); } - }, filter); + }; + + GeneralContext.listenPlugin(PluginEventType.BeforeStop, beforeStop, filter); + GeneralContext.listenPlugin(PluginEventType.AfterRun, afterRun, filter); + + PLUGIN_LISTENERS.add(afterRun); + PLUGIN_LISTENERS.add(beforeStop); } private void removeExtraMenus(MenuDef menuDef, String anchor, ShortCutMethodAction action, Set set) { diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java index 73dfe5ca92..758c673fa6 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorSelectDetailPane.java @@ -95,7 +95,7 @@ public class ColorSelectDetailPane extends BasicPane { public void stateChanged(ChangeEvent e) { ColorSelectionModel model = (ColorSelectionModel) e.getSource(); colorChooserPreview.setMyColor(model.getSelectedColor()); - colorChooserPreview.paint(colorChooserPreview.getGraphics()); + colorChooserPreview.repaint(); } }); previewPanel.add(colorChooserPreview); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java index 32e6564799..35b57d09d7 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/axis/ChartValuePane.java @@ -2,8 +2,8 @@ package com.fr.design.mainframe.chart.gui.style.axis; import com.fr.base.BaseFormula; import com.fr.base.Utils; +import com.fr.chart.base.AxisUnitType; import com.fr.chart.base.ChartBaseUtils; -import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Axis; import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.NumberAxis; @@ -78,7 +78,7 @@ public class ChartValuePane extends ChartAxisUsePane{ axisLineStylePane = new ChartAxisLineStylePane(); zeroPane = aliagnZero4Second(); axisReversed = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_AxisReversed")); - unitCombox = new UIComboBox(ChartConstants.UNIT_I18N_VALUES); + unitCombox = new UIComboBox(AxisUnitType.getI18NValues()); formatPane = new FormatPaneWithOutFont(); axisLabelPane = new ChartAxisLabelPane(); dataPane = createDataDefinePane(); @@ -257,10 +257,10 @@ public class ChartValuePane extends ChartAxisUsePane{ axisLineStylePane.update(axis); axis.setAxisReversed(this.axisReversed.isSelected()); String unitValue = Utils.objectToString(unitCombox.getSelectedItem()); - if(ComparatorUtils.equals(unitValue, ChartConstants.UNIT_I18N_VALUES[0])) { + if(ComparatorUtils.equals(unitValue, AxisUnitType.UNIT_NONE.toLocaleString())) { unitValue = null; } - numberAxis.setShowUnit(ChartConstants.getUnitValueFromKey(unitValue)); + numberAxis.setShowUnit(AxisUnitType.parse(unitValue)); if(numberAxis.isSurpportAxisTitle()) { updateAxisTitle(numberAxis); } @@ -378,11 +378,13 @@ public class ChartValuePane extends ChartAxisUsePane{ axisLineStylePane.populate(axis); axisReversed.setSelected(axis.hasAxisReversed()); - String unitKey = numberAxis.getShowUnit(); - if(StringUtils.isBlank(unitKey)) { - unitKey = ChartConstants.UNIT_I18N_KEYS[0]; + String unitKey; + if(numberAxis.getShowUnit() != null) { + unitKey = numberAxis.getShowUnit().getStringType(); + }else{ + unitKey = AxisUnitType.UNIT_NONE.getStringType(); } - unitCombox.setSelectedItem(ChartConstants.getUnitKey2Value(unitKey)); + unitCombox.setSelectedItem(AxisUnitType.parse(unitKey).toLocaleString()); if(numberAxis.isSurpportAxisTitle()) { populateAxisTitle(axis); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java index d6ee253426..0cf740dbe5 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java @@ -28,7 +28,7 @@ import java.util.Set; * 控件属性表绘制 * Modified by fanglei */ -public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane { +public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane { private static final int PADDING = 10; private static final int PADDING_M = 12; @@ -108,11 +108,10 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope */ private void initTables() { formWidgetCardPane.populate(); - eventTable.refresh(); + if (mobileExtraPropertyPanes != null) { for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) { extraPane.initPropertyGroups(designer); - extraPane.populate(designer); } } if (widgetPropertyTables != null) { @@ -222,7 +221,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Mobile_Terminal") }; - final CardLayout tabbedPane = new CardLayout(); + final CardLayout tabbedPane = new CardLayout(); final JPanel center = new JPanel(tabbedPane); center.add(formWidgetCardPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Properties")); center.add(eventTable, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event")); @@ -232,6 +231,16 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope tabsHeaderIconPane = new UIHeadGroup(tabTitles) { @Override public void tabChanged(int index) { + //切换的时候再populate + if (index == 1) { + eventTable.refresh(); + } else if (index == 2) { + if (mobileExtraPropertyPanes != null) { + for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) { + extraPane.populate(designer); + } + } + } tabbedPane.show(center, tabTitles[index]); } }; @@ -292,7 +301,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope if (evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED || evt.getCreatorEventID() == DesignerEvent.CREATOR_RESIZED) { formWidgetCardPane.populate(); - } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED){ + } else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { // 防止多次触发 if (lastAffectedCreator != null && lastAffectedCreator == evt.getAffectedCreator()) { return; 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 8832ec4c38..df9476c716 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 @@ -596,7 +596,7 @@ public abstract class ElementCasePane extends Tar * @return 是则返回true */ public boolean isSelectedOneCell() { - return selection.isSelectedOneCell(this); + return (selection == null) ? false : selection.isSelectedOneCell(this); } /** diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index 814a4ebeca..4ac2aab9b0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -427,7 +427,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { } } - if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preview"))) { + if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"))) { cellGUIAttr.setPreviewContent(previewCellContent.isSelected()); } diff --git a/designer-realize/src/main/resources/com/fr/start/jni/splash.dylib b/designer-realize/src/main/resources/com/fr/start/jni/splash.dylib index 5d096b2b37..2b59ee3eb0 100755 Binary files a/designer-realize/src/main/resources/com/fr/start/jni/splash.dylib and b/designer-realize/src/main/resources/com/fr/start/jni/splash.dylib differ