diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index c1c11553f7..1dd438e2d4 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -3,6 +3,7 @@ package com.fr.design; import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceType; @@ -91,8 +92,8 @@ public class EnvChangeEntrance { strategy.showTip(new PopTip() { @Override public void show() { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), - UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); } }); return false; @@ -127,8 +128,8 @@ public class EnvChangeEntrance { strategy.showTip(new PopTip() { @Override public void show() { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), - UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); } }); return false; @@ -137,8 +138,8 @@ public class EnvChangeEntrance { strategy.showTip(new PopTip() { @Override public void show() { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), - UIManager.getString("OptionPane.messageDialogTitle"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Switch_Workspace_Failed"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); } }); diff --git a/designer-base/src/main/java/com/fr/design/actions/community/UpAction.java b/designer-base/src/main/java/com/fr/design/actions/community/UpAction.java index 157f775b8c..9e550377f0 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/UpAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/UpAction.java @@ -2,6 +2,7 @@ package com.fr.design.actions.community; import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.menu.MenuKeySet; import com.fr.general.CloudCenter; import com.fr.log.FineLoggerFactory; @@ -38,7 +39,7 @@ public class UpAction extends UpdateAction try { Desktop.getDesktop().browse(new URI(url)); } catch (IOException exp) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser")); + FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser")); FineLoggerFactory.getLogger().error(exp.getMessage(), exp); } catch (URISyntaxException exp) { FineLoggerFactory.getLogger().error(exp.getMessage(), exp); diff --git a/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java b/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java index f3bfe5622e..f3c5236b52 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java @@ -21,7 +21,7 @@ import java.util.Map; import static javax.swing.JOptionPane.OK_CANCEL_OPTION; import static javax.swing.JOptionPane.OK_OPTION; import static javax.swing.JOptionPane.WARNING_MESSAGE; -import static javax.swing.JOptionPane.showConfirmDialog; +import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog; public final class WebPreviewUtils { diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index 17d19aab71..5277d2ebf1 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -2,6 +2,7 @@ package com.fr.design.actions.file.export; import com.fr.design.actions.JTemplateAction; import com.fr.design.base.mode.DesignModeContext; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.iprogressbar.FRProgressBar; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; @@ -132,10 +133,10 @@ public abstract class AbstractExportAction> extends JT E e = getEditingComponent(); if (!e.isALLSaved() && !DesignModeContext.isVcsMode()) { e.stopEditing(); - int returnVal = JOptionPane.showConfirmDialog( + int returnVal = FineJOptionPane.showConfirmDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + e.getEditingFILE() + "\" ?", - ProductConstants.PRODUCT_NAME, + Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE ); @@ -171,7 +172,7 @@ public abstract class AbstractExportAction> extends JT this.setProgress(100); FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); - JOptionPane.showMessageDialog( + FineJOptionPane.showMessageDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name); @@ -180,10 +181,10 @@ public abstract class AbstractExportAction> extends JT this.setProgress(100); target.closeTemplate(); FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - JOptionPane.showMessageDialog( + FineJOptionPane.showMessageDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Engine_Remote_Design_Permission_Denied"), - UIManager.getString("OptionPane.messageDialogTitle"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon") ); @@ -191,10 +192,10 @@ public abstract class AbstractExportAction> extends JT this.setProgress(100); target.closeTemplate(); FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - JOptionPane.showMessageDialog( + FineJOptionPane.showMessageDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Report_Export_Failed") + "\n" + path, - UIManager.getString("OptionPane.messageDialogTitle"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon") ); diff --git a/designer-base/src/main/java/com/fr/design/actions/help/ForumAction.java b/designer-base/src/main/java/com/fr/design/actions/help/ForumAction.java index 2d4814d2ed..0f3c5e9cc1 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/ForumAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/ForumAction.java @@ -6,6 +6,7 @@ package com.fr.design.actions.help; import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.menu.MenuKeySet; import com.fr.general.CloudCenter; import com.fr.log.FineLoggerFactory; @@ -47,7 +48,7 @@ public class ForumAction extends UpdateAction { try { Desktop.getDesktop().browse(new URI(url)); } catch (IOException exp) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser")); + FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser")); FineLoggerFactory.getLogger().error(exp.getMessage(), exp); } catch (URISyntaxException exp) { FineLoggerFactory.getLogger().error(exp.getMessage(), exp); diff --git a/designer-base/src/main/java/com/fr/design/actions/help/SupportQQAction.java b/designer-base/src/main/java/com/fr/design/actions/help/SupportQQAction.java index a118f9d878..16b8b19eba 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/SupportQQAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/SupportQQAction.java @@ -6,6 +6,7 @@ package com.fr.design.actions.help; import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.menu.MenuKeySet; import com.fr.log.FineLoggerFactory; @@ -37,7 +38,7 @@ public class SupportQQAction extends UpdateAction { try { Desktop.getDesktop().browse(new URI(ProductConstants.SUPPORT_QQ)); } catch (IOException exp) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser")); + FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser")); FineLoggerFactory.getLogger().error(exp.getMessage(), exp); } catch (URISyntaxException exp) { FineLoggerFactory.getLogger().error(exp.getMessage(), exp); diff --git a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java index 193c35775a..98f5f36530 100644 --- a/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java +++ b/designer-base/src/main/java/com/fr/design/condition/LiteConditionPane.java @@ -10,6 +10,7 @@ import com.fr.data.condition.ListCondition; import com.fr.data.condition.ObjectCondition; import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.UIFormula; import com.fr.design.formula.VariableResolver; @@ -123,7 +124,7 @@ public abstract class LiteConditionPane extends BasicBeanPa ExpandMutableTreeNode parentTreeNode = getParentTreeNode(); boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, false); if (result) { - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_BindColumn_This_Condition_Has_Been_Existed")); return; } @@ -222,7 +223,7 @@ public abstract class LiteConditionPane extends BasicBeanPa return; } - int returnVal = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), + int returnVal = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION); if (returnVal == JOptionPane.OK_OPTION) { @@ -610,7 +611,7 @@ public abstract class LiteConditionPane extends BasicBeanPa //修改的时候加入判断条件重复 REPORT-13441 boolean result = isExistedInParentTreeNode(parentTreeNode, liteCondition, true); if (result) { - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(LiteConditionPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_BindColumn_This_Condition_Has_Been_Existed")); return; } diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index 44ec26127b..25492c55ed 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -83,6 +83,7 @@ public abstract class DesignTableDataManager { //用于记录是否要弹出参数框 private static ThreadLocal threadLocal = new ThreadLocal(); + private static Map> columnCache = new HashMap<>(); /** * 清除全局 数据集缓存. @@ -113,11 +114,13 @@ public abstract class DesignTableDataManager { public static void closeTemplate(JTemplate template) { if (template != null) { + columnCache.remove(getEditingTableDataSource()); dsListenersMap.remove(template.getPath()); } } public static void envChange() { + columnCache.clear(); dsListenersMap.clear(); dsNameChangedMap.clear(); clearGlobalDs(); @@ -197,7 +200,51 @@ public abstract class DesignTableDataManager { java.util.Map resMap = getAllEditingDataSet(source); java.util.Map dsMap = getAllDataSetIncludingProcedure(resMap); TableDataWrapper tabledataWrapper = dsMap.get(dsName); - return tabledataWrapper == null ? new String[0] : tabledataWrapper.calculateColumnNameList().toArray(new String[0]); + if (tabledataWrapper == null) { + return new String[0]; + } else { + return getSelectedColumnNamesFromCache(source, dsName, tabledataWrapper); + } + } + + private static String[] getSelectedColumnNamesFromCache(TableDataSource dataSource, String dsName, TableDataWrapper tableDataWrapper) { + Map map = columnCache.get(dataSource); + if (map == null) { + map = new HashMap<>(); + String[] columnNames = tableDataWrapper.calculateColumnNameList().toArray(new String[0]); + map.put(dsName, columnNames); + columnCache.put(dataSource, map); + return columnNames; + } else { + String[] columnNames = map.get(dsName); + if (columnNames == null) { + columnNames = tableDataWrapper.calculateColumnNameList().toArray(new String[0]); + map.put(dsName, columnNames); + return columnNames; + } else { + return columnNames; + } + } + } + + public static void removeSelectedColumnNames(String dsName) { + Map map = columnCache.get(getEditingTableDataSource()); + if (map == null) { + return; + } + map.remove(dsName); + } + + public static void addDsColumnNames(String dsName, String[] columnNames) { + TableDataSource dataSource = getEditingTableDataSource(); + Map map = columnCache.get(dataSource); + if (map == null) { + map = new HashMap<>(); + map.put(dsName, columnNames); + columnCache.put(dataSource, map); + } else { + map.put(dsName, columnNames); + } } /** diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java index 028f71363b..b734968b36 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java @@ -17,6 +17,7 @@ import com.fr.design.data.datapane.preview.PreviewLabel; import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.tabledata.Prepare4DataSourceChange; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.icombobox.FRTreeComboBox; import com.fr.design.gui.icombobox.FilterableComboBoxModel; import com.fr.design.gui.icombobox.UIComboBox; @@ -332,7 +333,7 @@ public class ChoosePane extends BasicBeanPane implements Refresha DBUtils.refreshDatabase(); String schema = StringUtils.isEmpty(schemaBox.getSelectedItem()) ? null : schemaBox.getSelectedItem(); DataCoreUtils.refreshTables(getConnection(), TableProcedure.TABLE, schema); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Successfully") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Database"), + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Successfully") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh_Database"), JOptionPane.INFORMATION_MESSAGE); } @@ -438,7 +439,7 @@ public class ChoosePane extends BasicBeanPane implements Refresha } } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"), + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Failed"), JOptionPane.ERROR_MESSAGE); } } @@ -462,7 +463,7 @@ public class ChoosePane extends BasicBeanPane implements Refresha } if (!connect) { DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); - JOptionPane.showMessageDialog(designerFrame, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"), + FineJOptionPane.showMessageDialog(designerFrame, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Failed"), JOptionPane.ERROR_MESSAGE); failedToFindTable(); return null; diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java index 59880cc4ef..c3fd5065df 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java @@ -5,6 +5,7 @@ import com.fr.data.TableDataSource; import com.fr.data.api.StoreProcedureAssist; import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.design.data.DesignTableDataManager; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.ilist.ListModelElement; @@ -49,7 +50,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData if (StringUtils.isEmpty(tempName)) { isNamePermitted = false; nameableList.stopEditing(); - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Empty_Name_Tips")); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Empty_Name_Tips")); setIllegalIndex(editingIndex); return; } @@ -58,12 +59,12 @@ public class TableDataPaneListPane extends JListControlPane implements TableData && isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) { isNamePermitted = false; nameableList.stopEditing(); - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Duplicate_Name_Tips", tempName)); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Duplicate_Name_Tips", tempName)); setIllegalIndex(editingIndex); } else if (editingType instanceof StoreProcedure && isIncludeUnderline(tempName)) { isNamePermitted = false; nameableList.stopEditing(); - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Stored_Procedure_Name_Tips")); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Stored_Procedure_Name_Tips")); setIllegalIndex(editingIndex); } if (nameableList.getSelectedValue() instanceof ListModelElement) { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 56f81e9a5b..7c8b1f46b2 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -16,6 +16,9 @@ import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.file.HistoryTemplateListCache; +import com.fr.design.fun.TableDataDefineProvider; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; @@ -24,12 +27,12 @@ import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.icon.IconPathConstants; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ToolBarDef; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; - import com.fr.general.NameObject; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; @@ -38,8 +41,13 @@ import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.core.PropertyChangeAdapter; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.ToolTipManager; +import java.awt.BorderLayout; +import java.awt.GridLayout; import java.awt.dnd.DnDConstants; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; @@ -89,23 +97,9 @@ public class TableDataTreePane extends BasicTableDataTreePane { createAddMenuDef(); - GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) { - - @Override - public void on(PluginEvent event) { - - addMenuDef.clearShortCuts(); - createAddMenuDef(); - } - }, new PluginFilter() { - - @Override - public boolean accept(PluginContext context) { + // 创建插件监听 + createPluginListener(); - return context.contain(PluginModule.ExtraDesign); - } - }); - editAction = new EditAction(); removeAction = new RemoveAction(); previewTableDataAction = new PreviewTableDataAction(dataTree); @@ -145,8 +139,58 @@ public class TableDataTreePane extends BasicTableDataTreePane { new TableDataTreeDragSource(dataTree, DnDConstants.ACTION_COPY); checkButtonEnabled(); } - - + + private void createPluginListener() { + + //菜单栏监听 + GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) { + + @Override + public void on(PluginEvent event) { + + addMenuDef.clearShortCuts(); + createAddMenuDef(); + } + }, new PluginFilter() { + + @Override + public boolean accept(PluginContext context) { + + return context.contain(PluginModule.ExtraDesign); + } + }); + + //监听数据集插件 + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + @Override + public void on(PluginEvent event) { + //REPORT-25577 + //如果数据集插件禁用或启用。需要清空当前模板中的缓存 + reloadCurrTemplate(); + } + + private void reloadCurrTemplate() { + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); + if (accept(jt)) { + HistoryTemplateListCache.getInstance().closeSelectedReport(jt); + DesignerContext.getDesignerFrame().openTemplate(jt.getEditingFILE()); + } + } + + private boolean accept(JTemplate jt) { + + return jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists(); + } + }, new PluginFilter() { + @Override + public boolean accept(PluginContext pluginContext) { + + return pluginContext.contain(TableDataDefineProvider.XML_TAG); + } + }); + } + + protected void checkButtonEnabled() { super.checkButtonEnabled(editAction, previewTableDataAction, removeAction, op, dataTree); } @@ -243,6 +287,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { if (selectedNO == null) { return; } + DesignTableDataManager.removeSelectedColumnNames(selectedNO.getName()); dgEdit(((AbstractTableDataWrapper) selectedNO.getObject()).creatTableDataPane(), selectedNO.getName(), false); } } @@ -263,7 +308,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { return; } - int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + ":" + selectedNO.getName() + "?", + int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + ":" + selectedNO.getName() + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (returnVal == JOptionPane.OK_OPTION) { // richer:这个地方为什么要在DataSourceTree里面去remove呢?多此一举吧 @@ -274,6 +319,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { dataTree.setSelectionRow(dataTree.getRowCount() - 1); fireDSChanged(); checkButtonEnabled(); + DesignTableDataManager.removeSelectedColumnNames(selectedNO.getName()); } } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java index a14944d5e6..1e3f96a986 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java @@ -4,6 +4,7 @@ import com.fr.data.impl.Connection; import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.fun.ConnectionProvider; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameObjectCreator; @@ -43,7 +44,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh String tempName = getEditingName(); if (StringUtils.isEmpty(tempName)) { nameableList.stopEditing(); - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connection_Empty_Name")); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connection_Empty_Name")); setIllegalIndex(editingIndex); isNamePermitted = false; return; @@ -53,7 +54,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh isNamePermitted = false; nameableList.stopEditing(); String message = Toolkit.i18nText("Fine-Design_Basic_Connection_Duplicate_Name", tempName); - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), message); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), message); setIllegalIndex(editingIndex); } if (isNamePermitted && !ComparatorUtils.equals(tempName, selectedName)) { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java index 01d7c9a6ff..2cd16b4940 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java @@ -14,6 +14,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ilable.UILabel; @@ -303,7 +304,7 @@ public class PreviewTablePane extends BasicPane { return; } FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), columnErrMessage, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), columnErrMessage, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE); } private void populate(TableData tableData) throws Exception { @@ -394,8 +395,8 @@ public class PreviewTablePane extends BasicPane { } catch (Exception e) { if (!(e instanceof CancellationException)) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), - null, 0, UIManager.getIcon("OptionPane.errorIcon")); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); } dialog.setVisible(false); } finally { diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java index f55195d3b3..5a8e292220 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java @@ -14,6 +14,7 @@ import com.fr.data.impl.XMLTableData; import com.fr.design.actions.UpdateAction; import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; @@ -222,7 +223,7 @@ public class FileTableDataPane extends AbstractTableDataPane { public void actionPerformed(ActionEvent arg0) { String uri = ParameterHelper.analyze4Templatee(urlText.getText(), params); if (!checkURL(uri)) { - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(FileTableDataPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add_JS_warning")); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(FileTableDataPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add_JS_warning")); return; } params = getEditorPaneParameter(); @@ -234,10 +235,10 @@ public class FileTableDataPane extends AbstractTableDataPane { FineLoggerFactory.getLogger().error(e.getMessage(), e); } if (in == null) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"), - null, 0, UIManager.getIcon("OptionPane.errorIcon")); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon")); } else { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Connection_Successfully")); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Connection_Successfully")); try { in.close(); } catch (IOException e) { diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java index 1595ee0452..9c11bc72aa 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java @@ -17,6 +17,7 @@ import com.fr.design.data.datapane.sqlpane.SQLEditPane; import com.fr.design.data.tabledata.ResponseDataSourceChange; import com.fr.design.data.tabledata.StoreProcedureWorkerListener; import com.fr.design.data.tabledata.wrapper.StoreProcedureDataWrapper; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; @@ -239,7 +240,7 @@ public class ProcedureDataPane extends AbstractTableDataPane imp try { throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); } catch (Exception e) { - JOptionPane.showMessageDialog(ProcedureDataPane.this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); + FineJOptionPane.showMessageDialog(ProcedureDataPane.this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java index fc94a0618e..812eb25af3 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java @@ -65,6 +65,7 @@ public abstract class AbstractTableDataWrapper implements TableDataWrapper { } } columnNameList = DesignTableDataManager.getColumnNamesByTableData(embeddedTableData); + DesignTableDataManager.addDsColumnNames(name, columnNameList.toArray(new String[0])); return columnNameList; } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java index 49c7dcd119..cefc0e1128 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java @@ -9,6 +9,7 @@ import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.iprogressbar.AutoProgressBar; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.mainframe.DesignerContext; @@ -102,7 +103,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { return columnNameList; } if (!createStore(false)) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_No_TableData")); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_No_TableData")); return new ArrayList(); } columnNameList = Arrays.asList(procedureDataModel.getColumnName()); @@ -219,7 +220,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper { } catch (Exception e) { if (!(e instanceof CancellationException)) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage()); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), e.getMessage()); } loadingBar.close(); } diff --git a/designer-base/src/main/java/com/fr/design/dialog/FineJOptionPane.java b/designer-base/src/main/java/com/fr/design/dialog/FineJOptionPane.java new file mode 100644 index 0000000000..4a4424d9f5 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/dialog/FineJOptionPane.java @@ -0,0 +1,290 @@ +package com.fr.design.dialog; + +import com.fr.invoke.Reflect; + +import javax.swing.Icon; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import java.awt.Component; +import java.awt.HeadlessException; +import java.util.HashMap; +import java.util.Map; + +/** + * @author Joe + * @version 10.0 + * Created by Joe on 12/5/2019 + */ +public class FineJOptionPane extends JOptionPane { + + public final static String[] OPTION_DEFAULT = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_OK") }; + public final static String[] OPTION_YES_NO = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Yes"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No") }; + public final static String[] OPTION_YES_NO_CANCEL = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Yes"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Cancel") }; + public final static String[] OPTION_OK_CANCEL = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_OK"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Cancel") }; + + //选项类型optionType 和 选项字符串数组 一一对应 + private final static Map OPTION_MAP = new HashMap<>(); + + static { + OPTION_MAP.put(DEFAULT_OPTION, OPTION_DEFAULT); + OPTION_MAP.put(YES_NO_OPTION, OPTION_YES_NO); + OPTION_MAP.put(YES_NO_CANCEL_OPTION, OPTION_YES_NO_CANCEL); + OPTION_MAP.put(OK_CANCEL_OPTION, OPTION_OK_CANCEL); + } + + private final static String MESSAGE_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"); + private final static String CONFIRM_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"); + private final static String INPUT_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"); + + /** + * 使用默认 标题 和 消息类型 的消息提示弹出框 + * @param parentComponent 父容器 + * @param message 具体的提示消息 + * @throws HeadlessException + */ + public static void showMessageDialog(Component parentComponent, Object message) + throws HeadlessException { + showMessageDialog(parentComponent, message, MESSAGE_DIALOG_TITLE, + INFORMATION_MESSAGE); + } + + /** + * 使用默认 Icon 的消息提示弹出框 + * @param parentComponent 父容器 + * @param message 具体的提示消息 + * @param title 标题 + * @param messageType 消息类型 + * @throws HeadlessException + */ + public static void showMessageDialog(Component parentComponent, Object message, + String title, int messageType) + throws HeadlessException { + showMessageDialog(parentComponent, message, title, messageType, null); + } + + /** + * 使用默认 选项类型、选项 和 初始选项 的消息提示弹出框 + * @param parentComponent 父容器 + * @param message 具体的提示消息 + * @param title 标题 + * @param messageType 消息类型 + * @param icon 图标 + * @throws HeadlessException + */ + public static void showMessageDialog(Component parentComponent, Object message, + String title, int messageType, Icon icon) + throws HeadlessException { + showMessageDialog(parentComponent, message, title, DEFAULT_OPTION, + messageType, icon, OPTION_DEFAULT, null); + } + + /** + * 自定义的消息提示弹出框 + * @param parentComponent 父容器 + * @param message 具体的提示消息 + * @param title 标题 + * @param optionType 选项类型 + * @param messageType 消息类型 + * @param icon 图标 + * @param options 选项 + * @param initialValue 初始选项 + * @throws HeadlessException + */ + public static void showMessageDialog(Component parentComponent, Object message, + String title, int optionType, int messageType, + Icon icon, Object[] options, Object initialValue) + throws HeadlessException { + showOptionDialog(parentComponent, message, title, optionType, + messageType, icon, options, initialValue); + } + + /** + * 使用默认 标题 和 选项类型 的确认弹出框 + * @param parentComponent 父容器 + * @param message 具体的提示消息 + * @throws HeadlessException + */ + public static int showConfirmDialog(Component parentComponent, Object message) + throws HeadlessException { + return showConfirmDialog(parentComponent, message, + CONFIRM_DIALOG_TITLE, + YES_NO_CANCEL_OPTION); + } + + /** + * 使用默认 消息类型 的确认弹出框 + * @param parentComponent 父容器 + * @param message 具体的提示消息 + * @param title 标题 + * @param optionType 选项类型 + * @throws HeadlessException + */ + public static int showConfirmDialog(Component parentComponent, Object message, + String title, int optionType) throws HeadlessException { + return showConfirmDialog(parentComponent, message, title, optionType, + QUESTION_MESSAGE); + } + + /** + * 使用默认 Icon 的确认弹出框 + * @param parentComponent 父容器 + * @param message 具体的提示消息 + * @param title 标题 + * @param optionType 选项类型 + * @param messageType 消息类型 + * @throws HeadlessException + */ + public static int showConfirmDialog(Component parentComponent, Object message, + String title, int optionType, int messageType) + throws HeadlessException { + return showConfirmDialog(parentComponent, message, title, optionType, + messageType, null); + } + + /** + * 根据 选项类型 获取对应 选项 ,且使用默认 初始选项 的确认弹出框 + * @param parentComponent 父容器 + * @param message 具体的提示消息 + * @param title 标题 + * @param optionType 选项类型 + * @param messageType 消息类型 + * @param icon 图标 + * @throws HeadlessException + */ + public static int showConfirmDialog(Component parentComponent, Object message, + String title, int optionType, int messageType, Icon icon) + throws HeadlessException { + String[] options = OPTION_MAP.get(optionType); + return showConfirmDialog(parentComponent, message, title, optionType, + messageType, icon, options, options[0]); + } + + /** + * 自定义的确认弹出框 + * @param parentComponent 父容器 + * @param message 具体的提示消息 + * @param title 标题 + * @param optionType 选项类型 + * @param messageType 消息类型 + * @param icon 图标 + * @param options 选项 + * @param initialValue 初始选项 + * @throws HeadlessException + */ + public static int showConfirmDialog(Component parentComponent, Object message, + String title, int optionType, int messageType, Icon icon, + Object[] options, Object initialValue) + throws HeadlessException { + return showOptionDialog(parentComponent, message, title, optionType, + messageType, icon, options, initialValue); + } + + /** + * 指定消息内容的输入弹出框 + * @param message 消息内容 + * @return + * @throws HeadlessException + */ + public static String showInputDialog(Object message) + throws HeadlessException { + return showInputDialog(null, message); + } + + /** + * 使用默认 标题 和 消息类型 的输入弹出框 + * @param parentComponent 父容器 + * @param message 消息内容 + * @return + * @throws HeadlessException + */ + public static String showInputDialog(Component parentComponent, + Object message) throws HeadlessException { + return showInputDialog(parentComponent, message, INPUT_DIALOG_TITLE, QUESTION_MESSAGE); + } + + /** + * 使用默认 标题、消息类型、Icon 和 选项 的输入弹出框 + * @param parentComponent 父容器 + * @param message 消息类型 + * @param initialSelectionValue 初始选项 + * @return + */ + public static String showInputDialog(Component parentComponent, Object message, + Object initialSelectionValue) { + return (String)showInputDialog(parentComponent, message, + INPUT_DIALOG_TITLE, QUESTION_MESSAGE, null, null, + initialSelectionValue); + } + + /** + * 使用默认 父容器、消息内容 和 初始选项 的输入弹出框 + * @param message 消息内容 + * @param initialSelectionValue 初始选项 + * @return + */ + public static String showInputDialog(Object message, Object initialSelectionValue) { + return showInputDialog(null, message, initialSelectionValue); + } + + /** + * 使用默认 Icon、选项 和 初始选项 的输入弹出框 + * @param parentComponent 父容器 + * @param message 消息内容 + * @param title 标题 + * @param messageType 消息类型 + * @return + * @throws HeadlessException + */ + public static String showInputDialog(Component parentComponent, + Object message, String title, int messageType) + throws HeadlessException { + return (String)showInputDialog(parentComponent, message, title, + messageType, null, null, null); + } + + /** + * 自定义的输入弹出框 + * @param parentComponent 父容器 + * @param message 消息内容 + * @param title 标题 + * @param messageType 消息类型 + * @param icon 图标 + * @param selectionValues 选项 + * @param initialSelectionValue 初始选项 + * @return + * @throws HeadlessException + */ + public static Object showInputDialog(Component parentComponent, + Object message, String title, int messageType, Icon icon, + Object[] selectionValues, Object initialSelectionValue) + throws HeadlessException { + JOptionPane pane = new JOptionPane(message, messageType, + OK_CANCEL_OPTION, icon, + OPTION_OK_CANCEL, null); + + pane.setWantsInput(true); + pane.setSelectionValues(selectionValues); + pane.setInitialSelectionValue(initialSelectionValue); + pane.setComponentOrientation(((parentComponent == null) ? + getRootFrame() : parentComponent).getComponentOrientation()); + + int style = Reflect.on(JOptionPane.class).call("styleFromMessageType", messageType).get(); + JDialog dialog = Reflect.on(pane).call("createDialog", parentComponent, title, style).get(); + + pane.selectInitialValue(); + dialog.show(); + dialog.dispose(); + + Object value = pane.getInputValue(); + + if (value == UNINITIALIZED_VALUE) { + return null; + } + return value; + } + +} 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 c4e07e9676..a885c51883 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 @@ -167,7 +167,7 @@ public abstract class UIDialog extends JDialog { try { checkValid(); } catch (Exception exp) { - JOptionPane.showMessageDialog(this, exp.getMessage()); + FineJOptionPane.showMessageDialog(this, exp.getMessage()); return; } diff --git a/designer-base/src/main/java/com/fr/design/editor/DoubleDeckValueEditorPane.java b/designer-base/src/main/java/com/fr/design/editor/DoubleDeckValueEditorPane.java index de8df9a718..6e6c3d8b9b 100644 --- a/designer-base/src/main/java/com/fr/design/editor/DoubleDeckValueEditorPane.java +++ b/designer-base/src/main/java/com/fr/design/editor/DoubleDeckValueEditorPane.java @@ -3,6 +3,7 @@ package com.fr.design.editor; import com.fr.base.BaseFormula; import com.fr.design.DesignerEnvManager; import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.editor.editor.ColumnIndexEditor; import com.fr.design.editor.editor.ColumnNameEditor; import com.fr.design.editor.editor.Editor; @@ -302,8 +303,8 @@ public class DoubleDeckValueEditorPane extends BasicPane implements UIObserver, DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager(); if (designerEnvManager.isSupportStringToFormula()) { if (!designerEnvManager.isDefaultStringToFormula()) { - int returnValue = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit_String_To_Formula") - + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.YES_NO_OPTION); + int returnValue = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit_String_To_Formula") + + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION); if (returnValue == JOptionPane.OK_OPTION) { setCurrentEditor(j); diff --git a/designer-base/src/main/java/com/fr/design/editor/ValueEditorPane.java b/designer-base/src/main/java/com/fr/design/editor/ValueEditorPane.java index 588fc1218a..503929e228 100644 --- a/designer-base/src/main/java/com/fr/design/editor/ValueEditorPane.java +++ b/designer-base/src/main/java/com/fr/design/editor/ValueEditorPane.java @@ -3,6 +3,7 @@ package com.fr.design.editor; import com.fr.base.BaseFormula; import com.fr.design.DesignerEnvManager; import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.editor.editor.ColumnNameEditor; import com.fr.design.editor.editor.Editor; import com.fr.design.editor.editor.FormulaEditor; @@ -283,8 +284,8 @@ public class ValueEditorPane extends BasicPane implements UIObserver, GlobalName DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager(); if (designerEnvManager.isSupportStringToFormula()) { if (!designerEnvManager.isDefaultStringToFormula()) { - int returnValue = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit_String_To_Formula") - + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.YES_NO_OPTION); + int returnValue = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit_String_To_Formula") + + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION); if (returnValue == JOptionPane.OK_OPTION) { setCurrentEditor(j); diff --git a/designer-base/src/main/java/com/fr/design/extra/LoginWebPane.java b/designer-base/src/main/java/com/fr/design/extra/LoginWebPane.java index a6b60b605e..d0a155a582 100644 --- a/designer-base/src/main/java/com/fr/design/extra/LoginWebPane.java +++ b/designer-base/src/main/java/com/fr/design/extra/LoginWebPane.java @@ -1,5 +1,6 @@ package com.fr.design.extra; +import com.fr.design.dialog.FineJOptionPane; import javafx.application.Platform; import javafx.embed.swing.JFXPanel; import javafx.event.EventHandler; @@ -46,7 +47,7 @@ public class LoginWebPane extends JFXPanel { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - JOptionPane.showMessageDialog(LoginWebPane.this, message); + FineJOptionPane.showMessageDialog(LoginWebPane.this, message); } }); } diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java b/designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java index 115cc87dc1..f3dcec231d 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java @@ -1,6 +1,7 @@ package com.fr.design.extra; import com.fr.config.MarketConfig; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.extra.tradition.callback.UpdateOnlineCallback; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ilable.UILabel; @@ -181,14 +182,14 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane jt = getCurrentEditingTemplate(); + boolean access = jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists(); + if (access) { + closeSelectedReport(jt); + DesignerContext.getDesignerFrame().openTemplate(jt.getEditingFILE()); + } + } + } 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 5a722239c6..d9aa2f5be0 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 @@ -5,6 +5,7 @@ import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIScrollPopUpMenu; import com.fr.design.i18n.Toolkit; @@ -678,8 +679,8 @@ public class MutilTempalteTabPane extends JComponent { if (!specifiedTemplate.isALLSaved() && !DesignerMode.isVcsMode()) { specifiedTemplate.stopEditing(); - int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", - ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); + int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", + Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (returnVal == JOptionPane.YES_OPTION) { specifiedTemplate.saveTemplate(); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName())); @@ -931,7 +932,7 @@ public class MutilTempalteTabPane extends JComponent { //如果在权限编辑情况下,不允许切换到表单类型的工作簿 if (DesignerMode.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) { DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex)); - JOptionPane.showMessageDialog(MutilTempalteTabPane.this, Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported") + FineJOptionPane.showMessageDialog(MutilTempalteTabPane.this, Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported") + "!", Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); MutilTempalteTabPane.this.repaint(); return; diff --git a/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java b/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java index 295b63385b..f271f23c0e 100644 --- a/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java @@ -1 +1 @@ -package com.fr.design.file; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilist.UIList; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.ProductConstants; import javax.swing.*; import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; /** * Author : daisy * Date: 13-8-9 * Time: 下午3:41 */ public class SaveSomeTemplatePane extends BasicPane { private UICheckBox[] templateCheckBoxes = null; private BasicDialog dialog; private JPanel templatesChoosePane; private UIScrollPane scrollPane; private java.util.List> unSavedTemplate = new ArrayList>(); private boolean isAllSaved = false; //该变量用来判断是在关闭其他模板或是关闭设计器的时候,是否需要判断当前模板有没有保存 private boolean isJudgeCurrentEditingTemplate = true; public SaveSomeTemplatePane(boolean isNeedTojudgeCurrent) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); if (this.dialog == null) { this.dialog = this.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override public void doOk() { for (int i = 0; i < templateCheckBoxes.length; i++) { if (templateCheckBoxes[i].isSelected()) { saveSelectedTemplate(unSavedTemplate.get(i)); } } isAllSaved = true; } public void doCancel() { isAllSaved = false; } }); } UILabel tip = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select_The_Source_To_Save")); this.add(tip, BorderLayout.NORTH); templatesChoosePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); UIScrollPane scrollPane = new UIScrollPane(templatesChoosePane); this.add(scrollPane, BorderLayout.CENTER); this.isJudgeCurrentEditingTemplate = isNeedTojudgeCurrent; } private void initTemplatesChoosePane() { templatesChoosePane.setBorder(BorderFactory.createTitledBorder("")); for (int i = 0; i < unSavedTemplate.size(); i++) { templateCheckBoxes[i] = new UICheckBox(unSavedTemplate.get(i).getEditingFILE().getName()); templateCheckBoxes[i].setSelected(true); } final UIList templatesList = new UIList(templateCheckBoxes); templatesList.setModel(new UnSeletedTemplateListDataMode()); templatesList.setCellRenderer(new UnSelectedListCellRender()); templatesList.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { super.mousePressed(e); int index = templatesList.getSelectedIndex(); if (index < 0) { return; } UICheckBox checkBox = (UICheckBox) templatesList.getModel().getElementAt(index); checkBox.setSelected(!checkBox.isSelected()); templatesList.repaint(); } }); final UICheckBox filenameCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Choose_All")); filenameCheckBox.setSelected(true); filenameCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { boolean isSelected = filenameCheckBox.isSelected(); for (int i = 0; i < templatesList.getModel().getSize(); i++) { UICheckBox checkBox = (UICheckBox) templatesList.getModel().getElementAt(i); checkBox.setSelected(isSelected); } templatesList.repaint(); } }); templatesChoosePane.add(filenameCheckBox, BorderLayout.NORTH); templatesChoosePane.add(templatesList, BorderLayout.CENTER); } public boolean showSavePane() { populate(); //如果有未保存的文件 ,则跳出保存对话框,选择要存储的项目 if (!unSavedTemplate.isEmpty()) { dialog.setVisible(true); } else { isAllSaved = true; } return isAllSaved; } public void populate() { java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); JTemplate currentTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); for (int i = 0; i < opendedTemplate.size(); i++) { if (isneedToAdd(opendedTemplate.get(i), currentTemplate)) { unSavedTemplate.add(opendedTemplate.get(i)); } } templateCheckBoxes = new UICheckBox[unSavedTemplate.size()]; initTemplatesChoosePane(); } private boolean isneedToAdd(JTemplate template, JTemplate currentTemplate) { //所有模板都判断是不是保存 if (isJudgeCurrentEditingTemplate) { return !template.isALLSaved(); } //当前编辑的模板不判断是否已经保存 if (ComparatorUtils.equals(template, currentTemplate)) { return false; } else { return !template.isALLSaved(); } } private void saveSelectedTemplate(JTemplate specifiedTemplate) { if (!specifiedTemplate.isSaved()) { specifiedTemplate.stopEditing(); specifiedTemplate.saveTemplate(); } FineLoggerFactory.getLogger().info( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName())); } public int saveLastOneTemplate() { JTemplate specifiedTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (!specifiedTemplate.isALLSaved()) { specifiedTemplate.stopEditing(); int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (returnVal == JOptionPane.YES_OPTION && specifiedTemplate.saveTemplate()) { specifiedTemplate.saveTemplate(); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName())); } return returnVal; } return JOptionPane.YES_OPTION; } protected String title4PopupWindow() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Save"); } private class UnSelectedListCellRender extends DefaultListCellRenderer { @Override public Component getListCellRendererComponent(JList list, Object value, int index, final boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); templateCheckBoxes[index] = (UICheckBox) value; templateCheckBoxes[index].setBackground(list.getBackground()); return templateCheckBoxes[index]; } } private class UnSeletedTemplateListDataMode extends AbstractListModel { @Override public int getSize() { return templateCheckBoxes.length; } @Override public UICheckBox getElementAt(int index) { if (index > getSize() - 1 || index < 0) { return null; } return templateCheckBoxes[index]; } } } \ No newline at end of file +package com.fr.design.file; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilist.UIList; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.ProductConstants; import javax.swing.*; import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; /** * Author : daisy * Date: 13-8-9 * Time: 下午3:41 */ public class SaveSomeTemplatePane extends BasicPane { private UICheckBox[] templateCheckBoxes = null; private BasicDialog dialog; private JPanel templatesChoosePane; private UIScrollPane scrollPane; private java.util.List> unSavedTemplate = new ArrayList>(); private boolean isAllSaved = false; //该变量用来判断是在关闭其他模板或是关闭设计器的时候,是否需要判断当前模板有没有保存 private boolean isJudgeCurrentEditingTemplate = true; public SaveSomeTemplatePane(boolean isNeedTojudgeCurrent) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); if (this.dialog == null) { this.dialog = this.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { @Override public void doOk() { for (int i = 0; i < templateCheckBoxes.length; i++) { if (templateCheckBoxes[i].isSelected()) { saveSelectedTemplate(unSavedTemplate.get(i)); } } isAllSaved = true; } public void doCancel() { isAllSaved = false; } }); } UILabel tip = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select_The_Source_To_Save")); this.add(tip, BorderLayout.NORTH); templatesChoosePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); UIScrollPane scrollPane = new UIScrollPane(templatesChoosePane); this.add(scrollPane, BorderLayout.CENTER); this.isJudgeCurrentEditingTemplate = isNeedTojudgeCurrent; } private void initTemplatesChoosePane() { templatesChoosePane.setBorder(BorderFactory.createTitledBorder("")); for (int i = 0; i < unSavedTemplate.size(); i++) { templateCheckBoxes[i] = new UICheckBox(unSavedTemplate.get(i).getEditingFILE().getName()); templateCheckBoxes[i].setSelected(true); } final UIList templatesList = new UIList(templateCheckBoxes); templatesList.setModel(new UnSeletedTemplateListDataMode()); templatesList.setCellRenderer(new UnSelectedListCellRender()); templatesList.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { super.mousePressed(e); int index = templatesList.getSelectedIndex(); if (index < 0) { return; } UICheckBox checkBox = (UICheckBox) templatesList.getModel().getElementAt(index); checkBox.setSelected(!checkBox.isSelected()); templatesList.repaint(); } }); final UICheckBox filenameCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Choose_All")); filenameCheckBox.setSelected(true); filenameCheckBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { boolean isSelected = filenameCheckBox.isSelected(); for (int i = 0; i < templatesList.getModel().getSize(); i++) { UICheckBox checkBox = (UICheckBox) templatesList.getModel().getElementAt(i); checkBox.setSelected(isSelected); } templatesList.repaint(); } }); templatesChoosePane.add(filenameCheckBox, BorderLayout.NORTH); templatesChoosePane.add(templatesList, BorderLayout.CENTER); } public boolean showSavePane() { populate(); //如果有未保存的文件 ,则跳出保存对话框,选择要存储的项目 if (!unSavedTemplate.isEmpty()) { dialog.setVisible(true); } else { isAllSaved = true; } return isAllSaved; } public void populate() { java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); JTemplate currentTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); for (int i = 0; i < opendedTemplate.size(); i++) { if (isneedToAdd(opendedTemplate.get(i), currentTemplate)) { unSavedTemplate.add(opendedTemplate.get(i)); } } templateCheckBoxes = new UICheckBox[unSavedTemplate.size()]; initTemplatesChoosePane(); } private boolean isneedToAdd(JTemplate template, JTemplate currentTemplate) { //所有模板都判断是不是保存 if (isJudgeCurrentEditingTemplate) { return !template.isALLSaved(); } //当前编辑的模板不判断是否已经保存 if (ComparatorUtils.equals(template, currentTemplate)) { return false; } else { return !template.isALLSaved(); } } private void saveSelectedTemplate(JTemplate specifiedTemplate) { if (!specifiedTemplate.isSaved()) { specifiedTemplate.stopEditing(); specifiedTemplate.saveTemplate(); } FineLoggerFactory.getLogger().info( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName())); } public int saveLastOneTemplate() { JTemplate specifiedTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); if (!specifiedTemplate.isALLSaved()) { specifiedTemplate.stopEditing(); int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + specifiedTemplate.getEditingFILE() + "\" ?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (returnVal == JOptionPane.YES_OPTION && specifiedTemplate.saveTemplate()) { specifiedTemplate.saveTemplate(); FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName())); } return returnVal; } return JOptionPane.YES_OPTION; } protected String title4PopupWindow() { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Save"); } private class UnSelectedListCellRender extends DefaultListCellRenderer { @Override public Component getListCellRendererComponent(JList list, Object value, int index, final boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); templateCheckBoxes[index] = (UICheckBox) value; templateCheckBoxes[index].setBackground(list.getBackground()); return templateCheckBoxes[index]; } } private class UnSeletedTemplateListDataMode extends AbstractListModel { @Override public int getSize() { return templateCheckBoxes.length; } @Override public UICheckBox getElementAt(int index) { if (index > getSize() - 1 || index < 0) { return null; } return templateCheckBoxes[index]; } } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 1708c07533..93001bde44 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -4,6 +4,7 @@ package com.fr.design.file; import com.fr.base.FRContext; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itree.filetree.TemplateFileTree; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; @@ -254,16 +255,16 @@ public class TemplateTreePane extends JPanel implements FileOperations { ? Toolkit.i18nText("Fine-Design_Basic_Confirm_Delete_Folder") : Toolkit.i18nText("Fine-Design_Basic_Confirm_Delete_File"); - if (JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), + if (FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), tipContent, - UIManager.getString("OptionPane.messageDialogTitle"), + Toolkit.i18nText("Fine-Design_Basic_Confirm"), YES_NO_OPTION) == JOptionPane.YES_OPTION) { // 删除所有选中的即可 if (!deleteNodes(Arrays.asList(treeNodes))) { - JOptionPane.showConfirmDialog(null, + FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Delete_Failure"), - UIManager.getString("OptionPane.messageDialogTitle"), + Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); } @@ -277,24 +278,24 @@ public class TemplateTreePane extends JPanel implements FileOperations { if (deletableNodes.isEmpty()) { // 提醒被锁定模板无法删除 - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Unable_Delete_Locked_File"), - Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), WARNING_MESSAGE); return; } - if (JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), + if (FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), tipContent, - UIManager.getString("OptionPane.messageDialogTitle"), + Toolkit.i18nText("Fine-Design_Basic_Confirm"), YES_NO_OPTION) == JOptionPane.YES_OPTION) { // 删除其他 if (!deleteNodes(deletableNodes)) { - JOptionPane.showConfirmDialog(null, + FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Delete_Failure"), - UIManager.getString("OptionPane.messageDialogTitle"), + Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); } @@ -415,9 +416,9 @@ public class TemplateTreePane extends JPanel implements FileOperations { } if (!lockedNodes.isEmpty()) { - JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), + FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Warn_Rename_Lock_File"), - UIManager.getString("OptionPane.messageDialogTitle"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE); return true; } 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 a8c8c34779..dd8b5ab521 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 @@ -8,6 +8,7 @@ import com.fr.design.border.UIRoundedBorder; import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; @@ -583,14 +584,15 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { // alex:继续往下面走,expression为null时告知不合法公式 } - JOptionPane.showMessageDialog( + FineJOptionPane.showMessageDialog( FormulaPane.this, /* * alex:仅仅只需要根据expression是否为null作合法性判断 * 不需要eval * TODO 但有个问题,有些函数的参数个数是有规定的,何以判别之 */ - (expression != null ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Valid_Formula") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula")) + ".", ProductConstants.PRODUCT_NAME, + (expression != null ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Valid_Formula") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FormulaD_Invalid_Formula")) + ".", + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE); } } diff --git a/designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java b/designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java index a3bdbae216..9b5a95a431 100644 --- a/designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java @@ -2,6 +2,7 @@ package com.fr.design.formula; import com.fr.base.FRContext; import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; @@ -161,11 +162,11 @@ public class JavaEditorPane extends BasicPane { } try { WorkContext.getWorkResource().write(StableUtils.pathJoin(ProjectConstants.CLASSES_NAME, getJavaPath()), text.getBytes(EncodeConstants.ENCODING_UTF_8)); - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Common_Save_Successfully") + "!"); + FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Common_Save_Successfully") + "!"); fireSaveActionListener(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Common_Save_Failed") + "!"); + FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Common_Save_Failed") + "!"); } } @@ -191,7 +192,7 @@ public class JavaEditorPane extends BasicPane { if (StringUtils.isEmpty(message)) { message = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Compile_Success") + "!"; } - JOptionPane.showMessageDialog(null, message); + FineJOptionPane.showMessageDialog(null, message); } catch (InterruptedException e1) { FineLoggerFactory.getLogger().error(e1.getMessage(), e1); Thread.currentThread().interrupt(); diff --git a/designer-base/src/main/java/com/fr/design/fun/MobileBookMarkStyleProvider.java b/designer-base/src/main/java/com/fr/design/fun/MobileBookMarkStyleProvider.java new file mode 100644 index 0000000000..d376dd9ac7 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/MobileBookMarkStyleProvider.java @@ -0,0 +1,34 @@ +package com.fr.design.fun; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.form.ui.mobile.MobileBookMarkStyle; +import com.fr.stable.fun.mark.Mutable; + +/** + * 移动端书签样式扩展接口 + * + * @author hades + * @version 10.0 + * Created by hades on 2019/12/23 + */ +public interface MobileBookMarkStyleProvider extends Mutable { + + String XML_TAG = "MobileBookMarkStyleProvider"; + + int CURRENT_LEVEL = 1; + + /** + * 书签样式 + * @return + */ + Class classForMobileBookMarkStyle(); + + /** + * 书签样式面板 + * @return + */ + Class> classForMobileBookMarkStyleAppearance(); + + String displayName(); + +} diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileBookMarkStyleProvider.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileBookMarkStyleProvider.java new file mode 100644 index 0000000000..21ed6722b6 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileBookMarkStyleProvider.java @@ -0,0 +1,24 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.MobileBookMarkStyleProvider; +import com.fr.stable.fun.impl.AbstractProvider; +import com.fr.stable.fun.mark.API; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2019/12/24 + */ +@API(level = MobileBookMarkStyleProvider.CURRENT_LEVEL) +public abstract class AbstractMobileBookMarkStyleProvider extends AbstractProvider implements MobileBookMarkStyleProvider { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String mark4Provider() { + return getClass().getName(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java index 5618c407c0..0d12772d33 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java @@ -1,6 +1,7 @@ package com.fr.design.gui.controlpane; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ilist.JNameEdList; import com.fr.design.gui.ilist.ListModelElement; import com.fr.stable.Nameable; @@ -32,7 +33,7 @@ class ListControlPaneHelper { try { listControlPane.checkValid(); } catch (Exception exp) { - JOptionPane.showMessageDialog((Component) listControlPane, exp.getMessage()); + FineJOptionPane.showMessageDialog((Component) listControlPane, exp.getMessage()); listControlPane.setSelectedIndex(idx); return true; } diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index 6ab6bce56f..28df89b80a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -1,6 +1,7 @@ package com.fr.design.gui.controlpane; import com.fr.design.constants.UIConstants; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.controlpane.shortcutfactory.ShortCutFactory; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itoolbar.UIToolBarUI; @@ -250,7 +251,7 @@ abstract class UIControlPane extends JControlPane { } catch (Exception exp) { // 存在非法输入 拒绝隐藏 this.setAlwaysOnTop(true); - JOptionPane.showMessageDialog(this, exp.getMessage()); + FineJOptionPane.showMessageDialog(this, exp.getMessage()); this.requestFocus(); return; } diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/CommitTabbedPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/CommitTabbedPane.java index afbf43c305..66b057d0ca 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/CommitTabbedPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/CommitTabbedPane.java @@ -3,6 +3,7 @@ package com.fr.design.gui.frpane; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.write.submit.DBManipulationPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.javascript.Commit2DBJavaScriptPane; @@ -408,7 +409,7 @@ public class CommitTabbedPane extends JComponent implements MouseListener, Mous selectedIndex = dbManipulationPaneList.size()-1; commit2DBJavaScriptPane.updateCardPane(); } else if (isOverCloseIcon(x)){ - int re = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_CommitTab_Sure_To_Delete")+ "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_CommitTab_Remove") + int re = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_CommitTab_Sure_To_Delete")+ "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_CommitTab_Remove") , JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (re == JOptionPane.OK_OPTION) { dbManipulationPaneList.remove(getTabIndex(x)); diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/EditingStringListPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/EditingStringListPane.java index d3370a7c07..068e9cc9db 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/EditingStringListPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/EditingStringListPane.java @@ -1,6 +1,7 @@ package com.fr.design.gui.frpane; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; @@ -127,7 +128,7 @@ public abstract class EditingStringListPane extends BasicBeanPane> setAddEnabled(false); } } else { - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(EditingStringListPane.this), newvalue + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Already_Exists_Not_Add_Repeat")+"!"); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(EditingStringListPane.this), newvalue + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Already_Exists_Not_Add_Repeat")+"!"); } } }); @@ -149,7 +150,7 @@ public abstract class EditingStringListPane extends BasicBeanPane> public void actionPerformed(ActionEvent e) { Object selected = jlist.getSelectedValue(); if (selected != null) { - int re = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(EditingStringListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sure_To_Delete") + selected.toString() + "?"); + int re = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(EditingStringListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sure_To_Delete") + selected.toString() + "?"); if (re == JOptionPane.OK_OPTION) { JListUtils.removeSelectedListItems(jlist); } diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java index 3f4ae9b2a5..8405ce09ea 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java @@ -2,6 +2,7 @@ package com.fr.design.gui.frpane; import com.fr.design.ExtraDesignClassManager; import com.fr.design.designer.TargetComponent; +import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.fun.HyperlinkProvider; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.UIListControlPane; @@ -45,6 +46,7 @@ public abstract class HyperlinkGroupPane extends UIListControlPane { @Override public void on(PluginEvent event) { refreshNameableCreator(createNameableCreators()); + HistoryTemplateListCache.getInstance().reloadCurrentTemplate(); } }, new PluginFilter() { diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/JTreeControlPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/JTreeControlPane.java index 0c266b81ac..04e3626a4a 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/JTreeControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/JTreeControlPane.java @@ -5,6 +5,7 @@ import com.fr.data.impl.TreeNodeAttr; import com.fr.data.impl.TreeNodeWrapper; import com.fr.design.actions.UpdateAction; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.controlpane.ControlPane; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.UnrepeatedNameHelper; @@ -231,7 +232,7 @@ public class JTreeControlPane extends ControlPane { public void actionPerformed(ActionEvent e) { // TODO remove tree node - int val = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", + int val = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (val != JOptionPane.OK_OPTION) { return; diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java index 92ad39559e..c1021321b9 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPane.java @@ -1,5 +1,6 @@ package com.fr.design.gui.frpane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.general.ComparatorUtils; @@ -113,7 +114,7 @@ public class UITabbedPane extends JTabbedPane{ * @param i tab索引 */ public void doRemoveTab(int i){ - int re = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(UITabbedPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sure_To_Delete")+ "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove") + int re = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(UITabbedPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sure_To_Delete")+ "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove") , JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (re == JOptionPane.OK_OPTION) { super.removeTabAt(i); diff --git a/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataControlPane.java b/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataControlPane.java index 128adca1f1..6d74e48015 100644 --- a/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataControlPane.java @@ -2,6 +2,7 @@ package com.fr.design.gui.frpane.tree.layer.config; import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.controlpane.ControlPane; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itoolbar.UIToolbar; @@ -177,7 +178,7 @@ public class LayerDataControlPane extends ControlPane { public void actionPerformed(ActionEvent e) { // TODO remove tree node - int val = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", + int val = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (val != JOptionPane.OK_OPTION) { return; diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java index c1dc9b0581..86fc564384 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java @@ -1,19 +1,5 @@ package com.fr.design.gui.ibutton; -import java.awt.*; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; - -import javax.swing.AbstractButton; -import javax.swing.ButtonModel; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.event.EventListenerList; - import com.fr.base.Utils; import com.fr.design.constants.UIConstants; import com.fr.design.event.GlobalNameListener; @@ -21,231 +7,223 @@ import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ipoppane.PopupHider; -import com.fr.general.ComparatorUtils; import com.fr.design.style.color.ColorControlWindow; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.ComparatorUtils; + +import javax.swing.AbstractButton; +import javax.swing.ButtonModel; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.EventListenerList; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; public class UIColorButton extends UIButton implements PopupHider, UIObserver, GlobalNameObserver { - private static final int SIZE = 16; - private static final int SIZE_2 = 2; - private static final int SIZE_4 = 4; - private static final int SIZE_6 = 6; - private static final int POPUP_MENU_SHIFT = -70; - private Color color = Color.BLACK; - private ColorControlWindow popupWin; - private EventListenerList colorChangeListenerList = new EventListenerList(); - private boolean isEventBanned = false; - private String colorButtonName = ""; - private UIObserverListener uiObserverListener; - private GlobalNameListener globalNameListener = null; - - public UIColorButton() { - this(UIConstants.FONT_ICON); - } - - public UIColorButton(Icon icon) { - super(icon); - setUI(getButtonUI()); - addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - showPopupMenu(); - } - }); - iniListener(); - } - - private void iniListener() { - if (shouldResponseChangeListener()) { - this.addColorChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - if (uiObserverListener == null) { - return; - } - if (globalNameListener != null && shouldResponseNameListener()) { - globalNameListener.setGlobalName(colorButtonName); - } - uiObserverListener.doChange(); - } - }); - } - } - - private UIButtonUI getButtonUI() { - return new UIButtonUI() { - @Override - protected void paintIcon(Graphics g, JComponent c) { - super.paintIcon(g, c); - AbstractButton b = (AbstractButton) c; - ButtonModel model = b.getModel(); - if (model.isEnabled()) { - g.setColor(UIColorButton.this.getColor()); - } else { - g.setColor(new Color(Utils.filterRGB(UIColorButton.this.getColor().getRGB(), 50))); - } - g.fillRect((b.getWidth() - SIZE) / SIZE_2, b.getHeight() - SIZE_6, SIZE, SIZE_4); - } - }; - } - - public void setEventBanned(boolean isEventBanned) { - this.isEventBanned = isEventBanned; - } - - public void setGlobalName(String name) { - colorButtonName = name; - } - - public Color getColor() { - return color; - } - - public void setColor(Color color) { - if (ComparatorUtils.equals(this.color, color)) { - return; - } - - this.color = color; - hidePopupMenu(); - fireColorStateChanged(); - } - - private void showPopupMenu() { - if (isEventBanned) { - return; - } - - if (popupWin != null && popupWin.isVisible()) { - hidePopupMenu(); - return; - } - - if (!this.isEnabled()) { - return; - } - - popupWin = this.getColorControlWindow(); - - GUICoreUtils.showPopupMenu(popupWin, this, POPUP_MENU_SHIFT, this.getSize().height); - } - - /** - * 隐藏popupmenu - */ - public void hidePopupMenu() { - if (popupWin != null) { - popupWin.setVisible(false); - repaint(); - } - - popupWin = null; - } - - private ColorControlWindow getColorControlWindow() { - //find parant. - if (this.popupWin == null) { - this.popupWin = new ColorControlWindow(UIColorButton.this) { - @Override - protected void colorChanged() { - UIColorButton.this.setColor(this.getColor()); - } - - }; - } - - return popupWin; - } - - /** - * 添加监听 - * - * @param changeListener 监听列表 - */ - public void addColorChangeListener(ChangeListener changeListener) { - colorChangeListenerList.add(ChangeListener.class, changeListener); - } - - /** - * 移除监听 - * Removes an old ColorChangeListener. - * @param changeListener 监听列表 - */ - public void removeColorChangeListener(ChangeListener changeListener) { - colorChangeListenerList.remove(ChangeListener.class, changeListener); - } - - /** - * 颜色状态改变 - */ - public void fireColorStateChanged() { - Object[] listeners = colorChangeListenerList.getListenerList(); - ChangeEvent e = null; - - for (int i = listeners.length - 2; i >= 0; i -= 2) { - if (listeners[i] == ChangeListener.class) { - if (e == null) { - e = new ChangeEvent(this); - } - ((ChangeListener) listeners[i + 1]).stateChanged(e); - } - } - } - - - /** - * 注册状态改变监听 - * - * @param listener 观察者监听事件 - */ - public void registerChangeListener(UIObserverListener listener) { - uiObserverListener = listener; - } - - /** - * 是否需要响应监听 - * - * @return 是否响应 - */ - public boolean shouldResponseChangeListener() { - return true; - } - - /** - * 注册监听 - * - * @param listener 观察者监听事件 - */ - public void registerNameListener(GlobalNameListener listener) { - globalNameListener = listener; - } - - /** - * 是否需要相应 - * - * @return 是否响应 - */ - public boolean shouldResponseNameListener() { - return true; - } - - /** - * 主函数 - * - * @param args 参数 - */ - public static void main(String... args) { - LayoutManager layoutManager = null; - JFrame jf = new JFrame("test"); - jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - JPanel content = (JPanel) jf.getContentPane(); - content.setLayout(layoutManager); - - UIColorButton bb = new UIColorButton(UIConstants.FONT_ICON); - bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height); - content.add(bb); - GUICoreUtils.centerWindow(jf); - jf.setSize(400, 400); - jf.setVisible(true); - } + private static final int SIZE = 16; + private static final int SIZE_2 = 2; + private static final int SIZE_4 = 4; + private static final int SIZE_6 = 6; + private static final int POPUP_MENU_SHIFT = -70; + private Color color = Color.BLACK; + private ColorControlWindow popupWin; + private EventListenerList colorChangeListenerList = new EventListenerList(); + private boolean isEventBanned = false; + private String colorButtonName = ""; + private UIObserverListener uiObserverListener; + private GlobalNameListener globalNameListener = null; + + public UIColorButton() { + this(UIConstants.FONT_ICON); + } + + public UIColorButton(Icon icon) { + super(icon); + setUI(getButtonUI()); + addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + showPopupMenu(); + } + }); + iniListener(); + } + + private void iniListener() { + if (shouldResponseChangeListener()) { + this.addColorChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + if (uiObserverListener == null) { + return; + } + if (globalNameListener != null && shouldResponseNameListener()) { + globalNameListener.setGlobalName(colorButtonName); + } + uiObserverListener.doChange(); + } + }); + } + } + + private UIButtonUI getButtonUI() { + return new UIButtonUI() { + @Override + protected void paintIcon(Graphics g, JComponent c) { + super.paintIcon(g, c); + AbstractButton b = (AbstractButton) c; + ButtonModel model = b.getModel(); + if (model.isEnabled()) { + g.setColor(UIColorButton.this.getColor()); + } else { + g.setColor(new Color(Utils.filterRGB(UIColorButton.this.getColor().getRGB(), 50))); + } + g.fillRect((b.getWidth() - SIZE) / SIZE_2, b.getHeight() - SIZE_6, SIZE, SIZE_4); + } + }; + } + + public void setEventBanned(boolean isEventBanned) { + this.isEventBanned = isEventBanned; + } + + public void setGlobalName(String name) { + colorButtonName = name; + } + + public Color getColor() { + return color; + } + + public void setColor(Color color) { + if (ComparatorUtils.equals(this.color, color)) { + return; + } + + this.color = color; + hidePopupMenu(); + fireColorStateChanged(); + } + + private void showPopupMenu() { + if (isEventBanned) { + return; + } + + if (popupWin != null && popupWin.isVisible()) { + hidePopupMenu(); + return; + } + + if (!this.isEnabled()) { + return; + } + + popupWin = this.getColorControlWindow(); + + GUICoreUtils.showPopupMenu(popupWin, this, POPUP_MENU_SHIFT, this.getSize().height); + } + + /** + * 隐藏popupmenu + */ + public void hidePopupMenu() { + if (popupWin != null) { + popupWin.setVisible(false); + } + popupWin = null; + repaint(); + } + + private ColorControlWindow getColorControlWindow() { + //find parant. + if (this.popupWin == null) { + this.popupWin = new ColorControlWindow(UIColorButton.this) { + @Override + protected void colorChanged() { + UIColorButton.this.setColor(this.getColor()); + } + + }; + } + + return popupWin; + } + + /** + * 添加监听 + * + * @param changeListener 监听列表 + */ + public void addColorChangeListener(ChangeListener changeListener) { + colorChangeListenerList.add(ChangeListener.class, changeListener); + } + + /** + * 移除监听 + * Removes an old ColorChangeListener. + * + * @param changeListener 监听列表 + */ + public void removeColorChangeListener(ChangeListener changeListener) { + colorChangeListenerList.remove(ChangeListener.class, changeListener); + } + + /** + * 颜色状态改变 + */ + public void fireColorStateChanged() { + Object[] listeners = colorChangeListenerList.getListenerList(); + ChangeEvent e = null; + + for (int i = listeners.length - 2; i >= 0; i -= 2) { + if (listeners[i] == ChangeListener.class) { + if (e == null) { + e = new ChangeEvent(this); + } + ((ChangeListener) listeners[i + 1]).stateChanged(e); + } + } + } + + + /** + * 注册状态改变监听 + * + * @param listener 观察者监听事件 + */ + public void registerChangeListener(UIObserverListener listener) { + uiObserverListener = listener; + } + + /** + * 是否需要响应监听 + * + * @return 是否响应 + */ + public boolean shouldResponseChangeListener() { + return true; + } + + /** + * 注册监听 + * + * @param listener 观察者监听事件 + */ + public void registerNameListener(GlobalNameListener listener) { + globalNameListener = listener; + } + + /** + * 是否需要相应 + * + * @return 是否响应 + */ + public boolean shouldResponseNameListener() { + return true; + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java index 0752eef4d2..1c2aef38a7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java @@ -25,36 +25,43 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam public UIRadioButton() { super(); initListener(); + initComponent(); } public UIRadioButton(Icon icon) { super(icon); initListener(); + initComponent(); } public UIRadioButton(Action a) { super(a); initListener(); + initComponent(); } public UIRadioButton(Icon icon, boolean selected) { super(icon, selected); initListener(); + initComponent(); } public UIRadioButton(String text) { super(text); initListener(); + initComponent(); } public UIRadioButton(String text, boolean selected) { super(text, selected); initListener(); + initComponent(); } public UIRadioButton(String text, Icon icon) { super(text, icon); initListener(); + initComponent(); } @@ -81,6 +88,10 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam } } + private void initComponent() { + this.setFocusPainted(false); + } + /** * 给组件登记一个观察者监听事件 * diff --git a/designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTableUI.java b/designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTableUI.java index 8dc90f10bb..32b33cbab2 100644 --- a/designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTableUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTableUI.java @@ -10,6 +10,7 @@ import javax.swing.event.MouseInputListener; import com.fr.base.GraphHelper; import com.fr.design.constants.UIConstants; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.itable.UITableUI; import com.fr.design.mainframe.DesignerContext; @@ -74,7 +75,7 @@ public class UIMenuTableUI extends UITableUI{ @Override public void mousePressed(MouseEvent e) { if (e.getX() >= table.getWidth() - 20) { - int val = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", + int val = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (val == JOptionPane.OK_OPTION) { uiTable.removeLine(table.rowAtPoint(e.getPoint())); diff --git a/designer-base/src/main/java/com/fr/design/gui/itable/UITableUI.java b/designer-base/src/main/java/com/fr/design/gui/itable/UITableUI.java index 370ceacb8f..71e80027c3 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itable/UITableUI.java +++ b/designer-base/src/main/java/com/fr/design/gui/itable/UITableUI.java @@ -19,6 +19,7 @@ import javax.swing.table.TableModel; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.mainframe.DesignerContext; import com.fr.stable.Constants; @@ -132,7 +133,7 @@ public class UITableUI extends BasicTableUI { return; } if (!table.isEditing()) { - int val = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", + int val = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (val == JOptionPane.OK_OPTION) { ((UITable) table).removeLine(table.rowAtPoint(e.getPoint())); diff --git a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java index 0ec8fe90c6..fc219a30bc 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java +++ b/designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java @@ -1,6 +1,7 @@ package com.fr.design.gui.itableeditorpane; import com.fr.base.BaseUtils; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.mainframe.DesignerContext; import com.fr.log.FineLoggerFactory; @@ -207,7 +208,7 @@ public abstract class UITableModelAdapter extends AbstractTabl public void actionPerformed(ActionEvent e) { final int selectedRow = table.getSelectedRow(); if (selectedRow > table.getRowCount() - 1 || selectedRow < 0) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No-Alternatives")); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No-Alternatives")); return; } stopCellEditing(); @@ -251,7 +252,7 @@ public abstract class UITableModelAdapter extends AbstractTabl if(component == null){ component = DesignerContext.getDesignerFrame(); } - int val = JOptionPane.showConfirmDialog(component, + int val = FineJOptionPane.showConfirmDialog(component, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Are_You_Sure_To_Remove_The_Selected_Item") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (val != JOptionPane.OK_OPTION) { diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java index 3ad75044c2..88ee482cb8 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java @@ -32,7 +32,7 @@ public class BackgroundPane extends AbstractBasicStylePane { protected BackgroundQuickPane[] paneList; //获取当前面板 - protected JPanel currentPane = null; + protected BackgroundQuickPane currentPane = null; public BackgroundPane() { @@ -43,7 +43,6 @@ public class BackgroundPane extends AbstractBasicStylePane { this.setLayout(new BorderLayout(0, 6)); typeComboBox = new UIComboBox(); final CardLayout cardlayout = new CardLayout(); -// this.add(typeComboBox, BorderLayout.NORTH); paneList = supportKindsOfBackgroundUI(); @@ -58,12 +57,12 @@ public class BackgroundPane extends AbstractBasicStylePane { typeComboBox.addItem(pane.title4PopupWindow()); centerPane.add(pane, pane.title4PopupWindow()); } -// this.add(centerPane, BorderLayout.CENTER); typeComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { cardlayout.show(centerPane, (String) typeComboBox.getSelectedItem()); + currentPane = paneList[typeComboBox.getSelectedIndex()]; fireStateChanged(); } }); diff --git a/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java b/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java index ce3940bf2a..da0cd32ed5 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java @@ -16,7 +16,6 @@ import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; import com.fr.design.style.color.NewColorSelectBox; import com.fr.stable.Constants; @@ -28,6 +27,7 @@ import javax.swing.event.ChangeListener; import java.awt.*; import java.util.Arrays; import java.util.HashSet; +import java.util.Set; /** * @author zhou @@ -37,6 +37,7 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse private static final String[] BORDERARRAY = {"currentLineCombo", "currentLineColorPane", "outerToggleButton", "topToggleButton", "leftToggleButton", "bottomToggleButton", "rightToggleButton", "innerToggleButton", "horizontalToggleButton", "verticalToggleButton"}; + private static final Set BORDER_SET = new HashSet<>(Arrays.asList(BORDERARRAY)); private boolean insideMode = false; private UIToggleButton topToggleButton; @@ -193,25 +194,20 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse this.verticalToggleButton.setEnabled(this.insideMode); } + @Override public Style update(Style style) { if (style == null) { style = Style.DEFAULT_STYLE; } - CellBorderStyle cellBorderStyle = this.update(); - HashSet borderSet = new HashSet(Arrays.asList(BORDERARRAY)); - style = style.deriveBackground(backgroundPane.update()); - if (backgroundPane.currentPane != backgroundPane.paneList[1]){ - if (borderSet.contains(globalNameListener.getGlobalName())) { - style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(), - cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor()); - } - }else { - if (borderSet.contains(globalNameListener.getGlobalName()) && !((ColorBackgroundQuickPane) backgroundPane.currentPane).isBackGroundColor()){ - style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(), - cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor()); - } + if (backgroundPane.currentPane.isBackgroundChange()) { + style = style.deriveBackground(backgroundPane.update()); + } + if (BORDER_SET.contains(globalNameListener.getGlobalName())) { + CellBorderStyle cellBorderStyle = this.update(); + style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(), + cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor()); } return style; diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java index 532fe467c3..7147ef90e2 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java @@ -2,6 +2,7 @@ package com.fr.design.hyperlink; import com.fr.base.BaseUtils; import com.fr.base.Parameter; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.itableeditorpane.ParameterTableModel; @@ -122,7 +123,7 @@ public class ReportletHyperlinkPane extends AbstractHyperLinkPane { return contentDBManiPane; } - public static JavaScriptActionPane defaultJavaScriptActionPane = new JavaScriptActionPane() { + public static JavaScriptActionPane createDefaultJavaScriptActionPane() { + return new JavaScriptActionPane() { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - @Override - public DBManipulationPane createDBManipulationPane() { - JTemplate jTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); - return jTemplate == null ? new DBManipulationPane() : jTemplate.createDBManipulationPane(); - } + @Override + public DBManipulationPane createDBManipulationPane() { + JTemplate jTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); + return jTemplate == null ? new DBManipulationPane() : jTemplate.createDBManipulationPane(); + } - @Override - protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Callback_Function"); - } + @Override + protected String title4PopupWindow() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Callback_Function"); + } - @Override - public boolean isForm() { - return false; - } + @Override + public boolean isForm() { + return false; + } - public String[] getDefaultArgs() { - return new String[0]; - } - }; + @Override + public String[] getDefaultArgs() { + return new String[0]; + } + }; + } /** * 生成界面默认的组建 diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java index 790108978f..8cf75c0587 100644 --- a/designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java +++ b/designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java @@ -15,14 +15,13 @@ import java.util.Map; public class SplashMark implements LocaleMark { private Map map = new HashMap(); - private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif"; - private static final String SPLASH_EN_PATH = "/com/fr/design/images/splash_10_en.gif"; - private static final String SPLASH_JP_PATH = "/com/fr/design/images/splash_10_jp.gif"; + private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.png"; + private static final String SPLASH_EN_PATH = "/com/fr/design/images/splash_10_en.png"; public SplashMark() { map.put(Locale.CHINA, SPLASH_PATH); map.put(Locale.KOREA, SPLASH_EN_PATH); - map.put(Locale.JAPAN, SPLASH_JP_PATH); + map.put(Locale.JAPAN, SPLASH_EN_PATH); map.put(Locale.US, SPLASH_EN_PATH); map.put(Locale.TAIWAN, SPLASH_EN_PATH); } 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 082775a62d..f7b309eae6 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 @@ -13,6 +13,7 @@ import com.fr.design.base.mode.DesignModeContext; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.TargetModifiedEvent; @@ -180,7 +181,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta @Override public void windowClosing(WindowEvent e) { - + //关闭前当前模板 停止编辑 + HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().stopEditing(); SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true); // 只有一个文件未保存时 if (HistoryTemplateListCache.getInstance().getHistoryCount() == 1) { @@ -919,9 +921,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } else { editingTemplate.stopEditing(); if (!editingTemplate.getEditingFILE().exists()) { - int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), + int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Save") + " \"" + editingTemplate.getEditingFILE() - + "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION, + + "\" ?", Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (returnVal == JOptionPane.YES_OPTION && editingTemplate.saveTemplate()) { editingTemplate.saveTemplate(); @@ -1033,10 +1035,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta // p:判断一下,如何文件为空或者文件不存在,直接返回. if (tplFile == null || !tplFile.exists()) { - JOptionPane.showMessageDialog( + FineJOptionPane.showMessageDialog( this, Toolkit.i18nText("Fine-Design_Basic_Warning_Template_Do_Not_Exsit"), - ProductConstants.PRODUCT_NAME, + Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE ); DesignerFrameFileDealerPane.getInstance().refresh(); @@ -1046,10 +1048,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta try { openFile(tplFile); } catch (DecryptTemplateException e) { - JOptionPane.showMessageDialog( + FineJOptionPane.showMessageDialog( this, Toolkit.i18nText("Fine-Design_Encrypt_Decrypt_Exception"), - UIManager.getString("OptionPane.messageDialogTitle"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE, UIManager.getIcon("OptionPane.errorIcon") ); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index f24375da1f..0b52a582d3 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -11,6 +11,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.tabledata.ResponseDataSourceChange; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.FileOperations; import com.fr.design.file.FileToolbarStateChangeListener; import com.fr.design.file.HistoryTemplateListCache; @@ -324,9 +325,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public void actionPerformed(ActionEvent evt) { if (!selectedOperation.access()) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied"), - Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), WARNING_MESSAGE); return; } @@ -466,9 +467,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt @Override public void actionPerformed(ActionEvent evt) { if (!selectedOperation.access()) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied"), - Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), WARNING_MESSAGE); return; } @@ -477,9 +478,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt String lock = node.getLock(); if (lock != null && !lock.equals(node.getUserID())) { // 提醒被锁定模板无法重命名 - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Unable_Rename_Locked_File"), - Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), WARNING_MESSAGE); return; } @@ -506,9 +507,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt public void actionPerformed(ActionEvent evt) { if (!selectedOperation.access()) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied"), - Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), WARNING_MESSAGE); return; } @@ -705,9 +706,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt selectedOperation.refresh(); DesignerContext.getDesignerFrame().setTitle(); } else { - JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), + FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Rename_Failure"), - UIManager.getString("OptionPane.messageDialogTitle"), + Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); } @@ -896,9 +897,9 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt selectedOperation.refresh(); this.dispose(); if (!success) { - JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), + FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Make_Failure"), - UIManager.getString("OptionPane.messageDialogTitle"), + Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 97ce22814d..07191d536d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -458,9 +458,14 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } private void refreshContainer() { - validate(); - repaint(); - revalidate(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + validate(); + repaint(); + revalidate(); + } + }); } public int getToolPaneY() { 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 4ac0200696..c6da049bd9 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 @@ -21,6 +21,7 @@ import com.fr.design.actions.file.WebPreviewUtils; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.designer.DesignerProxy; import com.fr.design.designer.TargetComponent; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.InformationWarnPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.TemplateTreePane; @@ -540,7 +541,7 @@ 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); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); return false; } collectInfo(); @@ -594,10 +595,10 @@ public abstract class JTemplate> FineLoggerFactory.getLogger().error(e.getMessage(), e); } if (!access) { - JOptionPane.showMessageDialog( + FineJOptionPane.showMessageDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Template_Permission_Denied") + "!", - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); return false; } @@ -618,10 +619,10 @@ public abstract class JTemplate> } return saved; } else { - JOptionPane.showMessageDialog( + FineJOptionPane.showMessageDialog( DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design-Basic_Save_Failure"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); return false; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/UndoStateEdit.java b/designer-base/src/main/java/com/fr/design/mainframe/UndoStateEdit.java index 92de00dbcb..a70795d409 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/UndoStateEdit.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/UndoStateEdit.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe; import com.fr.base.vcs.DesignerMode; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; @@ -43,7 +44,7 @@ public class UndoStateEdit extends AbstractUndoableEdit { public void undo() throws CannotUndoException { super.undo(); if (cur.getAuthorityType() == BaseUndoState.AUTHORITY_STATE) { - int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Undo_All_Authority_Operations") + "?", + int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Undo_All_Authority_Operations") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Undo"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (returnVal == JOptionPane.NO_OPTION) { return; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/BackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/BackgroundQuickPane.java index 850132d863..99e482355c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/BackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/BackgroundQuickPane.java @@ -2,14 +2,20 @@ package com.fr.design.mainframe.backgroundpane; import com.fr.design.beans.BasicBeanPane; import com.fr.design.event.UIObserver; +import com.fr.design.event.UIObserverListener; import com.fr.general.Background; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + /** * @author zhou * @since 2012-5-29下午1:12:28 */ public abstract class BackgroundQuickPane extends BasicBeanPane implements UIObserver { + private boolean backgroundChange; + public abstract boolean accept(Background background); @Override @@ -23,6 +29,10 @@ public abstract class BackgroundQuickPane extends BasicBeanPane impl public abstract void reset(); + public boolean isBackgroundChange() { + return backgroundChange; + } + /** * 组件是否需要响应添加的观察者事件 * @@ -32,4 +42,20 @@ public abstract class BackgroundQuickPane extends BasicBeanPane impl return true; } + + class ChangeListenerImpl implements ChangeListener { + + private UIObserverListener listener; + + public ChangeListenerImpl(UIObserverListener listener) { + this.listener = listener; + } + + @Override + public void stateChanged(ChangeEvent e) { + backgroundChange = true; + this.listener.doChange(); + backgroundChange = false; + } + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java index 89c61ec9d0..f9b4c160e5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ColorBackgroundQuickPane.java @@ -19,7 +19,6 @@ import java.awt.Color; public class ColorBackgroundQuickPane extends BackgroundQuickPane { private NewColorSelectPane detailColorSelectPane; - private boolean isBackGroundColor; public ColorBackgroundQuickPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); @@ -39,7 +38,6 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane { public void populateColor(Color color) { this.detailColorSelectPane.setColor(color); - isBackGroundColor = false; } public Color updateColor() { @@ -47,23 +45,14 @@ public class ColorBackgroundQuickPane extends BackgroundQuickPane { return this.detailColorSelectPane.getNotNoneColor(); } - public boolean isBackGroundColor() { - return isBackGroundColor; - } - /** * 给组件登记一个观察者监听事件 * * @param listener 观察者监听事件 */ + @Override public void registerChangeListener(final UIObserverListener listener) { - detailColorSelectPane.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - isBackGroundColor = true; - listener.doChange(); - isBackGroundColor = false; - } - }); + detailColorSelectPane.addChangeListener(new ChangeListenerImpl(listener)); } @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java index 09be6771cf..6c3ea9e727 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/GradientBackgroundQuickPane.java @@ -96,17 +96,10 @@ public class GradientBackgroundQuickPane extends BackgroundQuickPane { * * @param listener 观察者监听事件 */ + @Override public void registerChangeListener(final UIObserverListener listener) { - gradientBar.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - listener.doChange(); - } - }); - directionPane.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - listener.doChange(); - } - }); + gradientBar.addChangeListener(new ChangeListenerImpl(listener)); + directionPane.addChangeListener(new ChangeListenerImpl(listener)); } @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java index afa6fc9077..e1496ff3d6 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/ImageBackgroundQuickPane.java @@ -127,12 +127,7 @@ public class ImageBackgroundQuickPane extends BackgroundQuickPane { */ @Override public void registerChangeListener(final UIObserverListener listener) { - changeListener = new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - listener.doChange(); - } - }; + changeListener = new ChangeListenerImpl(listener); imageLayoutPane.addChangeListener(changeListener); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/NullBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/NullBackgroundQuickPane.java index 8aa6573f51..9a86a38c11 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/NullBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/NullBackgroundQuickPane.java @@ -33,6 +33,10 @@ public class NullBackgroundQuickPane extends BackgroundQuickPane { } + @Override + public boolean isBackgroundChange() { + return true; + } /** * 是否接受 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java index 9da1344dcd..8f4c2ecfbf 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java @@ -112,23 +112,12 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane { * * @param listener 观察者监听事件 */ + @Override public void registerChangeListener(final UIObserverListener listener) { - foregroundColorPane.addSelectChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - listener.doChange(); - } - }); - backgroundColorPane.addSelectChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - listener.doChange(); - } - }); + foregroundColorPane.addSelectChangeListener(new ChangeListenerImpl(listener)); + backgroundColorPane.addSelectChangeListener(new ChangeListenerImpl(listener)); for (int i = 0, count = patternButtonArray.length; i < count; i++) { - patternButtonArray[i].addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - listener.doChange(); - } - }); + patternButtonArray[i].addChangeListener(new ChangeListenerImpl(listener)); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java index 0d94bf3bce..e9aed06acd 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java @@ -68,13 +68,10 @@ public class TextureBackgroundQuickPane extends BackgroundQuickPane { * * @param listener 观察者监听事件 */ + @Override public void registerChangeListener(final UIObserverListener listener) { for (int i = 0, count = textureButtonArray.length; i < count; i++) { - textureButtonArray[i].addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - listener.doChange(); - } - }); + textureButtonArray[i].addChangeListener(new ChangeListenerImpl(listener)); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileBookMarkStyleCustomDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileBookMarkStyleCustomDefinePane.java new file mode 100644 index 0000000000..20a14ea222 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileBookMarkStyleCustomDefinePane.java @@ -0,0 +1,27 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.form.ui.mobile.MobileBookMarkStyle; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2019/12/24 + */ +public class DefaultMobileBookMarkStyleCustomDefinePane extends BasicBeanPane { + + @Override + public void populateBean(MobileBookMarkStyle ob) { + + } + + @Override + public MobileBookMarkStyle updateBean() { + return null; + } + + @Override + protected String title4PopupWindow() { + return null; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileBookMarkStyleProvider.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileBookMarkStyleProvider.java new file mode 100644 index 0000000000..709afefe47 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileBookMarkStyleProvider.java @@ -0,0 +1,29 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.impl.AbstractMobileBookMarkStyleProvider; +import com.fr.form.ui.mobile.impl.DefaultMobileBookMarkStyle; +import com.fr.form.ui.mobile.MobileBookMarkStyle; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2019/12/24 + */ +public class DefaultMobileBookMarkStyleProvider extends AbstractMobileBookMarkStyleProvider { + + @Override + public Class classForMobileBookMarkStyle() { + return DefaultMobileBookMarkStyle.class; + } + + @Override + public Class> classForMobileBookMarkStyleAppearance() { + return DefaultMobileBookMarkStyleCustomDefinePane.class; + } + + @Override + public String displayName() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_None_BookMark_Style"); + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStyleDefinePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStyleDefinePane.java new file mode 100644 index 0000000000..0a480d99a0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStyleDefinePane.java @@ -0,0 +1,57 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.MobileBookMarkStyleProvider; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.form.ui.mobile.MobileBookMarkStyle; +import com.fr.general.ComparatorUtils; +import com.fr.invoke.Reflect; + +import javax.swing.*; +import java.awt.*; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2019/12/23 + */ +public class MobileBookMarkStyleDefinePane extends BasicBeanPane { + + private BasicBeanPane customDefinePane; + private String displayName; + + MobileBookMarkStyleDefinePane(MobileBookMarkStyleProvider bookMarkStyleProvider) { + this.customDefinePane = Reflect.on( + bookMarkStyleProvider.classForMobileBookMarkStyleAppearance()).create().get(); + this.displayName = bookMarkStyleProvider.displayName(); + initComponent(); + } + + private void initComponent() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel settingPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + if (!ComparatorUtils.equals(displayName, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_None_BookMark_Style"))) { + UILabel hintLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Hint")); + hintLabel.setForeground(Color.GRAY); + settingPane.add(hintLabel, BorderLayout.NORTH); + } + settingPane.add(this.customDefinePane, BorderLayout.CENTER); + this.add(settingPane, BorderLayout.CENTER); + } + + @Override + public void populateBean(MobileBookMarkStyle ob) { + this.customDefinePane.populateBean(ob); + } + + @Override + public MobileBookMarkStyle updateBean() { + return this.customDefinePane.updateBean(); + } + + @Override + protected String title4PopupWindow() { + return "MobileBookMarkStyleDefinePane"; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStylePane.java new file mode 100644 index 0000000000..4e361d4fa3 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStylePane.java @@ -0,0 +1,136 @@ +package com.fr.design.mainframe.mobile.ui; + +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.MobileBookMarkStyleProvider; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.form.ui.mobile.MobileBookMarkStyle; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2019/12/23 + */ +public class MobileBookMarkStylePane extends BasicBeanPane { + + public static ListCellRenderer renderer = new DefaultListCellRenderer() { + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, + boolean cellHasFocus) { + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + if (value instanceof MobileBookMarkStyle) { + this.setText((value.toString())); + } + return this; + } + }; + + private DefaultListModel listModel; + private JList bookMarkList; + private JPanel rightPane; + private CardLayout card; + private Map> map = new HashMap<>(); + + public MobileBookMarkStylePane() { + initComponent(); + } + + private void initComponent() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.listModel = new DefaultListModel<>(); + this.card = new CardLayout(); + this.rightPane = FRGUIPaneFactory.createCardLayout_S_Pane(); + this.rightPane.setLayout(card); + initDefaultAndExtraPanel(); + initLeftListPanel(); + initRightPanel(); + } + + private void initDefaultAndExtraPanel() { + List list = getMobileBookMarkStyleProvider(); + for (MobileBookMarkStyleProvider bookMarkStyleProvider : list) { + String displayName = bookMarkStyleProvider.displayName(); + MobileBookMarkStyleDefinePane mobileBookMarkStyleDefinePane = new MobileBookMarkStyleDefinePane( + bookMarkStyleProvider); + listModel.addElement(displayName); + rightPane.add(displayName, mobileBookMarkStyleDefinePane); + map.put(displayName, mobileBookMarkStyleDefinePane); + } + } + + private void initLeftListPanel() { + bookMarkList = new JList<>(listModel); + bookMarkList.setCellRenderer(renderer); + bookMarkList.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + card.show(rightPane, (String) bookMarkList.getSelectedValue()); + } + }); + JPanel leftPanel = FRGUIPaneFactory.createBorderLayout_L_Pane(); + leftPanel.add(bookMarkList, BorderLayout.CENTER); + leftPanel.setPreferredSize(new Dimension(100, 500)); + this.add(leftPanel, BorderLayout.WEST); + } + + private void initRightPanel() { + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); + centerPane.setPreferredSize(new Dimension(500, 500)); + centerPane.add(rightPane, BorderLayout.CENTER); + this.add(centerPane, BorderLayout.CENTER); + } + + + private List getMobileBookMarkStyleProvider() { + DefaultMobileBookMarkStyleProvider defaultMobileBookMarkStyleProvider = new DefaultMobileBookMarkStyleProvider(); + Set mobileBookMarkStyleProviders = ExtraDesignClassManager.getInstance().getArray( + MobileBookMarkStyleProvider.XML_TAG); + List list = new ArrayList<>(); + list.add(defaultMobileBookMarkStyleProvider); + list.addAll(mobileBookMarkStyleProviders); + return Collections.unmodifiableList(list); + } + + @Override + protected String title4PopupWindow() { + return null; + } + + + @Override + public void populateBean(MobileBookMarkStyle mobileBookMarkStyle) { + if (mobileBookMarkStyle != null) { + List bookMarkStyleProviders = getMobileBookMarkStyleProvider(); + int i = 0; + for (MobileBookMarkStyleProvider bookMarkStyleProvider : bookMarkStyleProviders) { + if (mobileBookMarkStyle.getClass() == bookMarkStyleProvider.classForMobileBookMarkStyle()) { + String displayName = bookMarkStyleProvider.displayName(); + bookMarkList.setSelectedIndex(i); + map.get(displayName).populateBean(mobileBookMarkStyle); + card.show(rightPane, displayName); + return; + } + i++; + } + } + bookMarkList.setSelectedIndex(0); + } + + @Override + public MobileBookMarkStyle updateBean() { + return map.get(bookMarkList.getSelectedValue()).updateBean(); + } + + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStylePane.java b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStylePane.java index d0e949fa9c..3573427ca9 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStylePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStylePane.java @@ -13,9 +13,9 @@ import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import javax.swing.*; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; import java.awt.*; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; import java.util.HashMap; import java.util.Map; @@ -79,8 +79,8 @@ public class MobileStylePane extends BasicPane { private void addWestList() { styleList = new JList<>(listModel); styleList.setCellRenderer(render); - styleList.addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent e) { + styleList.addListSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { String selectedValue = (String)styleList.getSelectedValue(); card.show(right, selectedValue); } 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 d916d967fc..cdafa8c410 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 @@ -528,14 +528,14 @@ public abstract class ToolBarMenuDock { */ public ShortCut[] createHelpShortCuts() { final java.util.List shortCuts = new ArrayList(); - shortCuts.add(new WebDemoAction()); // 英文,把 video 和帮助文档放到 Help 下面 if (GeneralContext.getLocale().equals(Locale.US)) { shortCuts.add(new VideoAction()); shortCuts.add(new TutorialAction()); } - //远程不使用更新升级 + //远程不使用更新升级,产品演示 if (WorkContext.getCurrent().isLocal()) { + shortCuts.add(new WebDemoAction()); shortCuts.add(new SoftwareUpdateAction()); } if (AlphaFineConfigManager.isALPHALicAvailable()) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java index cd01d409c4..2bd441c19e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.vcs.ui; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.frpane.UITextPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; @@ -61,7 +62,7 @@ public class FileVersionRowPanel extends JPanel { confirmBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { - if (JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Title"), + if (FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Title"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { vcsEntity.setUsername(VcsHelper.getInstance().getCurrentUsername()); WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(vcsEntity); @@ -75,7 +76,7 @@ public class FileVersionRowPanel extends JPanel { deleteBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { - if (JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Delete-Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Remove"), + if (FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Delete-Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Remove"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { try { WorkContext.getCurrent().get(VcsOperator.class).deleteVersion(vcsEntity.getFilename(), vcsEntity.getVersion()); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileBookMarkStyleWrapper.java b/designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileBookMarkStyleWrapper.java new file mode 100644 index 0000000000..85c98c1031 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileBookMarkStyleWrapper.java @@ -0,0 +1,30 @@ +package com.fr.design.mainframe.widget.wrappers; + +import com.fr.design.Exception.ValidationException; +import com.fr.design.designer.properties.Decoder; +import com.fr.design.designer.properties.Encoder; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2019/12/24 + */ +public class MobileBookMarkStyleWrapper implements Encoder, Decoder { + @Override + public Object decode(String txt) { + return null; + } + + @Override + public void validate(String txt) throws ValidationException { + + } + + @Override + public String encode(Object v) { + if (v == null) { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_None_BookMark_Style"); + } + return v.toString(); + } +} diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/AbstractListControlPane.java b/designer-base/src/main/java/com/fr/design/remote/ui/AbstractListControlPane.java index c41e4800a0..bca0422eab 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/AbstractListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/AbstractListControlPane.java @@ -6,6 +6,7 @@ import com.fr.design.beans.BasicBeanPane; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; @@ -367,7 +368,7 @@ public abstract class AbstractListControlPane extends BasicPane { checkValid(); } catch (Exception exp) { FineLoggerFactory.getLogger().error(exp.getMessage(), exp); - JOptionPane.showMessageDialog(AbstractListControlPane.this, exp.getMessage()); + FineJOptionPane.showMessageDialog(AbstractListControlPane.this, exp.getMessage()); authorityList.setSelectedIndex(idx); return true; } diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/list/AddedMemberList.java b/designer-base/src/main/java/com/fr/design/remote/ui/list/AddedMemberList.java index 5c2b39e6d6..1fc67b2852 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/list/AddedMemberList.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/list/AddedMemberList.java @@ -1,5 +1,6 @@ package com.fr.design.remote.ui.list; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.report.constant.RoleType; @@ -35,7 +36,7 @@ public class AddedMemberList extends MemberList { "Fine-Design_Basic_Utils_Are_You_Sure_To_Delete_The_Role_And_Its_Design_Authorities" : "Fine-Design_Basic_Utils_Are_You_Sure_To_Delete_The_User_And_Its_Design_Authorities"; if (member.isSelected() && member.hasAuthority()){ - int val = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText(keyTitle), + int val = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText(keyTitle), Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (val == JOptionPane.OK_OPTION) { member.setSelected(!member.isSelected()); diff --git a/designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberList.java b/designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberList.java index ea748816fc..5851ec48c6 100644 --- a/designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberList.java +++ b/designer-base/src/main/java/com/fr/design/remote/ui/list/AddingMemberList.java @@ -1,5 +1,6 @@ package com.fr.design.remote.ui.list; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; import com.fr.report.constant.RoleType; @@ -37,7 +38,7 @@ public class AddingMemberList extends MemberList { "Fine-Design_Basic_Utils_Are_You_Sure_To_Delete_The_Role_And_Its_Design_Authorities" : "Fine-Design_Basic_Utils_Are_You_Sure_To_Delete_The_User_And_Its_Design_Authorities"; if (member.isSelected() && member.hasAuthority()){ - int val = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText(keyTitle), + int val = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText(keyTitle), Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (val == JOptionPane.OK_OPTION) { member.setSelected(!member.isSelected()); diff --git a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java index d839461dda..65f66290ec 100644 --- a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java +++ b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java @@ -6,6 +6,7 @@ import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.tabledata.Prepare4DataSourceChange; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itoolbar.UIToolbar; @@ -159,7 +160,7 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo */ private void checkChanges() { //如若有变化,则弹出下面的对话框 - int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Role_changed_Is_Refresh") + "?", + int returnVal = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Role_changed_Is_Refresh") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Refresh"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); if (returnVal == JOptionPane.OK_OPTION) { roleTree.refreshTreeNode(); diff --git a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java index 2099a1e8a0..b5a5e40752 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java +++ b/designer-base/src/main/java/com/fr/design/style/color/ColorControlWindow.java @@ -1,40 +1,41 @@ package com.fr.design.style.color; -import java.awt.BorderLayout; -import java.awt.Color; +import com.fr.design.gui.ipoppane.PopupHider; +import com.fr.design.layout.FRGUIPaneFactory; import javax.swing.JPopupMenu; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; - -import com.fr.design.gui.ipoppane.PopupHider; -import com.fr.design.layout.FRGUIPaneFactory; +import java.awt.BorderLayout; +import java.awt.Color; public abstract class ColorControlWindow extends JPopupMenu { - private static final long serialVersionUID = 4317136753151221742L; - private PopupHider popupHider; - private ColorSelectionPopupPane selectionPopupPane; - protected abstract void colorChanged(); + private static final long serialVersionUID = 4317136753151221742L; + private PopupHider popupHider; + private ColorSelectionPopupPane selectionPopupPane; - /** + protected abstract void colorChanged(); + + /** * Constructor. */ public ColorControlWindow(PopupHider popupHider) { - this(false,popupHider); + this(false, popupHider); } - /** + + /** * Constructor. */ public ColorControlWindow(boolean isSupportTransparent, PopupHider popupHider) { this.initComponents(isSupportTransparent); this.popupHider = popupHider; } - + public Color getColor() { - if(selectionPopupPane == null) { - return null; - } - return selectionPopupPane.getColor(); + if (selectionPopupPane == null) { + return null; + } + return selectionPopupPane.getColor(); } /** @@ -52,30 +53,33 @@ public abstract class ColorControlWindow extends JPopupMenu { this.add(selectionPopupPane, BorderLayout.CENTER); this.pack(); } - + class ColorSelectionPopupPane extends NewColorSelectPane { - private static final long serialVersionUID = 7822856562329146354L; - public ColorSelectionPopupPane(boolean isSupportTransparent) { - super(isSupportTransparent); - this.addChangeListener(new ChangeListener() { - - @Override - public void stateChanged(ChangeEvent e) { - colorChanged(); - } - }); + private static final long serialVersionUID = 7822856562329146354L; + + public ColorSelectionPopupPane(boolean isSupportTransparent) { + super(isSupportTransparent); + this.addChangeListener(new ChangeListener() { + + @Override + public void stateChanged(ChangeEvent e) { + colorChanged(); + } + }); } + @Override protected void doTransparent() { - popupHider.hidePopupMenu(); - super.doTransparent(); - } - @Override - public void customButtonPressed() { - popupHider.hidePopupMenu(); - super.customButtonPressed(); - } - + popupHider.hidePopupMenu(); + super.doTransparent(); + } + + @Override + public void customButtonPressed() { + popupHider.hidePopupMenu(); + super.customButtonPressed(); + } + } } \ No newline at end of file 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 758c673fa6..13d8998222 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 @@ -11,6 +11,8 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.*; +import static com.fr.design.i18n.Toolkit.i18nText; + /** * 颜色选择器更多颜色面板 * @@ -56,7 +58,7 @@ public class ColorSelectDetailPane extends BasicPane { @Override protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select_Color"); + return i18nText("Fine-Design_Basic_Select_Color"); } protected void initComponents() { @@ -65,20 +67,15 @@ public class ColorSelectDetailPane extends BasicPane { // 颜色选择器面板 selectedPanel = new JColorChooser(this.color); selectedPanel.setPreferredSize(new Dimension(selectedPanel.getWidth(), SELECT_PANEL_HEIGHT)); - AbstractColorChooserPanel[] choosers = selectedPanel.getChooserPanels(); - for (int i = 0; i < choosers.length; i++) { - selectedPanel.removeChooserPanel(choosers[i]); - } selectedPanel.setPreviewPanel(new JPanel()); AbstractColorChooserPanel swatchChooserPanel = new SwatchChooserPanel(); AbstractColorChooserPanel customChooserPanel = new CustomChooserPanel(); - selectedPanel.addChooserPanel(swatchChooserPanel); - selectedPanel.addChooserPanel(customChooserPanel); + selectedPanel.setChooserPanels(new AbstractColorChooserPanel[]{swatchChooserPanel, customChooserPanel}); this.add(selectedPanel, BorderLayout.NORTH); // 最近使用面板 - recentUsePanel = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Used")); + recentUsePanel = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Used")); RecentUseColorPane recent = new RecentUseColorPane(selectedPanel); recentUsePanel.add(recent); @@ -87,7 +84,7 @@ public class ColorSelectDetailPane extends BasicPane { selectedPanel.setPreviewPanel(new JPanel()); // 预览 - previewPanel = FRGUIPaneFactory.createTitledBorderPaneCenter(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); + previewPanel = FRGUIPaneFactory.createTitledBorderPaneCenter(i18nText("Fine-Design_Basic_Preview")); final ColorChooserPreview colorChooserPreview = new ColorChooserPreview(); ColorSelectionModel model = selectedPanel.getSelectionModel(); model.addChangeListener(new ChangeListener() { diff --git a/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java b/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java index dce7b6c308..9066b4a901 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java +++ b/designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java @@ -3,15 +3,6 @@ */ package com.fr.design.style.color; -import java.awt.Color; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; - -import javax.swing.Icon; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.event.EventListenerList; - import com.fr.base.BaseUtils; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; @@ -20,234 +11,237 @@ import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.ibutton.UICombinationButton; import com.fr.design.gui.ipoppane.PopupHider; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.stable.os.OperatingSystem; + +import javax.swing.Icon; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.EventListenerList; +import java.awt.Color; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; /** * Color select pane2. */ public class UIToolbarColorButton extends UICombinationButton implements PopupHider, ColorSelectable, UIObserver { - private static final long serialVersionUID = 3220957076370197935L; - private Color color = null; - private boolean isCanBeNull = false; - private ColorControlWindow popupWin; - //color setting action. - private EventListenerList colorChangeListenerList = new EventListenerList(); - private UIObserverListener uiObserverListener; - - - public UIToolbarColorButton(Icon icon) { - super(new UIColorButton(icon), new UIButton(BaseUtils.readIcon("/com/fr/design/images/gui/popup.gif"))); - getLeftButton().setEventBanned(true); - getRightButton().addFocusListener(new FocusListener() { - - @Override - public void focusGained(FocusEvent e) { - } - - @Override - public void focusLost(FocusEvent e) { - hidePopupMenu(); - } - }); - iniListener(); - } - - private void iniListener() { - if (shouldResponseChangeListener()) { - this.addColorChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - if (uiObserverListener == null) { - return; - } - uiObserverListener.doChange(); - } - }); - } - } - - @Override - /** - * - */ - public UIColorButton getLeftButton() { - // TODO Auto-generated method stub - return (UIColorButton) super.getLeftButton(); - } - - /** - * @return - */ - public Color getColor() { - return this.color; - } - - /** - * @param color - */ - public void setColor(Color color) { - setColorWithoutchanged(color); - fireColorStateChanged(); - } - - /** - * 设置颜色 - * @param color 颜色 - */ - public void setColorWithoutchanged(Color color) { - this.color = color; - getLeftButton().setColor(color); - } - - /** - * 是否可为NULL值 - * @return 同上 - */ - public boolean isCanBeNull() { - return this.isCanBeNull; - } - - /** - * @param isCanBeNull - */ - public void setCanBeNull(boolean isCanBeNull) { - this.isCanBeNull = isCanBeNull; - } - - @Override - /** - * - */ - public void setEnabled(boolean enabled) { - super.setEnabled(enabled); - - if (!enabled) { - color = null; - } - - getLeftButton().setEnabled(enabled); - getLeftButton().setEnabled(enabled); - } - - @Override - /** - * - */ - public void setToolTipText(String tooltipText) { - getLeftButton().setToolTipText(tooltipText); - getLeftButton().setToolTipText(tooltipText); - } - - private void showPopupMenu() { - if (popupWin != null && popupWin.isVisible()) { - hidePopupMenu(); - return; - } - - if (!this.isEnabled()) { - return; - } - - popupWin = this.getColorControlWindow(); - - GUICoreUtils.showPopupMenu(popupWin, this, 0, this.getSize().height); - } - - /** - * 隐藏弹出框 - */ - public void hidePopupMenu() { - if (popupWin != null) { - popupWin.setVisible(false); - } - - popupWin = null; - } - - private ColorControlWindow getColorControlWindow() { - //find parant. - if (this.popupWin == null) { - this.popupWin = new ColorControlWindow(this.isCanBeNull(), UIToolbarColorButton.this) { - @Override - protected void colorChanged() { - UIToolbarColorButton.this.setColor(this.getColor()); - } - - }; - } - - return popupWin; - } - - /** - * Adds a new ColorChangeListener - * 注册监听 - * @param changeListener 监听 - */ - public void addColorChangeListener(ChangeListener changeListener) { - colorChangeListenerList.add(ChangeListener.class, changeListener); - } - - /** - * Removes an old ColorChangeListener. - * 移除监听 - * @param changeListener 监听 - */ - public void removeColorChangeListener(ChangeListener changeListener) { - colorChangeListenerList.remove(ChangeListener.class, changeListener); - } - - /** - * 触发颜色改变事件 - * - */ - public void fireColorStateChanged() { - Object[] listeners = colorChangeListenerList.getListenerList(); - ChangeEvent e = null; - - for (int i = listeners.length - 2; i >= 0; i -= 2) { - if (listeners[i] == ChangeListener.class) { - if (e == null) { - e = new ChangeEvent(this); - } - ((ChangeListener) listeners[i + 1]).stateChanged(e); - } - } - } - - protected void leftButtonClickEvent() { - color = getLeftButton().getColor(); - fireColorStateChanged(); - } - - @Override - protected void rightButtonClickEvent() { - showPopupMenu(); - } - - @Override - /** - * 选中颜色 - * @param colorCell 颜色单元格 - */ - public void colorSetted(ColorCell colorCell) { - hidePopupMenu(); - } - - @Override - /** - * 注册监听 - * @param listener 监听 - */ - public void registerChangeListener(UIObserverListener listener) { - uiObserverListener = listener; - } - - @Override - /** - * 是否响应监听 - * @return 同上 - */ - public boolean shouldResponseChangeListener() { - return true; - } + private static final long serialVersionUID = 3220957076370197935L; + private Color color = null; + private boolean isCanBeNull = false; + private ColorControlWindow popupWin; + //color setting action. + private EventListenerList colorChangeListenerList = new EventListenerList(); + private UIObserverListener uiObserverListener; + + public UIToolbarColorButton(Icon icon) { + super(new UIColorButton(icon), new UIButton(BaseUtils.readIcon("/com/fr/design/images/gui/popup.gif"))); + getLeftButton().setEventBanned(true); + getRightButton().addFocusListener(new FocusListener() { + + @Override + public void focusGained(FocusEvent e) { + } + + @Override + public void focusLost(FocusEvent e) { + hidePopupMenu(); + } + }); + iniListener(); + } + + private void iniListener() { + if (shouldResponseChangeListener()) { + this.addColorChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + if (uiObserverListener == null) { + return; + } + uiObserverListener.doChange(); + } + }); + } + } + + @Override + public UIColorButton getLeftButton() { + // TODO Auto-generated method stub + return (UIColorButton) super.getLeftButton(); + } + + @Override + public Color getColor() { + return this.color; + } + + @Override + public void setColor(Color color) { + setColorWithoutchanged(color); + fireColorStateChanged(); + } + + /** + * 设置颜色 + * + * @param color 颜色 + */ + public void setColorWithoutchanged(Color color) { + this.color = color; + getLeftButton().setColor(color); + } + + /** + * 是否可为NULL值 + * + * @return 同上 + */ + public boolean isCanBeNull() { + return this.isCanBeNull; + } + + /** + * @param isCanBeNull + */ + public void setCanBeNull(boolean isCanBeNull) { + this.isCanBeNull = isCanBeNull; + } + + @Override + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + + if (!enabled) { + color = null; + } + + getLeftButton().setEnabled(enabled); + getLeftButton().setEnabled(enabled); + } + + @Override + public void setToolTipText(String tooltipText) { + getLeftButton().setToolTipText(tooltipText); + getLeftButton().setToolTipText(tooltipText); + } + + private void showPopupMenu() { + if (popupWin != null && popupWin.isVisible()) { + hidePopupMenu(); + return; + } + + if (!this.isEnabled()) { + return; + } + + popupWin = this.getColorControlWindow(); + + GUICoreUtils.showPopupMenu(popupWin, this, 0, this.getSize().height); + } + + /** + * 隐藏弹出框 + */ + @Override + public void hidePopupMenu() { + if (popupWin != null && !OperatingSystem.isMacos()) { + popupWin.setVisible(false); + } + + popupWin = null; + } + + private ColorControlWindow getColorControlWindow() { + //find parant. + if (this.popupWin == null) { + this.popupWin = new ColorControlWindow(this.isCanBeNull(), UIToolbarColorButton.this) { + @Override + protected void colorChanged() { + UIToolbarColorButton.this.setColor(this.getColor()); + } + + }; + } + + return popupWin; + } + + /** + * Adds a new ColorChangeListener + * 注册监听 + * + * @param changeListener 监听 + */ + public void addColorChangeListener(ChangeListener changeListener) { + colorChangeListenerList.add(ChangeListener.class, changeListener); + } + + /** + * Removes an old ColorChangeListener. + * 移除监听 + * + * @param changeListener 监听 + */ + public void removeColorChangeListener(ChangeListener changeListener) { + colorChangeListenerList.remove(ChangeListener.class, changeListener); + } + + /** + * 触发颜色改变事件 + */ + public void fireColorStateChanged() { + Object[] listeners = colorChangeListenerList.getListenerList(); + ChangeEvent e = null; + + for (int i = listeners.length - 2; i >= 0; i -= 2) { + if (listeners[i] == ChangeListener.class) { + if (e == null) { + e = new ChangeEvent(this); + } + ((ChangeListener) listeners[i + 1]).stateChanged(e); + } + } + } + + @Override + protected void leftButtonClickEvent() { + color = getLeftButton().getColor(); + fireColorStateChanged(); + } + + @Override + protected void rightButtonClickEvent() { + showPopupMenu(); + } + + /** + * 选中颜色 + * + * @param colorCell 颜色单元格 + */ + @Override + public void colorSetted(ColorCell colorCell) { + hidePopupMenu(); + } + + /** + * 注册监听 + * + * @param listener 监听 + */ + @Override + public void registerChangeListener(UIObserverListener listener) { + uiObserverListener = listener; + } + + /** + * 是否响应监听 + * + * @return 同上 + */ + @Override + public boolean shouldResponseChangeListener() { + return true; + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java b/designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java index eb25ccea30..827a39fd39 100644 --- a/designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java +++ b/designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java @@ -30,6 +30,7 @@ public class RecoverForDesigner implements Recover { CommonIOUtils.copyFilesInDirByPath(StableUtils.pathJoin(installHome, ProjectConstants.LOGS_NAME, UpdateConstants.INSTALL_LIB, UpdateConstants.DESIGNERBACKUPPATH), StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LIB_NAME)); + FineLoggerFactory.getLogger().error("Recover down for designer"); return true; } catch (IOException e) { FineLoggerFactory.getLogger().error("Recover error for designer", e); @@ -54,6 +55,7 @@ public class RecoverForDesigner implements Recover { CommonIOUtils.copyFilesInDirByPath(StableUtils.pathJoin(installHome,ProjectConstants.LIB_NAME), StableUtils.pathJoin(installBackup,UpdateConstants.DESIGNERBACKUPPATH)); DesignerContext.getDesignerFrame().prepareForExit(); + FineLoggerFactory.getLogger().error("Backup down for designer"); return true; } catch (IOException e) { UpdateException exception = new UpdateException("Backup Exception for designer" + e.getMessage()); diff --git a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java index dcc282c53f..12b1d74b7c 100644 --- a/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java +++ b/designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java @@ -7,16 +7,11 @@ import com.fr.design.mainframe.DesignerFrame; import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.update.ui.dialog.UpdateMainDialog; import com.fr.general.CloudCenter; -import com.fr.general.GeneralContext; import com.fr.general.GeneralUtils; import com.fr.general.http.HttpToolbox; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; -import com.fr.stable.os.OperatingSystem; -import com.fr.stable.os.support.OSBasedAction; -import com.fr.stable.os.support.OSSupportCenter; -import com.fr.workspace.WorkContext; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -32,17 +27,6 @@ public class DesignerPushUpdateManager { private DesignerUpdateInfo updateInfo; - static { - if (DesignerPushUpdateConfigManager.getInstance().isAutoPushUpdateEnabled()) { - DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() { - @Override - public void designerOpened() { - getInstance().checkAndPop(); - } - }); - } - } - private DesignerPushUpdateManager() { } @@ -53,6 +37,17 @@ public class DesignerPushUpdateManager { return singleton; } + public void preparePushUpdate() { + if (DesignerPushUpdateConfigManager.getInstance().isAutoPushUpdateEnabled()) { + DesignerContext.getDesignerFrame().addDesignerOpenedListener(new DesignerOpenedListener() { + @Override + public void designerOpened() { + getInstance().checkAndPop(); + } + }); + } + } + private void initUpdateInfo(String currentVersion, String latestVersion) { String lastIgnoredVersion = DesignerPushUpdateConfigManager.getInstance().getLastIgnoredVersion(); String updatePushInfo = CloudCenter.getInstance().acquireUrlByKind("update.push"); diff --git a/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java b/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java index 1fb21d41cb..52e4144deb 100644 --- a/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java +++ b/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java @@ -5,6 +5,7 @@ import com.fr.decision.update.info.UpdateCallBack; import com.fr.decision.update.info.UpdateProgressCallBack; import com.fr.design.RestartHelper; import com.fr.design.constants.LayoutConstants; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.UIDialog; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; @@ -608,7 +609,7 @@ public class UpdateMainDialog extends UIDialog { public void onDownloadFailed() { progressBar.setVisible(false); deleteForDesignerUpdate(installLib); - JOptionPane.showMessageDialog(getParent(), Toolkit.i18nText("Fine-Design_Update_Info_Failed_Message")); + FineJOptionPane.showMessageDialog(getParent(), Toolkit.i18nText("Fine-Design_Update_Info_Failed_Message")); helper.restartForUpdate(frame); } }.execute(); diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java index 5238b0c657..4febad3a99 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java @@ -2,6 +2,7 @@ package com.fr.design.upm; import com.fr.base.FRContext; import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.UIDialog; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; @@ -64,18 +65,18 @@ public class UpmFinder { if (flag) { if (!checkUPMResourcesExist()){ // upm下载 - int val = JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"), - Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); + int val = FineJOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Need_Install"), + Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); if (val == JOptionPane.OK_OPTION){ try { UpmResourceLoader.INSTANCE.download(); UpmResourceLoader.INSTANCE.install(); - JOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), - Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE); + FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), + Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE); } catch (Exception e){ FineLoggerFactory.getLogger().error(e.getMessage(), e); - JOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Updater_Download_Failed"), - Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE); + FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Updater_Download_Failed"), + Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE); } } } diff --git a/designer-base/src/main/java/com/fr/design/utils/BrowseUtils.java b/designer-base/src/main/java/com/fr/design/utils/BrowseUtils.java index 8a68593efe..c8f98421c9 100644 --- a/designer-base/src/main/java/com/fr/design/utils/BrowseUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/BrowseUtils.java @@ -1,5 +1,6 @@ package com.fr.design.utils; +import com.fr.design.dialog.FineJOptionPane; import com.fr.log.FineLoggerFactory; import com.fr.stable.OperatingSystem; import com.fr.stable.StringUtils; @@ -27,7 +28,7 @@ public class BrowseUtils { // win10 内存用到到80%左右的时候, Desktop.browser经常提示"存储空间不足, 无法处理改命令", 用rundll32可以打开. Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + uri); } catch (IOException ee) { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser_Duplicate")); + FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Set_Default_Browser_Duplicate")); FineLoggerFactory.getLogger().error(e.getMessage(), e); } } else { diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index 8d32e6e0ed..6698a171fd 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -5,6 +5,7 @@ import com.fr.base.ServerConfig; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.gui.UILookAndFeel; import com.fr.design.mainframe.DesignerContext; @@ -176,7 +177,7 @@ public class DesignUtils { @Override public void run() { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), final_msg); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), final_msg); } }); } diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index f0412a948b..5a9396da64 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -16,6 +16,7 @@ import com.fr.data.util.function.SumFunction; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.border.UITitledBorder; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.icheckbox.UICheckBox; @@ -324,7 +325,7 @@ public final class GUICoreUtils { /** * Gets window/frame to screen center. - * @param 窗口 + * @param win 窗口 */ public static void setWindowFullScreen(Window win) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); @@ -341,7 +342,7 @@ public final class GUICoreUtils { * Shows down component. * 显示弹出关闭菜单 * @param popup 弹出菜单 - * @param 父组件 + * @param parentComponent 父组件 */ public static void showPopupCloseMenu(JPopupMenu popup, Component parentComponent) { if (popup == null) {// check null. @@ -537,7 +538,7 @@ public final class GUICoreUtils { /** * 产生一个Flow Pane, flowAligment是FlowLayout.LEFT, CENTER, RIGHT. * @param comps 组件 - * @param flowAlignement 对齐方式 + * @param flowAlignment 对齐方式 * @param hSpace 水平间隔 * @return 面板 */ @@ -660,7 +661,7 @@ public final class GUICoreUtils { /** * it's a very good method, user can get treePath from treeNode. - * @param 节点 + * @param treeNode 节点 * @return 路径 */ public static TreePath getTreePath(TreeNode treeNode) { @@ -740,7 +741,7 @@ public final class GUICoreUtils { return false; } - int returnVal = JOptionPane.showConfirmDialog(ancestorWindow, com.fr.design.i18n.Toolkit.i18nText(key), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), + int returnVal = FineJOptionPane.showConfirmDialog(ancestorWindow, com.fr.design.i18n.Toolkit.i18nText(key), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (returnVal == JOptionPane.OK_OPTION) { int minSelectedIndex = nodeList.getMinSelectionIndex(); diff --git a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java index e4aedd4219..12c72c5cd3 100644 --- a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java +++ b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java @@ -6,6 +6,7 @@ import com.fr.base.Icon; import com.fr.base.IconManager; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; @@ -150,7 +151,7 @@ public class CustomIconPane extends BasicPane { } else { // add failed - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.WARNING_MESSAGE); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); } } }).setVisible(true); @@ -179,9 +180,9 @@ public class CustomIconPane extends BasicPane { CustomIconPane.this.repaint(); } else { // remove failed - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); } } @@ -204,9 +205,9 @@ public class CustomIconPane extends BasicPane { // do nothing } if (oldIcon == null) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), - "Error", - "Error", + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE); } @@ -228,7 +229,7 @@ public class CustomIconPane extends BasicPane { // 失败了再弄回去 iconManager.addIcon(oldIcon, true); // edit failed - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.WARNING_MESSAGE); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message2"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); } } }).setVisible(true); @@ -425,9 +426,9 @@ public class CustomIconPane extends BasicPane { return; } if (WidgetInfoConfig.getInstance().getIconManager().contains(nameTextField.getText())) { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_Message3"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); } } diff --git a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java index c28f70e5fd..15e5aed4a7 100644 --- a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java +++ b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java @@ -17,6 +17,7 @@ import com.fr.design.data.tabledata.tabledatapane.FormatExplanationPane; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.editor.ValueEditorPane; import com.fr.design.editor.ValueEditorPaneFactory; import com.fr.design.editor.editor.Editor; @@ -584,7 +585,7 @@ public class DBManipulationPane extends BasicBeanPane { return; } - int returnVal = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(DBManipulationPane.this), + int returnVal = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(DBManipulationPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_sure_remove_item") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Base_Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (returnVal == JOptionPane.OK_OPTION) { diff --git a/designer-base/src/main/java/com/fr/env/EnvListPane.java b/designer-base/src/main/java/com/fr/env/EnvListPane.java index 30b4b76f12..6300abe95a 100644 --- a/designer-base/src/main/java/com/fr/env/EnvListPane.java +++ b/designer-base/src/main/java/com/fr/env/EnvListPane.java @@ -1,6 +1,7 @@ package com.fr.env; import com.fr.design.DesignerEnvManager; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.LocalDesignerWorkspaceInfo; import com.fr.design.env.RemoteDesignerWorkspaceInfo; @@ -33,13 +34,13 @@ public class EnvListPane extends JListControlPane { allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY; if (StringUtils.isEmpty(tempName)) { nameableList.stopEditing(); - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(EnvListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Workspace_Empty_Name_Warn_Text")); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(EnvListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Workspace_Empty_Name_Warn_Text")); setIllegalIndex(editingIndex); return; } if (!ComparatorUtils.equals(tempName, selectedName) && isNameRepeated(new List[]{Arrays.asList(allListNames)}, tempName)) { nameableList.stopEditing(); - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(EnvListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Workspace_Duplicate_Name_Warn_Text", tempName)); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(EnvListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Workspace_Duplicate_Name_Warn_Text", tempName)); setIllegalIndex(editingIndex); } } diff --git a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java index 52e63c9bfa..ac76405d9f 100644 --- a/designer-base/src/main/java/com/fr/file/FILEChooserPane.java +++ b/designer-base/src/main/java/com/fr/file/FILEChooserPane.java @@ -7,6 +7,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.UIDialog; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceType; @@ -846,7 +847,7 @@ public class FILEChooserPane extends BasicPane { saveDictionary(); dialogExit(); } else { - JOptionPane.showMessageDialog(this, Toolkit.i18nText("Fine-Design_Basic_App_Template_Report_Not_Exist")); + FineJOptionPane.showMessageDialog(this, Toolkit.i18nText("Fine-Design_Basic_App_Template_Report_Not_Exist")); return; } } @@ -876,8 +877,8 @@ public class FILEChooserPane extends BasicPane { if (access(selectedFile) && access(currentDirectory)) { if (selectedFile.exists()) { - int selVal = JOptionPane.showConfirmDialog(dialog, Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Cover_The_Current_File") + " ?", - ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE); + int selVal = FineJOptionPane.showConfirmDialog(dialog, Toolkit.i18nText("Fine-Design_Basic_Utils_Would_You_Like_To_Cover_The_Current_File") + " ?", + Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (selVal == JOptionPane.YES_OPTION) { option = JOPTIONPANE_OK_OPTION; saveDictionary(); @@ -891,7 +892,7 @@ public class FILEChooserPane extends BasicPane { saveDictionary(); } } else { - JOptionPane.showMessageDialog(FILEChooserPane.this, Toolkit.i18nText("Fine-Design_Basic_App_Privilege_No") + "!", Toolkit.i18nText("Fine-Design_Basic_App_File_Message"), JOptionPane.WARNING_MESSAGE); + FineJOptionPane.showMessageDialog(FILEChooserPane.this, Toolkit.i18nText("Fine-Design_Basic_App_Privilege_No") + "!", Toolkit.i18nText("Fine-Design_Basic_App_File_Message"), JOptionPane.WARNING_MESSAGE); } } @@ -1553,7 +1554,7 @@ public class FILEChooserPane extends BasicPane { if (access(currentDirectory)) { new MkdirDialog(); } else { - JOptionPane.showMessageDialog( + FineJOptionPane.showMessageDialog( FILEChooserPane.this, Toolkit.i18nText("Fine-Design_Basic_App_Privilege_No") + "!", Toolkit.i18nText("Fine-Design_Basic_App_File_Message"), @@ -1715,9 +1716,9 @@ public class FILEChooserPane extends BasicPane { scrollPane.getVerticalScrollBar().setValue(value); } else { - JOptionPane.showConfirmDialog(FILEChooserPane.this, + FineJOptionPane.showConfirmDialog(FILEChooserPane.this, Toolkit.i18nText("Fine-Design_Basic_Make_Failure"), - UIManager.getString("OptionPane.messageDialogTitle"), + Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); } diff --git a/designer-base/src/main/java/com/fr/start/BaseDesigner.java b/designer-base/src/main/java/com/fr/start/BaseDesigner.java index 833faaef70..3ad4708a84 100644 --- a/designer-base/src/main/java/com/fr/start/BaseDesigner.java +++ b/designer-base/src/main/java/com/fr/start/BaseDesigner.java @@ -26,7 +26,7 @@ import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.OperatingSystem; -import java.awt.*; +import java.awt.Window; import java.io.File; import java.lang.reflect.Method; diff --git a/designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.js b/designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.js index f42fb1ac7b..d1c46cee2a 100644 --- a/designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.js +++ b/designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.js @@ -104,8 +104,7 @@ function getMoreInfo() { function getCloseButton() { return BI.createWidget({ type: "bi.button", - text: "", - iconCls: "close-font", + text: String.fromCharCode(10005), cls: "close-btn", clear: true, handler: function () { diff --git a/designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java b/designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java index 8d2f522c06..c6675da0d3 100644 --- a/designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java +++ b/designer-base/src/test/java/com/fr/design/data/DesignTableDataManagerTest.java @@ -1,11 +1,14 @@ package com.fr.design.data; import com.fr.base.TableData; +import com.fr.data.TableDataSource; import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.design.data.tabledata.wrapper.TableDataFactory; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; import com.fr.file.ProcedureConfig; import com.fr.file.TableDataConfig; +import com.fr.invoke.Reflect; import org.easymock.EasyMock; import org.junit.Assert; import org.junit.Test; @@ -23,6 +26,7 @@ import java.util.Map; @SuppressStaticInitializationFor({"com.fr.design.data.tabledata.wrapper.TableDataFactory"}) public class DesignTableDataManagerTest { + @Test public void testFireDataChange() { @@ -99,4 +103,47 @@ public class DesignTableDataManagerTest { } + + @Test + public void testGetSelectedColumnNames() throws Exception { + PowerMock.mockStatic(TableDataConfig.class); + PowerMock.mockStatic(TemplateTableDataWrapper.class); + TableDataConfig config = EasyMock.mock(TableDataConfig.class); + TableData td1 = EasyMock.mock(TableData.class); + TableData td2 = EasyMock.mock(TableData.class); + TableDataSource dataSource = EasyMock.mock(TableDataSource.class); + EasyMock.expect(config.getTableData("ds1")).andReturn(td1).anyTimes(); + EasyMock.expect(config.getTableData("ds2")).andReturn(td2).anyTimes(); + EasyMock.expect(dataSource.getTableData("ds1")).andReturn(td1).anyTimes(); + EasyMock.expect(dataSource.getTableData("ds2")).andReturn(td2).anyTimes(); + EasyMock.expect(TableDataConfig.getInstance()).andReturn(config).anyTimes(); + PowerMock.mockStatic(TableDataFactory.class); + EasyMock.expect(TableDataFactory.getSortOfChineseNameOfServerData(config)) + .andReturn(new String[]{"ds1", "ds2"}).anyTimes(); + EasyMock.expect(TableDataFactory.getSortOfChineseNameOfTemplateData(dataSource)) + .andReturn(new String[]{"ds1", "ds2"}); + Map> cache = Reflect.on(DesignTableDataManager.class).field( + "columnCache").get(); + Map map = new HashMap<>(); + map.put("ds1", new String[]{"a", "b", "c"}); + cache.put(dataSource, map); + ProcedureConfig proConfig = EasyMock.mock(ProcedureConfig.class); + Map procedureMap = new HashMap<>(); + EasyMock.expect(proConfig.getProcedures()).andReturn(procedureMap).anyTimes(); + PowerMock.mockStatic(ProcedureConfig.class); + EasyMock.expect(ProcedureConfig.getInstance()).andReturn(proConfig).anyTimes(); + EasyMock.replay(config, proConfig, dataSource); + PowerMock.replay(TableDataFactory.class, TableDataConfig.class, ProcedureConfig.class, + TemplateTableDataWrapper.class); + Assert.assertEquals(new String[]{"a", "b", "c"}, + DesignTableDataManager.getSelectedColumnNames(dataSource, "ds1")); + } + + @Test + public void testAddDsColumnNames() { + DesignTableDataManager.addDsColumnNames("ds1", new String[]{"a", "b", "c"}); + Map> map = Reflect.on(DesignTableDataManager.class).field( + "columnCache").get(); + Assert.assertEquals(new String[]{"a", "b", "c"}, map.get(null).get("ds1")); + } } diff --git a/designer-base/src/test/java/com/fr/design/mainfarme/toolbar/ToolBarMenuDockTest.java b/designer-base/src/test/java/com/fr/design/mainfarme/toolbar/ToolBarMenuDockTest.java new file mode 100644 index 0000000000..c5f9f0a700 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/mainfarme/toolbar/ToolBarMenuDockTest.java @@ -0,0 +1,129 @@ +package com.fr.design.mainfarme.toolbar; + +import java.util.Locale; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.actions.community.VideoAction; +import com.fr.design.actions.help.AboutAction; +import com.fr.design.actions.help.FineUIAction; +import com.fr.design.actions.help.TutorialAction; +import com.fr.design.actions.help.WebDemoAction; +import com.fr.design.actions.help.alphafine.AlphaFineAction; +import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; +import com.fr.design.mainframe.toolbar.ToolBarMenuDock; +import com.fr.design.menu.SeparatorDef; +import com.fr.design.menu.ShortCut; +import com.fr.design.os.impl.SupportOSImpl; +import com.fr.design.update.actions.SoftwareUpdateAction; +import com.fr.general.GeneralContext; +import com.fr.workspace.WorkContext; +import com.fr.workspace.Workspace; +import org.easymock.EasyMock; +import org.easymock.Mock; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.easymock.PowerMock; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import org.powermock.reflect.Whitebox; + + +/** + * @author Lucian.Chen + * @version 10.0 + * Created by Lucian.Chen on 2019/12/11 + */ +@RunWith(PowerMockRunner.class) +@PrepareForTest({ + ToolBarMenuDock.class, + GeneralContext.class, + Locale.class, + WorkContext.class, + DesignerEnvManager.class, + AlphaFineConfigManager.class}) +public class ToolBarMenuDockTest { + + @Mock + VideoAction videoAction; + @Mock + TutorialAction tutorialAction; + @Mock + WebDemoAction webDemoAction; + @Mock + SoftwareUpdateAction softwareUpdateAction; + @Mock + AlphaFineAction alphaFineAction; + @Mock + FineUIAction fineUIAction; + @Mock + AboutAction aboutAction; + + @Before + public void testCreateHelpShortCutsBefore() { + try { + PowerMock.expectNew(VideoAction.class).andReturn(videoAction).anyTimes(); + PowerMock.expectNew(TutorialAction.class).andReturn(tutorialAction).anyTimes(); + PowerMock.expectNew(WebDemoAction.class).andReturn(webDemoAction).anyTimes(); + PowerMock.expectNew(SoftwareUpdateAction.class).andReturn(softwareUpdateAction).anyTimes(); + PowerMock.expectNew(AlphaFineAction.class).andReturn(alphaFineAction).anyTimes(); + PowerMock.expectNew(FineUIAction.class).andReturn(fineUIAction).anyTimes(); + PowerMock.expectNew(AboutAction.class).andReturn(aboutAction).anyTimes(); + } catch (Exception e) { + Assert.fail(e.getMessage()); + } + } + + @Test + public void testCreateHelpShortCuts() { + + // 处理判断条件 + GeneralContext context = EasyMock.createMock(GeneralContext.class); + PowerMock.mockStatic(GeneralContext.class); + EasyMock.expect(GeneralContext.getLocale()).andReturn(Locale.CHINA).once(); + EasyMock.expect(GeneralContext.getLocale()).andReturn(Locale.US).once(); + + Workspace workspace = EasyMock.createMock(Workspace.class); + PowerMock.mockStatic(WorkContext.class); + EasyMock.expect(WorkContext.getCurrent()).andReturn(workspace).anyTimes(); + + EasyMock.expect(workspace.isLocal()).andReturn(false).once(); + EasyMock.expect(workspace.isLocal()).andReturn(true).once(); + + DesignerEnvManager envManager = EasyMock.createMock(DesignerEnvManager.class); + PowerMock.mockStatic(DesignerEnvManager.class); + EasyMock.expect(DesignerEnvManager.getEnvManager()).andReturn(envManager).anyTimes(); + + EasyMock.expect(envManager.isOpenDebug()).andReturn(false).once(); + EasyMock.expect(envManager.isOpenDebug()).andReturn(true).once(); + + AlphaFineConfigManager configManager = EasyMock.createMock(AlphaFineConfigManager.class); + PowerMock.mockStatic(AlphaFineConfigManager.class); + EasyMock.expect(AlphaFineConfigManager.isALPHALicAvailable()).andReturn(false).once(); + EasyMock.expect(AlphaFineConfigManager.isALPHALicAvailable()).andReturn(true).once(); + + SupportOSImpl osImpl = EasyMock.createMock(SupportOSImpl.class); + Whitebox.setInternalState(SupportOSImpl.class, "FINEUI", osImpl); + EasyMock.expect(osImpl.support()).andReturn(false).anyTimes(); + + EasyMock.replay(context, workspace, envManager, configManager, osImpl); + PowerMock.replayAll(); + + + ToolBarMenuDock menuDock = new ToolBarMenuDock() { + @Override + public ShortCut[] createNewFileShortCuts() { + return new ShortCut[0]; + } + }; + + ShortCut[] shortCuts1 = new ShortCut[] {SeparatorDef.DEFAULT, aboutAction}; + ShortCut[] shortCuts2 = new ShortCut[] {videoAction, tutorialAction, webDemoAction, + softwareUpdateAction, alphaFineAction, SeparatorDef.DEFAULT, aboutAction}; + + Assert.assertEquals(menuDock.createHelpShortCuts(), shortCuts1); + Assert.assertEquals(menuDock.createHelpShortCuts(), shortCuts2); + + } +} diff --git a/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoTest.java b/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoTest.java index 19f6066ff8..426dba3b1d 100644 --- a/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoTest.java +++ b/designer-base/src/test/java/com/fr/design/mainframe/template/info/TemplateInfoTest.java @@ -54,7 +54,7 @@ public class TemplateInfoTest { TemplateInfo templateInfo = TemplateInfo.newInstance(templateID); assertEquals(templateID, templateInfo.getTemplateID()); assertEquals(StringUtils.EMPTY, Reflect.on(templateInfo).field("originID").get()); - assertEquals(0, Reflect.on(templateInfo).field("idleDayCount").get()); + assertEquals(0, (int) Reflect.on(templateInfo).field("idleDayCount").get()); assertEquals("{}", templateInfo.getProcessMapJsonString()); Map consumingMap = Reflect.on(templateInfo).field("consumingMap").get(); @@ -77,7 +77,7 @@ public class TemplateInfoTest { TemplateInfo templateInfo = TemplateInfo.newInstance(templateID, originID, originTime); assertEquals(templateID, templateInfo.getTemplateID()); assertEquals(originID, Reflect.on(templateInfo).field("originID").get()); - assertEquals(0, Reflect.on(templateInfo).field("idleDayCount").get()); + assertEquals(0, (int) Reflect.on(templateInfo).field("idleDayCount").get()); assertEquals("{}", templateInfo.getProcessMapJsonString()); Map consumingMap = Reflect.on(templateInfo).field("consumingMap").get(); diff --git a/designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java b/designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java index 2148257a41..d6134e0cee 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/series/PlotSeries/MapGroupExtensionPane.java @@ -13,6 +13,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.event.ChangeEvent; import com.fr.design.event.ChangeListener; import com.fr.design.event.UIObserver; @@ -327,15 +328,15 @@ public class MapGroupExtensionPane extends BasicPane implements UIObserver { } private void showRenameWaring(String newName){ - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), "\"" + newName + "\"" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Has_Been_Existed") - + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alert"), JOptionPane.WARNING_MESSAGE); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), "\"" + newName + "\"" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Has_Been_Existed") + + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); } private JMenuItem createRenameItem() { JMenuItem renameItem = new JMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Rename")); renameItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - String newName = JOptionPane.showInputDialog(DesignerContext.getDesignerFrame().getContentPane(), + String newName = FineJOptionPane.showInputDialog(DesignerContext.getDesignerFrame().getContentPane(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Rename"), groupExtensionPane.getSelectedObject()); if (StringUtils.isNotBlank(newName)) { String oldName = Utils.objectToString(groupExtensionPane.getSelectedObject()); diff --git a/designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java b/designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java index 8849cc17c9..c0fd710680 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java +++ b/designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java @@ -2,6 +2,7 @@ package com.fr.van.chart; import com.fr.chart.base.ChartConstants; import com.fr.design.RestartHelper; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.extra.PluginConstants; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.gui.GUICoreUtils; @@ -80,7 +81,8 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent { public void installOnline() { - int choose = JOptionPane.showConfirmDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Download_Online_Sources"), null, JOptionPane.YES_NO_OPTION); + int choose = JOptionPane.showConfirmDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Download_Online_Sources"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION); if (choose == JOptionPane.OK_OPTION) { initDialog(); @@ -203,13 +205,14 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent { dialog.dispose(); if (result) { - int choose = JOptionPane.showConfirmDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Work_After_Restart_Designer"), null, JOptionPane.YES_NO_OPTION); + int choose = FineJOptionPane.showConfirmDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Work_After_Restart_Designer"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION); if (choose == JOptionPane.OK_OPTION) { RestartHelper.restart(); } } else { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Dependence_Install_Failed")); + FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Dependence_Install_Failed")); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java index 133cba525f..8f7b9557d0 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartCustomPlotSelectPane.java @@ -2,6 +2,7 @@ package com.fr.van.chart.custom.component; import com.fr.chart.chartattr.Chart; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; @@ -115,7 +116,7 @@ public class VanChartCustomPlotSelectPane extends BasicBeanPane { customTypeList.get(index).getCheckBox().setSelected(true); //彈出警告框 - JOptionPane.showMessageDialog(new JPanel(), MASSAGE,"", JOptionPane.WARNING_MESSAGE); + FineJOptionPane.showMessageDialog(new JPanel(), MASSAGE,com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); } //点击后更新已选顺序 diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java index 297d781667..f609debe90 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapSourceChoosePane.java @@ -5,6 +5,7 @@ import com.fr.base.Utils; import com.fr.decision.webservice.v10.map.WMSFactory; import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; import com.fr.design.constants.LayoutConstants; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import com.fr.design.file.HistoryTemplateListPane; @@ -427,7 +428,7 @@ public class VanChartMapSourceChoosePane extends JPanel implements UIObserver { if(list != null && list.size() > 0) { resetWMSLayerPane(list); } else { - JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Invalid_WMS")); + FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Invalid_WMS")); } } }.execute(); diff --git a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java index d77078fad6..c6f64c498c 100644 --- a/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java +++ b/designer-form/src/main/java/com/fr/design/actions/FormMobileAttrAction.java @@ -77,8 +77,10 @@ public class FormMobileAttrAction extends JTemplateAction { formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后 ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); jf.getFormDesign().getSelectionModel().setSelectedCreator(jf.getFormDesign().getRootComponent()); - //改变布局为自适应布局,只在移动端属性设置保存后改变一次 - doChangeBodyLayout(); + //当自适应属性自动匹配处于勾选状态 进行切换 + if (formMobileAttr.isMobileOnly() && formMobileAttr.isAdaptivePropertyAutoMatch()) { + doChangeBodyLayout(); + } WidgetPropertyPane.getInstance().refreshDockingView(); jf.fireTargetModified(); diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java index 4e6adee4b4..4bc0f22e49 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java @@ -241,16 +241,12 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter { LayoutUtils.layoutRootContainer(container); }else{ //添加到其父组件布局中的时候,要用其父组件布局添加 - container.getLayoutAdapter().addBean(creator, x, y); if (creator.shouldScaleCreator() || creator.hasTitleStyle()) { - addParentCreator(creator); + XLayoutContainer parentPanel = creator.initCreatorWrapper(creator.getHeight()); + container.getLayoutAdapter().addBean(parentPanel, x, y); } else { - container.add(creator, creator.toData().getWidgetName(),0); + container.getLayoutAdapter().addBean(creator, x, y); } - XWFitLayout layout = (XWFitLayout) container; - // 更新对应的BoundsWidget - layout.updateBoundsWidget(); - updateCreatorBackBound(); } } diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRWCardTagLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRWCardTagLayoutAdapter.java new file mode 100644 index 0000000000..e5331edd05 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRWCardTagLayoutAdapter.java @@ -0,0 +1,39 @@ +package com.fr.design.designer.beans.adapters.layout; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XLayoutContainer; + +/** + * 针对tabpane的布局适配器 + * Created by kerry on 2019-12-10 + */ +public class FRWCardTagLayoutAdapter extends AbstractLayoutAdapter { + public FRWCardTagLayoutAdapter(XLayoutContainer container) { + super(container); + } + + /** + * 对于这种布局方式,不允许其他组件添加 + * + * @param creator + * @param x + * @param y + */ + @Override + protected void addComp(XCreator creator, int x, int y) { + + } + + /** + * 对于这种布局方式,不允许其他组件添加 + * + * @param creator 组件 + * @param x 添加的位置x,该位置是相对于container的 + * @param y 添加的位置y,该位置是相对于container的 + * @return + */ + @Override + public boolean accept(XCreator creator, int x, int y) { + return false; + } +} diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java index 76eb602300..052ae05390 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java @@ -18,9 +18,7 @@ import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; import com.fr.stable.ArrayUtils; -import java.awt.LayoutManager; -import java.awt.Rectangle; -import java.awt.Toolkit; +import java.awt.*; import java.awt.event.MouseEvent; import java.util.ArrayList; @@ -177,19 +175,36 @@ public class SelectionModel { } private void pasteXWFitLayout() { - //自适应布局编辑器内部左上角第一个坐标点 - int leftUpX = designer.getRootComponent().toData().getMargin().getLeft() + 1; - int leftUpY = designer.getRootComponent().toData().getMargin().getTop() + 1; - //选中第一个坐标点坐在的组件 - selection.setSelectedCreator((XCreator) designer.getRootComponent().getComponentAt(leftUpX, leftUpY)); - Rectangle rectangle = selection.getRelativeBounds(); - if (hasSelectedPasteSource()) { - selectedPaste(); + if (selection.getSelectedCreator().getClass().equals(XWTabFitLayout.class)) { + XLayoutContainer container = (XLayoutContainer) selection.getSelectedCreator(); + //tab布局编辑器内部左上角第一个坐标点 + int leftUpX = container.toData().getMargin().getLeft() + 1; + int leftUpY = container.toData().getMargin().getTop() + 1; + //选中第一个坐标点坐在的组件 + selection.setSelectedCreator((XCreator) container.getComponentAt(leftUpX, leftUpY)); + Rectangle rectangle = selection.getRelativeBounds(); + if (hasSelectedPasteSource()) { + selectedPaste(); + } else { + FormSelectionUtils.paste2Container(designer, container, clipboard, + rectangle.x + rectangle.width / 2, + rectangle.y + DELTA_X_Y); + } } else { - FormSelectionUtils.paste2Container(designer, designer.getRootComponent(), - clipboard, - rectangle.x + rectangle.width / 2, - rectangle.y + DELTA_X_Y); + //自适应布局编辑器内部左上角第一个坐标点 + int leftUpX = designer.getRootComponent().toData().getMargin().getLeft() + 1; + int leftUpY = designer.getRootComponent().toData().getMargin().getTop() + 1; + //选中第一个坐标点坐在的组件 + selection.setSelectedCreator((XCreator) designer.getRootComponent().getComponentAt(leftUpX, leftUpY)); + Rectangle rectangle = selection.getRelativeBounds(); + if (hasSelectedPasteSource()) { + selectedPaste(); + } else { + FormSelectionUtils.paste2Container(designer, designer.getRootComponent(), + clipboard, + rectangle.x + rectangle.width / 2, + rectangle.y + DELTA_X_Y); + } } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWidgetCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWidgetCreator.java index 4835ec16bf..590aea3395 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWidgetCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWidgetCreator.java @@ -4,6 +4,7 @@ package com.fr.design.designer.creator; import com.fr.base.BaseUtils; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.FormDesigner; @@ -183,7 +184,7 @@ public abstract class XWidgetCreator extends XCreator { */ public void ChangeCreatorName(FormDesigner designer, XCreator creator) { String oldName = creator.toData().getWidgetName(); - String value = JOptionPane.showInputDialog(designer, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Change_Widget_Name_Discription"), oldName); + String value = FineJOptionPane.showInputDialog(designer, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Change_Widget_Name_Discription"), oldName); if (value != null) { designer.renameCreator(creator, value); } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java index 5a7ae9817c..6de8c0114f 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java @@ -12,6 +12,7 @@ import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XButton; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIPopupMenu; @@ -210,8 +211,8 @@ public class XCardSwitchButton extends XButton { //删除card,同时修改其他switchbutton和tabfit的index private void deleteCard(XCardSwitchButton button, int index){ String titleName = button.getContentLabel().getText(); - int value = JOptionPane.showConfirmDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Confirm_Dialog_Content") + "“" + titleName + "”", - ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION); + int value = FineJOptionPane.showConfirmDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Confirm_Dialog_Content") + "“" + titleName + "”", + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION); if (value != JOptionPane.OK_OPTION) { return; } @@ -352,8 +353,8 @@ public class XCardSwitchButton extends XButton { //删除tab布局 private void deleteTabLayout(SelectionModel selectionModel, FormDesigner designer){ String titleName = this.getContentLabel().getText(); - int value = JOptionPane.showConfirmDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Confirm_Dialog_Content") + "“" + titleName + "”", - ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION); + int value = FineJOptionPane.showConfirmDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Confirm_Dialog_Content") + "“" + titleName + "”", + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION); if (value != JOptionPane.OK_OPTION) { return; } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java index 77282f63f9..dc8bb90801 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java @@ -8,8 +8,7 @@ import com.fr.base.ScreenResolution; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.LayoutAdapter; -import com.fr.design.designer.beans.adapters.layout.FRHorizontalLayoutAdapter; -import com.fr.design.designer.beans.adapters.layout.FRVerticalLayoutAdapter; +import com.fr.design.designer.beans.adapters.layout.FRWCardTagLayoutAdapter; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; @@ -311,12 +310,7 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout { @Override public LayoutAdapter getLayoutAdapter() { - if (isHori()) { - return new FRHorizontalLayoutAdapter(this); - }else{ - return new FRVerticalLayoutAdapter(this); - } - + return new FRWCardTagLayoutAdapter(this); } private boolean isHori(){ @@ -452,4 +446,4 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout { } } -} \ No newline at end of file +} diff --git a/designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBookMarkPropertyUI.java b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBookMarkPropertyUI.java new file mode 100644 index 0000000000..91451d81f4 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBookMarkPropertyUI.java @@ -0,0 +1,36 @@ +package com.fr.design.designer.properties.mobile; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.dialog.BasicPane; +import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; +import com.fr.design.gui.itable.AbstractPropertyTable; +import com.fr.design.widget.ui.designer.mobile.MobileAdvanceDefinePane; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2019/12/24 + */ +public class MobileBookMarkPropertyUI extends AbstractWidgetPropertyUIProvider { + + private XCreator xCreator; + + public MobileBookMarkPropertyUI(XCreator xCreator) { + this.xCreator = xCreator; + } + + @Override + public AbstractPropertyTable createWidgetAttrTable() { + return null; + } + + @Override + public BasicPane createWidgetAttrPane() { + return new MobileAdvanceDefinePane(xCreator); + } + + @Override + public String tableTitle() { + return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); + } +} 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 bac50642e0..c72aa45128 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 @@ -212,7 +212,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP * @param newName 新名称 */ public void refresh4TableData(String oldName, String newName) { - this.getTarget().renameTableData(oldName, newName); + this.getTarget().renameTableData(this.getTarget().getContainer(), oldName, newName); this.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_SELECTED); } 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 fbf52d021f..b94ad57dbb 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 @@ -37,6 +37,7 @@ import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWBorderLayout; import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.event.DesignerOpenedListener; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.util.XCreatorConstants; @@ -388,8 +389,8 @@ public class FormDesigner extends TargetComponent
implements TreeSelection } private void addParaPaneTooltips() { - JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Please_Drag_ParaPane"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); + FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Please_Drag_ParaPane"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); } /** @@ -635,8 +636,8 @@ public class FormDesigner extends TargetComponent implements TreeSelection return false; } if (this.getTarget().isNameExist(newName)) { - JOptionPane.showMessageDialog(this, "\"" + newName + "\"" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Has_Been_Existed") - + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alert"), JOptionPane.WARNING_MESSAGE); + FineJOptionPane.showMessageDialog(this, "\"" + newName + "\"" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Has_Been_Existed") + + "!", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); return false; } creator.resetCreatorName(newName); @@ -645,7 +646,7 @@ public class FormDesigner extends TargetComponent implements TreeSelection } public void showMessageDialog(String message) { - JOptionPane.showMessageDialog(this, message, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Alert"), JOptionPane.WARNING_MESSAGE); + FineJOptionPane.showMessageDialog(this, message, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE); FormSelectionUtils.rebuildSelection(this); repaint(); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index 6e8419f72f..7c2b67352c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -23,8 +23,7 @@ import com.fr.page.WatermarkPainter; import com.fr.report.core.ReportUtils; import com.fr.stable.ArrayUtils; -import javax.swing.JComponent; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.plaf.ComponentUI; import java.awt.AlphaComposite; import java.awt.Component; @@ -65,7 +64,7 @@ public class FormDesignerUI extends ComponentUI { * @param c 组件 */ @Override - public void paint(Graphics g, JComponent c) { + public void paint(final Graphics g, JComponent c) { XCreator rootComponent = designer.getRootComponent(); this.time = (float)designer.getResolution()/ScreenResolution.getScreenResolution(); if (rootComponent != null) { @@ -101,8 +100,14 @@ public class FormDesignerUI extends ComponentUI { if (designer.getPainter() != null) { // ComponentAdapter和LayoutAdapter提供的额外的Painter,该Painter一般用于提示作用, // 相当于一个浮动层, 要考虑参数面板的高度 - designer.getPainter().paint(g, designer.getArea().getHorizontalValue(), - designer.getArea().getVerticalValue() + designer.getParaHeight()); + new SwingWorker() { + @Override + protected Void doInBackground() throws Exception { + designer.getPainter().paint(g, designer.getArea().getHorizontalValue(), + designer.getArea().getVerticalValue() + designer.getParaHeight()); + return null; + } + }.execute(); } AddingModel addingModel = designer.getAddingModel(); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormEditToolBar.java b/designer-form/src/main/java/com/fr/design/mainframe/FormEditToolBar.java index 275730d8ff..b5fac75e5a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormEditToolBar.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormEditToolBar.java @@ -4,6 +4,7 @@ import com.fr.design.actions.UpdateAction; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; @@ -287,7 +288,8 @@ public class FormEditToolBar extends BasicPane { if (i < 0 || !(listModel.getElementAt(i) instanceof FormToolBarButton)) { return; } - int val = JOptionPane.showConfirmDialog(FormEditToolBar.this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Are_You_Sure_To_Delete_The_Data") + "?", "Message", JOptionPane.YES_NO_OPTION); + int val = FineJOptionPane.showConfirmDialog(FormEditToolBar.this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Are_You_Sure_To_Delete_The_Data") + "?", + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION); if (val != JOptionPane.YES_OPTION) { return; } 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 a5b76e1fca..ab19002c18 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 @@ -543,8 +543,12 @@ public class JForm extends JTemplate implements BaseJForm set = ExtraDesignClassManager.getInstance().getArray(WidgetPropertyUIProvider.XML_TAG); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/ElementCaseToolBarPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/ElementCaseToolBarPane.java index 4288d47caa..2e1564a2d2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/ElementCaseToolBarPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/editors/ElementCaseToolBarPane.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.widget.editors; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.core.WidgetOption; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; @@ -98,7 +99,7 @@ public class ElementCaseToolBarPane extends BasicBeanPane northToolBar.validate(); northToolBar.repaint(); } else { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Choose_One_Button")); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Choose_One_Button")); } } }); @@ -123,7 +124,7 @@ public class ElementCaseToolBarPane extends BasicBeanPane southToolBar.validate(); southToolBar.repaint(); } else { - JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Choose_One_Button")); + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Choose_One_Button")); } } }); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/UIBoundSpinner.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/UIBoundSpinner.java index 426d27f1ae..fbfd547aa8 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/UIBoundSpinner.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/component/UIBoundSpinner.java @@ -14,10 +14,16 @@ public class UIBoundSpinner extends UISpinner{ public UIBoundSpinner(double minValue, double maxValue, double dierta) { super(minValue, maxValue, dierta); + initComponents(); } public UIBoundSpinner(double minValue, double maxValue, double dierta, double defaultValue) { super(minValue, maxValue, dierta, defaultValue); + initComponents(); + } + + private void initComponents() { + setTextField(value); } @Override diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java index bfd0ea7ea7..8327fc1ab7 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java @@ -11,6 +11,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.MobileWidgetListPane; import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.widget.ui.designer.mobile.component.MobileBookMarkSettingPane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentFrozenPane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentMarginPane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane; @@ -34,6 +35,7 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane { private MobileComponentMarginPane marginPane; private MobileComponentLayoutIntervalPane intervalPane; private MobileComponentFrozenPane frozenPane; + private MobileBookMarkSettingPane bookMarkSettingPane; private UIExpandablePane advancePane; private UIExpandablePane layoutPane; @@ -96,10 +98,14 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane { marginPane = new MobileComponentMarginPane(FormBodyPaddingAttrMark.XML_TAG); intervalPane = new MobileComponentLayoutIntervalPane(FormBodyPaddingAttrMark.XML_TAG); frozenPane = new MobileComponentFrozenPane(); + bookMarkSettingPane = new MobileBookMarkSettingPane(); JPanel wrapLayoutPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JPanel wrapAdvancePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); wrapLayoutPane.add(intervalPane, BorderLayout.NORTH); wrapLayoutPane.add(frozenPane, BorderLayout.CENTER); - advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, marginPane); + wrapAdvancePane.add(marginPane, BorderLayout.CENTER); + wrapAdvancePane.add(bookMarkSettingPane, BorderLayout.SOUTH); + advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, wrapAdvancePane); layoutPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, wrapLayoutPane); //高级 holder.add(advancePane, BorderLayout.CENTER); @@ -109,8 +115,9 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane { boolean flag = !shouldHidePadding(designer); advancePane.setVisible(flag); layoutPane.setVisible(flag); - frozenPane.setVisible(appRelayoutCheck.isSelected()); - + boolean appRelayout = FormDesignerUtils.isAppRelayout(designer); + frozenPane.setVisible(appRelayout); + bookMarkSettingPane.setVisible(appRelayout); return holder; } @@ -147,13 +154,15 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane { @Override public void populate(FormDesigner designer) { this.designer = designer; + XCreator xCreator = designer.getSelectionModel().getSelection().getSelectedCreator(); appRelayoutCheck.setSelected(FormDesignerUtils.isAppRelayout(designer)); // 数据 populate 完成后,再设置监听 this.bindListeners2Widgets(); this.addAttributeChangeListener(changeListener); marginPane.populate((RichStyleWidgetProvider) getBodyCreator().toData()); intervalPane.populate((RichStyleWidgetProvider) getBodyCreator().toData()); - frozenPane.populate(designer.getSelectionModel().getSelection().getSelectedCreator()); + frozenPane.populate(xCreator); + bookMarkSettingPane.populate(xCreator); } @Override @@ -164,6 +173,7 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane { advancePane.setVisible(appPaddingVisible); layoutPane.setVisible(appPaddingVisible); frozenPane.setVisible(appRelayout); + bookMarkSettingPane.setVisible(appRelayout); mobileWidgetListPane.updateToDesigner(); designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); @@ -174,7 +184,9 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane { intervalPane.update((RichStyleWidgetProvider) getBodyCreator().toData()); } if (appRelayout) { - frozenPane.update(designer.getSelectionModel().getSelection().getSelectedCreator()); + XCreator xCreator = designer.getSelectionModel().getSelection().getSelectedCreator(); + frozenPane.update(xCreator); + bookMarkSettingPane.update(xCreator); } } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java index ed97fc0ee8..7b63397d2a 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java @@ -88,9 +88,9 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane { unavailableTipLabel.setForeground(Color.gray); panel.add(unavailableTipLabel, BorderLayout.NORTH); allowFullCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Full_Screen")); - panel.add(allowFullCheckBox); - functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated")); - panel.add(functionalWhenUnactivatedCheckBox); + panel.add(allowFullCheckBox,BorderLayout.CENTER); + functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated"), true); + panel.add(functionalWhenUnactivatedCheckBox, BorderLayout.SOUTH); return panel; } @@ -101,7 +101,7 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane { tipLabel.setForeground(Color.gray); updateTipLabel(); allowFullCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Full_Screen")); - functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated")); + functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated"), true); Component[][] components = new Component[][]{ new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_In_Logic"), SwingConstants.LEFT), new UILabel(ChartMobileFitAttrState.PROPORTION.description())}, diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java index 9a87003632..33201be32d 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java @@ -88,7 +88,7 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane { allowFullCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Full_Screen")); - functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated")); + functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated"), true); Component[][] components = new Component[][]{ new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Horizontal"), SwingConstants.LEFT), hComboBox}, diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java new file mode 100644 index 0000000000..9533e552cc --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java @@ -0,0 +1,170 @@ +package com.fr.design.widget.ui.designer.mobile; + +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.itextfield.UITextField; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.form.main.Form; +import com.fr.form.ui.FormWidgetHelper; +import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WLayout; +import com.fr.form.ui.container.WSortLayout; +import com.fr.form.ui.mobile.MobileBookMark; +import com.fr.general.ComparatorUtils; +import com.fr.general.IOUtils; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import java.awt.*; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.util.Iterator; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2019/12/24 + */ +public class MobileAdvanceDefinePane extends MobileWidgetDefinePane { + + private XCreator xCreator; + private UICheckBox useBookMarkCheck; + private UITextField bookMarkNameField; + + public MobileAdvanceDefinePane(XCreator xCreator) { + this.xCreator = xCreator; + } + + @Override + public void initPropertyGroups(Object source) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.useBookMarkCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Use_BookMark")); + this.bookMarkNameField = new UITextField() { + @Override + protected void initListener() { + if (shouldResponseChangeListener()) { + addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + attributeChange(); + } + }); + addKeyListener(new KeyAdapter() { + @Override + public void keyTyped(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ENTER) { + attributeChange(); + } + } + }); + } + } + }; + JPanel useBookMarkPane = TableLayoutHelper.createGapTableLayoutPane( + new Component[][]{new Component[]{useBookMarkCheck}}, + TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE); + final JPanel bookMarkNamePane = TableLayoutHelper.createGapTableLayoutPane( + new Component[][]{new Component[]{new UILabel( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Name")), bookMarkNameField}}, + TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE); + this.useBookMarkCheck.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + bookMarkNamePane.setVisible(MobileAdvanceDefinePane.this.useBookMarkCheck.isSelected()); + } + }); + contentPane.add(useBookMarkPane, BorderLayout.NORTH); + contentPane.add(bookMarkNamePane, BorderLayout.CENTER); + UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark"), 280, 20, contentPane); + JPanel wrapPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + wrapPane.add(uiExpandablePane, BorderLayout.NORTH); + this.add(wrapPane, BorderLayout.NORTH); + } + + private void bindListeners2Widgets() { + reInitAllListeners(); + AttributeChangeListener changeListener = new AttributeChangeListener() { + @Override + public void attributeChange() { + update(); + } + }; + this.addAttributeChangeListener(changeListener); + } + + private void reInitAllListeners() { + initListener(this); + } + + @Override + public Dimension getPreferredSize() { + return new Dimension(super.getPreferredSize().width, 80); + } + + @Override + public Dimension getMaximumSize() { + return new Dimension(400, 200); + } + + @Override + public void populate(FormDesigner designer) { + MobileBookMark bookMark = xCreator.toData().getMobileBookMark(); + this.bookMarkNameField.setText(bookMark.getBookMarkName()); + if (bookMark.isFrozen()) { + this.useBookMarkCheck.setSelected(false); + this.useBookMarkCheck.setEnabled(false); + } else { + this.useBookMarkCheck.setSelected(bookMark.isUseBookMark()); + } + this.bindListeners2Widgets(); + } + + @Override + public void update() { + MobileBookMark bookMark = xCreator.toData().getMobileBookMark(); + bookMark.setUseBookMark(this.useBookMarkCheck.isSelected()); + String newBookMarkName = this.bookMarkNameField.getText(); + if (ComparatorUtils.equals(newBookMarkName, bookMark.getBookMarkName())) { + return; + } + if (!isExist(newBookMarkName)) { + bookMark.setBookMarkName(newBookMarkName); + } else { + FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Rename_Failure"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"), + JOptionPane.ERROR_MESSAGE, IOUtils.readIcon("com/fr/design/form/images/joption_failure.png")); + this.bookMarkNameField.setText(bookMark.getBookMarkName()); + } + } + + private boolean isExist(String name) { + Form form = WidgetPropertyPane.getInstance().getEditingFormDesigner().getTarget(); + WLayout container = form.getContainer(); + WSortLayout wSortLayout = (WSortLayout) container.getWidget(container.getWidgetCount() - 1); + Iterator iterator = wSortLayout.getMobileWidgetIterator(); + while (iterator.hasNext()) { + Widget widget = form.getWidgetByName(iterator.next()); + if (widget != null && ComparatorUtils.equals(widget.getMobileBookMark().getBookMarkName(), name)) { + return true; + } + } + return false; + } + +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileWidgetStyleDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileWidgetStyleDefinePane.java index fb6f81fe58..d96be00836 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileWidgetStyleDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileWidgetStyleDefinePane.java @@ -66,7 +66,7 @@ public class MobileWidgetStyleDefinePane extends MobileWidgetDefinePane { @Override public Dimension getMaximumSize() { - return new Dimension(400, 200); + return new Dimension(400, 30); } private void bindListeners2Widgets() { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkSettingPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkSettingPane.java new file mode 100644 index 0000000000..6acd9638d0 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkSettingPane.java @@ -0,0 +1,117 @@ +package com.fr.design.widget.ui.designer.mobile.component; + +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.IntervalConstants; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.mobile.ui.MobileBookMarkStylePane; +import com.fr.design.mainframe.widget.accessibles.UneditableAccessibleEditor; +import com.fr.design.mainframe.widget.wrappers.MobileBookMarkStyleWrapper; +import com.fr.form.ui.container.WSortLayout; +import com.fr.form.ui.mobile.MobileBookMarkStyle; + +import javax.swing.*; +import java.awt.*; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2019/12/18 + */ +public class MobileBookMarkSettingPane extends BasicPane { + + private AccessibleMobileBookMarkStyleEditor mobileBookMarkStyleEditor; + private UICheckBox showHierarchicalBookmarksCheck; + + public MobileBookMarkSettingPane() { + initComponent(); + } + + private void initComponent() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.mobileBookMarkStyleEditor = new AccessibleMobileBookMarkStyleEditor(new MobileBookMarkStylePane()); + this.showHierarchicalBookmarksCheck = new UICheckBox( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Show_BookMark"), true); + JPanel booKMarkPane = TableLayoutHelper.createGapTableLayoutPane( + new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText( + "Fine-Design_Mobile_BookMark_Style")), this.mobileBookMarkStyleEditor}}, + TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE + ); + UILabel hintLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Show_BookMark_Hint")); + hintLabel.setForeground(Color.GRAY); + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p}; + double[] columnSize = {f}; + int[][] rowCount = {{1}, {1}}; + Component[][] components = new Component[][]{ + new Component[]{this.showHierarchicalBookmarksCheck}, + new Component[]{hintLabel} + }; + JPanel wrapPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + JPanel showBookMarkPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, + IntervalConstants.INTERVAL_L1, + IntervalConstants.INTERVAL_L1); + showBookMarkPane.setBorder( + BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); + wrapPane.add(booKMarkPane, BorderLayout.NORTH); + wrapPane.add(showBookMarkPane, BorderLayout.CENTER); + this.add(wrapPane, BorderLayout.CENTER); + } + + @Override + protected String title4PopupWindow() { + return "MobileBookMarkSettingPane"; + } + + public void populate(XCreator xCreator) { + WSortLayout wSortLayout = ((WSortLayout) xCreator.toData()); + this.mobileBookMarkStyleEditor.setValue(wSortLayout.getMobileBookMarkStyle()); + this.showHierarchicalBookmarksCheck.setSelected(wSortLayout.isShowBookmarks()); + } + + public void update(XCreator xCreator) { + WSortLayout wSortLayout = ((WSortLayout) xCreator.toData()); + wSortLayout.setMobileBookMarkStyle((MobileBookMarkStyle) mobileBookMarkStyleEditor.getValue()); + wSortLayout.setShowBookmarks(showHierarchicalBookmarksCheck.isSelected()); + } + + + class AccessibleMobileBookMarkStyleEditor extends UneditableAccessibleEditor { + + private MobileBookMarkStylePane mobileBookMarkStylePane; + + public AccessibleMobileBookMarkStyleEditor(MobileBookMarkStylePane mobileBookMarkStylePane) { + super(new MobileBookMarkStyleWrapper()); + this.mobileBookMarkStylePane = mobileBookMarkStylePane; + } + + @Override + public void showEditorPane() { + mobileBookMarkStylePane.setPreferredSize(BasicDialog.MEDIUM); + BasicDialog dialog = mobileBookMarkStylePane.showWindow(SwingUtilities.getWindowAncestor(this)); + dialog.addDialogActionListener(new DialogActionAdapter() { + @Override + public void doOk() { + MobileBookMarkStyle mobileBookMarkStyle = mobileBookMarkStylePane.updateBean(); + WSortLayout wSortLayout = (WSortLayout) WidgetPropertyPane.getInstance().getEditingFormDesigner().getSelectionModel().getSelection().getSelectedCreator().toData(); + setValue(mobileBookMarkStyle); + wSortLayout.setMobileBookMarkStyle(mobileBookMarkStyle); + fireStateChanged(); + } + }); + mobileBookMarkStylePane.populateBean((MobileBookMarkStyle) getValue()); + dialog.setVisible(true); + } + } + + +} \ No newline at end of file diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java index 0d5ce4b711..2492650972 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java @@ -11,6 +11,7 @@ import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; +import com.fr.form.ui.FormWidgetHelper; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WSortLayout; import com.fr.stable.ArrayUtils; @@ -63,13 +64,26 @@ public class MobileComponentFrozenPane extends BasicPane { public void update(XCreator xCreator) { List selected = new ArrayList<>(); WSortLayout wSortLayout = ((WSortLayout) xCreator.toData()); + List all = wSortLayout.getNonContainerWidgetList(); + for (String widgetName : all) { + updateMobileBookMark(wSortLayout, widgetName, false); + } Object[] values = uiComboCheckBox.getSelectedValues(); - for (Object widgetName : values) { - selected.add((String) widgetName); + for (Object value : values) { + String widgetName = (String) value; + selected.add(widgetName); + updateMobileBookMark(wSortLayout, widgetName, true); } wSortLayout.updateFrozenWidgets(selected); } + private void updateMobileBookMark(WSortLayout wSortLayout, String widgetName, boolean frozen) { + Widget widget = FormWidgetHelper.findWidgetWithBound(wSortLayout, widgetName); + if (widget != null) { + widget.getMobileBookMark().setFrozen(frozen); + } + } + public void populate(XCreator xCreator) { WSortLayout wSortLayout = ((WSortLayout) xCreator.toData()); List all = wSortLayout.getNonContainerWidgetList(); diff --git a/designer-form/src/test/java/com/fr/design/designer/beans/adapters/layout/FRWCardTagLayoutAdapterTest.java b/designer-form/src/test/java/com/fr/design/designer/beans/adapters/layout/FRWCardTagLayoutAdapterTest.java new file mode 100644 index 0000000000..0ff3ec0cc9 --- /dev/null +++ b/designer-form/src/test/java/com/fr/design/designer/beans/adapters/layout/FRWCardTagLayoutAdapterTest.java @@ -0,0 +1,23 @@ +package com.fr.design.designer.beans.adapters.layout; + +import com.fr.design.designer.creator.XElementCase; +import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; +import com.fr.form.ui.ElementCaseEditor; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import org.junit.Assert; +import org.junit.Test; + +import java.awt.Dimension; + +/** + * Created by kerry on 2019-12-10 + */ +public class FRWCardTagLayoutAdapterTest { + @Test + public void testAccept() { + FRWCardTagLayoutAdapter adapter = new FRWCardTagLayoutAdapter( + new XWCardTagLayout(new WCardTagLayout(), new Dimension(100, 100))); + Assert.assertFalse(adapter.accept(new XElementCase( + new ElementCaseEditor(), new Dimension(100, 100)), 1, 1)); + } +} diff --git a/designer-form/src/test/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayoutTest.java b/designer-form/src/test/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayoutTest.java new file mode 100644 index 0000000000..2b5ec78f21 --- /dev/null +++ b/designer-form/src/test/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayoutTest.java @@ -0,0 +1,18 @@ +package com.fr.design.designer.creator.cardlayout; + +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import org.junit.Assert; +import org.junit.Test; + +import java.awt.Dimension; + +/** + * Created by kerry on 2019-12-10 + */ +public class XWCardTagLayoutTest { + @Test + public void testGetLayoutAdapter() { + XWCardTagLayout tagLayout = new XWCardTagLayout(new WCardTagLayout(), new Dimension(100, 100)); + Assert.assertEquals("com.fr.design.designer.beans.adapters.layout.FRWCardTagLayoutAdapter", tagLayout.getLayoutAdapter().getClass().getName()); + } +} diff --git a/designer-form/src/test/java/com/fr/design/mainframe/JFormTest.java b/designer-form/src/test/java/com/fr/design/mainframe/JFormTest.java new file mode 100644 index 0000000000..f419ef7203 --- /dev/null +++ b/designer-form/src/test/java/com/fr/design/mainframe/JFormTest.java @@ -0,0 +1,20 @@ +package com.fr.design.mainframe; + +import org.easymock.EasyMock; +import org.junit.Assert; +import org.junit.Test; + +public class JFormTest { + + @Test + public void testRun() { + + JForm mockForm = EasyMock.partialMockBuilder(JForm.class).addMockedMethod("getUndoManager").createMock(); + try { + mockForm.canUndo(); + } catch (Exception e) { + Assert.fail(); + } + } + +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/cell/editor/DSColumnCellEditor.java b/designer-realize/src/main/java/com/fr/design/cell/editor/DSColumnCellEditor.java index 5f3ae97f1e..a7fb154e05 100644 --- a/designer-realize/src/main/java/com/fr/design/cell/editor/DSColumnCellEditor.java +++ b/designer-realize/src/main/java/com/fr/design/cell/editor/DSColumnCellEditor.java @@ -3,6 +3,7 @@ package com.fr.design.cell.editor; import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionListener; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dscolumn.DSColumnPane; import com.fr.design.mainframe.ElementCasePane; import com.fr.grid.Grid; @@ -71,8 +72,8 @@ public class DSColumnCellEditor extends AbstractCellEditor implements DialogActi try { this.dsColumnPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement); } catch (Exception exp) { - JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(grid), exp.getMessage(), - ProductConstants.APP_NAME, JOptionPane.ERROR_MESSAGE); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(grid), exp.getMessage(), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE); FineLoggerFactory.getLogger().error(exp.getMessage(), exp); } diff --git a/designer-realize/src/main/java/com/fr/design/expand/ParentPane.java b/designer-realize/src/main/java/com/fr/design/expand/ParentPane.java index e376902185..824e392e64 100644 --- a/designer-realize/src/main/java/com/fr/design/expand/ParentPane.java +++ b/designer-realize/src/main/java/com/fr/design/expand/ParentPane.java @@ -195,7 +195,7 @@ public class ParentPane extends BasicPane { @Override public void actionPerformed(ActionEvent e) { - cardLayout.show(parentCardPane, "Fine-Design_Report_Default"); + cardLayout.show(parentCardPane, "Default"); } }); diff --git a/designer-realize/src/main/java/com/fr/design/headerfooter/HFContainer.java b/designer-realize/src/main/java/com/fr/design/headerfooter/HFContainer.java index 577a0710b3..1726b21c27 100644 --- a/designer-realize/src/main/java/com/fr/design/headerfooter/HFContainer.java +++ b/designer-realize/src/main/java/com/fr/design/headerfooter/HFContainer.java @@ -24,6 +24,7 @@ import javax.swing.event.ChangeListener; import com.fr.base.headerfooter.HFElement; import com.fr.base.headerfooter.NewLineHFElement; +import com.fr.design.dialog.FineJOptionPane; /** @@ -283,7 +284,7 @@ public class HFContainer extends JPanel implements Scrollable { Object obj = evt.getSource(); if (obj instanceof HFComponent) { - int returnVal = JOptionPane.showConfirmDialog( + int returnVal = FineJOptionPane.showConfirmDialog( SwingUtilities.getWindowAncestor(HFContainer.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_HF_Are_You_Sure_To_Delete_It") + "?", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Delete"), diff --git a/designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java b/designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java index 5f1f941faa..b89971f879 100644 --- a/designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java +++ b/designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java @@ -81,7 +81,7 @@ public class ListenerEditPane extends BasicBeanPane { // 提交入库 List dbManiList = new ArrayList(); dbManiList.add(autoCreateDBManipulationPane()); - Commit2DBJavaScriptPane commit2DBJavaScriptPane = new Commit2DBJavaScriptPane(JavaScriptActionPane.defaultJavaScriptActionPane, + Commit2DBJavaScriptPane commit2DBJavaScriptPane = new Commit2DBJavaScriptPane(JavaScriptActionPane.createDefaultJavaScriptActionPane(), dbManiList); hyperlinkPane.add(DBCOMMIT, commit2DBJavaScriptPane); // 自定义事件 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 4e12bd5f85..27f3368216 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 @@ -523,8 +523,9 @@ public abstract class ElementCasePane extends Tar @Override public void setSelection(Selection selection) { - if (!ComparatorUtils.equals(this.selection, selection) || - !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())) { + if (!ComparatorUtils.equals(this.selection, selection) + || !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance()) + || DesignModeContext.isAuthorityEditing()) { try { //旧选中内容编辑器释放模板对象 QuickEditor editor = this.getCurrentEditor(); @@ -535,8 +536,8 @@ public abstract class ElementCasePane extends Tar FineLoggerFactory.getLogger().info("Nothing to release"); } this.selection = selection; + fireSelectionChanged(); } - fireSelectionChanged(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java index 9fdc9d5a8c..747789cdbe 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/SheetNameTabPane.java @@ -26,6 +26,7 @@ import com.fr.base.GraphHelper; import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButtonUI; @@ -875,7 +876,8 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(reportComposite), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_At_Least_One_Visual_Worksheet") + "!"); return; } - int returnValue = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(reportComposite), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Des_Remove_Work_Sheet"), ProductConstants.APP_NAME, + int returnValue = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(reportComposite), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Des_Remove_Work_Sheet"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.OK_CANCEL_OPTION); if (returnValue == JOptionPane.OK_OPTION) { if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { @@ -927,7 +929,7 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse return; } - String newName = JOptionPane.showInputDialog(reportComposite, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Rename") + ":", reportComposite.getEditingWorkBook().getReportName(selectedIndex)); + String newName = FineJOptionPane.showInputDialog(reportComposite, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Rename") + ":", reportComposite.getEditingWorkBook().getReportName(selectedIndex)); if (newName != null) { // marks:判断是否重名 boolean isExisted = false; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java index e2b13b1adf..63bc3d999b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java @@ -13,7 +13,6 @@ import com.fr.report.RemoteDesignConstants; import com.fr.serialization.SerializerHelper; import com.fr.stable.ArrayUtils; import com.fr.third.apache.log4j.spi.LoggingEvent; -import com.fr.third.guava.base.Optional; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.base.WorkspaceConstants; @@ -36,28 +35,19 @@ public class DesignerSocketIO { Disconnecting } - private static Optional socketIO = Optional.absent(); + private static Socket socket = null; private static Status status = Status.Disconnected; + //维护一个当前工作环境的uri列表 + private static String[] uri; + //维护一个关于uri列表的计数器 + private static int count; - private static final Emitter.Listener printLog = new Emitter.Listener() { - @Override - public void call(Object... objects) { - if (ArrayUtils.isNotEmpty(objects)) { - try { - LoggingEvent event = SerializerHelper.deserialize((byte[]) objects[0]); - DesignerLogger.log(event); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - } - }; public static void close() { - if (socketIO.isPresent()) { + if (socket != null) { status = Status.Disconnecting; - socketIO.get().close(); - socketIO = Optional.absent(); + socket.close(); + socket = null; } } @@ -66,57 +56,42 @@ public class DesignerSocketIO { if (current.isLocal()) { return; } + //每当更换工作环境,更新uri列表,同时更新计数器count try { - String[] uri = getSocketUri(current); - socketIO = Optional.of(IO.socket(new URI(uri[0]))); - socketIO.get().on(WorkspaceConstants.WS_LOGRECORD, printLog); - socketIO.get().on(WorkspaceConstants.CONFIG_MODIFY, new Emitter.Listener() { - @Override - public void call(Object... objects) { - assert objects != null && objects.length == 1; - String param = (String) objects[0]; - EventDispatcher.fire(RemoteConfigEvent.EDIT, param); - } - }); - socketIO.get().on(Socket.EVENT_DISCONNECT, new Emitter.Listener() { - @Override - public void call(Object... objects) { - /* - * todo 远程心跳断开不一定 socketio 断开 和远程紧密相关的业务都绑定在心跳上,切换成心跳断开之后进行提醒, - * socketio 只用推日志和通知配置变更 - */ - if (status != Status.Disconnecting) { - try { - UIUtil.invokeAndWaitIfNeeded(new Runnable() { - @Override - public void run() { - JOptionPane.showMessageDialog( - DesignerContext.getDesignerFrame(), - Toolkit.i18nText("Fine-Design_Basic_Remote_Disconnected"), - UIManager.getString("OptionPane.messageDialogTitle"), - JOptionPane.ERROR_MESSAGE, - UIManager.getIcon("OptionPane.errorIcon")); - EnvChangeEntrance.getInstance().chooseEnv(); - } - }); - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } - } - status = Status.Disconnected; - } - }); - socketIO.get().connect(); - status = Status.Connected; + uri = getSocketUri(); + } catch (IOException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + count = 0; + //建立socket并注册监听 + createSocket(); + } + + private static void createSocket(){ + //根据uri和计数器建立连接,并注册监听 + try { + if(count { public void checkValid() throws Exception { if (isLayerReportBox.isSelected()) { if (!ReportUtils.isLayerReportUsable(worksheet)) { - int value = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_After_Changed_Some_Attributes_Are_Different") + "?", - ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION); + int value = FineJOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_After_Changed_Some_Attributes_Are_Different") + "?", + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"), JOptionPane.YES_NO_OPTION); if (value != JOptionPane.YES_OPTION) { isLayerReportBox.setSelected(false); } diff --git a/designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java b/designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java index 2ee1d57811..558cf42913 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java @@ -1,6 +1,7 @@ package com.fr.design.report; import com.fr.config.ServerPreferenceConfig; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.style.StylePane; import com.fr.design.utils.gui.GUICoreUtils; @@ -31,14 +32,14 @@ public class ReportStylePane extends StylePane { popupMenu.add(menuItem); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - String name = JOptionPane.showInputDialog(getParent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Input_The_Name_Of_Gloabel_Style")); + String name = FineJOptionPane.showInputDialog(getParent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Input_The_Name_Of_Gloabel_Style")); if (ComparatorUtils.equals(name, "")) { return; } if (ServerPreferenceConfig.getInstance().getStyle(name) == null) { ServerPreferenceConfig.getInstance().putStyle(name, ReportStylePane.this.updateBean()); } else { - JOptionPane.showMessageDialog(getParent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_This_Name_Has_Exsit") + "!", com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Warning"), JOptionPane.WARNING_MESSAGE); + FineJOptionPane.showMessageDialog(getParent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_This_Name_Has_Exsit") + "!", com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Warning"), JOptionPane.WARNING_MESSAGE); } } }); diff --git a/designer-realize/src/main/java/com/fr/design/report/SubReportPane.java b/designer-realize/src/main/java/com/fr/design/report/SubReportPane.java index 0254f5e85c..ae08cf6718 100644 --- a/designer-realize/src/main/java/com/fr/design/report/SubReportPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/SubReportPane.java @@ -2,6 +2,7 @@ package com.fr.design.report; import com.fr.base.core.KV; import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.icheckbox.UICheckBox; @@ -62,7 +63,7 @@ public class SubReportPane extends BasicPane { if (chooseFILE != null && chooseFILE.exists()) { pathTextField.setText(chooseFILE.prefix() + chooseFILE.getPath()); } else { - JOptionPane.showConfirmDialog(SubReportPane.this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sub_Report_Message1"), + FineJOptionPane.showConfirmDialog(SubReportPane.this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sub_Report_Message1"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Sub_Report_ToolTips"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); chooseFILE = null; pathTextField.setText(""); diff --git a/designer-realize/src/main/java/com/fr/design/style/StylePane.java b/designer-realize/src/main/java/com/fr/design/style/StylePane.java index 7fd8db07d4..fc53376479 100644 --- a/designer-realize/src/main/java/com/fr/design/style/StylePane.java +++ b/designer-realize/src/main/java/com/fr/design/style/StylePane.java @@ -9,6 +9,7 @@ import com.fr.base.ScreenResolution; import com.fr.base.Style; import com.fr.base.core.StyleUtils; import com.fr.design.beans.BasicBeanPane; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.ElementCasePane; @@ -358,7 +359,7 @@ public class StylePane extends BasicBeanPane