Browse Source

Merge pull request #1023 in DESIGN/design from final/10.0 to bugfix/10.0

* commit '0ae502e597889d9dce993f7d99c1860932f94af4': (41 commits)
  REPORT-20267 非 简繁英日韩 海外版本设计器默认语言问题
  update
  update
  REPORT-20267 非简繁英日韩 海外版本设计器默认语言问题 && MOBILE-22490 链接修改
  REPORT-20303 FR中点击插件管理报错闪退
  REPORT-19218 设计器目录树工具栏重命名无法去除多个后缀名	&& REPORT-19200 数据表现与处理-其他属性-打印/导出单元格内容/背景
  REPORT-19237 权限编辑界面-可见可用逻辑问题
  update
  REPORT-19184 设计器,聚合报表进入编辑状态
  REPORT-18720  模板web属性里面采用服务器设置时 工具栏按钮应该是处于灰化且不可点击状态
  REPORT-19897 英文版设计器显示问题
  补充单元测试
  REPORT-19857 英文版alphafine显示问题 1. 把判断国际化的过程和 点击配置页面才能更新 的逻辑解耦。放到启动的时候做。 2. 配置不依赖于 searchOnline 而是判断中英文。
  不ignored异常
  加读写锁
  初始化时从插件里捞一把
  通过监听插件生命周期实现
  插件天生可拔插,这里不能用static,应每次调用时获取
  补充单元测试
  REPORT-18362 插件状态根据lic显示-前台
  ...
bugfix/10.0
neil 5 years ago
parent
commit
9ac9571941
  1. 15
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 64
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 6
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineAction.java
  4. 21
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java
  5. 163
      designer-base/src/main/java/com/fr/design/constants/UIConstants.java
  6. 2
      designer-base/src/main/java/com/fr/design/dialog/BasicPane.java
  7. 16
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java
  8. 6
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java
  9. 5
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java
  10. 2
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  11. 77
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java
  12. 25
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/JFileTree.java
  13. 2
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  14. 4
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  15. 2
      designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java
  16. 10
      designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java
  17. 1
      designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java
  18. 4
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  19. 17
      designer-base/src/main/java/com/fr/env/LocalEnvPane.java
  20. BIN
      designer-base/src/main/resources/com/fr/design/images/dialog/watermark/watermark_background_en.png
  21. BIN
      designer-base/src/main/resources/com/fr/design/images/reportcolumns/col_en.png
  22. BIN
      designer-base/src/main/resources/com/fr/design/images/reportcolumns/row_en.png
  23. 51
      designer-base/src/test/java/com/fr/design/gui/itree/filetree/FileNodeConstantsTest.java
  24. 1
      designer-form/src/main/java/com/fr/design/designer/properties/FormWidgetAuthorityEditPane.java
  25. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java
  26. 9
      designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java
  27. 20
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java
  28. 3
      designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java
  29. 24
      designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java
  30. 11
      designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java
  31. 2
      designer-realize/src/main/java/com/fr/design/webattr/WebSettingPane.java
  32. 29
      designer-realize/src/main/java/com/fr/design/widget/WidgetDefinePaneFactory.java
  33. 5
      designer-realize/src/main/java/com/fr/poly/creator/ECBlockEditor.java
  34. 4
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java
  35. 46
      designer-realize/src/test/java/com.fr/design/mainframe/alphafine/AlphaFineHelperTest.java
  36. 66
      designer-realize/src/test/java/com/fr/design/widget/WidgetDefinePaneFactoryTest.java

15
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -24,6 +24,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogFormatter;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.SupportLocale;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.general.xml.GeneralXMLTools;
@ -116,7 +117,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private Color paginationLineColor = Color.black; // line color of paper
private boolean supportCellEditorDef = false;
private boolean isDragPermited = false;
private Locale language = Locale.getDefault();
private Locale language = checkLocale(Locale.getDefault());
//2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容
private boolean useOracleSystemSpace = true;
private int cachingTemplateLimit = CACHINGTEMPLATE_LIMIT;
@ -1316,7 +1317,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
String tmpVal;
if ((tmpVal = reader.getElementValue()) != null) {
if (!CommonUtils.isNumber(tmpVal)) {
setLanguage(CommonUtils.stringToLocale(tmpVal));
setLanguage(checkLocale(CommonUtils.stringToLocale(tmpVal)));
} else {
// 用于兼容10.0之前的版本
int value = Integer.parseInt(tmpVal);
@ -1365,6 +1366,16 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
}
/**
* 对国际化进行校验
* 非简繁英日韩的默认环境 设计器全部默认为英文版本
* @param locale
* @return
*/
private Locale checkLocale(Locale locale) {
return SupportLocale.getInstance().isSupport(locale) ? locale : Locale.US;
}
private void readReportLengthUnit(XMLableReader reader) {
String tmpVal;
if (StringUtils.isNotBlank(tmpVal = reader.getElementValue())) {

64
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -1,8 +1,6 @@
package com.fr.design.actions.file;
import com.fr.base.BaseUtils;
import com.fr.config.Configuration;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper;
import com.fr.design.dialog.BasicDialog;
@ -190,20 +188,20 @@ public class PreferencePane extends BasicPane {
oracleSpace = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_All_Oracle_Tables"));
oraclePane.add(oracleSpace);
JPanel debuggerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Develop_Tools"));
openDebugComboBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Open_Debug_Window"));
debuggerPane.add(openDebugComboBox, BorderLayout.CENTER);
advancePane.add(debuggerPane);
JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager"));
useOptimizedUPMCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager"));
upmSelectorPane.add(useOptimizedUPMCheckbox);
advancePane.add(upmSelectorPane);
JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Manager"));
useUniverseDBMCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Use_Universe_Database_Manager"));
dbmSelectorPane.add(useUniverseDBMCheckbox);
advancePane.add(dbmSelectorPane);
// JPanel debuggerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Develop_Tools"));
// openDebugComboBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Open_Debug_Window"));
// debuggerPane.add(openDebugComboBox, BorderLayout.CENTER);
// advancePane.add(debuggerPane);
//
// JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager"));
// useOptimizedUPMCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager"));
// upmSelectorPane.add(useOptimizedUPMCheckbox);
// advancePane.add(upmSelectorPane);
//
// JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Manager"));
// useUniverseDBMCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Use_Universe_Database_Manager"));
// dbmSelectorPane.add(useUniverseDBMCheckbox);
// advancePane.add(dbmSelectorPane);
JPanel improvePane = FRGUIPaneFactory.createVerticalTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Product_Improve"));
joinProductImproveCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Join_Product_Improve"));
@ -648,10 +646,10 @@ public class PreferencePane extends BasicPane {
this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort()));
openDebugComboBox.setSelected(designerEnvManager.isOpenDebug());
useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM());
useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM());
// openDebugComboBox.setSelected(designerEnvManager.isOpenDebug());
// useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM());
//
// useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM());
this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace());
this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit());
@ -716,7 +714,7 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setJettyServerPort(portEditor.getValue().intValue());
designerEnvManager.setOpenDebug(openDebugComboBox.isSelected());
// designerEnvManager.setOpenDebug(openDebugComboBox.isSelected());
designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected());
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue());
@ -747,18 +745,18 @@ public class PreferencePane extends BasicPane {
}
});
Configurations.update(new Worker() {
@Override
public void run() {
ServerPreferenceConfig.getInstance().setUseOptimizedUPM(useOptimizedUPMCheckbox.isSelected());
ServerPreferenceConfig.getInstance().setUseUniverseDBM(useUniverseDBMCheckbox.isSelected());
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[] {ServerPreferenceConfig.class};
}
});
// Configurations.update(new Worker() {
// @Override
// public void run() {
// ServerPreferenceConfig.getInstance().setUseOptimizedUPM(useOptimizedUPMCheckbox.isSelected());
// ServerPreferenceConfig.getInstance().setUseUniverseDBM(useUniverseDBMCheckbox.isSelected());
// }
//
// @Override
// public Class<? extends Configuration>[] targets() {
// return new Class[] {ServerPreferenceConfig.class};
// }
// });
}

