Browse Source

Merge pull request #1261 in DESIGN/design from ~NEIL/design:feature/10.0 to feature/10.0

* commit '11b33b9e10a6816cff0d9c43ed24ee2a009d964e': (95 commits)
  .
  .
  .
  ct
  ct
  ct
  .
  release/10.0
  ct
  REPORT-19946 Linux设计器
  REPORT-19946 Linux设计器
  REPORT-23486 修复bug以及更改文件夹
  REPORT-23115 远程设计权限配置-版本不匹配时用户角色列表都为空
  REPORT-23570 修改国际化名字
  REPORT-23570 模版版本管理,gc为负数时应当提示“无可优化文件”
  REPORT-23486 修复bug以及更改文件夹
  REPORT-23486 修复bug以及更改文件夹
  REPORT-23486 修复bug以及更改文件夹
  REPORT-23486 修复bug以及更改文件夹
  REPORT-23486 修复bug以及更改文件夹
  ...
research/11.0
neil 5 years ago
parent
commit
2bd3085d4c
  1. 14
      designer-base/src/main/java/com/fr/design/DesignModelAdapter.java
  2. 32
      designer-base/src/main/java/com/fr/design/RestartHelper.java
  3. 138
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  4. 3
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  5. 4
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  6. 3
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  7. 12
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  8. 2
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  9. 11
      designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java
  10. 1
      designer-base/src/main/java/com/fr/design/fun/ParameterWidgetOptionProvider.java
  11. 40
      designer-base/src/main/java/com/fr/design/fun/ReportSupportedFileUIProvider.java
  12. 40
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportSupportedFileUIProvider.java
  13. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java
  14. 8
      designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java
  15. 21
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java
  16. 35
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java
  17. 2
      designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java
  18. 4
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java
  19. 64
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  20. 16
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  21. 29
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  22. 6
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java
  23. 3
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java
  24. 2
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java
  25. 3
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java
  26. 5
      designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java
  27. 3
      designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java
  28. 14
      designer-base/src/main/java/com/fr/design/os/impl/RestartAction.java
  29. 28
      designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java
  30. 38
      designer-base/src/main/java/com/fr/design/remote/ui/AbstractManagerPane.java
  31. 4
      designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrPane.java
  32. 2
      designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateFitAttrPane.java
  33. 99
      designer-base/src/main/java/com/fr/design/style/color/ColorPicker.java
  34. 65
      designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java
  35. 66
      designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java
  36. 25
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  37. 14
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  38. 77
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  39. 37
      designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java
  40. 61
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  41. 64
      designer-base/src/test/java/com/fr/design/gui/itree/filetree/FileNodeConstantsTest.java
  42. 48
      designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java
  43. 39
      designer-base/src/test/java/com/fr/file/FILEChooserPaneTest.java
  44. 2
      designer-chart/src/main/java/com/fr/design/chart/ChartCommonWizardPane.java
  45. 2
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  46. 6
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java
  47. 4
      designer-chart/src/main/java/com/fr/design/chartx/AbstractChartDataPane.java
  48. 4
      designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractDataPane.java
  49. 4
      designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractOtherPane.java
  50. 10
      designer-chart/src/main/java/com/fr/design/mainframe/MiddleChartPropertyPane.java
  51. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java
  52. 12
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  53. 16
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  54. 8
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java
  55. 14
      designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java
  56. 47
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  57. 5
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  58. 1
      designer-form/src/main/java/com/fr/design/designer/properties/EventPropertyTable.java
  59. 2
      designer-form/src/main/java/com/fr/design/form/mobile/FormMobileOthersPane.java
  60. 4
      designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java
  61. 14
      designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java
  62. 11
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  63. 2
      designer-realize/src/main/java/com/fr/design/actions/cell/CellAttributeAction.java
  64. 5
      designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java
  65. 2
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  66. 2
      designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java
  67. 7
      designer-realize/src/main/java/com/fr/design/mainframe/JPolyWorkBook.java
  68. 25
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  69. 37
      designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java
  70. 5
      designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java
  71. 4
      designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java
  72. 2
      designer-realize/src/main/java/com/fr/design/report/mobile/MobileOthersPane.java
  73. 2
      designer-realize/src/main/java/com/fr/design/webattr/EventPane.java
  74. 3
      designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java

14
designer-base/src/main/java/com/fr/design/DesignModelAdapter.java

@ -7,8 +7,11 @@ import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JTemplateProvider;
import com.fr.form.ui.DataControl;
import com.fr.form.ui.MultiFileEditor;
import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.js.WidgetName;
import java.util.Iterator;
@ -214,6 +217,17 @@ public abstract class DesignModelAdapter<T extends BaseBook, S extends JTemplate
public abstract List<WidgetName> getWidgetsName();
/**
* 判断是否是值编辑器可以设置的控件类型
* @param widget 控件
* @return 可以设置返回true否则返回false
*/
public boolean widgetAccepted(Widget widget) {
return widget != null
&& StringUtils.isNotEmpty(widget.getWidgetName())
&& (widget instanceof DataControl || widget instanceof MultiFileEditor);
}
/**
* 更新缓存的参数
*/

32
designer-base/src/main/java/com/fr/design/RestartHelper.java

@ -1,7 +1,7 @@
package com.fr.design;
import com.fr.design.os.impl.RestartAction;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.RestartAction;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory;
@ -9,7 +9,9 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.workspace.WorkContext;
import javax.swing.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@ -29,7 +31,8 @@ public class RestartHelper {
public static final String RECORD_FILE = StableUtils.pathJoin(StableUtils.getInstallHome(), "delete.properties");
public static final String MOVE_FILE = StableUtils.pathJoin(StableUtils.getInstallHome(), "move.properties");
private static OSBasedAction restartAction;
private static final OSBasedAction restartAction = new RestartAction();
/**
* 把要删除的文件都记录到delete.properties中
*
@ -141,6 +144,20 @@ public class RestartHelper {
restart(ArrayUtils.EMPTY_STRING_ARRAY);
}
public static void restartForUpdate(JFrame frame) {
try {
restartAction.execute(ArrayUtils.EMPTY_STRING_ARRAY);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage());
} finally {
WorkContext.getCurrent().close();
frame.dispose();
System.exit(0);
}
}
/**
* 重启设计器并删除某些特定的文件
*
@ -169,7 +186,7 @@ public class RestartHelper {
restartAction.execute(filesToBeDelete);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}finally {
} finally {
try {
if (null != randomAccessFile) {
randomAccessFile.close();
@ -179,12 +196,5 @@ public class RestartHelper {
}
DesignerContext.getDesignerFrame().exit();
}
}
/**
* 提前初始化重启动作
*/
public static void initRestartAction(){
restartAction = OSSupportCenter.getAction(RestartAction.class);
}
}

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