6
designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineAction.java

@ -1,6 +1,5 @@
package com.fr.design.actions.help.alphafine;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog;
@ -11,7 +10,7 @@ import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.IOUtils;
import javax.swing.*;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
/**
@ -51,9 +50,6 @@ public class AlphaFineAction extends UpdateAction {
final AlphaFineConfigPane alphaFineConfigPane = new AlphaFineConfigPane();
final AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
if (!FRContext.isChineseEnv()) {
manager.setSearchOnLine(false);
}
alphaFineConfigPane.populate(manager);
DialogActionListener dialogActionListener = new DialogActionAdapter() {
public void doOk() {

21
designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigPane.java

@ -189,23 +189,34 @@ public class AlphaFineConfigPane extends BasicPane {
}
public void populate(AlphaFineConfigManager alphaFineConfigManager) {
this.enabledCheckbox.setSelected(alphaFineConfigManager.isEnabled());
this.searchOnlineCheckbox.setEnabled(FRContext.isChineseEnv());
boolean enabled4Locale = FRContext.isChineseEnv();
this.searchOnlineCheckbox.setEnabled(enabled4Locale);
this.searchOnlineCheckbox.setSelected(alphaFineConfigManager.isSearchOnLine());
this.containActionCheckbox.setSelected(alphaFineConfigManager.isContainAction());
this.containTemplateCheckbox.setSelected(alphaFineConfigManager.isContainTemplate());
this.containFileContentCheckbox.setSelected(alphaFineConfigManager.isContainFileContent());
this.containDocumentCheckbox.setSelected(alphaFineConfigManager.isContainDocument() && alphaFineConfigManager.isSearchOnLine());
this.containDocumentCheckbox.setEnabled(alphaFineConfigManager.isSearchOnLine());
this.containDocumentCheckbox.setEnabled(enabled4Locale);
this.containPluginCheckbox.setSelected(alphaFineConfigManager.isContainPlugin() && alphaFineConfigManager.isSearchOnLine());
this.containPluginCheckbox.setEnabled(alphaFineConfigManager.isSearchOnLine());
this.containPluginCheckbox.setEnabled(enabled4Locale);
this.containRecommendCheckbox.setSelected(alphaFineConfigManager.isContainRecommend() && alphaFineConfigManager.isSearchOnLine());
this.containRecommendCheckbox.setEnabled(alphaFineConfigManager.isSearchOnLine());
this.containRecommendCheckbox.setEnabled(enabled4Locale);
this.shortcutsField.setText(getDisplayShortCut(alphaFineConfigManager.getShortcuts()));
this.needSegmentationCheckbox.setSelected(alphaFineConfigManager.isNeedSegmentationCheckbox());
this.needIntelligentCustomerService.setSelected(alphaFineConfigManager.isNeedIntelligentCustomerService() && alphaFineConfigManager.isSearchOnLine());
this.needIntelligentCustomerService.setEnabled(alphaFineConfigManager.isSearchOnLine());
this.needIntelligentCustomerService.setEnabled(enabled4Locale);
shortCutKeyStore = convert2KeyStroke(alphaFineConfigManager.getShortcuts());
}

163
designer-base/src/main/java/com/fr/design/constants/UIConstants.java

@ -3,13 +3,19 @@
*/
package com.fr.design.constants;
import com.fr.base.BaseUtils;
import com.fr.general.IOUtils;
import com.fr.stable.Constants;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Image;
import java.awt.Point;
import java.awt.Stroke;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
/**
@ -17,19 +23,19 @@ import java.awt.image.BufferedImage;
*/
public interface UIConstants {
public static final Icon CPT_ICON = BaseUtils.readIcon("/com/fr/base/images/oem/cpt.png");
public static final Icon BLACK_ICON = BaseUtils.readIcon("/com/fr/base/images/cell/blank.gif");
public static final Icon CPT_ICON = IOUtils.readIcon("/com/fr/base/images/oem/cpt.png");
public static final Icon BLACK_ICON = IOUtils.readIcon("/com/fr/base/images/cell/blank.gif");
public static final Image APPFIT_V0 = BaseUtils.readImage("/com/fr/design/images/dialog/appfit/V0.png");
public static final Image APPFIT_V1 = BaseUtils.readImage("/com/fr/design/images/dialog/appfit/V1.png");
public static final Image APPFIT_V2 = BaseUtils.readImage("/com/fr/design/images/dialog/appfit/V2.png");
public static final Image APPFIT_V3 = BaseUtils.readImage("/com/fr/design/images/dialog/appfit/V3.png");
public static final Image APPFIT_V4 = BaseUtils.readImage("/com/fr/design/images/dialog/appfit/V4.png");
public static final Image APPFIT_H0 = BaseUtils.readImage("/com/fr/design/images/dialog/appfit/H0.png");
public static final Image APPFIT_H1 = BaseUtils.readImage("/com/fr/design/images/dialog/appfit/H1.png");
public static final Image APPFIT_H2 = BaseUtils.readImage("/com/fr/design/images/dialog/appfit/H2.png");
public static final Image APPFIT_H3 = BaseUtils.readImage("/com/fr/design/images/dialog/appfit/H3.png");
public static final Image APPFIT_H4 = BaseUtils.readImage("/com/fr/design/images/dialog/appfit/H4.png");
public static final Image APPFIT_V0 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/V0.png");
public static final Image APPFIT_V1 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/V1.png");
public static final Image APPFIT_V2 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/V2.png");
public static final Image APPFIT_V3 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/V3.png");
public static final Image APPFIT_V4 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/V4.png");
public static final Image APPFIT_H0 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/H0.png");
public static final Image APPFIT_H1 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/H1.png");
public static final Image APPFIT_H2 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/H2.png");
public static final Image APPFIT_H3 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/H3.png");
public static final Image APPFIT_H4 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/H4.png");
public static final Border CELL_ATTR_ZEROBORDER = BorderFactory.createEmptyBorder(0, 0, 0, 0);
public static final Border CELL_ATTR_EMPTYBORDER = BorderFactory.createEmptyBorder(0, 10, 0, 0);
@ -45,15 +51,15 @@ public interface UIConstants {
* Cell default cursor.
*/
public static final Cursor CELL_DEFAULT_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor(
BaseUtils.readImage("/com/fr/base/images/cell/cursor/cell_default.png"),
IOUtils.readImage("/com/fr/base/images/cell/cursor/cell_default.png"),
new Point(16, 16), "CellDefaultCursor");
public static final Cursor DRAW_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor(
BaseUtils.readImage("/com/fr/base/images/cell/cursor/cursor_draw.png"),
IOUtils.readImage("/com/fr/base/images/cell/cursor/cursor_draw.png"),
new Point(16, 16), "DrawCursor");
public static final Cursor FORMAT_BRUSH_CURSOR = Toolkit.getDefaultToolkit().createCustomCursor(
BaseUtils.readImage("/com/fr/base/images/cell/cursor/brush_cursor0.png"),
IOUtils.readImage("/com/fr/base/images/cell/cursor/brush_cursor0.png"),
new Point(16, 16), "formatBrushCursor");
/**
@ -140,63 +146,64 @@ public interface UIConstants {
public static final BufferedImage DRAG_BAR = BaseUtils.readImage("com/fr/design/images/control/bar.png");
public static final BufferedImage DRAG_BAR_LIGHT = BaseUtils.readImage("com/fr/design/images/control/bar-light.png");
public static final BufferedImage ARROW_NORTH = BaseUtils.readImage("com/fr/design/images/control/up_arrow.png");
public static final BufferedImage ARROW_SOUTH = BaseUtils.readImage("com/fr/design/images/control/down_arrow.png");
public static final BufferedImage ARROW_EAST = BaseUtils.readImage("com/fr/design/images/control/east_arrow.png");
public static final BufferedImage ARROW_WEST = BaseUtils.readImage("com/fr/design/images/control/west_arrow.png");
public static final BufferedImage DRAG_BAR_RIGHT = BaseUtils.readImage("com/fr/design/images/control/barm.png");
public static final BufferedImage DRAG_BAR_LEFT = BaseUtils.readImage("com/fr/design/images/control/barl.png");
public static final BufferedImage DRAG_UP_NORMAL = BaseUtils.readImage("com/fr/design/images/control/upnor.png");
public static final BufferedImage DRAG_UP_PRESS = BaseUtils.readImage("com/fr/design/images/control/uppre.png");
public static final BufferedImage DRAG_DOWN_NORMAL = BaseUtils.readImage("com/fr/design/images/control/downnor.png");
public static final BufferedImage DRAG_DOWN_PRESS = BaseUtils.readImage("com/fr/design/images/control/downpre.png");
public static final BufferedImage DRAG_RIGHT_NORMAL = BaseUtils.readImage("com/fr/design/images/control/rightnor.png");
public static final BufferedImage DRAG_RIGHT_PRESS = BaseUtils.readImage("com/fr/design/images/control/rightpre.png");
public static final BufferedImage DRAG_LEFT_NORMAL = BaseUtils.readImage("com/fr/design/images/control/leftnor.png");
public static final BufferedImage DRAG_LEFT_PRESS = BaseUtils.readImage("com/fr/design/images/control/leftpre.png");
public static final BufferedImage DRAG_DOT = BaseUtils.readImage("com/fr/design/images/control/dot.png");
public static final BufferedImage DRAG_LINE = BaseUtils.readImage("com/fr/design/images/control/dot-line.png");
public static final BufferedImage ACCESSIBLE_EDITOR_DOT = BaseUtils.readImage("com/fr/design/images/control/dot.png");
public static final BufferedImage DRAG_DOT_VERTICAL = BaseUtils.readImage("com/fr/design/images/control/dotv.png");
public static final BufferedImage POP_BUTTON_DOWN = BaseUtils.readImage("com/fr/design/images/buttonicon/popdownarrow.png");
public static final BufferedImage POP_BUTTON_UP = BaseUtils.readImage("com/fr/design/images/buttonicon/popuparrow.png");
public static final BufferedImage DRAG_DOWN_SELECTED_SMALL = BaseUtils.readImage("com/fr/design/images/buttonicon/downSelected.png");
public static final BufferedImage DRAG_LEFT_NORMAL_SMALL = BaseUtils.readImage("com/fr/design/images/buttonicon/leftNormal.png");
public static final BufferedImage WATERMARK_BACKGROUND = BaseUtils.readImage("/com/fr/design/images/dialog/watermark/watermark_background.png");
public static final BufferedImage DRAG_BAR = IOUtils.readImage("com/fr/design/images/control/bar.png");
public static final BufferedImage DRAG_BAR_LIGHT = IOUtils.readImage("com/fr/design/images/control/bar-light.png");
public static final BufferedImage ARROW_NORTH = IOUtils.readImage("com/fr/design/images/control/up_arrow.png");
public static final BufferedImage ARROW_SOUTH = IOUtils.readImage("com/fr/design/images/control/down_arrow.png");
public static final BufferedImage ARROW_EAST = IOUtils.readImage("com/fr/design/images/control/east_arrow.png");
public static final BufferedImage ARROW_WEST = IOUtils.readImage("com/fr/design/images/control/west_arrow.png");
public static final BufferedImage DRAG_BAR_RIGHT = IOUtils.readImage("com/fr/design/images/control/barm.png");
public static final BufferedImage DRAG_BAR_LEFT = IOUtils.readImage("com/fr/design/images/control/barl.png");
public static final BufferedImage DRAG_UP_NORMAL = IOUtils.readImage("com/fr/design/images/control/upnor.png");
public static final BufferedImage DRAG_UP_PRESS = IOUtils.readImage("com/fr/design/images/control/uppre.png");
public static final BufferedImage DRAG_DOWN_NORMAL = IOUtils.readImage("com/fr/design/images/control/downnor.png");
public static final BufferedImage DRAG_DOWN_PRESS = IOUtils.readImage("com/fr/design/images/control/downpre.png");
public static final BufferedImage DRAG_RIGHT_NORMAL = IOUtils.readImage("com/fr/design/images/control/rightnor.png");
public static final BufferedImage DRAG_RIGHT_PRESS = IOUtils.readImage("com/fr/design/images/control/rightpre.png");
public static final BufferedImage DRAG_LEFT_NORMAL = IOUtils.readImage("com/fr/design/images/control/leftnor.png");
public static final BufferedImage DRAG_LEFT_PRESS = IOUtils.readImage("com/fr/design/images/control/leftpre.png");
public static final BufferedImage DRAG_DOT = IOUtils.readImage("com/fr/design/images/control/dot.png");
public static final BufferedImage DRAG_LINE = IOUtils.readImage("com/fr/design/images/control/dot-line.png");
public static final BufferedImage ACCESSIBLE_EDITOR_DOT = IOUtils.readImage("com/fr/design/images/control/dot.png");
public static final BufferedImage DRAG_DOT_VERTICAL = IOUtils.readImage("com/fr/design/images/control/dotv.png");
public static final BufferedImage POP_BUTTON_DOWN = IOUtils.readImage("com/fr/design/images/buttonicon/popdownarrow.png");
public static final BufferedImage POP_BUTTON_UP = IOUtils.readImage("com/fr/design/images/buttonicon/popuparrow.png");
public static final BufferedImage DRAG_DOWN_SELECTED_SMALL = IOUtils.readImage("com/fr/design/images/buttonicon/downSelected.png");
public static final BufferedImage DRAG_LEFT_NORMAL_SMALL = IOUtils.readImage("com/fr/design/images/buttonicon/leftNormal.png");
public static final BufferedImage WATERMARK_BACKGROUND = IOUtils.readImage("/com/fr/design/images/dialog/watermark/" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_WaterMark_Background_Icon_File_Name"));
public static final int MODEL_NORMAL = 0;
public static final int MODEL_PRESS = 1;
public static final Icon ARROW_DOWN_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/arrowdown.png");
public static final Icon ARROW_UP_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/arrowup.png");
public static final Icon YES_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/yes.png");
public static final Icon CHOOSEN_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/select_item.png");
public static final Icon PRE_WIDGET_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/prewidget.png");
public static final Icon EDIT_NORMAL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/editn.png");
public static final Icon EDIT_PRESSED_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/editp.png");
public static final Icon HIDE_NORMAL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/hiden.png");
public static final Icon HIDE_PRESSED_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/hidep.png");
public static final Icon VIEW_NORMAL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/viewn.png");
public static final Icon VIEW_PRESSED_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/viewp.png");
public static final Icon RUN_BIG_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/run24.png");
public static final Icon RUN_SMALL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/runs.png");
public static final Icon PAGE_BIG_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/pageb24.png");
public static final Icon WRITE_BIG_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/writeb24.png");
public static final Icon ANA_BIG_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/anab24.png");
public static final Icon PAGE_SMALL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/pages.png");
public static final Icon WRITE_SMALL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/writes.png");
public static final Icon ANA_SMALL_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/anas.png");
public static final Icon REFRESH_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/refresh.png");
public static final Icon FONT_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png");
public static final Icon HISTORY_ICON = BaseUtils.readIcon("com/fr/design/images/buttonicon/history.png");
public static final Icon DELETE_ICON = BaseUtils.readIcon("com/fr/design/images/m_file/close.png");
public static final Icon EDIT_ICON = BaseUtils.readIcon("com/fr/design/images/m_file/edit.png");
public static final Icon SEARCH_ICON = BaseUtils.readIcon("/com/fr/design/images/data/search.png");
public static final Icon BLACK_SEARCH_ICON = BaseUtils.readIcon("/com/fr/design/images/data/black_search.png");
public static final Icon CLEAR_ICON = BaseUtils.readIcon("/com/fr/design/images/data/source/delete.png");
public static final Icon LIST_EDIT_ICON = BaseUtils.readIcon("/com/fr/design/images/control/edit.png");
public static final Icon LIST_EDIT_WHITE_ICON = BaseUtils.readIcon("/com/fr/design/images/control/edit_white.png");
public static final Icon ARROW_DOWN_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/arrowdown.png");
public static final Icon ARROW_UP_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/arrowup.png");
public static final Icon YES_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/yes.png");
public static final Icon CHOOSEN_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/select_item.png");
public static final Icon PRE_WIDGET_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/prewidget.png");
public static final Icon EDIT_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/editn.png");
public static final Icon EDIT_PRESSED_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/editp.png");
public static final Icon HIDE_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/hiden.png");
public static final Icon HIDE_PRESSED_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/hidep.png");
public static final Icon VIEW_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/viewn.png");
public static final Icon VIEW_PRESSED_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/viewp.png");
public static final Icon RUN_BIG_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/run24.png");
public static final Icon RUN_SMALL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/runs.png");
public static final Icon PAGE_BIG_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/pageb24.png");
public static final Icon WRITE_BIG_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/writeb24.png");
public static final Icon ANA_BIG_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/anab24.png");
public static final Icon PAGE_SMALL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/pages.png");
public static final Icon WRITE_SMALL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/writes.png");
public static final Icon ANA_SMALL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/anas.png");
public static final Icon REFRESH_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/refresh.png");
public static final Icon FONT_ICON = IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png");
public static final Icon HISTORY_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/history.png");
public static final Icon DELETE_ICON = IOUtils.readIcon("com/fr/design/images/m_file/close.png");
public static final Icon EDIT_ICON = IOUtils.readIcon("com/fr/design/images/m_file/edit.png");
public static final Icon SEARCH_ICON = IOUtils.readIcon("/com/fr/design/images/data/search.png");
public static final Icon BLACK_SEARCH_ICON = IOUtils.readIcon("/com/fr/design/images/data/black_search.png");
public static final Icon CLEAR_ICON = IOUtils.readIcon("/com/fr/design/images/data/source/delete.png");
public static final Icon LIST_EDIT_ICON = IOUtils.readIcon("/com/fr/design/images/control/edit.png");
public static final Icon LIST_EDIT_WHITE_ICON = IOUtils.readIcon("/com/fr/design/images/control/edit_white.png");
public static final Color PRESSED_DARK_GRAY = new Color(127, 127, 127);
public static final Color GRDIENT_DARK_GRAY = new Color(45, 45, 45);
public static final Color BARNOMAL = new Color(232, 232, 233);
@ -205,10 +212,10 @@ public interface UIConstants {
public static final int BUTTON_GROUP_ARC = 0;
public static final int LARGEARC = 6;
public static final Stroke BS = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 2f, new float[]{3, 1}, 0);
public static final Icon PREVIEW_DOWN = BaseUtils.readIcon("com/fr/design/images/buttonicon/prevew_down_icon.png");
public static final Icon CLOSE_OF_AUTHORITY = BaseUtils.readIcon("/com/fr/design/images/m_report/close.png");
public static final Icon CLOSE_OVER_AUTHORITY = BaseUtils.readIcon("/com/fr/design/images/m_report/close_over.png");
public static final Icon CLOSE_PRESS_AUTHORITY = BaseUtils.readIcon("/com/fr/design/images/m_report/close_press.png");
public static final Icon PREVIEW_DOWN = IOUtils.readIcon("com/fr/design/images/buttonicon/prevew_down_icon.png");
public static final Icon CLOSE_OF_AUTHORITY = IOUtils.readIcon("/com/fr/design/images/m_report/close.png");
public static final Icon CLOSE_OVER_AUTHORITY = IOUtils.readIcon("/com/fr/design/images/m_report/close_over.png");
public static final Icon CLOSE_PRESS_AUTHORITY = IOUtils.readIcon("/com/fr/design/images/m_report/close_press.png");
public static final int CLOSE_AUTHORITY_HEIGHT_AND_WIDTH = 24;

2
designer-base/src/main/java/com/fr/design/dialog/BasicPane.java

@ -129,7 +129,7 @@ public abstract class BasicPane extends JPanel {
* @param dimension 自定义尺寸
* @return 对话框
*/
protected BasicDialog showWindowWithCustomSize(Window window, DialogActionListener l, Dimension dimension) {
public BasicDialog showWindowWithCustomSize(Window window, DialogActionListener l, Dimension dimension) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);

16
designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java

@ -206,5 +206,21 @@ public class PluginOperateUtils {
return pluginInfo.toString();
}
public static String getSwitchedInfo(PluginTaskResult result) {
StringBuilder pluginInfo = new StringBuilder();
List<PluginTaskResult> pluginTaskResults = result.asList();
for (PluginTaskResult pluginTaskResult : pluginTaskResults) {
PluginTask pluginTask = pluginTaskResult.getCurrentTask();
if (pluginTask == null) {
continue;
}
PluginMarker pluginMarker = pluginTask.getToMarker();
PluginContext pluginContext = PluginManager.getContext(pluginMarker);
if (pluginContext != null && pluginContext.getSelfState() == 1) {
pluginInfo.append("\n").append(pluginContext.getSwitchedReason());
}
}
return pluginInfo.toString();
}
}

6
designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java

@ -36,10 +36,12 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
@Override
public void done(PluginTaskResult result) {
String pluginInfo = PluginOperateUtils.getSuccessInfo(result);
if (result.isSuccess()) {
String switchedInfo = PluginOperateUtils.getSwitchedInfo(result);
jsCallback.execute("success");
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success"));
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success"));
FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo);
JOptionPane.showMessageDialog(null, pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo);
} else if (result.errorCode() == PluginErrorCode.NeedDealWithPluginDependency) {
int rv = JOptionPane.showOptionDialog(
null,

5
designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java

@ -35,9 +35,10 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
protected void allDone(PluginTaskResult result) {
String pluginInfo = PluginOperateUtils.getSuccessInfo(result);
if (result.isSuccess()) {
String switchedInfo = PluginOperateUtils.getSwitchedInfo(result);
jsCallback.execute("success");
FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success"));
JOptionPane.showMessageDialog(null, pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success"));
FineLoggerFactory.getLogger().info(pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo);
JOptionPane.showMessageDialog(null, pluginInfo + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Install_Success") + switchedInfo);
} else if(result.errorCode() == PluginErrorCode.HasLowerPluginWhenInstall){
int rv = JOptionPane.showOptionDialog(
null,

2
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -263,9 +263,9 @@ public class HistoryTemplateListCache implements CallbackEvent {
JTemplate<?, ?> template = iterator.next();
String tPath = template.getPath();
if (isDir ? tPath.startsWith(path) : tPath.equals(path)) {
int size = getHistoryCount();
iterator.remove();
int index = iterator.nextIndex();
int size = getHistoryCount();
if (size == index + 1 && index > 0) {
//如果删除的是后一个Tab,则定位到前一个
MutilTempalteTabPane.getInstance().setSelectedIndex(index - 1);

77
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java

@ -0,0 +1,77 @@
package com.fr.design.gui.itree.filetree;
import com.fr.base.FRContext;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.mainframe.App;
import com.fr.general.GeneralContext;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
/**
* Created by alex sung on 2019/7/23.
*/
public class FileNodeConstants {
private static List<String> supportFileType;
private static ReadWriteLock rwl = new ReentrantReadWriteLock();
private FileNodeConstants() {
}
static {
initSupportedTypes();
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent pluginEvent) {
initSupportedTypes();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext pluginContext) {
return pluginContext.contain(PluginModule.ExtraDesign);
}
});
}
private static void addAppExtensions(String[] extensions) {
for (int i = 0, size = extensions.length; i < size; i++) {
if (!supportFileType.contains(extensions[i])) {
supportFileType.add(extensions[i]);
}
}
}
private static void initSupportedTypes() {
try {
rwl.writeLock().lock();
supportFileType = new ArrayList<>(Arrays.asList(FRContext.getFileNodes().getSupportedTypes()));
//通过插件扩展的
Set<App> apps = ExtraDesignClassManager.getInstance().getArray(App.MARK_STRING);
for (App app : apps) {
addAppExtensions(app.defaultExtensions());
}
} finally {
rwl.writeLock().unlock();
}
}
public static String[] getSupportFileTypes() {
try {
rwl.readLock().lock();
return supportFileType.toArray(new String[0]);
} finally {
rwl.readLock().unlock();
}
}
}

25
designer-base/src/main/java/com/fr/design/gui/itree/filetree/JFileTree.java

@ -1,10 +1,11 @@
package com.fr.design.gui.itree.filetree;
import com.fr.base.BaseUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.project.ProjectConstants;
import org.jetbrains.annotations.Nullable;
import javax.swing.Icon;
import javax.swing.JTree;
@ -29,7 +30,8 @@ import java.util.Stack;
* File Tree.
*/
public class JFileTree extends AbstractFileTree {
protected FileFilter fileFilter;
private FileFilter fileFilter;
public JFileTree() {
this(null);
@ -68,11 +70,11 @@ public class JFileTree extends AbstractFileTree {
DefaultMutableTreeNode rootTreeNode = (DefaultMutableTreeNode) defaultTreeModel.getRoot();
rootTreeNode.removeAllChildren();
for (int k = 0; k < rootFiles.length; k++) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode(new RootFile(rootFiles[k]));
for (File rootFile : rootFiles) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode(new RootFile(rootFile));
rootTreeNode.add(node);
if (rootFiles[k].isDirectory()) {
if (rootFile.isDirectory()) {
node.add(new DefaultMutableTreeNode(Boolean.TRUE));
}
}
@ -93,6 +95,7 @@ public class JFileTree extends AbstractFileTree {
this.fileFilter = fileFilter;
}
@Nullable
public File getSelectedFile() {
TreePath selectedTreePath = this.getSelectionPath();
if (selectedTreePath == null) {
@ -140,7 +143,7 @@ public class JFileTree extends AbstractFileTree {
File rootFile = rootLocalFile.getFile();
// 是父子关系,开始找孩子.
if (AbstractFileTree.isParentFile(rootFile, currentFile)) {
Stack nameStack = new Stack(); // 将所有的名字加入Stack.
Stack<String> nameStack = new Stack<>(); // 将所有的名字加入Stack.
while (true) {
if (ComparatorUtils.equals(rootFile, currentFile)) {
break;
@ -153,7 +156,7 @@ public class JFileTree extends AbstractFileTree {
}
DefaultMutableTreeNode curChildTreeNode = rootChildTreeNode;
while (!nameStack.isEmpty()) {
String name = (String) nameStack.pop();
String name = nameStack.pop();
this.expandTreeNode(curChildTreeNode);
for (int j = 0; j < curChildTreeNode.getChildCount(); j++) {
DefaultMutableTreeNode tmpChildTreeNode =
@ -198,9 +201,8 @@ public class JFileTree extends AbstractFileTree {
if (files == null) {
return new FileDirectoryNode[0];
}
List fileNodeList = new ArrayList();
for (int k = 0; k < files.length; k++) {
File tmpFile = files[k];
List<FileDirectoryNode> fileNodeList = new ArrayList<>();
for (File tmpFile : files) {
// 文件属性为隐藏的话 不放入列表
if (tmpFile.isHidden()) {
continue;
@ -256,7 +258,7 @@ public class JFileTree extends AbstractFileTree {
// 得到本地tree图标
Icon tmpIcon = view.getSystemIcon(currentFile);
if (currentFile.isDirectory() && fBuf.length() > 0) {
tmpIcon = BaseUtils.readIcon("/com/fr/design/images/gui/folder.png");
tmpIcon = IOUtils.readIcon("/com/fr/design/images/gui/folder.png");
}
this.setIcon(tmpIcon);
this.setName(null);
@ -299,6 +301,7 @@ public class JFileTree extends AbstractFileTree {
*/
@Override
public int compare(FileDirectoryNode v1, FileDirectoryNode v2) {
//noinspection Duplicates
if (v1.isDirectory()) {
if (v2.isDirectory()) {
return v1.getName().toLowerCase().compareTo(v2.getName().toLowerCase());

2
designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java

@ -228,7 +228,7 @@ public class TemplateFileTree extends EnvFileTree {
if (fileNodes == null) {
fileNodes = new FileNode[0];
}
Arrays.sort(fileNodes, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes()));
Arrays.sort(fileNodes, new FileNodeComparator(FileNodeConstants.getSupportFileTypes()));
return fileNodes;
}

4
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -532,7 +532,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
String oldName = fnf.getName();
String suffix = fnf.isDirectory() ? StringUtils.EMPTY : oldName.substring(oldName.lastIndexOf(CoreConstants.DOT), oldName.length());
oldName = oldName.replace(suffix, StringUtils.EMPTY);
oldName = StringUtils.replaceLast(oldName, suffix, StringUtils.EMPTY);
this.setLayout(new BorderLayout());
this.setModal(true);
@ -651,7 +651,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
String oldName = fnf.getName();
String suffix = fnf.isDirectory() ? StringUtils.EMPTY : oldName.substring(oldName.lastIndexOf(CoreConstants.DOT), oldName.length());
oldName = oldName.replaceAll(suffix, StringUtils.EMPTY);
oldName = StringUtils.replaceLast(oldName, suffix, StringUtils.EMPTY);
// 输入为空或者没有修改
if (ComparatorUtils.equals(userInput, oldName)) {

2
designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java

@ -60,4 +60,4 @@ public final class JTemplateFactory {
ALL_APP.remove(app);
}
}
}
}

10
designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrAction.java

@ -1,6 +1,5 @@
package com.fr.design.report.fit.menupane;
import com.fr.base.BaseUtils;
import com.fr.design.actions.JTemplateAction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.DialogActionAdapter;
@ -8,18 +7,17 @@ import com.fr.design.dialog.UIDialog;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.IOUtils;
import com.fr.report.fit.FitProvider;
import com.fr.report.fit.ReportFitAttr;
import javax.swing.KeyStroke;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
/**
* Created by Administrator on 2015/7/6 0006.
*/
public class ReportFitAttrAction extends JTemplateAction {
private static final Dimension MEDIUM = new Dimension(430, 400);
private static final MenuKeySet REPORT_FIT_ATTR = new MenuKeySet() {
@Override
public char getMnemonic() {
@ -67,7 +65,7 @@ public class ReportFitAttrAction extends JTemplateAction {
}
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/reportfit/fit.png"));
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/reportfit/fit.png"));
}
/**
@ -75,6 +73,7 @@ public class ReportFitAttrAction extends JTemplateAction {
*
* @param e 事件
*/
@Override
public void actionPerformed(ActionEvent e) {
final JTemplate jwb = getEditingComponent();
if (jwb == null) {
@ -93,14 +92,13 @@ public class ReportFitAttrAction extends JTemplateAction {
private void showReportFitDialog(ReportFitAttr fitAttr, final JTemplate jwb, final FitProvider wbTpl, final BasicBeanPane<ReportFitAttr> attrPane) {
attrPane.populateBean(fitAttr);
UIDialog dialog = attrPane.showUnsizedWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
UIDialog dialog = attrPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
wbTpl.setReportFitAttr(attrPane.updateBean());
jwb.fireTargetModified();
}
});
dialog.setSize(MEDIUM);
dialog.setVisible(true);
}

1
designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java

@ -12,6 +12,7 @@ import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.JDialog;

4
designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

@ -362,10 +362,10 @@ public class UpdateMainDialog extends UIDialog {
add(jarVersionInfoPane, BorderLayout.NORTH);
//海外版本不显示更新信息
if (GeneralContext.getLocale().equals(Locale.CHINA) || GeneralContext.getLocale().equals(Locale.TAIWAN)){
if (GeneralContext.getLocale().equals(Locale.CHINA) || GeneralContext.getLocale().equals(Locale.TAIWAN)) {
add(jarUpdateInfoPane, BorderLayout.CENTER);
add(updateActionPane, BorderLayout.SOUTH);
}else {
} else {
add(updateActionPane, BorderLayout.CENTER);
}

17
designer-base/src/main/java/com/fr/env/LocalEnvPane.java vendored

@ -6,9 +6,9 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.itree.filetree.JFileTree;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.file.filter.OnlyShowDirectoryFileFilter;
import com.fr.stable.StringUtils;
import javax.swing.JPanel;
@ -33,8 +33,9 @@ public class LocalEnvPane extends BasicBeanPane<LocalDesignerWorkspaceInfo> {
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.add(northPane, BorderLayout.NORTH);
northPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Location") + ":"), BorderLayout.WEST);
northPane.add(pathTextField = new UITextField(), BorderLayout.CENTER);
northPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Location") + ":"), BorderLayout.WEST);
pathTextField = new UITextField();
northPane.add(pathTextField, BorderLayout.CENTER);
// 删除选择文件按钮 添加JFileTree
@ -54,19 +55,23 @@ public class LocalEnvPane extends BasicBeanPane<LocalDesignerWorkspaceInfo> {
@Override
public void valueChanged(TreeSelectionEvent e) {
pathTextField.setText(localEnvTree.getSelectedFile().getPath());
File selectFile = localEnvTree.getSelectedFile();
if (selectFile == null) {
return;
}
pathTextField.setText(selectFile.getPath());
}
});
UITextArea description = new UITextArea();
centerPane.add(description, BorderLayout.SOUTH);
description.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Env_Des1"));
description.setText(Toolkit.i18nText("Fine-Design_Basic_Env_Des1"));
description.setEditable(false);
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Location");
return Toolkit.i18nText("Fine-Design_Basic_Location");
}
@Override

BIN
designer-base/src/main/resources/com/fr/design/images/dialog/watermark/watermark_background_en.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/reportcolumns/col_en.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/reportcolumns/row_en.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

51
designer-base/src/test/java/com/fr/design/gui/itree/filetree/FileNodeConstantsTest.java

@ -0,0 +1,51 @@
package com.fr.design.gui.itree.filetree;
import com.fr.base.extension.FileExtension;
import com.fr.base.io.BaseBook;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.mainframe.AbstractAppProvider;
import com.fr.design.mainframe.App;
import com.fr.design.mainframe.JTemplate;
import com.fr.file.FILE;
import com.fr.stable.fun.mark.Mutable;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Test;
import java.util.HashSet;
import java.util.Set;
/**
* Created by alex sung on 2019/7/25.
*/
public class FileNodeConstantsTest {
@Test
public void supportFileTypesTest(){
ExtraDesignClassManager extra = EasyMock.mock(ExtraDesignClassManager.class);
Set<Mutable> apps = new HashSet<Mutable>(){{add(new MockCptxApp());}};
EasyMock.expect(extra.getArray(App.MARK_STRING)).andReturn(apps).anyTimes();
EasyMock.replay(extra);
Assert.assertEquals(1, extra.getArray(App.MARK_STRING).size());
App app = (App) extra.getArray(App.MARK_STRING).iterator().next();
Assert.assertEquals("cptx", app.defaultExtensions()[0]);
}
private class MockCptxApp extends AbstractAppProvider{
@Override
public String[] defaultExtensions() {
return new String[] {FileExtension.CPTX.getExtension()};
}
@Override
public JTemplate openTemplate(FILE tplFile) {
return null;
}
@Override
public BaseBook asIOFile(FILE tplFile) {
return null;
}
}
}

1
designer-form/src/main/java/com/fr/design/designer/properties/FormWidgetAuthorityEditPane.java

@ -56,6 +56,7 @@ public class FormWidgetAuthorityEditPane extends AuthorityEditPane {
for (String selectedRole : selectedArray) {
for (Widget widget : widgets) {
widget.changeVisibleAuthorityState(selectedRole, widgetVisible.isSelected());
widgetAvailable.setEnabled(widgetVisible.isSelected());
}
}
doAfterAuthority();

10
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java

@ -19,6 +19,7 @@ import com.fr.design.mainframe.MobileWidgetListPane;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.container.WSortLayout;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
@ -87,9 +88,7 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane {
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}};
if (ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING).size() != 0) {
tipLabel = null;
} else {
if (ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING).isEmpty()) {
((WParameterLayout) (paraCreator.toData())).setProvider((MobileParamStyleProvider) ((Item) paramLocationComboBox.getItemAt(0)).getValue());
}
Component[][] components = new Component[][]{
@ -127,10 +126,9 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane {
@Override
public void mouseClicked(MouseEvent e) {
try {
//todo 添加对应插件下载地址
Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("plugin.download")));
Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("plugin.mobile.style")));
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
}
}
@Override

9
designer-realize/src/main/java/com/fr/design/cell/editor/BiasTextPainterCellEditor.java

@ -24,6 +24,7 @@ import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -34,6 +35,7 @@ import java.awt.event.ActionListener;
public class BiasTextPainterCellEditor extends AbstractCellEditor {
private BiasTextPainterPane biasTextPainterPane = null;
private static final double MULTIPLE = 1.5;
/**
* Constructor.
@ -84,8 +86,10 @@ public class BiasTextPainterCellEditor extends AbstractCellEditor {
Window parentWindow = SwingUtilities.getWindowAncestor(grid);
this.biasTextPainterPane = new BiasTextPainterPane();
Dimension dimension = this.biasTextPainterPane.getPreferredSize();
Dimension wrapDimension = new Dimension((int) (dimension.width * MULTIPLE), (int) (dimension.height * MULTIPLE));
this.biasTextPainterPane.populate(biasTextPainter);
return this.biasTextPainterPane.showSmallWindow(parentWindow, new DialogActionAdapter() {
return this.biasTextPainterPane.showWindowWithCustomSize(parentWindow, new DialogActionAdapter() {
@Override
public void doOk() {
@ -96,7 +100,7 @@ public class BiasTextPainterCellEditor extends AbstractCellEditor {
public void doCancel() {
BiasTextPainterCellEditor.this.fireEditingCanceled();
}
});
}, wrapDimension);
}
public static class BiasTextPainterPane extends BasicPane {
@ -142,7 +146,6 @@ public class BiasTextPainterCellEditor extends AbstractCellEditor {
group.add(choice2);
choicePane.add(choice1);
// choicePane.add(new UILabel(" "));
choicePane.add(choice2);
centerPane.add(choicePane, BorderLayout.SOUTH);

20
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineHelper.java

@ -15,6 +15,7 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.PluginSearchManager
import com.fr.design.mainframe.alphafine.search.manager.impl.RecentSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchManager;
import com.fr.design.mainframe.alphafine.search.manager.impl.SimilarSearchManager;
import com.fr.general.GeneralContext;
import com.fr.general.ProcessCanceledException;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSON;
@ -33,6 +34,25 @@ public class AlphaFineHelper {
public static final NoResultModel NO_CONNECTION_MODEL = new NoResultModel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Connection_Failed"));
private static AlphaFineDialog alphaFineDialog;
private static final String URL_FOR_TEST_NETWORK = "https://www.baidu.com";
private AlphaFineHelper() {
}
/**
* 根据国际化调整配置
*/
public static void switchConfig4Locale() {
AlphaFineConfigManager manager = DesignerEnvManager.getEnvManager().getAlphaFineConfigManager();
if (!GeneralContext.isChineseEnv()) {
manager.setSearchOnLine(false);
manager.setContainDocument(false);
manager.setContainPlugin(false);
manager.setContainRecommend(false);
manager.setNeedIntelligentCustomerService(false);
}
}
/**
* 弹出alphafine搜索面板

3
designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java

@ -62,8 +62,7 @@ public class CellElementEditPane extends BasicPane {
@Override
public void tabChanged(int index) {
card.show(center, paneList.get(index).title4PopupWindow());
paneList.get(index).populateBean(cellelement, ePane);// 设置面板变了,也要populate
paneList.get(index).addAttributeChangeListener(listener);
populate(ePane);
if (titleChangeListener != null) {
titleChangeListener.fireTitleChange(getSelectedTabName());
}

24
designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java

@ -1,6 +1,5 @@
package com.fr.design.report;
import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.border.UITitledBorder;
@ -15,14 +14,27 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.IOUtils;
import com.fr.report.stable.WorkSheetAttr;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ColumnRow;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SpinnerNumberModel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -87,6 +99,7 @@ public class ReportColumnsPane extends BasicPane{
};
onOffButtonGroup = new UIButtonGroup(textArray) {
@Override
protected void initButton(UIToggleButton labelButton) {
labelButton.setSize(new Dimension(60,20));
labelButton.setPreferredSize(new Dimension(60, 20));
@ -190,7 +203,7 @@ public class ReportColumnsPane extends BasicPane{
JPanel sampleLablePane = new JPanel(new GridLayout(1,2));
sampleLablePane.setPreferredSize(new Dimension(524, 130));
JPanel rPane = new JPanel();
UILabel rLabel = new UILabel(BaseUtils.readIcon("/com/fr/design/images/reportcolumns/" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Row_Icon_File_Name")));
UILabel rLabel = new UILabel(IOUtils.readIcon("/com/fr/design/images/reportcolumns/" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Row_Icon_File_Name")));
rLabel.setBorder(BorderFactory.createEmptyBorder(5,45,0,49));
rPane.add(rLabel);
rowButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportColumns_Columns_Horizontally"));
@ -198,7 +211,7 @@ public class ReportColumnsPane extends BasicPane{
rPane.add(rowButton);
sampleLablePane.add(rPane);
JPanel cPane = new JPanel();
UILabel cLabel = new UILabel(BaseUtils.readIcon("/com/fr/design/images/reportcolumns/col.png"));
UILabel cLabel = new UILabel(IOUtils.readIcon("/com/fr/design/images/reportcolumns/" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Col_Icon_File_Name")));
cLabel.setBorder(BorderFactory.createEmptyBorder(5,49,0,49));
cPane.add(cLabel);
colButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportColumns_Columns_Vertically"));
@ -552,6 +565,7 @@ public class ReportColumnsPane extends BasicPane{
/**
* 判断输入是否合法
*/
@Override
public void checkValid() throws Exception {
String repeatText = repeatColDataTextField.getText().trim();
if(StringUtils.isEmpty(repeatText)){

11
designer-realize/src/main/java/com/fr/design/webattr/ToolBarDragPane.java

@ -35,6 +35,7 @@ import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.ImageObserver;
import java.util.List;
/**
* 新的拖拽ToolBar button以实现自定义工具栏 报表web设置那儿的.应该不叫ToolBarDragPane因为实际没有提供drag功能
@ -225,6 +226,16 @@ public class ToolBarDragPane extends WidgetToolBarPane {
public void setAllEnabled(boolean b) {
GUICoreUtils.setEnabled(this, b);
isEnabled = b;
removeAllListener(northToolBar.getToolBarButtons());
}
private void removeAllListener(List<ToolBarButton> toolBarButtons) {
for (ToolBarButton button : toolBarButtons) {
button.setEnabled(isEnabled);
if (!isEnabled) {
button.removeMouseListener(button);
}
}
}
/**

2
designer-realize/src/main/java/com/fr/design/webattr/WebSettingPane.java

@ -122,8 +122,8 @@ public abstract class WebSettingPane<T extends WebContent> extends BasicBeanPane
choseComboBox.removeItemListener(itemListener);
choseComboBox.setSelectedIndex(SERVER_SET);
choseComboBox.addItemListener(itemListener);
checkEnabled(false);
populateServerSettings();
checkEnabled(false);
return;
}
// 模板设置

29
designer-realize/src/main/java/com/fr/design/widget/WidgetDefinePaneFactory.java

@ -48,6 +48,7 @@ import com.fr.report.web.button.write.AppendRowButton;
import com.fr.report.web.button.write.DeleteRowButton;
import com.fr.stable.bridge.BridgeMark;
import com.fr.stable.bridge.StableFactory;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.Map;
@ -60,7 +61,9 @@ import java.util.Map;
* Time : 上午11:17
*/
public class WidgetDefinePaneFactory {
private static Map<Class<? extends Widget>, Appearance> defineMap = new HashMap<Class<? extends Widget>, Appearance>();
private static Map<Class<? extends Widget>, Appearance> pluginDefineMap = ExtraDesignClassManager.getInstance().getCellWidgetOptionsMap();
static {
defineMap.put(NumberEditor.class, new Appearance(NumberEditorDefinePane.class, WidgetConstants.NUMBER + ""));
@ -91,24 +94,32 @@ public class WidgetDefinePaneFactory {
defineMap.put(AppendRowButton.class, new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + ""));
defineMap.put(DeleteRowButton.class, new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + ""));
defineMap.put(TreeNodeToggleButton.class, new Appearance(ButtonDefinePane.class, WidgetConstants.BUTTON + ""));
defineMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetOptionsMap());
}
private WidgetDefinePaneFactory() {
}
@Nullable
public static RN createWidgetDefinePane(Widget widget, Operator operator) {
Appearance dn = defineMap.get(widget.getClass());
DataModify<Widget> definePane = null;
try {
definePane = (DataModify) dn.getDefineClass().newInstance();
definePane.populateBean(widget);
operator.did(definePane.dataUI(), dn.getDisplayName());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
// 再走一遍插件。
if (dn == null) {
dn = pluginDefineMap.get(widget.getClass());
}
return new RN(definePane, dn.getDisplayName());
if (dn != null) {
DataModify<Widget> definePane = null;
try {
definePane = (DataModify) dn.getDefineClass().newInstance();
definePane.populateBean(widget);
operator.did(definePane.dataUI(), dn.getDisplayName());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return new RN(definePane, dn.getDisplayName());
}
return null;
}
public static class RN {

5
designer-realize/src/main/java/com/fr/poly/creator/ECBlockEditor.java

@ -136,6 +136,7 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
* @date 2014-11-24-下午3:48:19
*/
public void resetSelectionAndChooseState() {
boolean chooseBlock = designer.isChooseBlock();
designer.setChooseType(SelectionType.INNER);
if (DesignerMode.isAuthorityEditing()) {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
@ -167,7 +168,9 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
conditionAttributesGroupPane.populate(editComponent);
EastRegionContainerPane.getInstance().updateCellElementState(isSelectedOneCell());
if (chooseBlock) {
EastRegionContainerPane.getInstance().switchTabTo(EastRegionContainerPane.KEY_CELL_ATTR);
}
}
// 超级链接

4
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -47,6 +47,7 @@ import com.fr.design.mainframe.InformationCollector;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.WidgetToolBarPane;
import com.fr.design.mainframe.alphafine.AlphaFineHelper;
import com.fr.design.mainframe.bbs.BBSGuestPane;
import com.fr.design.mainframe.bbs.UserInfoPane;
import com.fr.design.mainframe.form.FormECCompositeProvider;
@ -134,8 +135,9 @@ public class DesignerActivator extends Activator {
DesignerSocketIO.update();
UserInfoPane.getInstance().updateBBSUserInfo();
storePassport();
AlphaFineHelper.switchConfig4Locale();
}
private void loadLogAppender() {
logHandler = new LogHandler<DesignerLogAppender>() {
final DesignerLogAppender logAppender = new DesignerLogAppender();

46
designer-realize/src/test/java/com.fr/design/mainframe/alphafine/AlphaFineHelperTest.java

@ -0,0 +1,46 @@
package com.fr.design.mainframe.alphafine;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.general.GeneralContext;
import org.easymock.EasyMock;
import org.junit.Assert;
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.core.classloader.annotations.SuppressStaticInitializationFor;
import org.powermock.modules.junit4.PowerMockRunner;
import static org.junit.Assert.*;
@RunWith(PowerMockRunner.class)
public class AlphaFineHelperTest {
@Test
@PrepareForTest({GeneralContext.class, DesignerEnvManager.class})
@SuppressStaticInitializationFor("com.fr.design.mainframe.alphafine.AlphaFineHelper")
public void testSwitchConfig4Locale() throws Exception {
PowerMock.mockStatic(GeneralContext.class);
EasyMock.expect(GeneralContext.isChineseEnv()).andReturn(true).times(1).andReturn(false).times(1);
DesignerEnvManager manager = EasyMock.mock(DesignerEnvManager.class);
EasyMock.expect(manager.getAlphaFineConfigManager()).andReturn(new AlphaFineConfigManager()).anyTimes();
EasyMock.replay(manager);
PowerMock.mockStatic(DesignerEnvManager.class);
EasyMock.expect(DesignerEnvManager.getEnvManager()).andReturn(manager).anyTimes();
PowerMock.replayAll();
AlphaFineHelper.switchConfig4Locale();
AlphaFineConfigManager config = manager.getAlphaFineConfigManager();
Assert.assertEquals(true, config.isSearchOnLine());
AlphaFineHelper.switchConfig4Locale();
Assert.assertEquals(false, config.isSearchOnLine());
}
}

66
designer-realize/src/test/java/com/fr/design/widget/WidgetDefinePaneFactoryTest.java

@ -0,0 +1,66 @@
package com.fr.design.widget;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.widget.ui.ButtonDefinePane;
import com.fr.form.ui.Button;
import com.fr.form.ui.Widget;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.easymock.PowerMock;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.util.HashMap;
import java.util.Map;
@RunWith(PowerMockRunner.class)
@PowerMockIgnore("javax.swing.*")
public class WidgetDefinePaneFactoryTest {
@Test
@PrepareForTest({ExtraDesignClassManager.class, WidgetDefinePaneFactory.class})
public void testCreateWidgetDefinePane() throws Exception {
Map<Class<? extends Widget>, Appearance> map = new HashMap<>();
ExtraDesignClassManager mockDesignManager = EasyMock.mock(ExtraDesignClassManager.class);
EasyMock.expect(mockDesignManager.getCellWidgetOptionsMap()).andReturn(map).anyTimes();
EasyMock.replay(mockDesignManager);
PowerMock.mockStatic(ExtraDesignClassManager.class);
EasyMock.expect(ExtraDesignClassManager.getInstance()).andReturn(mockDesignManager).anyTimes();
PowerMock.replayAll(ExtraDesignClassManager.class);
Button mockWidget = EasyMock.mock(Button.class);
EasyMock.replay(mockWidget);
ButtonDefinePane mockPane = EasyMock.mock(ButtonDefinePane.class);
mockPane.populateBean(EasyMock.anyObject(Button.class));
EasyMock.expectLastCall();
EasyMock.replay(mockPane);
Operator mockOperator = EasyMock.mock(Operator.class);
mockOperator.did(EasyMock.anyObject(DataCreatorUI.class), EasyMock.anyString());
EasyMock.replay(mockOperator);
WidgetDefinePaneFactory.RN rn1 = WidgetDefinePaneFactory.createWidgetDefinePane(mockWidget, mockOperator);
Assert.assertNull(rn1);
Appearance appearance = new Appearance(ButtonDefinePane.class, "test");
map.put(mockWidget.getClass(), appearance);
WidgetDefinePaneFactory.RN rn2 = WidgetDefinePaneFactory.createWidgetDefinePane(mockWidget, mockOperator);
Assert.assertNotNull(rn2);
map.clear();
WidgetDefinePaneFactory.RN rn3 = WidgetDefinePaneFactory.createWidgetDefinePane(mockWidget, mockOperator);
Assert.assertNull(rn3);
}
}
Loading…
Cancel
Save