@ -1,6 +1,7 @@
package com.fr.design.actions.file;
import com.fr.cluster.ClusterBridge;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.config.Configuration;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignerEnvManager;
@ -46,36 +47,10 @@ import com.fr.workspace.WorkContext;
import com.fr.workspace.server.vcs.VcsOperator;
import com.fr.workspace.server.vcs.git.config.GcConfig;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.text.DecimalFormat;
import java.util.Locale;
@ -87,7 +62,7 @@ import static com.fr.design.i18n.Toolkit.i18nText;
/**
* 选项对话框
*
* @author zhou
* @editor zhou
* @since 2012-3-28下午3:39:48
*/
public class PreferencePane extends BasicPane {
@ -159,7 +134,6 @@ public class PreferencePane extends BasicPane {
private IntegerEditor portEditor;
private UICheckBox oracleSpace;
private UISpinner cachingTemplateSpinner;
private UICheckBox openDebugComboBox;
private UICheckBox useOptimizedUPMCheckbox;
private UICheckBox useUniverseDBMCheckbox;
private UICheckBox joinProductImproveCheckBox;
@ -170,12 +144,10 @@ public class PreferencePane extends BasicPane {
private UICheckBox saveCommitCheckBox;
private UICheckBox useIntervalCheckBox;
private IntegerEditor saveIntervalEditor;
private UICheckBox gcEnableCheckBox;
private UIButton gcButton;
private UILabel remindVcsLabel;
private JDialog gcDialog;
private UILabel gcMessage = new UILabel();
private JPanel gcDialogDownPane = new JPanel();
@ -222,12 +194,6 @@ public class PreferencePane extends BasicPane {
oracleSpace = new UICheckBox(i18nText("Fine-Design_Basic_Show_All_Oracle_Tables"));
oraclePane.add(oracleSpace);
JPanel debuggerPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Develop_Tools"));
openDebugComboBox = new UICheckBox(i18nText("Fine-Design_Basic_Open_Debug_Window"));
debuggerPane.add(openDebugComboBox, BorderLayout.CENTER);
advancePane.add(debuggerPane);
JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Update_Plugin_Manager"));
useOptimizedUPMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager"));
upmSelectorPane.add(useOptimizedUPMCheckbox);
@ -242,12 +208,16 @@ public class PreferencePane extends BasicPane {
joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve"));
improvePane.add(joinProductImproveCheckBox);
if (SupportOSImpl.AUTOPUSHUPDATE.support()) {
if(SupportOSImpl.AUTOPUSHUPDATE.support()){
autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update"));
improvePane.add(autoPushUpdateCheckBox);
}
/*
if (DesignerPushUpdateManager.getInstance().isAutoPushUpdateSupported()) {
autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update"));
improvePane.add(autoPushUpdateCheckBox);
}*/
JPanel spaceUpPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
spaceUpPane.add(oraclePane, BorderLayout.NORTH);
spaceUpPane.add(createMemoryPane(), BorderLayout.CENTER);
@ -264,9 +234,7 @@ public class PreferencePane extends BasicPane {
private void createVcsSettingPane(JPanel generalPane) {
JPanel vcsPane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Vcs_Title"));
generalPane.add(vcsPane);
remindVcsLabel = new UILabel(i18nText("Fine-Design_Vcs_Remind"));
remindVcsLabel.setVisible(!VcsHelper.getInstance().needInit());
vcsEnableCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_SaveAuto"));
saveCommitCheckBox = new UICheckBox(i18nText("Fine-Design_Vcs_No_Delete"));
@ -290,7 +258,7 @@ public class PreferencePane extends BasicPane {
@Override
public void stateChanged(ChangeEvent e) {
boolean selected = vcsEnableCheckBox.isSelected();
if (selected) {
if (selected && vcsEnableCheckBox.isEnabled()) {
saveCommitCheckBox.setEnabled(true);
saveIntervalEditor.setEnabled(true);
useIntervalCheckBox.setEnabled(true);
@ -334,14 +302,9 @@ public class PreferencePane extends BasicPane {
gcEnableCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
gcButton.setEnabled(gcEnableCheckBox.isSelected());
gcButton.setEnabled(gcEnableCheckBox.isSelected() && gcEnableCheckBox.isEnabled());
}
});
//集群下禁用
if (ClusterBridge.isClusterMode()) {
gcEnableCheckBox.setEnabled(false);
gcButton.setEnabled(false);
}
return gcControlPane;
}
@ -523,8 +486,23 @@ public class PreferencePane extends BasicPane {
JPanel logLevelPane = FRGUIPaneFactory.createTitledBorderPane("log" + i18nText("Fine-Design_Basic_Level_Setting"));
logPane.add(logLevelPane);
logLevelComboBox = new UIComboBox(LOG);
logLevelComboBox.setEnabled(WorkContext.getCurrent().isLocal());
logLevelPane.add(logLevelComboBox);
logLevelComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Configurations.update(new Worker() {
@Override
public void run() {
Log4jConfig.getInstance().setRootLevel((Level) logLevelComboBox.getSelectedItem());
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{Log4jConfig.class};
}
});
}
});
}
private void createLanPane(JPanel generalPane) {
@ -552,8 +530,8 @@ public class PreferencePane extends BasicPane {
});
UILabel noticeLabel = new UILabel(i18nText("Fine-Design_Basic_Work_After_Restart_Designer"));//sail:提示重启后生效
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double[] columnSize = {p, p, p};
double rowSize[] = {p};
double columnSize[] = {p, p, p};
Component[][] components = {
{languageLabel, languageComboBox, noticeLabel},
};
@ -593,7 +571,7 @@ public class PreferencePane extends BasicPane {
private void createLengthPane(JPanel advancePane) {
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double rowSize[] = {p};
// 长度单位选择
JPanel lengthPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Setting_Ruler_Units"));
@ -615,8 +593,8 @@ public class PreferencePane extends BasicPane {
private void createServerPane(JPanel advancePane) {
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double[] columnSize = {p, p, p};
double rowSize[] = {p};
double columnSize[] = {p, p, p};
JPanel serverPortPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Web_Preview_Port_Setting"));
advancePane.add(serverPortPane);
@ -655,7 +633,7 @@ public class PreferencePane extends BasicPane {
/**
* The method of populate.
*
* @param designerEnvManager 设计器环境管理器
* @param designerEnvManager
*/
public void populate(DesignerEnvManager designerEnvManager) {
if (designerEnvManager == null) {
@ -684,6 +662,11 @@ public class PreferencePane extends BasicPane {
defaultStringToFormulaBox.setSelected(false);
}
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager();
if (FineClusterConfig.getInstance().isCluster()) {
vcsEnableCheckBox.setEnabled(false);
gcEnableCheckBox.setEnabled(false);
}
if (VcsHelper.getInstance().needInit()) {
vcsEnableCheckBox.setSelected(vcsConfigManager.isVcsEnable());
} else {
@ -717,9 +700,8 @@ public class PreferencePane extends BasicPane {
this.pageLengthComboBox.setSelectedIndex(designerEnvManager.getPageLengthUnit());
this.reportLengthComboBox.setSelectedIndex(designerEnvManager.getReportLengthUnit());
this.portEditor.setValue(designerEnvManager.getEmbedServerPort());
this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort()));
openDebugComboBox.setSelected(designerEnvManager.isOpenDebug());
useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM());
useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM());
@ -787,9 +769,7 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setPageLengthUnit((short) pageLengthComboBox.getSelectedIndex());
designerEnvManager.setReportLengthUnit((short) reportLengthComboBox.getSelectedIndex());
designerEnvManager.setJettyServerPort(portEditor.getValue());
designerEnvManager.setOpenDebug(openDebugComboBox.isSelected());
designerEnvManager.setJettyServerPort(portEditor.getValue().intValue());
designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected());
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue());
@ -821,24 +801,17 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50);
}
if (WorkContext.getCurrent().isLocal()) {
Configurations.update(new Worker() {
@Override
public void run() {
Level level = (Level) logLevelComboBox.getSelectedItem();
if (level != null) {
Log4jConfig.getInstance().setRootLevel(level);
}
}
Configurations.update(new Worker() {
@Override
public void run() {
Log4jConfig.getInstance().setRootLevel(((Level) logLevelComboBox.getSelectedItem()));
}
@Override
public Class<? extends Configuration>[] targets() {
@SuppressWarnings("unchecked")
Class<? extends Configuration>[] classes = new Class[]{Log4jConfig.class};
return classes;
}
});
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{Log4jConfig.class};
}
});
Configurations.update(new Worker() {
@Override
@ -910,7 +883,7 @@ public class PreferencePane extends BasicPane {
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
updateGcDialogPanelInfo(i18nText("Fine-Design_Vcs_Reduce_File_Size") + fileSizeConvert(size));
updateGcDialogPanelInfo(size <= 0 ? i18nText("Fine-Design_Vcs_No_Optimizable_File") : i18nText("Fine-Design_Vcs_Reduce_File_Size") + fileSizeConvert(size));
gcDialogDownPane.revalidate();
gcDialogDownPane.repaint();
gcDialogDownPane.add(gcOkButton);
@ -1089,3 +1062,4 @@ public class PreferencePane extends BasicPane {
}
}

3
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -38,6 +38,7 @@ import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import javax.swing.JFrame;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.io.ByteArrayOutputStream;
@ -422,7 +423,7 @@ public abstract class DesignTableDataManager {
final Map<String, Object> parameterMap = new HashMap<>();
if (needInputParams(isMustInputParameters, parameters)) {
final ParameterInputPane pPane = new ParameterInputPane(parameters);
pPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
pPane.showSmallWindow(new JFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
parameterMap.putAll(pPane.update());

4
designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java

@ -438,6 +438,8 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> 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"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Failed"), JOptionPane.ERROR_MESSAGE);
}
}
@ -461,7 +463,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
if (!connect) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
JOptionPane.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.INFORMATION_MESSAGE);
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Failed"), JOptionPane.ERROR_MESSAGE);
failedToFindTable();
return null;
}

3
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -43,7 +43,8 @@ public class JDBCDefPane extends JPanel {
jdbcMap.put(OTHER_DB, new DriverURLName[]{new DriverURLName("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:"),
new DriverURLName("org.hsqldb.jdbcDriver", "jdbc:hsqldb:file:[PATH_TO_DB_FILES]"), new DriverURLName("com.inet.tds.TdsDriver", "jdbc:inetdae7:localhost:1433/"),
new DriverURLName("COM.cloudscape.JDBCDriver", "jdbc:cloudscape:/cloudscape/"),
new DriverURLName("com.internetcds.jdbc.tds.Driver", "jdbc:freetds:sqlserver://localhost/")});
new DriverURLName("com.internetcds.jdbc.tds.Driver", "jdbc:freetds:sqlserver://localhost/"),
new DriverURLName("com.fr.swift.jdbc.Driver", "jdbc:swift:emb://default")});
jdbcMap.put("Inceptor",new DriverURLName[]{new DriverURLName("org.apache.hive.jdbc.HiveDriver","jdbc:inceptor2://localhost:10000/default"),
new DriverURLName("org.apache.hadoop.hive.jdbc.HiveDriver","jdbc:inceptor://localhost:10000/default")});
jdbcMap.put("Oracle", new DriverURLName[]{new DriverURLName("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@localhost:1521:databaseName")});

12
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -27,15 +27,7 @@ import com.fr.function.TIME;
import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
@ -163,7 +155,7 @@ public class PreviewTablePane extends BasicPane {
this.add(new JScrollPane(preveiwTable), BorderLayout.CENTER);
if (this.dialog == null) {
this.dialog = this.showWindow(DesignerContext.getDesignerFrame());
this.dialog = this.showWindow(new JFrame());
}
progressBar = new AutoProgressBar(this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) {
public void doMonitorCanceled() {

2
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java

@ -442,7 +442,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
@Override
public void actionPerformed(ActionEvent e) {
FILEChooserPane fileChooser = FILEChooserPane.getInstance(true, false, new ChooseFileFilter(getFileSuffix()));
if (fileChooser.showOpenDialog(DesignerContext.getDesignerFrame()) == FILEChooserPane.OK_OPTION) {
if (fileChooser.showOpenDialog(FileTableDataPane.this) == FILEChooserPane.OK_OPTION) {
final FILE file = fileChooser.getSelectedFILE();
if (file == null) {// 选择的文件不能是 null
return;

11
designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java

@ -13,6 +13,7 @@ import com.fr.workspace.WorkContext;
import com.fr.workspace.server.authority.AuthorityOperator;
import com.fr.workspace.server.authority.decision.DecisionOperator;
import java.lang.reflect.UndeclaredThrowableException;
import java.util.ArrayList;
public class NodeAuthProcessor {
@ -41,9 +42,15 @@ public class NodeAuthProcessor {
if (!WorkContext.getCurrent().isLocal()) {
try {
String userName = WorkContext.getCurrent().getConnection().getUserName();
String userId = WorkContext.getCurrent().get(DecisionOperator.class).getUserIdByName(userName);
DesignAuthority[] authorities = null;
try {
String userId = WorkContext.getCurrent().get(DecisionOperator.class).getUserIdByName(userName);
authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities(userId);
} catch(UndeclaredThrowableException e) {
// 兼容旧版本的服务器
authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities();
}
// 远程设计获取设计成员的权限列表
DesignAuthority[] authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities(userId);
DesignAuthority authority = null;
if (authorities != null) {

1
designer-base/src/main/java/com/fr/design/fun/ParameterWidgetOptionProvider.java

@ -17,6 +17,7 @@ public interface ParameterWidgetOptionProvider extends Mutable {
/**
* 自定义参数控件的实际类该类需要继承自com.fr.form.ui.Widget
* 如果有控件值属性该类需要实现DataControl接口否则可能有部分功能无法使用比如值编辑器选择控件的时候无法找到插件里的控件
* @return 控件类
*/
Class<? extends Widget> classForWidget();

40
designer-base/src/main/java/com/fr/design/fun/ReportSupportedFileUIProvider.java

@ -0,0 +1,40 @@
package com.fr.design.fun;
import com.fr.design.mainframe.JTemplate;
import com.fr.file.FILEChooserPane;
import com.fr.stable.fun.mark.Mutable;
import javax.swing.Icon;
/**
* Created by kerry on 2019-10-11
*/
public interface ReportSupportedFileUIProvider extends Mutable {
int CURRENT_LEVEL = 1;
String XML_TAG = "ReportSupportedFileUIProvider";
/**
* 向文件选择器中添加指定文件类型过滤器
* @param fileChooser 文件选择器
* @param suffix 文件后缀
*/
void addChooseFileFilter(FILEChooserPane fileChooser, String suffix);
/**
* 获取文件关联的icon
* @param path 文件路径
* @param isShowLock 是否显示被锁住
* @return 对应的图标
*/
Icon getFileIcon(String path,boolean isShowLock);
/**
* 保存为新类型文件
* @param targetPath 目标路径
* @param jTemplate 模板对象
*/
boolean saveToNewFile(String targetPath, JTemplate jTemplate);
}

40
designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportSupportedFileUIProvider.java

@ -0,0 +1,40 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.mainframe.JTemplate;
import com.fr.file.FILEChooserPane;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
import javax.swing.Icon;
/**
* Created by kerry on 2019-10-14
*/
@API(level = ReportSupportedFileUIProvider.CURRENT_LEVEL)
public abstract class AbstractReportSupportedFileUIProvider extends AbstractProvider implements ReportSupportedFileUIProvider {
@Override
public void addChooseFileFilter(FILEChooserPane fileChooser, String suffix) {
}
@Override
public Icon getFileIcon(String path, boolean isShowLock) {
return null;
}
@Override
public boolean saveToNewFile(String targetPath, JTemplate jTemplate) {
return false;
}
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

2
designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java

@ -111,8 +111,8 @@ public class RegPane extends BasicPane {
cardPane.setPreferredSize(new Dimension(0,0 ));
detailedCardLayout.show(cardPane, "Default");
}
fireRegChangeAction();
}
fireRegChangeAction();
}
});
}

8
designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java

@ -35,6 +35,7 @@ public class UINumberField extends UITextField {
private double maxValue = Double.MAX_VALUE;
private boolean isContentChanged = false;
private boolean fillNegativeNumber = true;
public UINumberField() {
this(MAX_INTEGERLENGTH_32, MAX_DECIMALLENGTH);
@ -62,6 +63,10 @@ public class UINumberField extends UITextField {
initListener();
}
public void canFillNegativeNumber(boolean fillNegativeNumber) {
this.fillNegativeNumber = fillNegativeNumber;
}
public int getMaxIntegerLength() {
return maxIntegerLength;
}
@ -185,6 +190,9 @@ public class UINumberField extends UITextField {
// kunsnat: 这种限制输入 有个不好的地方, 比如删除时: 10.1 最大值限定100, 那么就删除中间的小数点之后变为101, 超出了100.
// 但是直接限制不能删除中间类似小数点, 那么也可能遇到: 最小值10 , 从100变化到其中的19, 就很难..
private boolean notChange(String strNew) {
if (!fillNegativeNumber && strNew.contains("-")) {
return true;
}
boolean noChange = false;
boolean isMinus = strNew.startsWith("-");
strNew = strNew.replaceFirst("-", StringUtils.EMPTY); // 控制能输入负数

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

@ -1,14 +1,15 @@
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.base.extension.FileExtension;
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 com.fr.report.ExtraReportClassManager;
import com.fr.report.fun.ReportSupportedFileProvider;
import java.util.ArrayList;
import java.util.Arrays;
@ -44,10 +45,10 @@ public class FileNodeConstants {
});
}
private static void addAppExtensions(String[] extensions) {
private static void addAppExtensions(FileExtension[] extensions) {
for (int i = 0, size = extensions.length; i < size; i++) {
if (!supportFileType.contains(extensions[i])) {
supportFileType.add(extensions[i]);
if (!supportFileType.contains(extensions[i].getExtension())) {
supportFileType.add(extensions[i].getExtension());
}
}
}
@ -55,12 +56,14 @@ public class FileNodeConstants {
private static void initSupportedTypes() {
try {
rwl.writeLock().lock();
supportFileType = new ArrayList<>(Arrays.asList(FRContext.getFileNodes().getSupportedTypes()));
supportFileType = new ArrayList<String>();
//通过插件扩展的
Set<App> apps = ExtraDesignClassManager.getInstance().getArray(App.MARK_STRING);
for (App app : apps) {
addAppExtensions(app.defaultExtensions());
Set<ReportSupportedFileProvider> providers = ExtraReportClassManager.getInstance().getArray(ReportSupportedFileProvider.XML_TAG);
for (ReportSupportedFileProvider provider : providers) {
addAppExtensions(provider.getFileExtensions());
}
supportFileType.addAll(Arrays.asList(FRContext.getFileNodes().getSupportedTypes()));
} finally {
rwl.writeLock().unlock();
}

35
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java

@ -1,7 +1,9 @@
package com.fr.design.gui.itree.filetree;
import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.icon.LockIcon;
import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StableUtils;
@ -11,6 +13,7 @@ import javax.swing.Icon;
import javax.swing.UIManager;
import javax.swing.filechooser.FileSystemView;
import java.io.File;
import java.util.Set;
public class FileTreeIcon {
private FileTreeIcon() {
@ -146,16 +149,42 @@ public class FileTreeIcon {
if (node.isDirectory()) {
return FileTreeIcon.FOLDER_IMAGE_ICON;
}
return FileSystemView.getFileSystemView().getSystemIcon(new File(path));
return getLocalFileIcon(path);
}
}
if (node.isDirectory()) {
return FileTreeIcon.FOLDER_IMAGE_ICON;
} else {
return FileTreeIcon.getIcon(FileTreeIcon.getFileType(node.getName()), isShowLock);
return getRemoteFileIcon(node, isShowLock);
}
}
private static Icon getLocalFileIcon(String path) {
Icon icon = getExtraIcon(path, false);
if (icon != null) {
return icon;
}
return FileSystemView.getFileSystemView().getSystemIcon(new File(path));
}
private static Icon getRemoteFileIcon(FileNode node, boolean isShowLock) {
Icon icon = getExtraIcon(node.getName(), isShowLock);
if (icon != null) {
return icon;
}
return FileTreeIcon.getIcon(FileTreeIcon.getFileType(node.getName()), isShowLock);
}
private static Icon getExtraIcon(String path, boolean isShowLock) {
Set<ReportSupportedFileUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG);
for (ReportSupportedFileUIProvider provider : providers) {
if (provider.getFileIcon(path, isShowLock) != null) {
return provider.getFileIcon(path, isShowLock);
}
}
return null;
}
private static Icon getIcon(int fileType, boolean isLocked) {
if (fileType == JAVA_FILE) {
if (isLocked) {
@ -293,4 +322,4 @@ public class FileTreeIcon {
return TEXT_FILE;
}
}
}
}

2
designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java

@ -368,6 +368,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane<ReportletHyp
sizeJPanel.add(heightLabel);
UINumberField heightTextFiled = new UINumberField();
heightTextFiled.setMinValue(0);
heightTextFiled.canFillNegativeNumber(false);
heightTextFiled.setText(String.valueOf(DEFAULT_H_VALUE));
heightTextFiled.setPreferredSize(new Dimension(40, 20));
sizeJPanel.add(heightTextFiled);
@ -377,6 +378,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane<ReportletHyp
sizeJPanel.add(widthLabel);
UINumberField widthTextFiled = new UINumberField();
widthTextFiled.setMinValue(0);
widthTextFiled.canFillNegativeNumber(false);
widthTextFiled.setText(String.valueOf(DEFAULT_V_VALUE));
widthTextFiled.setPreferredSize(new Dimension(40, 20));
sizeJPanel.add(widthTextFiled);

4
designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java

@ -8,6 +8,7 @@ import com.fr.design.fun.JavaScriptActionProvider;
import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.form.ui.WebContentUtils;
import com.fr.js.JavaScript;
@ -149,7 +150,8 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
@Override
public DBManipulationPane createDBManipulationPane() {
return new DBManipulationPane();
JTemplate jTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate();
return jTemplate == null ? new DBManipulationPane() : jTemplate.createDBManipulationPane();
}
@Override

64
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -4,7 +4,6 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager;
@ -113,9 +112,9 @@ import java.util.Set;
public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener {
public static final String DESIGNER_FRAME_NAME = "designer_frame";
private static final String DESIGNER_FRAME_NAME = "designer_frame";
public static final Dimension MIN_SIZE = new Dimension(100, 100);
private static final Dimension MIN_SIZE = new Dimension(100, 100);
private static final long serialVersionUID = -8732559571067484460L;
@ -145,9 +144,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private UIToolbar combineUp;
private NewTemplatePane newWorkBookPane = null;
private NewTemplatePane newWorkBookPane;
private Icon closeMode = UIConstants.CLOSE_OF_AUTHORITY;
private Icon closeMode;
private JLayeredPane layeredPane = this.getLayeredPane();
@ -184,7 +183,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true);
// 只有一个文件未保存时
if (HistoryTemplateListPane.getInstance().getHistoryCount() == 1) {
if (HistoryTemplateListCache.getInstance().getHistoryCount() == 1) {
int choose = saveSomeTempaltePane.saveLastOneTemplate();
if (choose != JOptionPane.CANCEL_OPTION) {
DesignerFrame.this.exit();
@ -318,7 +317,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
public void componentResized(ComponentEvent e) {
reCalculateFrameSize();
if (DesignerMode.isAuthorityEditing()) {
if (DesignModeContext.isAuthorityEditing()) {
doResize();
}
}
@ -334,9 +333,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
public void resizeFrame() {
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite();
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().setComposite();
reCalculateFrameSize();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize();
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().doResize();
}
public void closeAuthorityEditing() {
@ -416,8 +415,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
/**
* @param ad
* @return
* @param ad 菜单栏
* @return panel
*/
protected JPanel initNorthEastPane(final ToolBarMenuDock ad) {
//hugh: private修改为protected方便oem的时候修改右上的组件构成
@ -515,7 +514,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
protected ArrayList<WindowListener> getFrameListeners() {
ArrayList<WindowListener> arrayList = new ArrayList<WindowListener>();
ArrayList<WindowListener> arrayList = new ArrayList<>();
arrayList.add(windowAdapter);
return arrayList;
}
@ -593,7 +592,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*/
public void refreshDottedLine() {
if (DesignerMode.isAuthorityEditing()) {
if (DesignModeContext.isAuthorityEditing()) {
populateAuthorityArea();
populateCloseButton();
addDottedLine();
@ -633,7 +632,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*/
private void fireAuthorityStateToNormal() {
java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList();
List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListCache.getInstance().getHistoryList();
for (JTemplate<?, ?> jTemplate : opendedTemplate) {
// 如果在权限编辑时做过操作,则将做过的操作作为一个整体状态赋给正在报表
if (jTemplate.isDoSomethingInAuthority()) {
@ -676,7 +675,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
for (UIButton fixButton : fixButtons) {
combineUp.add(fixButton);
}
if (!DesignerMode.isAuthorityEditing()) {
if (!DesignModeContext.isAuthorityEditing()) {
combineUp.addSeparator(new Dimension(2, 16));
if (toolbar4Form != null) {
for (JComponent jComponent : toolbar4Form) {
@ -692,7 +691,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private void addExtraButtons() {
JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt == null) {
return;
}
@ -709,7 +708,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
private void addShareButton() {
JTemplate<?, ?> jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt == null) {
return;
}
@ -784,13 +783,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*/
public void needToAddAuhtorityPaint() {
newWorkBookPane.setButtonGray(DesignerMode.isAuthorityEditing());
newWorkBookPane.setButtonGray(DesignModeContext.isAuthorityEditing());
// 进入或退出权限编辑模式,通知插件
Set<ShortCut> extraShortCuts = ExtraDesignClassManager.getInstance().getExtraShortCuts();
for (ShortCut shortCut : extraShortCuts) {
if (shortCut instanceof AbstractTemplateTreeShortCutProvider) {
shortCut.notifyFromAuhtorityChange(DesignerMode.isAuthorityEditing());
shortCut.notifyFromAuhtorityChange(DesignModeContext.isAuthorityEditing());
}
}
}
@ -811,7 +810,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*/
public void setTitle() {
JTemplate<?, ?> editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
JTemplate<?, ?> editingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
StringBuilder defaultTitleSB = new StringBuilder();
defaultTitleSB.append(ProductConstants.PRODUCT_NAME);
defaultTitleSB.append(" ");
@ -909,7 +908,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
public void saveCurrentEditingTemplate() {
JTemplate<?, ?> editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
JTemplate<?, ?> editingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (editingTemplate == null) {
return;
}
@ -1092,7 +1091,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
if (inValidDesigner(jt)) {
this.addAndActivateJTemplate();
MutilTempalteTabPane.getInstance().setTemTemplate(
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate());
} else {
activeTemplate(jt);
}
@ -1106,8 +1105,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*/
private void activeTemplate(JTemplate jt) {
// 如果该模板已经打开,则进行激活就可以了
int index = HistoryTemplateListPane.getInstance().contains(jt);
List<JTemplate<?, ?>> historyList = HistoryTemplateListPane.getInstance().getHistoryList();
int index = HistoryTemplateListCache.getInstance().contains(jt);
List<JTemplate<?, ?>> historyList = HistoryTemplateListCache.getInstance().getHistoryList();
if (index != -1) {
historyList.get(index).activeJTemplate(index, jt);
} else {
@ -1115,11 +1114,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
}
/**
* Exit退出
*/
public void exit() {
public void prepareForExit() {
Thread thread = new Thread() {
@Override
@ -1138,7 +1133,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
DesignerEnvManager.getEnvManager().setLastOpenFile(
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath());
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath());
DesignerEnvManager.getEnvManager().setLastWestRegionToolPaneY(
WestRegionContainerPane.getInstance().getToolPaneY());
@ -1150,6 +1145,13 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
EastRegionContainerPane.getInstance().getContainerWidth());
DesignerEnvManager.getEnvManager().saveXMLFile();
}
/**
* Exit退出
*/
public void exit() {
prepareForExit();
//关闭当前环境
WorkContext.getCurrent().close();
@ -1251,7 +1253,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/**
* 更新进度框进度
*
* @param progress
* @param progress 进度值
*/
public void updateProgress(int progress) {

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

@ -1,8 +1,10 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.extension.FileExtension;
import com.fr.base.vcs.DesignerMode;
import com.fr.cluster.ClusterBridge;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
@ -367,17 +369,18 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private void fireVcsActionChange() {
if (!DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable()
|| VcsHelper.getInstance().isUnSelectedTemplate()
|| ClusterBridge.isClusterMode()) {
|| FineClusterConfig.getInstance().isCluster()) {
setEnabled(false);
return;
}
if (WorkContext.getCurrent() != null) {
boolean pathSupportVcsAction = selectedOperation.getFilePath() != null && pathSupportVcsAction(selectedOperation.getFilePath());
if (!WorkContext.getCurrent().isLocal()) {
//当前环境为远程环境时
FileNode node = TemplateTreePane.getInstance().getTemplateFileTree().getSelectedFileNode();
if (selectedOperation.getFilePath() != null) {
if (pathSupportVcsAction) {
if (node.getLock() != null && !ComparatorUtils.equals(node.getUserID(), node.getLock())) {
setEnabled(false);
} else {
@ -388,11 +391,18 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
}
} else {
//当前环境为本地环境时
setEnabled(selectedOperation.getFilePath() != null);
setEnabled(pathSupportVcsAction);
}
}
}
private boolean pathSupportVcsAction(String path) {
if (FileExtension.CPT.matchExtension(path) || FileExtension.FRM.matchExtension(path)) {
return true;
}
return false;
}
private void closeOpenedTemplate(String path, boolean isCurrentEditing) {
for (JTemplate jTemplate : HistoryTemplateListCache.getInstance().getHistoryList()) {
if (ComparatorUtils.equals(jTemplate.getEditingFILE().getPath(), path)) {

29
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.Parameter;
import com.fr.base.ScreenResolution;
import com.fr.base.extension.FileExtension;
import com.fr.base.io.BaseBook;
import com.fr.base.iofile.attr.DesignBanCopyAttrMark;
import com.fr.base.iofile.attr.TemplateIdAttrMark;
@ -12,7 +13,6 @@ import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.AllowAuthorityEditAction;
import com.fr.design.actions.TableDataSourceAction;
import com.fr.design.actions.edit.RedoAction;
import com.fr.design.actions.edit.UndoAction;
@ -27,6 +27,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerFrameUpButtonProvider;
import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.fun.PreviewProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
@ -49,6 +50,7 @@ import com.fr.design.write.submit.DBManipulationPane;
import com.fr.file.FILE;
import com.fr.file.FILEChooserPane;
import com.fr.file.MemFILE;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils;
@ -575,6 +577,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
String oldName = this.getPath();
// alex:如果是SaveAs的话需要让用户来选择路径了
FILEChooserPane fileChooser = getFILEChooserPane(isShowLoc);
addChooseFILEFilter(fileChooser);
fileChooser.setFileNameTextField(fileName, this.suffix());
int chooseResult = fileChooser.showSaveDialog(DesignerContext.getDesignerFrame(), this.suffix());
@ -625,6 +628,11 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
}
}
protected void addChooseFILEFilter(FILEChooserPane fileChooser){
}
// 保存新模板时会进入此方法(新建模板直接保存,或者另存为)
protected boolean saveNewFile(FILE editingFILE, String oldName) {
String originID = StringUtils.EMPTY;
@ -635,13 +643,26 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
initForCollect();
this.editingFILE = editingFILE;
boolean result = this.saveFile();
boolean result = this.saveToNewFile(oldName);
if (result) {
DesignerFrameFileDealerPane.getInstance().refresh();
collectInfo(originID);
}
//更换最近打开
DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(oldName, this.getPath());
return result;
}
protected boolean saveToNewFile(String oldName){
boolean result = false;
Set<ReportSupportedFileUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG);
for (ReportSupportedFileUIProvider provider : providers) {
result = result || provider.saveToNewFile(this.editingFILE.getPath(), this);
}
if(!result){
result = result || this.saveFile();
//更换最近打开
DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(oldName, this.getPath());
this.refreshToolArea();
}
return result;
}

6
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java

@ -5,7 +5,7 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.Widget;
import com.fr.form.ui.mobile.MobileStyle;
@ -23,7 +23,7 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
private Widget widget;
private MobileStyleCustomDefinePane customBeanPane;
private Class<? extends MobileStyle> mobileStyleClazz;
private NewColorSelectBox colorSelectBox;
private ColorSelectBox colorSelectBox;
private Color titleColor = new Color(47, 142, 241);
MobileStyleDefinePane(Widget widget, Class<? extends MobileStyleCustomDefinePane> customBeanPaneClass,
@ -91,7 +91,7 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
UILabel colorSelectLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Widget_Background"), UILabel.RIGHT);
colorSelectLabel.setPreferredSize(new Dimension(65, 20));
colorSelectBox = new NewColorSelectBox(152);
colorSelectBox = new ColorSelectBox(152);
colorSelectBox.addSelectChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {

3
designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.vcs.common;
import com.fr.cluster.ClusterBridge;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.design.file.HistoryTemplateListCache;
@ -173,7 +174,7 @@ public class VcsHelper implements JTemplateActionListener {
public void templateSaved(JTemplate<?, ?> jt) {
if (needInit()
&& DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable()
&& !ClusterBridge.isClusterMode()) {
&& !FineClusterConfig.getInstance().isCluster()) {
fireVcs(jt);
}
}

2
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java

@ -66,7 +66,7 @@ public class MobileTemplateStylePane extends AbstractTemplateStylePane<MobileTem
attrConfPane.add(right, BorderLayout.CENTER);
centerPane.add(attrConfPane, BorderLayout.CENTER);
styleList.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
public void mouseReleased(MouseEvent e) {
String selectedValue = (String)styleList.getSelectedValue();
card.show(right, selectedValue);
}

3
designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java

@ -1,6 +1,5 @@
package com.fr.design.mainframe.widget.accessibles;
import com.fr.design.dialog.BasicPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
@ -58,7 +57,7 @@ public class TemplateStylePane extends AbstractTemplateStylePane<TemplateStyle>
centerPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"), null));
centerPane.add(previewPane);
styleList.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
public void mouseReleased(MouseEvent e) {
previewPane.repaint((TemplateStyle) styleList.getSelectedValue());
}
});

5
designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java

@ -15,6 +15,7 @@ import com.fr.design.parameter.ParameterDesignerProvider;
import com.fr.design.parameter.ParameterReader;
import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.solution.sandbox.collection.PluginSandboxCollections;
import com.fr.stable.StableUtils;
import org.jetbrains.annotations.NotNull;
@ -235,7 +236,7 @@ public class DesignModuleFactory {
public static void registerParameterReader(ParameterReader reader) {
if (instance.parameterReaderList == null) {
instance.parameterReaderList = new ArrayList<ParameterReader>();
instance.parameterReaderList = PluginSandboxCollections.newSandboxList();
}
instance.parameterReaderList.add(reader);
}
@ -246,4 +247,4 @@ public class DesignModuleFactory {
}
return instance.parameterReaderList.toArray(new ParameterReader[instance.parameterReaderList.size()]);
}
}
}

3
designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java

@ -21,13 +21,12 @@ public class DemoAction implements OSBasedAction {
}
String executorPath;
if (OperatingSystem.isMacos()) {
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.app");
} else if(OperatingSystem.isWindows()){
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.exe demo");
}else{
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.sh demo");
executorPath = StableUtils.pathJoin(installHome, "bin", "designer demo");
}
if (OperatingSystem.isMacos()) {

14
designer-base/src/main/java/com/fr/design/os/impl/RestartAction.java

@ -10,10 +10,19 @@ import java.util.ArrayList;
import java.util.List;
public class RestartAction implements OSBasedAction {
private static String installHome;
public RestartAction() {
installHome = StableUtils.getInstallHome();
}
@Override
public void execute(Object... objects) {
String[] filesToBeDelete = (String[])objects;
String installHome = StableUtils.getInstallHome();
if (installHome == null) {
installHome = StableUtils.getInstallHome();
}
try{
if (OperatingSystem.isMacos()) {
restartInMacOS(installHome, filesToBeDelete);
@ -56,8 +65,7 @@ public class RestartAction implements OSBasedAction {
private static void restartInLinux(String installHome, String[] filesToBeDelete) throws Exception {
ProcessBuilder builder = new ProcessBuilder();
List<String> commands = new ArrayList<String>();
//现在先写的是restart.sh
commands.add(installHome + File.separator + "bin" + File.separator + "restart.sh");
commands.add(installHome + File.separator + "bin" + File.separator + "restart");
if (ArrayUtils.isNotEmpty(filesToBeDelete)) {
commands.add(StableUtils.join(filesToBeDelete, "+"));
}

28
designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java

@ -9,11 +9,14 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.remote.ui.AuthorityManagerPane;
import com.fr.log.FineLoggerFactory;
import com.fr.report.DesignAuthority;
import com.fr.report.constant.RoleType;
import com.fr.stable.ArrayUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.authority.AuthorityOperator;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.List;
/**
* @author yaohwu
@ -38,13 +41,24 @@ public class RemoteDesignAuthManagerAction extends UpdateAction {
if (!WorkContext.getCurrent().isLocal()) {
try {
// 远程设计获取全部设计成员的权限列表
DesignAuthority[] userAuthorities = WorkContext.getCurrent().get(AuthorityOperator.class).getUserAuthorities();
DesignAuthority[] customAuthorities = WorkContext.getCurrent().get(AuthorityOperator.class).getCustomRoleAuthorities();
if (userAuthorities != null && userAuthorities.length != 0) {
managerPane.populateByUser(userAuthorities);
}
if (customAuthorities != null && customAuthorities.length != 0) {
managerPane.populateByCustom(customAuthorities);
DesignAuthority[] authorities = WorkContext.getCurrent().get(AuthorityOperator.class).getAuthorities();
List<DesignAuthority> userAuthorities = new ArrayList<DesignAuthority>();
List<DesignAuthority> customAuthorities = new ArrayList<DesignAuthority>();
if (authorities != null) {
for (DesignAuthority authority : authorities) {
if (authority.getRoleType() == RoleType.CUSTOM) {
customAuthorities.add(authority);
}
else {
userAuthorities.add(authority);
}
}
if (userAuthorities.size() != 0) {
managerPane.populateByUser(userAuthorities.toArray(new DesignAuthority[userAuthorities.size()]));
}
if (customAuthorities.size() != 0) {
managerPane.populateByCustom(customAuthorities.toArray(new DesignAuthority[customAuthorities.size()]));
}
}
} catch (Exception exception) {
FineLoggerFactory.getLogger().error(exception.getMessage(), exception);

38
designer-base/src/main/java/com/fr/design/remote/ui/AbstractManagerPane.java

@ -67,6 +67,12 @@ public abstract class AbstractManagerPane extends BasicPane {
*/
private List<RemoteDesignMember> addedMembers = new ArrayList<>();
/**
* 具有设计权限的角色/用户
*/
private List<RemoteDesignMember> authorityMembers = new ArrayList<>();
/**
* 决策平台用户列表model
*/
@ -211,6 +217,9 @@ public abstract class AbstractManagerPane extends BasicPane {
resetAddedMembers();
this.addedMembers.addAll(addedMembers);
resetAuthorityMembers();
this.authorityMembers.addAll(addedMembers);
// 刷新右侧面板
addToAddedMemberList();
@ -314,15 +323,15 @@ public abstract class AbstractManagerPane extends BasicPane {
private void addToMemberList() {
addingListModel.clear();
for (RemoteDesignMember addingMember : addingMembers) {
for (RemoteDesignMember member : addingMembers) {
// 如果包含在右侧列表中,那么左侧列表默认选中
for (RemoteDesignMember addedMember : addedMembers){
if (addingMember.equals(addedMember)){
addingMember.setAuthority(addedMember.hasAuthority());
addingMember.setSelected(true);
}
if (addedMembers.contains(member)) {
member.setSelected(true);
}
else {
member.setSelected(false);
}
addingListModel.addElement(addingMember);
addingListModel.addElement(member);
}
addingList.revalidate();
addingList.repaint();
@ -350,6 +359,10 @@ public abstract class AbstractManagerPane extends BasicPane {
addedMembers.clear();
}
private void resetAuthorityMembers() {
authorityMembers.clear();
}
protected abstract Collection<RemoteDesignMember> getMembers(String userName, String keyWord);
protected abstract Collection<RemoteDesignMember> getMembers(String userName, String keyWord, int pageNum, int count);
@ -376,6 +389,7 @@ public abstract class AbstractManagerPane extends BasicPane {
@Override
protected void done() {
referAddingMemberList();
addToMemberList();
}
};
@ -403,12 +417,22 @@ public abstract class AbstractManagerPane extends BasicPane {
@Override
protected void done() {
referAddingMemberList();
addToMemberList();
}
};
loadMoreWorker.execute();
}
// 检查左侧列表角色/用户是否有权限
private void referAddingMemberList() {
for (RemoteDesignMember member : addingMembers) {
if (authorityMembers.contains(member)){
member.setAuthority(true);
}
}
}
private void sync2AddedMembersFromAdding() {
RemoteDesignMember[] members = new RemoteDesignMember[addingListModel.getSize()];

4
designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrPane.java

@ -50,7 +50,7 @@ public class ReportFitAttrPane extends BasicBeanPane<ReportFitAttr> {
* @return 标题
*/
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Attr");
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr");
}
}
}

2
designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateFitAttrPane.java

@ -50,6 +50,6 @@ public class TemplateFitAttrPane extends BasicBeanPane<ReportFitAttr> {
* @return 标题
*/
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Attr");
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Fit_Attr");
}
}

99
designer-base/src/main/java/com/fr/design/style/color/ColorPicker.java

@ -4,7 +4,8 @@ package com.fr.design.style.color;
* Created by plough on 2016/12/22.
*/
import com.fr.base.BaseUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.*;
@ -19,8 +20,7 @@ import java.awt.image.BufferedImage;
/**
* 取色框
*/
public class ColorPicker extends JDialog implements ActionListener
{
public class ColorPicker extends JDialog implements ActionListener {
private Container container = getContentPane(); // 主容器
private int setCoordinateX; // 取色框x坐标
private int setCoordinateY; // 取色框y坐标
@ -42,8 +42,7 @@ public class ColorPicker extends JDialog implements ActionListener
/**
* 构造函数创建一个取色框窗体
*/
public ColorPicker(ColorSelectable colorSelectable, Boolean setColorRealTime)
{
public ColorPicker(ColorSelectable colorSelectable, Boolean setColorRealTime) {
setUndecorated(true); // 去掉窗体边缘
setResizable(false);
Shape shape = new Ellipse2D.Double(0, 0, colorPickerSize, colorPickerSize);
@ -78,7 +77,6 @@ public class ColorPicker extends JDialog implements ActionListener
}
colorPickerPanel.captureScreen();
}
// System.out.println(KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow());
}
/**
@ -95,11 +93,33 @@ public class ColorPicker extends JDialog implements ActionListener
public void updateLocation() {
mousePos = MouseInfo.getPointerInfo().getLocation();
setCoordinateX = mousePos.x - getSize().width/2;
setCoordinateY = mousePos.y- getSize().height/2;
updateCoordinate();
setLocation(setCoordinateX, setCoordinateY);
updateMousePos();
updateCoordinate();
colorPickerPanel.setMagnifierLocation(setCoordinateX,
setCoordinateY);
setLocation(setCoordinateX, setCoordinateY);
}
private void updateCoordinate() {
setCoordinateX = mousePos.x - getSize().width / 2;
setCoordinateY = mousePos.y - getSize().height / 2;
}
/**
* 兼容多屏下鼠标位置的计算
*/
private void updateMousePos() {
Rectangle bounds = GUICoreUtils.getRectScreen();
mousePos.x -= bounds.x;
mousePos.y -= bounds.y;
if (mousePos.x < 0) {
mousePos.x *= -1;
}
if (mousePos.y < 0) {
mousePos.y *= -1;
}
}
/**
@ -107,8 +127,7 @@ public class ColorPicker extends JDialog implements ActionListener
*
* @param colorPickerSize 取色框尺寸
*/
public void updateSize(int colorPickerSize)
{
public void updateSize(int colorPickerSize) {
colorPickerPanel.setColorPickerSize(colorPickerSize);
setSize(colorPickerSize, colorPickerSize);
validate(); // 更新所有子控件
@ -125,20 +144,19 @@ public class ColorPicker extends JDialog implements ActionListener
// 隐藏鼠标光标
public void hideCursor() {
Image imageCursor = Toolkit.getDefaultToolkit().getImage("");
Cursor cu = Toolkit.getDefaultToolkit().createCustomCursor(imageCursor, new Point(0,0), "cursor");
Cursor cu = Toolkit.getDefaultToolkit().createCustomCursor(imageCursor, new Point(0, 0), "cursor");
setCursor(cu);
}
private class MouseFunctions extends MouseAdapter
{
private class MouseFunctions extends MouseAdapter {
@Override
public void mousePressed(MouseEvent e) {
pickComplete(e.getButton() == e.BUTTON1); // 左键确定
pickComplete(e.getButton() == MouseEvent.BUTTON1); // 左键确定
}
}
}
class ColorPickerPanel extends JPanel
{
class ColorPickerPanel extends JPanel {
private BufferedImage screenImage;
private Image colorPickerFrame; // 取色框的边框图案
private int colorPickerSize; // 取色框尺寸
@ -155,11 +173,11 @@ class ColorPickerPanel extends JPanel
/**
* 带参数的构造函数
* @param scaleFactor 放大倍数
*
* @param scaleFactor 放大倍数
*/
public ColorPickerPanel(int scaleFactor)
{
colorPickerFrame = BaseUtils.readImage("/com/fr/design/images/gui/colorPicker/colorPickerFrame.png");
public ColorPickerPanel(int scaleFactor) {
colorPickerFrame = IOUtils.readImage("/com/fr/design/images/gui/colorPicker/colorPickerFrame.png");
this.scaleFactor = scaleFactor;
captureScreen();
}
@ -168,26 +186,22 @@ class ColorPickerPanel extends JPanel
* 截屏
*/
public void captureScreen() {
try
{
try {
robot = new Robot();
}
catch (AWTException e)
{
} catch (AWTException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
// 截屏幕
screenImage = robot.createScreenCapture(new Rectangle(0, 0, Toolkit
.getDefaultToolkit().getScreenSize().width, Toolkit
.getDefaultToolkit().getScreenSize().height));
screenImage = robot.createScreenCapture(GUICoreUtils.getRectScreen());
}
/**
* 设置取色框的位置
* @param locationX x坐标
* @param locationY y坐标
*
* @param locationX x坐标
* @param locationY y坐标
*/
public void setMagnifierLocation(int locationX, int locationY)
{
public void setMagnifierLocation(int locationX, int locationY) {
this.locationX = locationX;
this.locationY = locationY;
repaint(); // 注意重画控件
@ -201,17 +215,16 @@ class ColorPickerPanel extends JPanel
return new Color(R, G, B);
}
public void setColorPickerSize(int colorPickerSize)
{
public void setColorPickerSize(int colorPickerSize) {
this.colorPickerSize = colorPickerSize;
}
public void paintComponent(Graphics g)
{
@Override
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
double pixelCount = (double)colorPickerSize / scaleFactor; // 取色器一条边上的放大后的像素点个数(可以是小数)
double pixelCount = (double) colorPickerSize / scaleFactor; // 取色器一条边上的放大后的像素点个数(可以是小数)
// 关键处理代码
g2d.drawImage(
screenImage, // 要画的图片
@ -219,10 +232,10 @@ class ColorPickerPanel extends JPanel
0, // 目标矩形的第一个角的y坐标
colorPickerSize, // 目标矩形的第二个角的x坐标
colorPickerSize, // 目标矩形的第二个角的y坐标
locationX + (int)((colorPickerSize - pixelCount) * 0.5) + 1, // 源矩形的第一个角的x坐标
locationY + (int)((colorPickerSize - pixelCount) * 0.5) + 1, // 源矩形的第一个角的y坐标
locationX + (int)((colorPickerSize + pixelCount) * 0.5) + 1, // 源矩形的第二个角的x坐标
locationY + (int)((colorPickerSize + pixelCount) * 0.5) + 1, // 源矩形的第二个角的y坐标
locationX + (int) ((colorPickerSize - pixelCount) * 0.5) + 1, // 源矩形的第一个角的x坐标
locationY + (int) ((colorPickerSize - pixelCount) * 0.5) + 1, // 源矩形的第一个角的y坐标
locationX + (int) ((colorPickerSize + pixelCount) * 0.5) + 1, // 源矩形的第二个角的x坐标
locationY + (int) ((colorPickerSize + pixelCount) * 0.5) + 1, // 源矩形的第二个角的y坐标
this
);
g2d.drawImage(colorPickerFrame, 0, 0, this);

65
designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java

@ -3,14 +3,14 @@ package com.fr.design.update.actions;
import com.fr.decision.update.backup.Recover;
import com.fr.decision.update.data.UpdateConstants;
import com.fr.decision.update.exception.UpdateException;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.CommonIOUtils;
import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.CommonUtils;
import com.fr.stable.ProjectLibrary;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import java.io.File;
import java.io.IOException;
@ -22,59 +22,82 @@ import java.io.IOException;
*/
public class RecoverForDesigner implements Recover {
private final String installHome = StableUtils.getInstallHome();
@Override
public boolean recover() {
try{
CommonIOUtils.copyFilesInDirByPath(StableUtils.pathJoin(StableUtils.getInstallHome(), UpdateConstants.DESIGNERBACKUPPATH),
CommonIOUtils.copyFilesInDirByPath(StableUtils.pathJoin(installHome, ProjectConstants.LOGS_NAME,
UpdateConstants.INSTALL_LIB, UpdateConstants.DESIGNERBACKUPPATH),
StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LIB_NAME));
return true;
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage() + "Recover error for designer");
FineLoggerFactory.getLogger().error("Recover error for designer", e);
return false;
}
}
@Override
public boolean backup() {
String installHome = StableUtils.getInstallHome();
//jar包备份文件的目录为"backup/"+jar包当前版本号
String todayBackupDir = StableUtils.pathJoin(installHome, UpdateConstants.DESIGNER_BACKUP_DIR, (GeneralUtils.readBuildNO()));
backupFilesFromInstallEnv(todayBackupDir);
String envHome = ProjectLibrary.getInstance().getLibHome();
backupFilesFromInstallEnv(envHome, todayBackupDir);
backupFilesFromInstallLib(installHome, todayBackupDir);
try {
File file = new File(StableUtils.pathJoin(installHome, UpdateConstants.DOWNLOADPATH));
CommonUtils.mkdirs(file);
IOUtils.copyFilesInDirByPath(StableUtils.pathJoin(installHome,ProjectConstants.LIB_NAME),
StableUtils.pathJoin(installHome, UpdateConstants.DESIGNERBACKUPPATH));
String installBackup = StableUtils.pathJoin(installHome, ProjectConstants.LOGS_NAME,
UpdateConstants.INSTALL_LIB);
File installLib = new File(installBackup);
CommonUtils.mkdirs(installLib);
File download = new File(StableUtils.pathJoin(installBackup,UpdateConstants.DOWNLOADPATH));
CommonUtils.mkdirs(download);
CommonIOUtils.copyFilesInDirByPath(StableUtils.pathJoin(installHome,ProjectConstants.LIB_NAME),
StableUtils.pathJoin(installBackup,UpdateConstants.DESIGNERBACKUPPATH));
DesignerContext.getDesignerFrame().prepareForExit();
return true;
}catch (IOException e) {
} catch (IOException e) {
UpdateException exception = new UpdateException("Backup Exception for designer" + e.getMessage());
FineLoggerFactory.getLogger().error(exception.getMessage(),exception);
return false;
}
}
private void backupFilesFromInstallEnv(String todayBackupDir) {
private void backupFilesFromInstallEnv(String envHome, String todayBackupDir) {
try {
CommonUtils.mkdirs(new File(StableUtils.pathJoin(todayBackupDir,UpdateConstants.BACKUPPATH)));
IOUtils.copyFilesInDirByPath(
StableUtils.pathJoin(WorkContext.getCurrent().getPath(),ProjectConstants.LIB_NAME),
StableUtils.pathJoin(todayBackupDir,UpdateConstants.BACKUPPATH));
File file = new File(StableUtils.pathJoin(todayBackupDir,UpdateConstants.BACKUPPATH));
CommonUtils.mkdirs(file);
file = new File(StableUtils.pathJoin(envHome,ProjectConstants.LIB_NAME));
File[] files = file.listFiles();
File dir = new File(StableUtils.pathJoin(todayBackupDir,UpdateConstants.BACKUPPATH));
if (files != null) {
for (File file1 : files) {
if (file1.getName().startsWith(UpdateConstants.FINE) && file1.getName().endsWith(UpdateConstants.JAR_FILE_SUFFIX)) {
CommonIOUtils.copy(file1, dir);
}
}
}
} catch (IOException e) {
UpdateException exception = new UpdateException(e.getMessage());
FineLoggerFactory.getLogger().error(exception.getMessage() + "backup for Designer recover in env failed");
FineLoggerFactory.getLogger().error(exception.getMessage() , "backup for Designer recover in env failed");
}
}
private void backupFilesFromInstallLib(String installHome, String todayBackupDir) {
try {
CommonUtils.mkdirs(new File(StableUtils.pathJoin(todayBackupDir,UpdateConstants.DESIGNERBACKUPPATH)));
IOUtils.copyFilesInDirByPath(
StableUtils.pathJoin(installHome,ProjectConstants.LIB_NAME),
StableUtils.pathJoin(todayBackupDir,UpdateConstants.DESIGNERBACKUPPATH));
File lib = new File(StableUtils.pathJoin(installHome,ProjectConstants.LIB_NAME));
File[] files = lib.listFiles();
File dir = new File(StableUtils.pathJoin(todayBackupDir,UpdateConstants.DESIGNERBACKUPPATH));
if (files != null) {
for (File file : files) {
if (file.getName().startsWith(UpdateConstants.FINE) || file.getName().contains(UpdateConstants.ASPECTJRT)) {
CommonIOUtils.copy(file, dir);
}
}
}
} catch (IOException e) {
UpdateException exception = new UpdateException(e.getMessage());
FineLoggerFactory.getLogger().error(exception.getMessage() + "backup for Designer recover in install failed");
FineLoggerFactory.getLogger().error(exception.getMessage() , "backup for Designer recover in install failed");
}
}
}

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

@ -10,7 +10,6 @@ import com.fr.general.ComparatorUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.WorkContext;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
@ -143,7 +142,6 @@ public class RestoreResultDialog extends JDialog {
jTextArea.setFont(new Font("Default", Font.PLAIN, 12));
infoPane.add(jTextArea);
pane.add(infoPane, BorderLayout.CENTER);
this.setSize(RESTORE_OLD_VERSION);
this.setTitle(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Updater_Restore_to_V8"));
}
@ -162,34 +160,68 @@ public class RestoreResultDialog extends JDialog {
List<String> list = new ArrayList<>();
String installHome = StableUtils.getInstallHome();
putJarBackupFilesToInstallLib(installHome, map, list);
putJarBackupFilesToInstallEnv(installHome, map, list);
filesToMove(installHome, map);
filesToDelete(installHome, list);
RestartHelper.saveFilesWhichToMove(map);
RestartHelper.saveFilesWhichToDelete(list.toArray(new String[list.size()]));
}
private void putJarBackupFilesToInstallLib(String installHome, Map<String, String> map, List<String> list) {
private void filesToMove(String installHome, Map<String, String> map) {
String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR;
String envHome = StableUtils.pathJoin(installHome, UpdateConstants.WEBAPPS, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME);
File installLib = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, UpdateConstants.DESIGNERBACKUPPATH));
File[] files = installLib.listFiles();
if (files != null) {
for (File file : files) {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName()));
list.add(StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName()));
File envLib = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, UpdateConstants.BACKUPPATH));
File[] files;
if (installLib.exists() && envLib.exists()) {
files = installLib.listFiles();
if (files != null) {
for (File file : files) {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName()));
}
}
files = envLib.listFiles();
if (files != null) {
for (File file : files) {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(envHome, ProjectConstants.LIB_NAME, file.getName()));
}
}
} else {
installLib = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir));
files = installLib.listFiles();
if (files != null) {
for (File file : files) {
if (file.getName().contains(UpdateConstants.DESIGNER) || file.getName().equals(UpdateConstants.ASPECTJRT)) {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName()));
} else {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(envHome, ProjectConstants.LIB_NAME, file.getName()));
}
}
}
}
}
private void putJarBackupFilesToInstallEnv(String installHome, Map<String, String> map, List<String> list) {
String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR;
File installEnv = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, UpdateConstants.BACKUPPATH));
private void filesToDelete(String installHome, List<String> list) {
String envHome = StableUtils.pathJoin(installHome, UpdateConstants.WEBAPPS, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME);
File installEnv = new File(StableUtils.pathJoin(envHome,ProjectConstants.LIB_NAME));
File[] files = installEnv.listFiles();
if (files != null) {
for (File file : files) {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(WorkContext.getCurrent().getPath(), ProjectConstants.LIB_NAME, file.getName()));
list.add(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), ProjectConstants.LIB_NAME, file.getName()));
if (file.getName().startsWith(UpdateConstants.FINE)) {
list.add(StableUtils.pathJoin(envHome, ProjectConstants.LIB_NAME, file.getName()));
}
}
}
installEnv = new File(StableUtils.pathJoin(installHome,ProjectConstants.LIB_NAME));
files = installEnv.listFiles();
if (files != null) {
for (File file : files) {
if (file.getName().startsWith(UpdateConstants.FINE) || file.getName().contains(UpdateConstants.ASPECTJRT)) {
list.add(StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName()));
}
}
}
}

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

@ -30,6 +30,7 @@ import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.*;
import com.fr.stable.project.ProjectConstants;
import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse;
import com.fr.third.org.apache.http.client.methods.HttpGet;
import com.fr.third.org.apache.http.impl.client.CloseableHttpClient;
@ -47,10 +48,8 @@ import java.io.*;
import java.nio.charset.StandardCharsets;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.*;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ExecutionException;
import static java.nio.charset.StandardCharsets.*;
@ -594,19 +593,23 @@ public class UpdateMainDialog extends UIDialog {
UpdateCallBack callBack = new UpdateProgressCallBack(progressBar);
updateButton.setEnabled(false);
updateLabel.setVisible(false);
RestoreResultDialog.deletePreviousPropertyFile();
final String installLib = StableUtils.pathJoin(StableUtils.getInstallHome(), ProjectConstants.LOGS_NAME, UpdateConstants.INSTALL_LIB);
final JFrame frame = DesignerContext.getDesignerFrame();
final RestartHelper helper = new RestartHelper();
new FileProcess(callBack) {
@Override
public void onDownloadSuccess() {
progressBar.setVisible(false);
deleteForDesignerUpdate();
RestartHelper.restart();
deleteForDesignerUpdate(installLib);
helper.restartForUpdate(frame);
}
@Override
public void onDownloadFailed() {
progressBar.setVisible(false);
deleteForDesignerUpdate();
deleteForDesignerUpdate(installLib);
JOptionPane.showMessageDialog(getParent(), Toolkit.i18nText("Fine-Design_Update_Info_Failed_Message"));
RestartHelper.restart();
helper.restartForUpdate(frame);
}
}.execute();
}
@ -614,11 +617,9 @@ public class UpdateMainDialog extends UIDialog {
});
}
private void deleteForDesignerUpdate() {
File designerBackup = new File(StableUtils.pathJoin(StableUtils.getInstallHome(),UpdateConstants.DESIGNERBACKUPPATH));
CommonUtils.deleteFile(designerBackup);
File downloadForDesigner = new File(StableUtils.pathJoin(StableUtils.getInstallHome(),UpdateConstants.DOWNLOADPATH));
CommonUtils.deleteFile(downloadForDesigner);
private void deleteForDesignerUpdate(String installLib) {
File dir = new File(installLib);
CommonUtils.deleteFile(dir);
}
//获取备份目录

14
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -79,6 +79,8 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -967,4 +969,16 @@ public final class GUICoreUtils {
}
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 10);
}
/**
* 获取当前所有显示器设备的总长总宽
* @return
*/
public static Rectangle getRectScreen() {
Rectangle rectangle = new Rectangle(0, 0, 0, 0);
for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
rectangle = rectangle.union(gd.getDefaultConfiguration().getBounds());
}
return rectangle;
}
}

77
designer-base/src/main/java/com/fr/env/RemoteEnvPane.java vendored

@ -52,15 +52,16 @@ import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.util.concurrent.ExecutionException;
import static com.fr.design.layout.TableLayout.FILL;
import static com.fr.design.layout.TableLayout.PREFERRED;
import static com.fr.env.TestConnectionResult.AUTH_FAILED;
import static com.fr.third.guava.base.Optional.fromNullable;
/**
* @author yaohwu
*/
@SuppressWarnings("squid:MaximumInheritanceDepth")
public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92);
@ -118,6 +119,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
/**
* 主机位置
*/
@SuppressWarnings("squid:S1948")
private RemoteWorkspaceURL remoteWorkspaceURL = new RemoteWorkspaceURL("");
/**
* https 配置面板
@ -138,6 +140,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
/**
* 主机名web应用Servlet端口监听器
*/
@SuppressWarnings("squid:S1948")
private DocumentListener individualDocListener = new DocumentListener() {
@Override
@ -148,19 +151,32 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
@Override
public void insertUpdate(DocumentEvent e) {
updateRemoteURL();
fillRemoteEnvURLField();
changedUpdate(e);
}
@Override
public void removeUpdate(DocumentEvent e) {
updateRemoteURL();
fillRemoteEnvURLField();
changedUpdate(e);
}
private void updateRemoteURL() {
boolean isHttps = httpsCheckbox.isSelected();
String host = hostNameInput.getText();
String port = portInput.getText();
String web = webAppNameInput.getText();
String servlet = servletNameInput.getText();
remoteWorkspaceURL.setHttps(isHttps);
remoteWorkspaceURL.setHost(host);
remoteWorkspaceURL.setPort(port);
remoteWorkspaceURL.setWeb(web);
remoteWorkspaceURL.setServlet(servlet);
remoteWorkspaceURL.resetUrl();
}
};
/**
* 路径输入框监听器
*/
@SuppressWarnings("squid:S1948")
private DocumentListener overallDocListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
@ -169,7 +185,6 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
@Override
public void removeUpdate(DocumentEvent e) {
actionURLInputChange();
}
@ -177,10 +192,22 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
public void changedUpdate(DocumentEvent e) {
actionURLInputChange();
}
private void actionURLInputChange() {
remoteWorkspaceURL = new RemoteWorkspaceURL(remoteEnvURLInput.getText());
fillIndividualField();
httpsCheckbox.setSelected(remoteWorkspaceURL.getHttps());
boolean isHttps = httpsCheckbox.isSelected();
DesignerEnvManager.getEnvManager().setHttps(isHttps);
fileChooserButton.setEnabled(isHttps);
updateHttpsConfigPanel();
}
};
/**
* https checkbox listener
*/
@SuppressWarnings("squid:S1948")
private ActionListener httpsCheckboxListener = new ActionListener() {
@Override
@ -523,17 +550,17 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
final RemoteDesignerWorkspaceInfo remoteEnv = updateBean();
final WorkspaceConnectionInfo connection = remoteEnv.getConnection();
final SwingWorker<Boolean, Void> worker = new SwingWorker<Boolean, Void>() {
final SwingWorker<TestConnectionResult, Void> worker = new SwingWorker<TestConnectionResult, Void>() {
@Override
protected Boolean doInBackground() throws Exception {
protected TestConnectionResult doInBackground() throws Exception {
DesignerEnvManager.getEnvManager().setCertificatePath(connection.getCertPath());
DesignerEnvManager.getEnvManager().setCertificatePass(connection.getCertSecretKey());
try {
return WorkContext.getConnector().testConnection(connection);
return TestConnectionResult.parse(WorkContext.getConnector().testConnection(connection), connection);
} catch (WorkspaceAuthException ignored) {
return null;
return AUTH_FAILED;
}
}
@ -541,14 +568,13 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
protected void done() {
okButton.setEnabled(true);
try {
TestConnectionResult result = TestConnectionResult.parse(get(), connection);
TestConnectionResult result = get();
message.setText(result.getText());
uiLabel.setIcon(result.getIcon());
} catch (InterruptedException | ExecutionException e) {
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
Thread.currentThread().interrupt();
}
dialogDownPane.remove(cancelButton);
dialogDownPane.revalidate();
@ -633,35 +659,10 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
enableSubDocListener();
}
private void updateRemoteURL() {
boolean isHttps = httpsCheckbox.isSelected();
String host = hostNameInput.getText();
String port = portInput.getText();
String web = webAppNameInput.getText();
String servlet = servletNameInput.getText();
remoteWorkspaceURL.setHttps(isHttps);
remoteWorkspaceURL.setHost(host);
remoteWorkspaceURL.setPort(port);
remoteWorkspaceURL.setWeb(web);
remoteWorkspaceURL.setServlet(servlet);
}
private void updateHttpsConfigPanel() {
httpsConfigPanel.removeAll();
packHttpsConfigPanel();
httpsConfigPanel.revalidate();
httpsConfigPanel.repaint();
}
private void actionURLInputChange() {
remoteWorkspaceURL = new RemoteWorkspaceURL(remoteEnvURLInput.getText());
fillIndividualField();
httpsCheckbox.setSelected(remoteWorkspaceURL.getHttps());
boolean isHttps = httpsCheckbox.isSelected();
DesignerEnvManager.getEnvManager().setHttps(isHttps);
fileChooserButton.setEnabled(isHttps);
updateHttpsConfigPanel();
}
}

37
designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java vendored

@ -1,10 +1,9 @@
package com.fr.env;
import com.fr.stable.AssistUtils;
import com.fr.stable.FCloneable;
import com.fr.stable.StringUtils;
import java.util.Objects;
/**
* @author yaohwu
*/
@ -42,6 +41,7 @@ public class RemoteWorkspaceURL implements FCloneable {
private String port;
private String web;
private String servlet;
private String url;
/**
@ -51,7 +51,7 @@ public class RemoteWorkspaceURL implements FCloneable {
* @param url x:x/x/x/x
*/
public RemoteWorkspaceURL(String url) {
this.url = url;
// 没有写协议名称 默认 使用 http 协议
if (!url.startsWith(HTTPS) && !url.startsWith(HTTP)) {
url = HTTP + url;
@ -116,11 +116,15 @@ public class RemoteWorkspaceURL implements FCloneable {
}
public String getURL() {
if (this.url != null) {
return url;
}
String prefix = isHttps ? HTTPS : HTTP;
String portColon = StringUtils.isNotEmpty(port) ? ":" : StringUtils.EMPTY;
String webAppNameSlash = StringUtils.isNotEmpty(web) ? "/" : StringUtils.EMPTY;
String servletNameSlash = StringUtils.isNotEmpty(servlet) ? "/" : StringUtils.EMPTY;
return prefix + host + portColon + port + webAppNameSlash + web + servletNameSlash + servlet;
this.url = prefix + host + portColon + port + webAppNameSlash + web + servletNameSlash + servlet;
return this.url;
}
@ -164,26 +168,24 @@ public class RemoteWorkspaceURL implements FCloneable {
return servlet;
}
public void resetUrl() {
this.url = null;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RemoteWorkspaceURL that = (RemoteWorkspaceURL) o;
return isHttps == that.isHttps &&
Objects.equals(host, that.host) &&
Objects.equals(port, that.port) &&
Objects.equals(web, that.web) &&
Objects.equals(servlet, that.servlet);
return o instanceof RemoteWorkspaceURL && AssistUtils.equals(isHttps, ((RemoteWorkspaceURL) o).isHttps)
&& AssistUtils.equals(host, ((RemoteWorkspaceURL) o).host)
&& AssistUtils.equals(port, ((RemoteWorkspaceURL) o).port)
&& AssistUtils.equals(web, ((RemoteWorkspaceURL) o).web)
&& AssistUtils.equals(servlet, ((RemoteWorkspaceURL) o).servlet)
&& AssistUtils.equals(url, ((RemoteWorkspaceURL) o).url);
}
@Override
public int hashCode() {
return Objects.hash(isHttps, host, port, web, servlet);
return AssistUtils.hashCode(isHttps, host, port, web, servlet, url);
}
@Override
@ -194,6 +196,7 @@ public class RemoteWorkspaceURL implements FCloneable {
", port='" + port + '\'' +
", web='" + web + '\'' +
", servlet='" + servlet + '\'' +
", url='" + url + '\'' +
'}';
}

61
designer-base/src/main/java/com/fr/file/FILEChooserPane.java

@ -4,12 +4,14 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.extension.FileExtension;
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.UIDialog;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.icombobox.UIComboBox;
@ -31,6 +33,8 @@ import com.fr.file.filter.FILEFilter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import com.fr.report.ExtraReportClassManager;
import com.fr.report.fun.ReportSupportedFileProvider;
import com.fr.stable.CoreConstants;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
@ -90,6 +94,7 @@ import java.util.ArrayList;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -475,8 +480,11 @@ public class FILEChooserPane extends BasicPane {
@Override
public void itemStateChanged(ItemEvent e) {
Object ss = postfixComboBox.getSelectedItem();
if (ss instanceof FILEFilter) {
setFILEFilter((FILEFilter) ss);
if (ss instanceof ChooseFileFilter) {
setFILEFilter((ChooseFileFilter) ss);
if (fileNameTextField.isShowing()) {
fileNameTextField.setText(calProperFileName(fileNameTextField.getText(), (ChooseFileFilter) ss));
}
} else {
setFILEFilter(null);
}
@ -484,6 +492,21 @@ public class FILEChooserPane extends BasicPane {
});
}
private String calProperFileName(String fileName, ChooseFileFilter fileFilter) {
if(fileFilter == null){
return fileName;
}
String filterExtension = fileFilter.getExtensionString();
int lastDotIndex = fileName.lastIndexOf(".") != -1 ? fileName.lastIndexOf(".") : fileName.length();
String fileNameWithOutExtension = fileName.substring(0, lastDotIndex);
String fileNameExtension = fileName.substring(lastDotIndex);
FileExtension fileExtension = FileExtension.parse(fileNameExtension);
if (StringUtils.isEmpty(fileName) || StringUtils.isEmpty(filterExtension) || fileFilter.containsExtension(fileExtension.getExtension())) {
return fileName;
}
return fileNameWithOutExtension + filterExtension;
}
private void doCancel() {
this.locationBtnPane.setPopDir(null);
dialogExit();
@ -720,16 +743,26 @@ public class FILEChooserPane extends BasicPane {
if (editing == null || !editing.isChartBook()) {
if (type == JFileChooser.OPEN_DIALOG) {
this.addChooseFILEFilter(new ChooseFileFilter(FRContext.getFileNodes().getSupportedTypes(), appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
ChooseFileFilter supportedTypes = new ChooseFileFilter(FRContext.getFileNodes().getSupportedTypes(), appName + Toolkit.i18nText("Fine-Design_Report_Template_File"));
Set<ReportSupportedFileProvider> providers = ExtraReportClassManager.getInstance().getArray(ReportSupportedFileProvider.XML_TAG);
for (ReportSupportedFileProvider provider : providers) {
for (FileExtension fileExtension : provider.getFileExtensions()){
supportedTypes.addExtension(fileExtension.getExtension());
}
}
this.addChooseFILEFilter(supportedTypes);
}
// ben:filefilter设置初值为cpt过滤
this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPT, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPTX, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
// richer:form文件 daniel 改成三个字
this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.FRM, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
this.addChooseFILEFilter(new ChooseFileFilter(FileExtension.FRMX, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
Set<ReportSupportedFileUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG);
for (ReportSupportedFileUIProvider provider : providers) {
provider.addChooseFileFilter(this, StringUtils.EMPTY);
}
} else {
if (type == JFileChooser.OPEN_DIALOG) {
this.addChooseFILEFilter(new ChooseFileFilter(EnumSet.of(FileExtension.XLS, FileExtension.XLSX), Toolkit.i18nText("Fine-Design_Basic_Import_Excel_Source")));
@ -782,12 +815,7 @@ public class FILEChooserPane extends BasicPane {
}
}
//jerry 26216 只保留.cpt .frm有用的格式,并且不可编辑
if (type == JFileChooser.OPEN_DIALOG) {
postfixComboBox.setEnabled(true);
} else {
postfixComboBox.setEnabled(false);
}
postfixComboBox.setEnabled(true);
//只有一个类型时不可下拉
if (filterList.size() == 1) {
postfixComboBox.setEnabled(false);
@ -841,14 +869,8 @@ public class FILEChooserPane extends BasicPane {
private void saveDialog() {
String filename = fileNameTextField.getText();
if (!filename.endsWith(suffix)) {
ChooseFileFilter chooseFileFilter = (ChooseFileFilter) (postfixComboBox.getSelectedItem());
if (chooseFileFilter != null && StringUtils.isNotEmpty(chooseFileFilter.getExtensionString())) {
fileNameTextField.setText(filename + chooseFileFilter.getExtensionString());
} else {
fileNameTextField.setText(filename + this.suffix);
}
}
filename = calProperFileName(filename, (ChooseFileFilter) (postfixComboBox.getSelectedItem()));
fileNameTextField.setText(filename);
option = OK_OPTION;
FILE selectedFile = this.getSelectedFILE();
@ -874,6 +896,7 @@ public class FILEChooserPane extends BasicPane {
}
}
private boolean access(FILE selectedFile) {
boolean access = false;
try {

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

@ -1,51 +1,63 @@
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.report.ExtraReportClassManager;
import com.fr.report.fun.ReportSupportedFileProvider;
import com.fr.report.fun.impl.AbstractReportSupportedFileProvider;
import com.fr.stable.fun.mark.Mutable;
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.modules.junit4.PowerMockRunner;
import java.util.HashSet;
import java.util.Set;
/**
* Created by alex sung on 2019/7/25.
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest(ExtraReportClassManager.class)
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);
public void supportFileTypesTest() {
ExtraReportClassManager extra = mockExtraReportClassManager();
Assert.assertEquals(1, extra.getArray(ReportSupportedFileProvider.XML_TAG).size());
ReportSupportedFileProvider option = (ReportSupportedFileProvider) extra.getArray(ReportSupportedFileProvider.XML_TAG).iterator().next();
Assert.assertEquals(FileExtension.CPTX, option.getFileExtensions()[0]);
}
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]);
@Test
public void testSupportFileTypesOrder() {
ExtraReportClassManager extra = mockExtraReportClassManager();
PowerMock.mockStatic(ExtraReportClassManager.class);
EasyMock.expect(ExtraReportClassManager.getInstance()).andReturn(extra).once();
PowerMock.replayAll();
String[] fileTypes = FileNodeConstants.getSupportFileTypes();
Assert.assertEquals("cptx", fileTypes[0]);
Assert.assertEquals("cpt", fileTypes[1]);
}
private class MockCptxApp extends AbstractAppProvider{
@Override
public String[] defaultExtensions() {
return new String[] {FileExtension.CPTX.getExtension()};
}
private ExtraReportClassManager mockExtraReportClassManager() {
ExtraReportClassManager extra = EasyMock.mock(ExtraReportClassManager.class);
Set<Mutable> options = new HashSet<Mutable>() {{
add(new MockNewTemplateFileOption());
}};
EasyMock.expect(extra.getArray(ReportSupportedFileProvider.XML_TAG)).andReturn(options).anyTimes();
EasyMock.replay(extra);
return extra;
}
@Override
public JTemplate openTemplate(FILE tplFile) {
return null;
}
private class MockNewTemplateFileOption extends AbstractReportSupportedFileProvider {
@Override
public BaseBook asIOFile(FILE tplFile) {
return null;
public FileExtension[] getFileExtensions() {
return new FileExtension[]{FileExtension.CPTX
};
}
}
}

48
designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java → designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java vendored

@ -4,11 +4,57 @@ import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
/**
* @author yaohwu
*/
public class RemoteEnvURLTest {
public class RemoteWorkspaceURLTest {
@Test
public void testEqualAndHashCode() {
String a = "https://yaohwu:8080/webroot/app/c/d";
RemoteWorkspaceURL workspaceURL1 = new RemoteWorkspaceURL(a);
RemoteWorkspaceURL workspaceURL2 = new RemoteWorkspaceURL(a);
assertEquals(workspaceURL1.hashCode(), workspaceURL2.hashCode());
assertEquals(workspaceURL1, workspaceURL2);
workspaceURL2.resetUrl();
assertNotEquals(workspaceURL1.hashCode(), workspaceURL2.hashCode());
assertNotEquals(workspaceURL1, workspaceURL2);
}
@Test
public void testUrlReset() {
String a = "https://yaohwu:8080/webroot/app/c/d";
RemoteWorkspaceURL workspaceURL = new RemoteWorkspaceURL(a);
Assert.assertEquals(a, workspaceURL.getURL());
Assert.assertEquals("app", workspaceURL.getServlet());
Assert.assertEquals("webroot", workspaceURL.getWeb());
Assert.assertEquals("yaohwu", workspaceURL.getHost());
Assert.assertEquals("8080", workspaceURL.getPort());
Assert.assertTrue(workspaceURL.getHttps());
workspaceURL.setHttps(false);
workspaceURL.setHost("finereport");
Assert.assertEquals(a, workspaceURL.getURL());
Assert.assertEquals("app", workspaceURL.getServlet());
Assert.assertEquals("webroot", workspaceURL.getWeb());
Assert.assertEquals("finereport", workspaceURL.getHost());
Assert.assertEquals("8080", workspaceURL.getPort());
Assert.assertFalse(workspaceURL.getHttps());
workspaceURL.resetUrl();
Assert.assertEquals("http://finereport:8080/webroot/app", workspaceURL.getURL());
Assert.assertEquals("app", workspaceURL.getServlet());
Assert.assertEquals("webroot", workspaceURL.getWeb());
Assert.assertEquals("finereport", workspaceURL.getHost());
Assert.assertEquals("8080", workspaceURL.getPort());
Assert.assertFalse(workspaceURL.getHttps());
}
@Test
public void testURLParser() {

39
designer-base/src/test/java/com/fr/file/FILEChooserPaneTest.java

@ -0,0 +1,39 @@
package com.fr.file;
import com.fr.base.extension.FileExtension;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.invoke.Reflect;
import com.fr.stable.StringUtils;
import org.junit.Assert;
import org.junit.Test;
/**
* Created by kerry on 2019-10-15
*/
public class FILEChooserPaneTest {
@Test
public void testAddChooseFileFilter() {
FILEChooserPane chooserPane = Reflect.on(FILEChooserPane.class).field("INSTANCE").get();
Reflect.on(chooserPane).set("suffix", ".cpt");
String result1 = Reflect.on(chooserPane).call("calProperFileName", "WorkBook1.cpt", null).get();
Assert.assertEquals("WorkBook1.cpt", result1);
ChooseFileFilter chooseFileFilter1 = new ChooseFileFilter(FileExtension.CPT, StringUtils.EMPTY);
String result2 = Reflect.on(chooserPane).call("calProperFileName", "WorkBook1.cpt", chooseFileFilter1).get();
Assert.assertEquals("WorkBook1.cpt", result2);
ChooseFileFilter chooseFileFilter2 = new ChooseFileFilter(FileExtension.CPTX, StringUtils.EMPTY);
String result3 = Reflect.on(chooserPane).call("calProperFileName", "WorkBook1.cpt", chooseFileFilter2).get();
Assert.assertEquals("WorkBook1.cptx", result3);
ChooseFileFilter chooseFileFilter3 = new ChooseFileFilter(FileExtension.CPT, StringUtils.EMPTY);
String result4 = Reflect.on(chooserPane).call("calProperFileName", "WorkBook1.cptx", chooseFileFilter3).get();
Assert.assertEquals("WorkBook1.cpt", result4);
ChooseFileFilter chooseFileFilter5 = new ChooseFileFilter(FileExtension.CPTX, StringUtils.EMPTY);
String result5 = Reflect.on(chooserPane).call("calProperFileName", "WorkBook1.cptx", chooseFileFilter5).get();
Assert.assertEquals("WorkBook1.cptx", result5);
}
}

2
designer-chart/src/main/java/com/fr/design/chart/ChartCommonWizardPane.java

@ -12,7 +12,7 @@ public abstract class ChartCommonWizardPane extends ChartWizardPane {
return;
}
populate(cc.getSelectedChartProvider());
populate(cc.getSelectedChartProvider(ChartProvider.class));
}
public abstract void populate(ChartProvider chart);

2
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -123,7 +123,7 @@ public class ChartTypePane extends ChartCommonWizardPane {
return;
}
ChartProvider chart4Update = cc.getSelectedChartProvider();
ChartProvider chart4Update = cc.getSelectedChartProvider(ChartProvider.class);
if (chart4Update == null) {
String plotID = this.chartIDs[mainTypeList.getSelectedIndex()];
ChartProvider chart = ChartTypeManager.getInstance().getCharts(plotID)[iconViewList.getSelectedIndex()];

6
designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java

@ -13,6 +13,8 @@ import com.fr.log.FineLoggerFactory;
import com.fr.script.Calculator;
import com.fr.stable.core.PropertyChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
@ -22,8 +24,6 @@ import java.awt.RenderingHints;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.ArrayList;
import java.util.List;
/**
* @author kunsnat E-mail:kunsnat@gmail.com
@ -236,7 +236,7 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
private void drawChart(Graphics2D g2d) {
if (chartCollection4Design != null) {
BaseChartPainter painter = chartCollection4Design.createResultChartPainter(Calculator.createCalculator(),
BaseChartPainter painter = chartCollection4Design.createResultChartPainterWithOutDealFormula(Calculator.createCalculator(),
WebChartIDInfo.createEmptyDesignerInfo(), chartWidth, chartHeight);
int resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution();

4
designer-chart/src/main/java/com/fr/design/chartx/AbstractChartDataPane.java

@ -26,7 +26,7 @@ public abstract class AbstractChartDataPane<T extends ChartDataDefinitionProvide
if (collection == null) {
return;
}
VanChart chart = collection.getSelectedChart(VanChart.class);
VanChart chart = collection.getSelectedChartProvider(VanChart.class);
if (chart == null) {
return;
}
@ -48,7 +48,7 @@ public abstract class AbstractChartDataPane<T extends ChartDataDefinitionProvide
if (collection == null) {
return;
}
VanChart chart = collection.getSelectedChart(VanChart.class);
VanChart chart = collection.getSelectedChartProvider(VanChart.class);
if (chart == null) {
return;
}

4
designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractDataPane.java

@ -35,7 +35,7 @@ public abstract class AbstractDataPane extends ChartDataPane {
if (collection == null) {
return;
}
AbstractChartWithData chart = collection.getSelectedChart(AbstractChartWithData.class);
AbstractChartWithData chart = collection.getSelectedChartProvider(AbstractChartWithData.class);
if (chart == null) {
return;
}
@ -57,7 +57,7 @@ public abstract class AbstractDataPane extends ChartDataPane {
if (collection == null) {
return;
}
AbstractChartWithData chart = collection.getSelectedChart(AbstractChartWithData.class);
AbstractChartWithData chart = collection.getSelectedChartProvider(AbstractChartWithData.class);
if (chart == null) {
return;
}

4
designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractOtherPane.java

@ -18,7 +18,7 @@ public abstract class AbstractOtherPane<T extends AbstractChartWithData> extends
if (collection == null) {
return;
}
AbstractChartWithData chart = collection.getSelectedChart(AbstractChartWithData.class);
AbstractChartWithData chart = collection.getSelectedChartProvider(AbstractChartWithData.class);
if (chart == null) {
return;
}
@ -32,7 +32,7 @@ public abstract class AbstractOtherPane<T extends AbstractChartWithData> extends
if (collection == null) {
return;
}
AbstractChartWithData chart = collection.getSelectedChart(AbstractChartWithData.class);
AbstractChartWithData chart = collection.getSelectedChartProvider(AbstractChartWithData.class);
if (chart == null) {
return;
}

10
designer-chart/src/main/java/com/fr/design/mainframe/MiddleChartPropertyPane.java

@ -6,6 +6,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.chart.BaseChartCollection;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.designer.TargetComponent;
import com.fr.design.gui.chart.BaseChartPropertyPane;
@ -14,11 +15,12 @@ import com.fr.design.gui.frpane.UITitlePanel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itabpane.TitleChangeListener;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import java.awt.BorderLayout;
public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{
@ -91,7 +93,7 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{
* @param ePane 面板
*/
public void populateChartPropertyPane(ChartCollection collection, TargetComponent<?> ePane) {
addChartEditPane(collection.getSelectedChartProvider().getID());
addChartEditPane(collection.getSelectedChartProvider(ChartProvider.class).getID());
setSupportCellData(true);
this.container.setEPane(ePane);
chartEditPane.populate(collection);

4
designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java

@ -111,7 +111,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
if (!ComparatorUtils.equals(collection, lastCollection)) {
VanChart vanChart = collection.getSelectedChart(VanChart.class);
VanChart vanChart = collection.getSelectedChartProvider(VanChart.class);
if (vanChart != null) {
//此处画图
vanChart.demoImgEvent(true);
@ -230,7 +230,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
return;
}
ChartProvider chartProvider = collection.getSelectedChartProvider();
ChartProvider chartProvider = collection.getSelectedChartProvider(ChartProvider.class);
if (checkNeedsReLayout(chartProvider)) {
String chartID = chartProvider.getID();
if ("WaferChipChart".equals(chartID) || "BoxPlotChart".equals(chartID)) {

12
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -176,7 +176,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
* @return
*/
public ChartProvider getChangeStateNewChart() {
ChartProvider chart = editingCollection.getSelectedChartProvider();
ChartProvider chart = editingCollection.getSelectedChartProvider(ChartProvider.class);
String chartID = chart.getID();
String priority = ChartTypeManager.getInstanceWithCheck().getPriority(chartID);
return ChartTypeManager.getInstanceWithCheck().getFirstChart(priority);
@ -199,7 +199,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
}
private boolean supportChange() {
return supportChangeConfigChartClassSet.contains(editingCollection.getSelectedChartProvider().getClass());
return supportChangeConfigChartClassSet.contains(editingCollection.getSelectedChartProvider(ChartProvider.class).getClass());
}
ActionListener configListener = new ActionListener() {
@ -354,9 +354,9 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
}
private void checkConfigButtonVisible() {
addButton.setVisible(ChartTypeManager.enabledChart(editingCollection.getSelectedChartProvider().getID()));
addButton.setVisible(ChartTypeManager.enabledChart(editingCollection.getSelectedChartProvider(ChartProvider.class).getID()));
//新建一个collection
if (editingCollection.getChartCount() == 1 && editingCollection.getSelectedChartProvider() != null) {
if (editingCollection.getChartCount() == 1 && editingCollection.getSelectedChartProvider(ChartProvider.class) != null) {
//Chart 不支持图表切换
configButton.setVisible(supportChange());
}
@ -484,7 +484,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
private void deleteAButton() {
//先重构属性,在重构面板,否则面板在重构过程中,会重新将属性中的切换图表加到indexList中,导致面板无法删除
//记录改变前的plotID
String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChartProvider().getID();
String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChartProvider(ChartProvider.class).getID();
if (editingCollection != null) {
int count = editingCollection.getChartCount();
for (int i = 0; i < count; i++) {
@ -564,7 +564,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
if (isEnabled()) {
noSelected();
//记录改变前的plotID
String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChartProvider().getID();
String lastPlotID = editingCollection == null ? StringUtils.EMPTY : editingCollection.getSelectedChartProvider(ChartProvider.class).getID();
changeCollectionSelected(getButtonName());
setSelectedWithFireListener(true);
fireSelectedChanged();

16
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -19,15 +19,15 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* 图表 属性表, 类型选择 界面.
@ -208,7 +208,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
//处理办法:这边除了重构 下拉项选项和cardNames 还需要把cards重构下(不需要init pane,只需要我需要的拿出来就好了)
private void relayout(ChartCollection collection){
//重构需要重构下拉框选项和cardNames
ChartProvider chart = collection.getSelectedChartProvider();
ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class);
String chartID = chart.getID();
String priority = ChartTypeManager.getInstanceWithCheck().getPriority(chartID);
boolean enabledChart = ChartTypeManager.enabledChart(chartID);
@ -294,7 +294,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
* @param collection
*/
public void reLayoutEditPane(String lastPlotID, ChartCollection collection){
ChartProvider chart = collection.getSelectedChartProvider();
ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class);
String plotID = chart.getID();
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID);
if (editPane != null && editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){
@ -315,7 +315,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
public void populate(ChartCollection collection) {
editingCollection = collection;
ChartProvider chart = collection.getSelectedChartProvider();
ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class);
this.remove(leftContentPane);
initContentPane();
@ -333,7 +333,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
public void update(ChartCollection collection) {
editingCollection = collection;
buttonPane.update(collection);// 内部操作时 已经做过处理.
ChartProvider chart = collection.getSelectedChartProvider();
ChartProvider chart = collection.getSelectedChartProvider(ChartProvider.class);
chartTypeComBox.updateBean(chart);
}

8
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java

@ -88,7 +88,12 @@ public class GisMapPlotPane extends AbstractDeprecatedChartTypePane {
return ChartConstants.GIS_CHAER;
}
protected String[] getTypeLayoutPath() {
@Override
public String getPlotID() {
return ChartConstants.GIS_CHAER;
}
protected String[] getTypeLayoutPath() {
return new String[]{"/com/fr/design/images/chart/GisMapPlot/layout/0.png",
"/com/fr/design/images/chart/GisMapPlot/layout/1.png",
};
@ -157,7 +162,6 @@ public class GisMapPlotPane extends AbstractDeprecatedChartTypePane {
* 更新界面内容
*/
public void populateBean(Chart chart) {
typeDemo.get(0).isPressing = true;
GisMapPlot plot = (GisMapPlot) chart.getPlot();
if(plot.isGisType()){

14
designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/WordCloudIndependentVanChartInterface.java

@ -14,6 +14,8 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.van.chart.designer.other.VanChartInteractivePaneWithOutSort;
import com.fr.van.chart.designer.other.VanChartOtherPane;
@ -21,6 +23,8 @@ import com.fr.van.chart.designer.other.zoom.ZoomPane;
import com.fr.van.chart.designer.other.zoom.ZoomPaneWithOutMode;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI;
import com.fr.van.chart.wordcloud.designer.data.WordCloudPlotReportDataContentPane;
import com.fr.van.chart.wordcloud.designer.data.WordCloudPlotTableDataContentPane;
import com.fr.van.chart.wordcloud.designer.other.VanChartWordCloudConditionPane;
import com.fr.van.chart.wordcloud.designer.style.VanChartWordCloudSeriesPane;
import com.fr.van.chart.wordcloud.designer.type.VanChartWordCloudTypePane;
@ -63,6 +67,16 @@ public class WordCloudIndependentVanChartInterface extends AbstractIndependentVa
return "com/fr/design/images/form/toolbar/wordcloud.png";
}
@Override
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) {
return new WordCloudPlotReportDataContentPane();
}
@Override
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) {
return new WordCloudPlotTableDataContentPane();
}
@Override
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot) {
return new VanChartWordCloudSeriesPane(parent, plot);

47
designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

@ -18,7 +18,9 @@ import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.stable.ArrayUtils;
import java.awt.*;
import java.awt.LayoutManager;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
@ -175,36 +177,19 @@ public class SelectionModel {
}
private void pasteXWFitLayout() {
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);
}
//自适应布局编辑器内部左上角第一个坐标点
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 {
//自适应布局编辑器内部左上角第一个坐标点
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);
}
FormSelectionUtils.paste2Container(designer, designer.getRootComponent(),
clipboard,
rectangle.x + rectangle.width / 2,
rectangle.y + DELTA_X_Y);
}
}
@ -497,4 +482,4 @@ public class SelectionModel {
selection.setSelectedCreators(rebuildSelection);
fireCreatorSelected();
}
}
}

5
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -31,6 +31,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.act.TitlePacker;
import com.fr.general.cardtag.TemplateStyle;
import com.fr.stable.ProductConstants;
import com.fr.stable.unit.PT;
import javax.swing.*;
@ -210,7 +211,7 @@ public class XCardSwitchButton extends XButton {
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 + "”",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_ConfirmDialog_Title"), JOptionPane.YES_NO_OPTION);
ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION);
if (value != JOptionPane.OK_OPTION) {
return;
}
@ -352,7 +353,7 @@ public class XCardSwitchButton extends XButton {
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 + "”",
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_ConfirmDialog_Title"),JOptionPane.YES_NO_OPTION);
ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION);
if (value != JOptionPane.OK_OPTION) {
return;
}

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

@ -28,6 +28,7 @@ public class EventPropertyTable extends UIListControlPane {
public EventPropertyTable(FormDesigner designer) {
super();
this.setNameListEditable(false);
this.designer = designer;
}

2
designer-form/src/main/java/com/fr/design/form/mobile/FormMobileOthersPane.java

@ -33,7 +33,7 @@ public class FormMobileOthersPane extends BasicBeanPane<FormMobileAttr> {
contentPane.add(appearRefreshCheckPane, BorderLayout.WEST);
promptWhenLeaveWithoutSubmitCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Prompt_When_Leave_Without_Submit"));
contentPane.add(promptWhenLeaveWithoutSubmitCheckPane, BorderLayout.CENTER);
allowDoubleClickOrZoomCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("允许双击/双指缩放"));
allowDoubleClickOrZoomCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr_Allow_Zoom"));
contentPane.add(allowDoubleClickOrZoomCheckPane, BorderLayout.EAST);
borderPane.add(contentPane);
this.add(borderPane);

4
designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java

@ -8,9 +8,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.form.main.Form;
import com.fr.form.main.WidgetGatherAdapter;
import com.fr.form.ui.BaseChartEditor;
import com.fr.form.ui.DataControl;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.MultiFileEditor;
import com.fr.form.ui.Widget;
import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider;
@ -74,7 +72,7 @@ public class FormModelAdapter extends DesignModelAdapter<Form, BaseJForm<Form>>
@Override
public void dealWith(Widget widget) {
if (widget instanceof DataControl || widget instanceof MultiFileEditor) {
if (widgetAccepted(widget)) {
list.add(new WidgetName(widget.getWidgetName()));
}
}

14
designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java

@ -11,6 +11,7 @@ import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.Widget;
@ -264,12 +265,18 @@ public class FormSelection {
* @param designer 设计界面组件
*/
public void fixCreator(FormDesigner designer) {
int i = 0;
for (XCreator creator : selection) {
LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(designer, creator);
if (layoutAdapter != null) {
creator.setBackupBound(backupBounds);
if (creator.acceptType(XWAbsoluteLayout.class) && recs.size() > i) {
creator.setBackupBound(recs.get(i));
} else {
creator.setBackupBound(backupBounds);
}
layoutAdapter.fix(creator);
}
i++;
}
}
@ -317,6 +324,9 @@ public class FormSelection {
clipBoard.reset();
for (XCreator root : selection) {
if(root.acceptType(XWTabFitLayout.class)){
continue;
}
try {
XCreator creator = XCreatorUtils.createXCreator((Widget) root.toData().clone());
creator.setBounds(root.getBounds());
@ -326,4 +336,4 @@ public class FormSelection {
}
}
}
}
}

11
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.PaperSize;
import com.fr.base.Parameter;
import com.fr.base.extension.FileExtension;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState;
import com.fr.design.actions.FormMobileAttrAction;
@ -34,6 +35,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.xpane.FormHyperlinkGroupPane;
import com.fr.design.gui.xpane.FormHyperlinkGroupPaneNoPop;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.form.FormECCompositeProvider;
import com.fr.design.mainframe.form.FormECDesignerProvider;
@ -52,6 +54,8 @@ import com.fr.design.report.fit.menupane.ReportFitAttrAction;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.file.FILE;
import com.fr.file.FILEChooserPane;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.form.FormElementCaseContainerProvider;
import com.fr.form.FormElementCaseProvider;
import com.fr.form.main.Form;
@ -66,6 +70,7 @@ import com.fr.report.cell.cellattr.CellImage;
import com.fr.report.worksheet.FormElementCase;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.ProductConstants;
import com.fr.stable.bridge.StableFactory;
import com.fr.web.controller.ViewRequestConstants;
@ -949,4 +954,10 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
public String route() {
return ViewRequestConstants.FORM_VIEW_PATH;
}
protected void addChooseFILEFilter(FILEChooserPane fileChooser){
String appName = ProductConstants.APP_NAME;
// richer:form文件 daniel 改成三个字
fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.FRM, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
}
}

2
designer-realize/src/main/java/com/fr/design/actions/cell/CellAttributeAction.java

@ -17,7 +17,7 @@ public class CellAttributeAction extends CellAttributeTableAction {
@Override
protected String getID() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Other_Attributes");
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Datasource_Other_Attributes");
}
}

5
designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java

@ -110,7 +110,10 @@ public class CellWidgetPropertyPane extends BasicPane {
if (tplEC.getTemplateCellElement(cellElement.getColumn(), cellElement.getRow()) == null) {//cellElement未加入到report中时要添加进去
tplEC.addCellElement(cellElement);
} else {
cellElement = tplEC.getTemplateCellElement(finalCS.getColumn(), finalCS.getRow());
TemplateCellElement newCellElement = tplEC.getTemplateCellElement(finalCS.getColumn(), finalCS.getRow());
if (newCellElement != null) {
cellElement = newCellElement;
}
}
setCellWidget(cellWidget, cellElement);
} else {

2
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java

@ -863,7 +863,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
// those that are interested in this event
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == SelectionListener.class) {
((SelectionListener) listeners[i + 1]).selectionChanged(new SelectionEvent(this));
((SelectionListener) listeners[i + 1]).selectionChanged(new SelectionEvent(ElementCasePane.this));
}
}
}

2
designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java

@ -9,6 +9,7 @@ import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.errorinfo.ErrorInfoUploader;
import com.fr.design.mainframe.messagecollect.impl.FocusPointMessageUploader;
import com.fr.design.mainframe.messagecollect.solid.SolidCollector;
import com.fr.design.mainframe.template.info.TemplateInfoCollector;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
@ -230,6 +231,7 @@ public class InformationCollector implements XMLReadable, XMLWriter {
service.schedule(new Runnable() {
@Override
public void run() {
SolidCollector.getInstance().sendToCloudCenterAndDeleteFile();
sendUserInfo();
FocusPointMessageUploader.getInstance().sendToCloudCenter();
TemplateInfoCollector.getInstance().sendTemplateInfo();

7
designer-realize/src/main/java/com/fr/design/mainframe/JPolyWorkBook.java

@ -3,6 +3,7 @@
*/
package com.fr.design.mainframe;
import com.fr.file.FILEChooserPane;
import com.fr.main.impl.WorkBook;
import com.fr.report.poly.PolyWorkSheet;
@ -44,4 +45,8 @@ public class JPolyWorkBook extends JWorkBook {
public void refreshEastPropertiesPane() {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY);
}
}
protected void addExtraChooseFILEFilter(FILEChooserPane fileChooser) {
}
}

25
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.Parameter;
import com.fr.base.ScreenResolution;
import com.fr.base.extension.FileExtension;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignModelAdapter;
import com.fr.design.ExtraDesignClassManager;
@ -34,12 +35,14 @@ import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.fun.PreviewProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIModeControlContainer;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.mainframe.template.info.JWorkBookProcessInfo;
import com.fr.design.mainframe.template.info.TemplateProcessInfo;
@ -65,8 +68,10 @@ import com.fr.design.write.submit.DBManipulationPane;
import com.fr.design.write.submit.SmartInsertDBManipulationInWidgetEventPane;
import com.fr.design.write.submit.SmartInsertDBManipulationPane;
import com.fr.file.FILE;
import com.fr.file.FILEChooserPane;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.general.ComparatorUtils;
import com.fr.general.ModuleContext;
import com.fr.grid.Grid;
@ -90,6 +95,7 @@ import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils;
import com.fr.stable.AssistUtils;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.module.Module;
@ -669,11 +675,13 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
// Export - MenuDef
MenuDef exportMenuDef = new MenuDef(KeySetUtils.EXPORT.getMenuName());
exportMenuDef.setIconPath("/com/fr/design/images/m_file/export.png");
addShortCut(exportMenuDef, excelExportMenuDef);
return exportMenuDef;
}
protected void addShortCut(MenuDef exportMenuDef, MenuDef excelExportMenuDef) {
exportMenuDef.addShortCut(excelExportMenuDef, new PDFExportAction(this), new WordExportAction(this), new SVGExportAction(this),
new CSVExportAction(this), new TextExportAction(this), new EmbeddedExportExportAction(this));
return exportMenuDef;
}
/**
@ -1166,4 +1174,17 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
public String route() {
return ViewRequestConstants.REPORT_VIEW_PATH;
}
protected void addChooseFILEFilter(FILEChooserPane fileChooser) {
String appName = ProductConstants.APP_NAME;
fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.CPT, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
addExtraChooseFILEFilter(fileChooser);
}
protected void addExtraChooseFILEFilter(FILEChooserPane fileChooser){
Set<ReportSupportedFileUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG);
for (ReportSupportedFileUIProvider provider : providers) {
provider.addChooseFileFilter(fileChooser, this.suffix());
}
}
}

37
designer-realize/src/main/java/com/fr/design/mainframe/WorkBookModelAdapter.java

@ -7,14 +7,12 @@ import com.fr.design.DesignModelAdapter;
import com.fr.design.bridge.DesignToolbarProvider;
import com.fr.form.ui.Widget;
import com.fr.main.impl.WorkBook;
import com.fr.main.impl.WorkBookHelper;
import com.fr.main.parameter.ReportParameterAttr;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.ElementCase;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.report.Report;
import com.fr.script.Calculator;
import com.fr.stable.Filter;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory;
@ -30,6 +28,7 @@ import java.util.List;
*/
public class WorkBookModelAdapter extends DesignModelAdapter<WorkBook, JWorkBook> {
public WorkBookModelAdapter(JWorkBook jworkbook) {
super(jworkbook);
}
@ -115,27 +114,21 @@ public class WorkBookModelAdapter extends DesignModelAdapter<WorkBook, JWorkBook
*
* @return widgetName 控件列表.
*/
@Override
public List<WidgetName> getWidgetsName() {
List<WidgetName> list = new ArrayList<WidgetName>();
WorkBook wb = this.getBook();
for (int i = 0, len = wb.getReportCount(); i < len; i++) {
Report report = wb.getReport(i);
Iterator it = report.iteratorOfElementCase();
while (it.hasNext()) {
ElementCase ec = (ElementCase) it.next();
Iterator cs = ec.cellIterator();
while (cs.hasNext()) {
CellElement ce = (CellElement) cs.next();
if (ce instanceof DefaultTemplateCellElement) {
Widget widget = ((DefaultTemplateCellElement) ce).getWidget();
if (widget != null && StringUtils.isNotEmpty(widget.getWidgetName())) {
list.add(new WidgetName(widget.getWidgetName()));
}
}
}
return WorkBookHelper.listWidgetNamesInWorkBook(wb, new Filter<Widget>() {
@Override
public boolean accept(Widget widget) {
return widgetAccepted(widget);
}
}
return list;
}, new Filter<Widget>() {
@Override
public boolean accept(Widget widget) {
//todo 这边有没有必要统一改成widgetAccepted?暂时不改,插件那边可能会有影响,因为插件有的控件并没有实现DataControl的
return widget != null && StringUtils.isNotEmpty(widget.getWidgetName());
}
});
}
/**

5
designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java

@ -37,6 +37,9 @@ public class ErrorInfo {
this.uploadtime = dateToString();
}
public ErrorInfo() {
}
public String getUsername() {
return username;
}
@ -123,7 +126,7 @@ public class ErrorInfo {
saveFileToCache(jo);
}
private void saveFileToCache(JSONObject jo) {
public void saveFileToCache(JSONObject jo) {
String content = jo.toString();
String fileName = UUID.randomUUID() + ErrorInfoUploader.SUFFIX;
File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), ErrorInfoUploader.FOLDER_NAME, fileName));

4
designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java

@ -69,6 +69,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
soverlapRowStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Title_Start_Row_Form")));
repeatTitleRowPane = new RepeatRowPane();
soverlapRowStartPane.add(repeatTitleRowPane);
soverlapRowStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Row")));
return soverlapRowStartPane;
}
@ -85,6 +86,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
// 重复打印标题的结束列
repeatTitleColPane = new RepeatColPane();
soverlapColStartPane.add(repeatTitleColPane);
soverlapColStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column")));
return soverlapColStartPane;
}
@ -100,6 +102,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
foverlapRowStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Finis_Start_Row_Form")));
repeatFinisRowPane = new RepeatRowPane();
foverlapRowStartPane.add(repeatFinisRowPane);
foverlapRowStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Row")));
return foverlapRowStartPane;
}
@ -115,6 +118,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
foverlapColStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Finis_Start_Column_Form")));
repeatFinisColPane = new RepeatColPane();
foverlapColStartPane.add(repeatFinisColPane);
foverlapColStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column")));
return foverlapColStartPane;
}

2
designer-realize/src/main/java/com/fr/design/report/mobile/MobileOthersPane.java

@ -32,7 +32,7 @@ public class MobileOthersPane extends BasicBeanPane<ElementCaseMobileAttr> {
contentPane.setBorder(BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L1, 0, 0));
appearRefreshCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Appear_Refresh"));
contentPane.add(appearRefreshCheckPane, BorderLayout.WEST);
allowDoubleClickOrZoomCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("允许双击/双指缩放"));
allowDoubleClickOrZoomCheckPane = new MobileRadioCheckPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr_Allow_Zoom"));
contentPane.add(allowDoubleClickOrZoomCheckPane, BorderLayout.CENTER);
borderPane.add(contentPane);
this.add(borderPane);

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

@ -168,7 +168,7 @@ public class EventPane extends BasicPane {
return;
}
int val = JOptionPane.showConfirmDialog(EventPane.this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Are_You_Sure_To_Delete_The_Data") + "?", "Message",
int val = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(EventPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Are_You_Sure_To_Delete_The_Data") + "?", "Message",
JOptionPane.YES_NO_OPTION);
if (val != JOptionPane.YES_OPTION) {
return;

3
designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java

@ -5,6 +5,7 @@ import com.fr.design.RestartHelper;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.DesignUtils;
import com.fr.event.EventDispatcher;
import com.fr.file.TmpFileUtils;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.module.Activator;
@ -17,6 +18,8 @@ public class PreStartActivator extends Activator {
@Override
public void start() {
//清空临时文件
TmpFileUtils.cleanUpInnerTmpFiles();
RestartHelper.deleteRecordFilesWhenStart();
//初始化
EventDispatcher.fire(ModuleEvent.MajorModuleStarting, Toolkit.i18nText("Fine-Design_Basic_Initializing"));

Loading…
Cancel
Save