Browse Source

Merge remote-tracking branch 'origin/feature/10.0' into feature/10.0

# Conflicts:
#	designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java
research/11.0
jinbokai 5 years ago
parent
commit
95ba244443
  1. 14
      designer-base/src/main/java/com/fr/design/DesignModelAdapter.java
  2. 61
      designer-base/src/main/java/com/fr/design/RestartHelper.java
  3. 27
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  4. 43
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  5. 1
      designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java
  6. 3
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  7. 4
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  8. 3
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  9. 12
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  10. 8
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/AutoStoreProcedureTableModel.java
  11. 3
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java
  12. 25
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/CustomDictModel.java
  13. 23
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  14. 5
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
  15. 11
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  16. 2
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java
  17. 1
      designer-base/src/main/java/com/fr/design/designer/EditingState.java
  18. 6
      designer-base/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptor.java
  19. 4
      designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java
  20. 1
      designer-base/src/main/java/com/fr/design/dialog/JWizardDialog.java
  21. 2
      designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java
  22. 19
      designer-base/src/main/java/com/fr/design/editor/editor/WidgetNameEditor.java
  23. 2
      designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java
  24. 1
      designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java
  25. 4
      designer-base/src/main/java/com/fr/design/extra/AppStoreBuilder.java
  26. 9
      designer-base/src/main/java/com/fr/design/extra/LoginDialog.java
  27. 7
      designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java
  28. 3
      designer-base/src/main/java/com/fr/design/extra/PluginAbstractLoadingViewPane.java
  29. 5
      designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java
  30. 10
      designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java
  31. 3
      designer-base/src/main/java/com/fr/design/extra/PluginUpdatePane.java
  32. 10
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  33. 2
      designer-base/src/main/java/com/fr/design/extra/QQLoginDialog.java
  34. 1
      designer-base/src/main/java/com/fr/design/extra/ShopDialog.java
  35. 38
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  36. 11
      designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java
  37. 22
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  38. 1
      designer-base/src/main/java/com/fr/design/fun/ParameterWidgetOptionProvider.java
  39. 40
      designer-base/src/main/java/com/fr/design/fun/ReportSupportedFileUIProvider.java
  40. 40
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportSupportedFileUIProvider.java
  41. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java
  42. 4
      designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java
  43. 2
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java
  44. 12
      designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java
  45. 42
      designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java
  46. 3
      designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java
  47. 2
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java
  48. 44
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java
  49. 8
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java
  50. 41
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java
  51. 8
      designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java
  52. 21
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java
  53. 31
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java
  54. 14
      designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java
  55. 34
      designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java
  56. 6
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxUtilities.java
  57. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java
  58. 4
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java
  59. 9
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java
  60. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/folding/HtmlFoldParser.java
  61. 1
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/FormulaTokenMaker.java
  62. 2
      designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java
  63. 4
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java
  64. 6
      designer-base/src/main/java/com/fr/design/layout/TableLayout.java
  65. 64
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  66. 16
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  67. 25
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  68. 20
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  69. 2
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java
  70. 6
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java
  71. 3
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java
  72. 2
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java
  73. 2
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java
  74. 3
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java
  75. 3
      designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java
  76. 3
      designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java
  77. 14
      designer-base/src/main/java/com/fr/design/os/impl/RestartAction.java
  78. 26
      designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthManagerAction.java
  79. 36
      designer-base/src/main/java/com/fr/design/remote/ui/AbstractManagerPane.java
  80. 2
      designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrPane.java
  81. 2
      designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateFitAttrPane.java
  82. 4
      designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java
  83. 6
      designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java
  84. 8
      designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java
  85. 93
      designer-base/src/main/java/com/fr/design/style/color/ColorPicker.java
  86. 42
      designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java
  87. 65
      designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java
  88. 58
      designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java
  89. 25
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  90. 14
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  91. 77
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  92. 37
      designer-base/src/main/java/com/fr/env/RemoteWorkspaceURL.java
  93. 59
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  94. 8
      designer-base/src/main/java/com/fr/file/FileNodeFILE.java
  95. 62
      designer-base/src/test/java/com/fr/design/gui/itree/filetree/FileNodeConstantsTest.java
  96. 48
      designer-base/src/test/java/com/fr/env/RemoteWorkspaceURLTest.java
  97. 39
      designer-base/src/test/java/com/fr/file/FILEChooserPaneTest.java
  98. 2
      designer-chart/src/main/java/com/fr/design/chart/ChartCommonWizardPane.java
  99. 2
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  100. 6
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java
  101. Some files were not shown because too many files have changed in this diff Show More

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);
}
/**
* 更新缓存的参数
*/

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

@ -6,12 +6,12 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.os.OperatingSystem;
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;
@ -19,8 +19,6 @@ import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@ -33,7 +31,7 @@ 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 final OSBasedAction restartAction = new RestartAction();
/**
* 把要删除的文件都记录到delete.properties中
@ -146,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);
}
}
/**
* 重启设计器并删除某些特定的文件
*
@ -171,8 +183,7 @@ public class RestartHelper {
}catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
OSBasedAction osBasedAction = OSSupportCenter.getAction(RestartAction.class);
osBasedAction.execute(filesToBeDelete);
restartAction.execute(filesToBeDelete);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
@ -186,40 +197,4 @@ public class RestartHelper {
DesignerContext.getDesignerFrame().exit();
}
}
/* private static void restartInMacOS(String installHome, String[] filesToBeDelete) throws Exception {
ProcessBuilder builder = new ProcessBuilder();
List<String> commands = new ArrayList<String>();
commands.add("open");
commands.add(installHome + File.separator + "bin" + File.separator + "restart.app");
if (ArrayUtils.isNotEmpty(filesToBeDelete)) {
commands.add("--args");
commands.add(StableUtils.join(filesToBeDelete, "+"));
}
builder.command(commands);
builder.start();
}
private static void restartInWindows(String installHome, String[] filesToBeDelete) throws Exception {
ProcessBuilder builder = new ProcessBuilder();
List<String> commands = new ArrayList<String>();
commands.add(installHome + File.separator + "bin" + File.separator + "restart.exe");
if (ArrayUtils.isNotEmpty(filesToBeDelete)) {
commands.add(StableUtils.join(filesToBeDelete, "+"));
}
builder.command(commands);
builder.start();
}
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");
if (ArrayUtils.isNotEmpty(filesToBeDelete)) {
commands.add(StableUtils.join(filesToBeDelete, "+"));
}
builder.command(commands);
builder.start();
}*/
}

27
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;
@ -133,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;
@ -194,11 +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);
@ -263,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);
@ -307,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;
}
@ -672,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 {
@ -707,7 +702,6 @@ public class PreferencePane extends BasicPane {
this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort()));
openDebugComboBox.setSelected(designerEnvManager.isOpenDebug());
useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM());
useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM());
@ -777,8 +771,6 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setJettyServerPort(portEditor.getValue().intValue());
designerEnvManager.setOpenDebug(openDebugComboBox.isSelected());
designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected());
designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue());
designerEnvManager.setJoinProductImprove(this.joinProductImproveCheckBox.isSelected());
@ -891,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);
@ -1070,3 +1062,4 @@ public class PreferencePane extends BasicPane {
}
}

43
designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java

@ -57,49 +57,6 @@ public class ConnectionListAction extends UpdateAction {
osBasedAction.execute();
}
/* private void openDesignDatabaseManager() {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final ConnectionConfig datasourceManager = ConnectionConfig.getInstance();
final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() {
public void complete() {
ConnectionConfig connectionConfig = datasourceManager.mirror();
populate(connectionConfig);
}
protected void renameConnection(String oldName, String newName) {
datasourceManager.renameConnection(oldName, newName);
}
};
final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null);
databaseListDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
if (!databaseManagerPane.isNamePermitted()) {
databaseListDialog.setDoOKSucceed(false);
return;
}
Configurations.modify(new WorkerFacade(ConnectionConfig.class) {
@Override
public void run() {
databaseManagerPane.update(datasourceManager);
}
}.addCallBack(new CallBackAdaptor() {
@Override
public boolean beforeCommit() {
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
return doWithDatasourceManager(datasourceManager, databaseManagerPane, databaseListDialog);
}
@Override
public void afterCommit() {
DesignerContext.getDesignerBean("databasename").refreshBeanElement();
}
}));
}
});
databaseListDialog.setVisible(true);
}
*/
/**
* 更新datasourceManager
*

1
designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java

@ -16,7 +16,6 @@ import java.awt.event.ActionEvent;
* @since 8.0
*/
public class PluginManagerAction extends UpdateAction {
private static String PLUGIN_MANAGER_ROUTE = "#management/plugin";
public PluginManagerAction() {
this.setMenuKeySet(PLUGIN_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName());

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() {

8
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/AutoStoreProcedureTableModel.java

@ -38,6 +38,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
this.setDefaultEditor(ParameterTableModel.ParameterEditor.class, new ParameterTableModel().new ParameterEditor());
this.setDefaultRenderer(StoreProcedureParameterValueEditor.class, new ProcedureParameterValueRenderer());
}
@Override
public boolean isCellEditable(int row, int col) {
if (ComparatorUtils.equals(getValueAt(row, col -1), "OUT")) {
return false;
@ -48,6 +49,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
return false;
}
@Override
public boolean shouldResponseDoubleClickAction () {
return false;
}
@ -77,15 +79,16 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
}, 100);
}
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
//do nothing
}
});
this.addCellEditorListener(new CellEditorListener() {
@Override
public void editingCanceled(ChangeEvent e) {
//do nothing
}
@Override
@ -147,6 +150,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
editor = ValueEditorPaneFactory.createStoreProcedValueEditorPane();
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
editor.setCurrentEditor(0);
editor.populate(value);

3
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java

@ -124,6 +124,7 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
java.util.List<ParameterProvider> oldParas = editorPane.update();
oldParas.add(new Parameter());
@ -132,6 +133,7 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
@Override
public void checkEnabled() {
//do nothing
}
}
private class RemoveParaAction extends UITableEditAction {
@ -149,6 +151,7 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
@Override
public void checkEnabled() {
//do nothing
}
}

25
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/CustomDictModel.java

@ -1,22 +1,21 @@
package com.fr.design.data.tabledata.tabledatapane;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import com.fr.design.gui.itableeditorpane.ActionStyle;
import com.fr.design.gui.itableeditorpane.UIArrayTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditAction;
import com.fr.design.gui.itableeditorpane.UITableModelAdapter;
import com.fr.design.gui.itextfield.UITextField;
import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
import javax.swing.table.TableCellEditor;
import com.fr.design.gui.itableeditorpane.ActionStyle;
import com.fr.design.gui.itableeditorpane.UIArrayTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditAction;
import com.fr.design.gui.itableeditorpane.UITableModelAdapter;
import com.fr.design.gui.itextfield.UITextField;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
public class CustomDictModel extends UITableModelAdapter<Object[]> implements ActionStyle {
/**
@ -34,11 +33,13 @@ public class CustomDictModel extends UITableModelAdapter<Object[]> implements Ac
this.setDefaultEditor(ParameterEditor.class, new ParameterEditor());
}
@Override
public Object getValueAt(int row, int column) {
Object[] os = this.getList().get(row);
return os[column];
}
@Override
public void setValueAt(Object value, int row, int column) {
Object[] os = this.getList().get(row);
os[column] = value;
@ -104,7 +105,7 @@ public class CustomDictModel extends UITableModelAdapter<Object[]> implements Ac
@Override
public void editingCanceled(ChangeEvent e) {
//do nothing
}
@Override

23
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;
@ -521,6 +521,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
@Override
public void checkEnabled() {
//do nothing
}
}
@ -832,7 +833,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
}
private class XMLNodeTree extends JTree {
private DefaultTreeModel treeModel;
private DefaultTreeModel xmlTreeModel;
private DefaultTreeModel waitTreeModel = null;
@ -854,7 +855,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
private MouseListener treeMouseListener = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (XMLNodeTree.this.getModel() != treeModel) {
if (XMLNodeTree.this.getModel() != xmlTreeModel) {
return;
}
int selRow = XMLNodeTree.this.getRowForLocation(e.getX(), e.getY());
@ -891,7 +892,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
}
public DefaultTreeModel getTreeModel() {
return treeModel;
return xmlTreeModel;
}
//防止界面卡死。
@ -908,7 +909,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
//wikky:为满足706设计时对不合法的xml文件(有多个根节点)的处理,把拿到的InputStream强制在最外层添加<XML></XML>作为唯一根节点而将文件转换为合法的xml。
private void initData() {
params = getEditorPaneParameter(); // 生成tree结构放哪儿呢?放这里感觉不对撒
treeModel = null;
xmlTreeModel = null;
selectedNode = null;
xmlColumnsList.clear();
DataSource dataSource = null;
@ -949,17 +950,17 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
loadedTreeModel();
}
if (treeModel == null) {
if (xmlTreeModel == null) {
FineLoggerFactory.getLogger().info("The file is wrong or bad, can not create the XMLReader.");
return;
}
if (treeModel.getChildCount(treeModel.getRoot()) == 1) {
treeModel = new DefaultTreeModel((ExpandMutableTreeNode) treeModel.getChild(treeModel.getRoot(), 0));
if (xmlTreeModel.getChildCount(xmlTreeModel.getRoot()) == 1) {
xmlTreeModel = new DefaultTreeModel((ExpandMutableTreeNode) xmlTreeModel.getChild(xmlTreeModel.getRoot(), 0));
} else {
ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot();
ExpandMutableTreeNode root = (ExpandMutableTreeNode) xmlTreeModel.getRoot();
root.setUserObject(StringUtils.EMPTY);
}
this.setModel(treeModel);
this.setModel(xmlTreeModel);
}
private void loadedTreeModel() {
@ -1011,7 +1012,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
}
currentNode = new ExpandMutableTreeNode(nodeName);
if (layer == 0) {
treeModel = new DefaultTreeModel(currentNode);
xmlTreeModel = new DefaultTreeModel(currentNode);
} else {
boolean conflict = false;
for (int i = 0; i < parentNode.getChildCount(); i++) {

5
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java

@ -144,12 +144,14 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
refresh();
}
@Override
public void checkEnabled() {
//do nothing
}
}
@ -259,14 +261,17 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
private UIButton formulaButton;
private DocumentListener documentListener = new DocumentListener() {
@Override
public void changedUpdate(DocumentEvent e) {
updateFormula(formulaContentTextField.getText());
}
@Override
public void insertUpdate(DocumentEvent e) {
updateFormula(formulaContentTextField.getText());
}
@Override
public void removeUpdate(DocumentEvent e) {
updateFormula(formulaContentTextField.getText());
}

11
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java

@ -187,6 +187,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
}
populateWorker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
try {
storeProcedureContext.setText(StringUtils.EMPTY);
@ -204,6 +205,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
return null;
}
@Override
public void done() {
editorPane.populate(storeprocedure.getParameters());
}
@ -218,6 +220,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
*
* @param listener 监听器
*/
@Override
public void addStoreProcedureWorkerListener(StoreProcedureWorkerListener listener) {
this.storeProcedureWorkerListener = listener;
@ -227,6 +230,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
/**
* 去除存储过程监听器
*/
@Override
public void removeStoreProcedureWorkerListener() {
this.storeProcedureWorkerListener = null;
@ -264,6 +268,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
}
updateWorker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
sp.setCalculating(true);
@ -271,6 +276,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
return null;
}
@Override
public void done() {
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
sp.setCalculating(false);
@ -328,6 +334,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
/**
* 响应数据集改变
*/
@Override
public void fireDSChanged() {
fireDSChanged(new HashMap<String, String>());
}
@ -337,6 +344,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
*
* @param map 改变的map
*/
@Override
public void fireDSChanged(Map<String, String> map) {
DesignTableDataManager.fireDSChanged(map);
}
@ -348,6 +356,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png"));
}
@Override
public void actionPerformed(ActionEvent evt) {
StoreProcedure sp = updateBeanWithOutExecute();
StoreProcedureDataWrapper storeProcedureDataWrappe = new StoreProcedureDataWrapper(sp, StringUtils.EMPTY, queryText.getText());
@ -361,12 +370,14 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
refresh();
}
@Override
public void checkEnabled() {
//do nothing
}
}
}

2
designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java

@ -27,6 +27,6 @@ public class UniversalDatabaseDialog extends UIDialog {
@Override
public void checkValid() throws Exception {
//do nothing
}
}

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

@ -7,6 +7,7 @@ public interface EditingState {
@Override
public void revert() {
//do nothing
}
};

6
designer-base/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptor.java

@ -4,7 +4,7 @@
package com.fr.design.designer.creator;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.stable.core.PropertyChangeListener;
import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
@ -17,7 +17,7 @@ public final class CRPropertyDescriptor extends PropertyDescriptor {
public static final String RENDERER = "renderer";
private boolean isSubProperty = false;
private PropertyChangeAdapter l;
private PropertyChangeListener l;
public CRPropertyDescriptor(String name, Class<?> beanClass) throws IntrospectionException {
super(name, beanClass);
@ -35,7 +35,7 @@ public final class CRPropertyDescriptor extends PropertyDescriptor {
return this;
}
public CRPropertyDescriptor setPropertyChangeListener(PropertyChangeAdapter l) {
public CRPropertyDescriptor setPropertyChangeListener(PropertyChangeListener l) {
this.l = l;
return this;
}

4
designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java

@ -121,12 +121,12 @@ public abstract class BasicScrollPane<T> extends BasicBeanPane<T>{
@Override
public void addLayoutComponent(String name, Component comp) {
//do nothing
}
@Override
public void removeLayoutComponent(Component comp) {
//do nothing
}
@Override

1
designer-base/src/main/java/com/fr/design/dialog/JWizardDialog.java

@ -363,5 +363,6 @@ public class JWizardDialog extends BasicDialog {
@Override
public void checkValid() throws Exception {
//do nothing
}
}

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

@ -168,7 +168,7 @@ public class JWizardPanel extends BasicPane {
public void addNotify() {
if (firstNotify) {
Font font = stepTitleLabel.getFont();
font = font.deriveFont(Font.BOLD, font.getSize() * 14 / 10.0F);
font = font.deriveFont(Font.BOLD, (float) (font.getSize() * 14 / 10.0D));
stepTitleLabel.setFont(font);
firstNotify = false;
}

19
designer-base/src/main/java/com/fr/design/editor/editor/WidgetNameEditor.java

@ -1,18 +1,17 @@
package com.fr.design.editor.editor;
import java.awt.BorderLayout;
import java.awt.Component;
import javax.swing.JList;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import com.fr.design.DesignModelAdapter;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.icombobox.FilterComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.js.WidgetName;
import javax.swing.JList;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.BorderLayout;
import java.awt.Component;
/**
* the editor to edit WidgetName
*
@ -43,12 +42,12 @@ public class WidgetNameEditor extends Editor<WidgetName> {
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
//do nothing
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
//do nothing
}
@Override

2
designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java vendored

@ -64,7 +64,9 @@ public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
writer.attr("path", path);
}
@Override
@SuppressWarnings("squid:S2975")
public Object clone() throws CloneNotSupportedException {
LocalDesignerWorkspaceInfo object = (LocalDesignerWorkspaceInfo)super.clone();

1
designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java vendored

@ -79,6 +79,7 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
}
@Override
@SuppressWarnings("squid:S2975")
public Object clone() throws CloneNotSupportedException {
RemoteDesignerWorkspaceInfo object = (RemoteDesignerWorkspaceInfo) super.clone();

4
designer-base/src/main/java/com/fr/design/extra/AppStoreBuilder.java

@ -10,10 +10,10 @@ package com.fr.design.extra;
public class AppStoreBuilder {
public void checkStoreJavaSciptVersion() {
//do nothing
}
public void updateStoreJavaScript() {
//do nothing
}
}

9
designer-base/src/main/java/com/fr/design/extra/LoginDialog.java

@ -4,12 +4,8 @@ import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StableUtils;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Frame;
import javax.swing.*;
import java.awt.*;
/**
* Created by vito on 2017/5/5.
@ -41,5 +37,6 @@ public class LoginDialog extends UIDialog {
@Override
public void checkValid() throws Exception {
// do nothing
}
}

7
designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java

@ -14,10 +14,8 @@ import javafx.concurrent.Task;
import javafx.scene.web.WebEngine;
import netscape.javascript.JSObject;
import javax.swing.JDialog;
import javax.swing.SwingUtilities;
import java.awt.Color;
import java.awt.Desktop;
import javax.swing.*;
import java.awt.*;
import java.net.URI;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -221,5 +219,6 @@ public class LoginWebBridge {
}
public void openUrlAtLocalWebBrowser(WebEngine eng, String url) {
// do nothing
}
}

3
designer-base/src/main/java/com/fr/design/extra/PluginAbstractLoadingViewPane.java

@ -4,7 +4,6 @@ import com.fr.base.BaseUtils;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
@ -88,7 +87,7 @@ public abstract class PluginAbstractLoadingViewPane<V, T> extends PluginAbstract
@Override
public void pressInstallButton() {
// do nothing
}
@Override

5
designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java

@ -7,7 +7,6 @@ import com.fr.design.gui.ilist.UIList;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.license.Licensed;
import com.fr.plugin.manage.PluginManager;
@ -23,7 +22,7 @@ import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -155,7 +154,7 @@ public class PluginControlPane extends BasicPane {
PluginManager.getController().uninstall(PluginMarker.create(id, version), true, new PluginTaskCallback() {
@Override
public void done(PluginTaskResult result) {
// do nothing
}
});
}

10
designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java

@ -13,11 +13,7 @@ import com.fr.plugin.manage.control.ProgressCallback;
import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.io.File;
import java.util.List;
@ -98,7 +94,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
@Override
public void pressInstallButton() {
// do nothing
}
@Override
@ -174,7 +170,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
PluginManager.getController().install(chosenFile, new ProgressCallback() {
@Override
public void updateProgress(String description, double progress) {
// do nothing
}
@Override

3
designer-base/src/main/java/com/fr/design/extra/PluginUpdatePane.java

@ -4,7 +4,6 @@ import com.fr.config.MarketConfig;
import com.fr.design.extra.tradition.callback.UpdateOnlineCallback;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker;
@ -192,7 +191,7 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<List<PluginV
PluginManager.getController().update(chosenFile, new ProgressCallback() {
@Override
public void updateProgress(String description, double progress) {
// do nothing
}
@Override

10
designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java

@ -55,7 +55,7 @@ public class PluginWebBridge {
private static PluginWebBridge helper;
private UIDialog uiDialog;
private ACTIONS action;
private ACTIONS actions;
private Map<String, Object> config;
private WebEngine webEngine;
@ -94,10 +94,10 @@ public class PluginWebBridge {
* @return 配置信息
*/
public String getRunConfig() {
if (action != null) {
if (actions != null) {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put(ACTION, action.getContext());
jsonObject.put(ACTION, actions.getContext());
Set<String> keySet = config.keySet();
for (String key : keySet) {
jsonObject.put(key, config.get(key).toString());
@ -117,7 +117,7 @@ public class PluginWebBridge {
* @param config 参数
*/
public void setRunConfig(ACTIONS action, Map<String, Object> config) {
this.action = action;
this.actions = action;
this.config = config;
}
@ -125,7 +125,7 @@ public class PluginWebBridge {
* 清楚打开动作
*/
public void clearRunConfig() {
this.action = null;
this.actions = null;
this.config = null;
}

2
designer-base/src/main/java/com/fr/design/extra/QQLoginDialog.java

@ -3,7 +3,6 @@ package com.fr.design.extra;
import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
@ -27,6 +26,7 @@ public class QQLoginDialog extends UIDialog {
@Override
public void checkValid() throws Exception {
// do nothing
}
}

1
designer-base/src/main/java/com/fr/design/extra/ShopDialog.java

@ -29,5 +29,6 @@ public class ShopDialog extends UIDialog {
@Override
public void checkValid() throws Exception {
// do nothing
}
}

38
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

@ -21,26 +21,9 @@ import com.fr.third.javax.annotation.Nonnull;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator;
import javax.swing.BorderFactory;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.*;
import javax.swing.plaf.basic.BasicMenuItemUI;
import java.awt.AWTEvent;
import java.awt.AlphaComposite;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.*;
import java.awt.event.AWTEventListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -398,8 +381,8 @@ public class MutilTempalteTabPane extends JComponent {
//画下面的那条线
if (templateStartX < maxWidth) {
GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, 2);
generalPath.moveTo((float) templateStartX, getHeight() - 1.0F);
generalPath.lineTo((float) maxWidth, getHeight() - 1.0F);
generalPath.moveTo((float) templateStartX, (float) (getHeight() - 1.0D));
generalPath.lineTo((float) maxWidth, (float) (getHeight() - 1.0D));
g2d.fill(generalPath);
//TODO hzzz delete
// g2d.setPaint(UIConstants.LINE_COLOR);
@ -409,7 +392,7 @@ public class MutilTempalteTabPane extends JComponent {
private void paintDefaultBackground(Graphics2D g2d) {
//画默认背景
g2d.setPaint(new GradientPaint(1, 1, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND, 1, getHeight() - 1.0F, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND));
g2d.setPaint(new GradientPaint(1, 1, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND, 1, (float) (getHeight() - 1.0D), UIConstants.TEMPLATE_TAB_PANE_BACKGROUND));
g2d.fillRect(0, 0, getWidth(), getHeight());
}
@ -535,7 +518,7 @@ public class MutilTempalteTabPane extends JComponent {
double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX};
double[] y = {1, getHeight() + 1, getHeight() + 1, 1, 1};
RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(templateStartX, 1, this.getWidth(), this.getHeight(), 7, 7);
g2d.setPaint(new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, getHeight() - 1.0F, UIConstants.SELECT_TAB));
g2d.setPaint(new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, (float) (getHeight() - 1.0D), UIConstants.SELECT_TAB));
//选了30度和60度的特殊角度的x,y作为经过的两个点的坐标
double specialLocation1 = 2.5;
double specialLocation2 = 4.330127;
@ -590,9 +573,9 @@ public class MutilTempalteTabPane extends JComponent {
double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX};
double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1};
if (selfIndex == mouseOveredIndex) {
g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, getHeight() - 1.0F, UIConstants.HOVER_BLUE));
g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, (float) (getHeight() - 1.0D), UIConstants.HOVER_BLUE));
} else {
g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, getHeight() - 1.0F, UIConstants.SHADOW_GREY));
g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, (float) (getHeight() - 1.0D), UIConstants.SHADOW_GREY));
}
@ -854,7 +837,7 @@ public class MutilTempalteTabPane extends JComponent {
*/
@Override
public void mouseEntered(MouseEvent e) {
// do nothing
}
/**
@ -877,6 +860,7 @@ public class MutilTempalteTabPane extends JComponent {
*/
@Override
public void mouseReleased(MouseEvent e) {
// do nothing
}
/**
@ -886,6 +870,7 @@ public class MutilTempalteTabPane extends JComponent {
*/
@Override
public void mouseClicked(MouseEvent e) {
// do nothing
}
/**
@ -957,6 +942,7 @@ public class MutilTempalteTabPane extends JComponent {
*/
@Override
public void mouseDragged(MouseEvent e) {
// do nothing
}
/**

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();
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) {
@ -128,7 +135,7 @@ public class NodeAuthProcessor {
* @param fileNode file nodes
* @return 带权限信息的文件节点
*/
public boolean fixFileNodeAuth(FileNode fileNode) {
public boolean checkFileNodeAuth(FileNode fileNode) {
boolean isLocal = WorkContext.getCurrent().isLocal();
boolean isRoot = WorkContext.getCurrent().isRoot();

22
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -27,17 +27,7 @@ import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.stable.script.Expression;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.TreeSelectionEvent;
@ -47,10 +37,7 @@ import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.MutableTreeNode;
import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
@ -148,10 +135,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
keyWordTextField.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
//do nothing
}
@Override
public void keyReleased(KeyEvent e) {
//do nothing
}
@Override
@ -236,7 +225,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
protected void extendCheckBoxPane(JPanel checkBoxPane) {
// do nothing
}
private void configFormulaArea() {
@ -412,6 +401,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
@Override
public void keyTyped(KeyEvent e) {
// do nothing
}
protected void search(String keyWord, boolean findDescription) {

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();
}
});
}

4
designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java

@ -172,11 +172,9 @@ public class UIComboBoxButton extends JButton {
}
c.setBackground(UIManager.getColor("ComboBox.focusBackground"));
if (c instanceof JComponent) {
mustResetOpaque = true;
JComponent jc = (JComponent) c;
savedOpaque = jc.isOpaque();
jc.isOpaque();
jc.setOpaque(true);
paintFocus = true;
}
} else {
c.setForeground(comboBox.getForeground());

2
designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java

@ -46,7 +46,7 @@ public class UIModeControlContainer extends JLayeredPane {
private boolean isHideMode = false;
private boolean isSheeetCovered = false;
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 30 / 100.0F);
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f);
public UIModeControlContainer() {
this(new JPanel(), new JPanel());

12
designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java

@ -1,5 +1,6 @@
package com.fr.design.gui.ilable;
import javax.swing.event.MouseInputAdapter;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Graphics;
@ -7,9 +8,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.event.MouseInputAdapter;
/**
* Action label
*/
@ -31,6 +29,7 @@ public class ActionLabel extends UILabel {
/**
* Repaints the text.
*/
@Override
public void paintComponent(Graphics _gfx) {
super.paintComponent(_gfx);
@ -39,12 +38,17 @@ public class ActionLabel extends UILabel {
}
private MouseInputAdapter mouseInputAdapter = new MouseInputAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
//do nothing
}
@Override
public void mousePressed(MouseEvent e) {
//do nothing
}
@Override
public void mouseReleased(MouseEvent evt) {
Object source = evt.getSource();
@ -65,6 +69,7 @@ public class ActionLabel extends UILabel {
}
}
@Override
public void mouseExited(MouseEvent evt) {
Object source = evt.getSource();
@ -73,6 +78,7 @@ public class ActionLabel extends UILabel {
}
}
@Override
public void mouseDragged(MouseEvent e) {
}

42
designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java

@ -287,7 +287,7 @@ public class UIBasicMenuItemUI extends MenuItemUI {
View v = (View) c.getClientProperty(BasicHTML.propertyKey);
if (v != null) {
d = getPreferredSize(c);
d.width -= v.getPreferredSpan(View.X_AXIS) - v.getMinimumSpan(View.X_AXIS);
d.width -= (double) v.getPreferredSpan(View.X_AXIS) - (double) v.getMinimumSpan(View.X_AXIS);
}
return d;
}
@ -345,7 +345,7 @@ public class UIBasicMenuItemUI extends MenuItemUI {
View v = (View) c.getClientProperty(BasicHTML.propertyKey);
if (v != null) {
d = getPreferredSize(c);
d.width += v.getMaximumSpan(View.X_AXIS) - v.getPreferredSpan(View.X_AXIS);
d.width += (double) v.getMaximumSpan(View.X_AXIS) - (double) v.getPreferredSpan(View.X_AXIS);
}
return d;
}
@ -816,7 +816,6 @@ public class UIBasicMenuItemUI extends MenuItemUI {
// get Accelerator text
KeyStroke accelerator = b.getAccelerator();
String acceleratorText = "";
drawMenu(acceleratorText, accelerator, c, ic, maxValue, offset, paintIcon, b);
String text = layoutMenuItem(fm, b.getText(), fmAccel, acceleratorText, ic, null,
arrowIcon, b.getVerticalAlignment(), b.getHorizontalAlignment(),
b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect,
@ -834,43 +833,6 @@ public class UIBasicMenuItemUI extends MenuItemUI {
g.setFont(holdf);
}
private void drawMenu(String acceleratorText, KeyStroke accelerator, JComponent c,
Icon ic, int maxValue, int offset, Icon paintIcon, JMenuItem b) {
if (accelerator != null) {
int modifiers = accelerator.getModifiers();
if (modifiers > 0) {
acceleratorText = KeyEvent.getKeyModifiersText(modifiers);
//acceleratorText += "-";
acceleratorText += acceleratorDelimiter;
}
int keyCode = accelerator.getKeyCode();
if (keyCode != 0) {
acceleratorText += KeyEvent.getKeyText(keyCode);
} else {
acceleratorText += accelerator.getKeyChar();
}
}
if (!isTopLevelMenu()) {
if (c instanceof JCheckBoxMenuItem || c instanceof JRadioButtonMenuItem) {
ic = checkIcon;
if (checkIcon.getIconWidth() < maxValue) {
ic = new EmptyIcon(maxValue, checkIcon.getIconHeight());
offset = (maxValue - checkIcon.getIconWidth()) / 2;
}
paintIcon = null;
} else if (c instanceof JMenuItem) {
if (ic == null || ic.getIconWidth() < maxValue) {
int height = (ic == null) ? 2 : b.getIcon().getIconHeight();
int width = (ic == null) ? 2 : b.getIcon().getIconWidth();
offset = (maxValue - width) / 2;
ic = new EmptyIcon(maxValue, height);
}
}
}
}
private void drawAccText(String acceleratorText, Graphics g, JComponent p, ButtonModel model, FontMetrics fmAccel, JComponent c) {
if (acceleratorText != null && !ComparatorUtils.equals(acceleratorText, "")) {
//Get the maxAccWidth from the parent to calculate the offset.

3
designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java

@ -157,8 +157,7 @@ public class UIMenuTable extends JTable {
@Override
public TableCellRenderer getDefaultRenderer(Class<?> columnClass) {
columnClass = UITable.class;
return super.getDefaultRenderer(columnClass);
return super.getDefaultRenderer(UITable.class);
}
private class UITableRender implements TableCellRenderer {

2
designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java

@ -72,6 +72,7 @@ public class UIProgressBorder extends UIRoundedBorder {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
@SuppressWarnings("squid:S2164")
private void paintBorderShadow(Graphics2D g2, int shadowWidth, int x, int y, int width, int height) {
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
shadowWidth = Math.max(shadowWidth, 2);
@ -85,6 +86,7 @@ public class UIProgressBorder extends UIRoundedBorder {
}
}
@SuppressWarnings("squid:S2164")
private static Color getMixedColor(Color c1, float pct1, Color c2, float pct2) {
float[] clr1 = c1.getComponents(null);
float[] clr2 = c2.getComponents(null);

44
designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java

@ -165,50 +165,6 @@ public class UIBasicScrollBarUI extends BasicScrollBarUI {
// drawColorAndLength(g, t, x2, y2, color);
}
private void drawColorAndLength(Graphics g, Rectangle t, int x2, int y2, Color color) {
if (scrollbar.getOrientation() == JScrollBar.VERTICAL) {
int y1 = t.y + (t.height) / 2 - 4;
y2 = Math.min(y1 + 8, t.y + t.height - 5);
int y = y1;
// we take only saturation & brightness and apply them
// to the background color (normal/rollover/pressed)
g.setColor(UISBChooser.getAdjustedColor(color, 0, 71));
while (y < y2) {
g.drawLine(5, y, 11, y);
y += 2;
}
y = y1 + 1;
g.setColor(UISBChooser.getAdjustedColor(color, 0, -13));
while (y < y2) {
g.drawLine(6, y, 12, y);
y += 2;
}
} else {
int x1 = t.x + (t.width) / 2 - 4;
x2 = Math.min(x1 + 8, t.x + t.width - 5);
int x = x1 + 1;
// we take only saturation & brightness and apply them
// to the background color (normal/rollover/pressed)
g.setColor(UISBChooser.getAdjustedColor(color, 0, 71));
while (x < x2) {
g.drawLine(x, 5, x, 11);
x += 2;
}
x = x1;
g.setColor(UISBChooser.getAdjustedColor(color, 0, -13));
while (x < x2) {
g.drawLine(x, 6, x, 12);
x += 2;
}
}
}
private void drawVertical(Graphics g, Rectangle t, int xs, int ys, int x2,
Color pressedColor, Color rolloverColor,
Color normalColor) {

8
designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java

@ -90,6 +90,7 @@ public class UISBChooser extends JDialog {
(frame.getHeight() - getSize().height) / 2);
}
@SuppressWarnings("squid:S1226")
private void initP3(JPanel p3, JPanel p1) {
p3 = new JPanel(new FlowLayout(FlowLayout.LEFT, 3, 8));
p3.add(new JLabel("R:"));
@ -198,6 +199,7 @@ public class UISBChooser extends JDialog {
twoColorField.setUpperColor(outColor);
}
@SuppressWarnings("squid:S2164")
public static Color getAdjustedColor(Color inColor, int sat, int bri) {
Color briColor = inColor;
@ -219,9 +221,9 @@ public class UISBChooser extends JDialog {
int dg = briColor.getGreen() - satColor.getGreen();
int db = briColor.getBlue() - satColor.getBlue();
r = briColor.getRed() - (int) Math.round(dr * sat / VALUE * 1.0);
g = briColor.getGreen() - (int) Math.round(dg * sat / VALUE * 1.0);
b = briColor.getBlue() - (int) Math.round(db * sat / VALUE * 1.0);
r = briColor.getRed() - (int) Math.round(dr * sat / (VALUE * 1.0));
g = briColor.getGreen() - (int) Math.round(dg * sat / (VALUE * 1.0));
b = briColor.getBlue() - (int) Math.round(db * sat / (VALUE * 1.0));
} else {
float d = ColorRoutines.getGreyValue(briColor);
float dr = briColor.getRed() - d;

41
designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java

@ -2,6 +2,25 @@ package com.fr.design.gui.iscrollbar;
import com.fr.design.constants.UIConstants;
import com.fr.stable.StringUtils;
import sun.swing.DefaultLookup;
import javax.swing.BoundedRangeModel;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.JViewport;
import javax.swing.LookAndFeel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ScrollBarUI;
import javax.swing.plaf.UIResource;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
@ -22,24 +41,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.BoundedRangeModel;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.JViewport;
import javax.swing.LookAndFeel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ScrollBarUI;
import javax.swing.plaf.UIResource;
import sun.swing.DefaultLookup;
/**
* Like BasicScrollBarUI,but without two buttons
@ -590,6 +591,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* will cause a repaint.
*/
@SuppressWarnings("squid:S2164")
protected void layoutVScrollbar(JScrollBar sb) {
Dimension sbSize = sb.getSize();
Insets sbInsets = sb.getInsets();
@ -672,6 +674,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* Make sure the thumb fits between the buttons. Note that setting the
* thumbs bounds causes a repaint.
*/
@SuppressWarnings("squid:S2164")
protected void layoutHScrollbar(JScrollBar sb) {
Dimension sbSize = sb.getSize();
Insets sbInsets = sb.getInsets();
@ -1080,7 +1083,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
scrollbar.repaint();
}
@SuppressWarnings("squid:S2164")
private void setValueFrom(MouseEvent e) {
boolean active = isThumbRollover();
BoundedRangeModel model = scrollbar.getModel();

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();
}

31
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,14 +149,40 @@ 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 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) {

14
designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java

@ -102,7 +102,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_s_normal_white.png")},
{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/defaultAlignment_white.png")}};
Integer[] hAlignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT, Integer.valueOf(Constants.DISTRIBUTED), Constants.NULL};
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment);
hAlignmentPane = new UIButtonGroup<>(hAlignmentIconArray, hAlignment);
hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Right"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Distributed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_DEFAULT")});
hPaneContainer = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
@ -112,7 +112,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal_white.png")},
{IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png"), IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal_white.png")}};
Integer[] vAlignment = new Integer[]{Constants.TOP, Constants.CENTER, Constants.BOTTOM};
vAlignmentPane = new UIButtonGroup<Integer>(vAlignmentIconArray, vAlignment);
vAlignmentPane = new UIButtonGroup<>(vAlignmentIconArray, vAlignment);
vAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Top"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Tooltips_Bottom")});
initOtherComponent();
initAllNames();
@ -174,7 +174,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
}
private void initTextRotationCombox() {
ArrayList<String> selectOption = new ArrayList<String>();
ArrayList<String> selectOption = new ArrayList<>();
selectOption.add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Angle"));
VerticalTextProcessor processor = ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class);
selectOption.addAll(Arrays.asList(processor.getComboxOption()));
@ -343,8 +343,8 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
int rightPadding = indentationUnitProcessor.paddingUnitProcessor(style.getPaddingRight());
// alex:indent
this.leftIndentSpinner.setValue(new Integer(leftPadding));
this.rightIndentSpinner.setValue(new Integer(rightPadding));
this.leftIndentSpinner.setValue(leftPadding);
this.rightIndentSpinner.setValue(rightPadding);
this.spaceBeforeSpinner.setValue(style.getSpacingBefore());
this.spaceAfterSpinner.setValue(style.getSpacingAfter());
@ -360,7 +360,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
public Style update(Style style) {
// peter:需要判断传递进来的值是否为null.
if (style == null) {
return style;
return null;
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style_Alignment_Pane_Horizontal"))) {
@ -463,7 +463,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
}
/**
* @param name
* @param name 全局名
*/
public void setGlobalName(String name) {
}

34
designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java

@ -9,6 +9,8 @@
*/
package com.fr.design.gui.syntax.print;
import com.fr.log.FineLoggerFactory;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.Element;
@ -62,8 +64,8 @@ public abstract class RPrintUtilities {
private static int getLineBreakPoint(String line, final int maxCharsPerLine) {
int breakPoint = -1;
for (int i=0; i<breakChars.length; i++) {
int breakCharPos = line.lastIndexOf(breakChars[i], maxCharsPerLine-1);
for (char breakChar : breakChars) {
int breakCharPos = line.lastIndexOf(breakChar, maxCharsPerLine - 1);
if (breakCharPos > breakPoint)
breakPoint = breakCharPos;
}
@ -147,11 +149,11 @@ public abstract class RPrintUtilities {
int tabIndex = curLineString.indexOf('\t');
while (tabIndex > -1) {
int spacesNeeded = tabSizeInSpaces - (tabIndex % tabSizeInSpaces);
String replacementString = "";
StringBuilder replacementString = new StringBuilder();
for (int i=0; i<spacesNeeded; i++)
replacementString += ' ';
replacementString.append(' ');
// Note that "\t" is actually a regex for this method.
curLineString = curLineString.replaceFirst("\t", replacementString);
curLineString = curLineString.replaceFirst("\t", replacementString.toString());
tabIndex = curLineString.indexOf('\t');
}
}
@ -385,7 +387,7 @@ public abstract class RPrintUtilities {
doc.getText(currentLineStart+startingOffset, currentLineEnd-(currentLineStart+startingOffset),
currentLineSeg);
} catch (BadLocationException ble) {
System.err.println("BadLocationException in print (where there shouldn't be one!): " + ble);
FineLoggerFactory.getLogger().error("BadLocationException in print (where there shouldn't be one!): " + ble.getMessage());
return Printable.NO_SUCH_PAGE;
}
@ -417,12 +419,12 @@ public abstract class RPrintUtilities {
// currentPos will be the last position in the current text of a "line break character."
currentPos = -1;
String currentLineString = currentLineSeg.toString();
for (int i=0; i<breakChars.length; i++) {
for (char breakChar : breakChars) {
// "+1" below so we include the character on the line.
int pos = currentLineString.lastIndexOf(breakChars[i]) + 1;
int pos = currentLineString.lastIndexOf(breakChar) + 1;
//if (pos>-1 && pos>currentPos)
// currentPos = pos;
if (pos>0 && pos>currentPos & pos!=currentLineString.length())
if (pos > 0 && pos > currentPos & pos != currentLineString.length())
currentPos = pos;
}
@ -440,7 +442,7 @@ public abstract class RPrintUtilities {
try {
doc.getText(currentLineStart+startingOffset, currentPos, currentLineSeg);
} catch (BadLocationException ble) {
System.err.println(ble);
FineLoggerFactory.getLogger().error(ble.getMessage());
return Printable.NO_SUCH_PAGE;
}
currentLineLengthInPixels = Utilities.
@ -453,12 +455,11 @@ public abstract class RPrintUtilities {
try {
doc.getText((currentLineStart+startingOffset), currentPos, currentLineSeg);
} catch (BadLocationException ble) {
System.err.println("BadLocationException in print (a):");
System.err.println("==> currentLineStart: " + currentLineStart +
"; startingOffset: " + startingOffset + "; currentPos: " + currentPos);
System.err.println("==> Range: " + (currentLineStart+startingOffset) + " - " +
FineLoggerFactory.getLogger().error("BadLocationException in print (a):" + "==> currentLineStart: " + currentLineStart +
"; startingOffset: " + startingOffset + "; currentPos: " + currentPos +
"==> Range: " + (currentLineStart+startingOffset) + " - " +
(currentLineStart+startingOffset+currentPos));
ble.printStackTrace();
FineLoggerFactory.getLogger().error(ble.getMessage());
return Printable.NO_SUCH_PAGE;
}
@ -521,7 +522,8 @@ public abstract class RPrintUtilities {
return x;
int tabSizeInPixels = tabSizeInSpaces * fm.charWidth(' ');
int ntabs = (((int) x) - xOffset) / tabSizeInPixels;
return xOffset + ((ntabs + 1) * tabSizeInPixels);
double reFloat = (double) xOffset + (double) ((ntabs + 1) * tabSizeInPixels);
return (float) reFloat;
}
}

6
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxUtilities.java

@ -518,6 +518,8 @@ public class RSyntaxUtilities implements SwingConstants {
}
numEmbedded--;
}
} else {
//do nothing
}
} // End of for (int i=segOffset; i<segOffset+charSegment.count; i++).
@ -584,6 +586,8 @@ public class RSyntaxUtilities implements SwingConstants {
}
numEmbedded--;
}
} else {
//do nothing
}
}
@ -961,6 +965,8 @@ public class RSyntaxUtilities implements SwingConstants {
i--;
}
offs = lineStart + i;
} else {
//do nothing
}
}

2
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java

@ -656,7 +656,7 @@ public class SyntaxView extends View implements TabExpander,
if (tabSize == 0)
return x;
int ntabs = (((int) x) - tabBase) / tabSize;
return tabBase + ((ntabs + 1) * tabSize);
return (float) (tabBase + ((ntabs + 1) * tabSize));
}

4
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java

@ -9,6 +9,7 @@
package com.fr.design.gui.syntax.ui.rsyntaxtextarea;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
@ -73,6 +74,9 @@ class TokenIterator implements Iterator<Token> {
token = null;
}
}
else {
throw new NoSuchElementException();
}
return t;
}

9
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java

@ -268,7 +268,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander,
if (host.getEOLMarkersVisible()) {
g.setColor(host.getForegroundForTokenType(Token.WHITESPACE));
g.setFont(host.getFontForTokenType(Token.WHITESPACE));
g.drawString("\u00B6", x, y-fontHeight);
g.drawString("\u00B6", x, (float) (y-fontHeight));
}
}
@ -458,7 +458,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander,
if (host.getEOLMarkersVisible()) {
g.setColor(host.getForegroundForTokenType(Token.WHITESPACE));
g.setFont(host.getFontForTokenType(Token.WHITESPACE));
g.drawString("\u00B6", x, y-fontHeight);
g.drawString("\u00B6", x, (float) (y-fontHeight));
}
}
@ -841,10 +841,11 @@ public class WrappedSyntaxView extends BoxView implements TabExpander,
* @return the tab stop, measured in points >= 0
*/
public float nextTabStop(float x, int tabOffset) {
if (tabSize == 0)
if (tabSize == 0) {
return x;
}
int ntabs = ((int) x - tabBase) / tabSize;
return tabBase + ((ntabs + 1) * tabSize);
return (float) (tabBase + ((ntabs + 1) * tabSize));
}

2
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/folding/HtmlFoldParser.java

@ -172,7 +172,7 @@ public class HtmlFoldParser implements FoldParser {
// Continuing an MLC from a previous line
if (inMLC) {
// Found the end of the MLC starting on a previous line...
if (t.endsWith(MLC_END)) {
if (currentFold != null && t.endsWith(MLC_END)) {
int mlcEnd = t.getEndOffset() - 1;
currentFold.setEndOffset(mlcEnd);
Fold parentFold = currentFold.getParent();

1
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/FormulaTokenMaker.java

@ -18,6 +18,7 @@ import java.io.IOException;
* on 9/18/19 6:12 PM from the specification file
* <tt>/Users/3dot141/Downloads/FolxDownload/App/jflex-1.4.1/bin/FormulaTokenMaker.flex</tt>
*/
@SuppressWarnings("squid:S1192")
public class FormulaTokenMaker extends AbstractJFlexCTokenMaker {
/** This character denotes the end of 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

6
designer-base/src/main/java/com/fr/design/layout/TableLayout.java

@ -1747,7 +1747,7 @@ public class TableLayout implements LayoutManager2, Serializable {
for (counter = 0; counter < numCr; counter++)
if ((crSpec[z][counter] > 0.0) && (crSpec[z][counter] < 1.0))
fillSizeRatio -= crSpec[z][counter];
else if (crSpec[z][counter] == FILL)
else if (AssistUtils.equals(crSpec[z][counter], FILL))
numFillSize++;
// Adjust fill ratios to reflect number of fill rows/columns
@ -1773,8 +1773,8 @@ public class TableLayout implements LayoutManager2, Serializable {
int crPrefMin[] = new int[numCr];
for (counter = 0; counter < numCr; counter++)
if ((crSpec[z][counter] == PREFERRED) ||
(crSpec[z][counter] == MINIMUM)) {
if ((AssistUtils.equals(crSpec[z][counter], PREFERRED)) ||
(AssistUtils.equals(crSpec[z][counter], MINIMUM))) {
crPrefMin[counter] = crSize[z][counter];
}

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)) {

25
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);
}
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;
}

20
designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.ui.util.UIUtil;
import com.fr.general.ComparatorUtils;
import com.fr.general.log.Log4jConfig;
import com.fr.log.FineLoggerFactory;
@ -199,6 +200,7 @@ public class DesignerLogHandler {
jTextArea.addMouseListener(new MouseAdapter() {
// check for right click
@Override
public void mousePressed(MouseEvent event) {
if (event.getButton() == MouseEvent.BUTTON3) {
@ -219,6 +221,7 @@ public class DesignerLogHandler {
ActionMap actionMap = resultPane.getActionMap();
actionMap.put("clear", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) {
resultPane.setText("");
@ -260,21 +263,25 @@ public class DesignerLogHandler {
printMessage(message, intLevel, date, null);
}
private void printMessage(String msg, int intLevel, Date date, Throwable e) {
this.log(LOG_SIMPLE_DATE_FORMAT.format(date) + "\n", 0);
private void printMessage(final String msg, final int intLevel, final Date date, final Throwable e) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
LogHandlerArea.this.log(LOG_SIMPLE_DATE_FORMAT.format(date) + "\n", 0);
String message = appendLocaleMark(msg, intLevel);
this.log(message, intLevel);
LogHandlerArea.this.log(message, intLevel);
setMessage(message, intLevel);
if (e == null) {
return;
}
StackTraceElement[] traceElements = e.getStackTrace();
for (int i = 0; i < traceElements.length; i++) {
this.log("\t" + "at " + traceElements[i].toString() + "\n", 0);
for (StackTraceElement traceElement : traceElements) {
LogHandlerArea.this.log("\t" + "at " + traceElement.toString() + "\n", 0);
}
}
});
}
private void log(String str, int style) {
@ -346,6 +353,7 @@ public class DesignerLogHandler {
ActionListener popupListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.selectAll.getText())) {

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

@ -69,7 +69,7 @@ public class LogHandlerBarUI extends ComponentUI implements MouseListener, Focus
int w = button.getWidth();
int h = button.getHeight();
Graphics2D g2d = (Graphics2D) g;
GradientPaint gp = new GradientPaint(1, 1, darkColor, 1, h - 1, darkColor);
GradientPaint gp = new GradientPaint(1, 1, darkColor, 1, (float)(h - 1), darkColor);
g2d.setPaint(gp);
g2d.fillRect(0, 0, w, h);
}

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/vcs/ui/FileVersionDialog.java

@ -31,7 +31,7 @@ import java.util.List;
public class FileVersionDialog extends UIDialog {
public static final long DELAY = 24 * 60 * 60 * 1000;
public static final long DELAY = 24 * 60 * 60 * 1000L;
private UIButton okBtn;
private UIButton cancelBtn;
private DateEditor dateEditor;

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());
}
});

3
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);
}

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, "+"));
}

26
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);
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()]));
}
if (customAuthorities != null && customAuthorities.length != 0) {
managerPane.populateByCustom(customAuthorities);
}
} catch (Exception exception) {
FineLoggerFactory.getLogger().error(exception.getMessage(), exception);

36
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()];

2
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");
}
}

4
designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java

@ -20,7 +20,7 @@ public class VerticalRulerUI extends RulerUI{
@Override
protected void paintRuler(Graphics g, int showText, int extra, Dimension size, int ratio) {
int k = pxToLength(extra) * ratio;
for (int i = k; i < (pxToLength(size.height + extra) + 1) * ratio; i++) {
for (int i = k; i < (pxToLength( (double)size.height + extra) + 1) * ratio; i++) {
g.setColor(BaseRuler.UNIT_SIGN_COLOR);
if (i % BaseRuler.SCALE_10 == 0) {
double times = (double) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getJTemplateResolution() / ScreenResolution.getScreenResolution();
@ -44,7 +44,7 @@ public class VerticalRulerUI extends RulerUI{
@Override
protected void paintPTRuler(Graphics g, int extra, Dimension size, int unit) {
int k = pxToLength(extra);
for (int i = unit * (k/unit); i < pxToLength(size.height + extra); i += unit) {
for (int i = unit * (k/unit); i < pxToLength((double)size.height + extra); i += unit) {
g.setColor(BaseRuler.UNIT_SIGN_COLOR);
if (i % BaseRuler.SCALE_100 == 0) {
GraphHelper.drawLine(g, size.width, toPX(i) - extra, 0, toPX(i) - extra);

6
designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java

@ -159,15 +159,15 @@ public class PatternBackgroundPane extends BPane {
Dimension d = getSize();
this.patternBackground.paint(g2d, new Rectangle2D.Double(0, 0,
d.width - 1, d.height - 1));
d.width - 1d, d.height - 1d));
if (this.pIndex == patternIndex) {// it's selected.
g2d.setPaint(new Color(255, 51, 0));
} else {
g2d.setPaint(Color.gray);
}
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1,
d.height - 1));
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1d,
d.height - 1d));
}
public Dimension getPreferredSize() {

8
designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java

@ -152,8 +152,8 @@ public class TextureBackgroundPane extends BPane {
Dimension d = getSize();
g2d.setPaint(this.buttonTexturePaint);
GraphHelper.fill(g2d, new Rectangle2D.Double(0, 0, d.width - 1,
d.height - 1));
GraphHelper.fill(g2d, new Rectangle2D.Double(0, 0, d.width - 1d,
d.height - 1d));
if (ComparatorUtils.equals(texturePaint, this.buttonTexturePaint)) {// it's
// selected.
@ -161,8 +161,8 @@ public class TextureBackgroundPane extends BPane {
} else {
g2d.setPaint(Color.gray);
}
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1,
d.height - 1));
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1d,
d.height - 1d));
}
public Dimension getPreferredSize() {

93
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 放大倍数
*/
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坐标
*/
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);

42
designer-base/src/main/java/com/fr/design/style/color/CustomChooserPanel.java

@ -314,8 +314,8 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
* @param p The point where the MouseEvent occurred.
*/
private void updateH(Point p) {
float s = (IMG_WIDTH - p.x * 1f) / IMG_WIDTH;
float b = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT;
double s = (IMG_WIDTH - p.x * 1D) / IMG_WIDTH;
double b = (IMG_HEIGHT - p.y * 1D) / IMG_HEIGHT;
// Avoid two changes to the model by changing internalChange to true.
internalChange = true;
@ -332,8 +332,8 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
* @param p The point where the MouseEvent occurred.
*/
private void updateS(Point p) {
float h = p.x * 1f / IMG_WIDTH;
float b = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT;
double h = p.x * 1D / IMG_WIDTH;
double b = (IMG_HEIGHT - p.y * 1D) / IMG_HEIGHT;
internalChange = true;
hSpinner.setValue(new Integer((int) (h * H_MAX)));
@ -349,8 +349,8 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
* @param p The point where the MouseEvent occurred.
*/
private void updateB(Point p) {
float h = p.x * 1f / IMG_WIDTH;
float s = (IMG_HEIGHT - p.y * 1f) / IMG_HEIGHT;
double h = p.x * 1D / IMG_WIDTH;
double s = (IMG_HEIGHT - p.y * 1D) / IMG_HEIGHT;
internalChange = true;
hSpinner.setValue(new Integer((int) (h * H_MAX)));
@ -523,9 +523,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
private void adjustHSLValue(float[] hsbVals) {
if (!spinnerTrigger) {
hSpinner.setValue(new Integer((int) (hsbVals[0] * HSPINNER_VALUE)));
sSpinner.setValue(new Integer((int) (hsbVals[1] * SSPINNER_VALUE)));
bSpinner.setValue(new Integer((int) (hsbVals[2] * LSPINNER_VALUE)));
hSpinner.setValue(new Integer((int) ((double) hsbVals[0] * HSPINNER_VALUE)));
sSpinner.setValue(new Integer((int) ((double) hsbVals[1] * SSPINNER_VALUE)));
bSpinner.setValue(new Integer((int) ((double) hsbVals[2] * LSPINNER_VALUE)));
}
switch (locked) {
case HLOCKED:
@ -534,9 +534,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
}
if (!handlingMouse) {
gradientPoint.x = (int) ((1
- ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_WIDTH);
- ((Number) sSpinner.getValue()).intValue() / (double) SSPINNER_VALUE) * IMG_WIDTH);
gradientPoint.y = (int) ((1
- ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE) * IMG_HEIGHT);
- ((Number) bSpinner.getValue()).intValue() / (double) LSPINNER_VALUE) * IMG_HEIGHT);
}
break;
case SLOCKED:
@ -544,9 +544,9 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
slider.setValue(((Number) sSpinner.getValue()).intValue());
}
if (!handlingMouse) {
gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH);
gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / (double) HSPINNER_VALUE * IMG_WIDTH);
gradientPoint.y = (int) ((1
- ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE) * IMG_HEIGHT);
- ((Number) bSpinner.getValue()).intValue() / (double) LSPINNER_VALUE) * IMG_HEIGHT);
}
break;
case BLOCKED:
@ -554,18 +554,18 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
slider.setValue(((Number) bSpinner.getValue()).intValue());
}
if (!handlingMouse) {
gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE * IMG_WIDTH);
gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / (double) HSPINNER_VALUE * IMG_WIDTH);
gradientPoint.y = (int) ((1
- ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE) * IMG_HEIGHT);
- ((Number) sSpinner.getValue()).intValue() / (double) SSPINNER_VALUE) * IMG_HEIGHT);
}
break;
}
}
private void updateImageAndTrack() {
float h = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE;
float s = ((Number) sSpinner.getValue()).intValue() / SSPINNER_VALUE;
float b = ((Number) bSpinner.getValue()).intValue() / LSPINNER_VALUE;
float h = (float) (((Number) hSpinner.getValue()).intValue() / (double) HSPINNER_VALUE);
float s = (float) (((Number) sSpinner.getValue()).intValue() / (double) SSPINNER_VALUE);
float b = (float) (((Number) bSpinner.getValue()).intValue() / (double) LSPINNER_VALUE);
spinnerTrigger = true;
getColorSelectionModel().setSelectedColor(new Color(Color.HSBtoRGB(h, s, b)));
@ -837,12 +837,12 @@ class CustomChooserPanel extends AbstractColorChooserPanel implements ColorSelec
private void updateHLockImage() {
int index = 0;
int[] pix = new int[IMG_WIDTH * IMG_HEIGHT];
float hValue = ((Number) hSpinner.getValue()).intValue() / HSPINNER_VALUE;
float hValue = (float)(((Number) hSpinner.getValue()).intValue() / (double) HSPINNER_VALUE );
for (int j = 0; j < IMG_HEIGHT; j++) {
for (int i = 0; i < IMG_WIDTH; i++) {
pix[index++] = Color.HSBtoRGB(hValue, (IMG_WIDTH - i * 1f) / IMG_WIDTH,
(IMG_HEIGHT - j * 1f) / IMG_HEIGHT) | (BINARY_FOR_EIGHT << TWENTY_FOUR);
pix[index++] = Color.HSBtoRGB(hValue, (float) ((IMG_WIDTH - i * 1D) / IMG_WIDTH),
(float) ((IMG_HEIGHT - j * 1D) / IMG_HEIGHT)) | (BINARY_FOR_EIGHT << TWENTY_FOUR);
}
}

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");
}
}
}

58
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();
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()));
list.add(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 + '\'' +
'}';
}

59
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);
}
//只有一个类型时不可下拉
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 {

8
designer-base/src/main/java/com/fr/file/FileNodeFILE.java

@ -23,7 +23,7 @@ import com.fr.workspace.WorkspaceEvent;
import com.fr.workspace.resource.WorkResourceTempRenameStream;
import com.fr.workspace.server.lock.TplOperator;
import javax.swing.Icon;
import javax.swing.*;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.OutputStream;
@ -68,14 +68,14 @@ public class FileNodeFILE implements FILE {
this.node = new FileNode(StableUtils.pathJoin(parentDir, name), isDir);
this.envPath = WorkContext.getCurrent().getPath();
this.hasFullAuth = NodeAuthProcessor.getInstance().fixFileNodeAuth(node);
this.hasFullAuth = NodeAuthProcessor.getInstance().checkFileNodeAuth(node);
}
public FileNodeFILE(FileNode node) {
this.node = node;
this.envPath = WorkContext.getCurrent().getPath();
this.hasFullAuth = NodeAuthProcessor.getInstance().fixFileNodeAuth(node);
this.hasFullAuth = NodeAuthProcessor.getInstance().checkFileNodeAuth(node);
}
public FileNodeFILE(FileNode node, boolean hasFullAuth) {
@ -91,7 +91,7 @@ public class FileNodeFILE implements FILE {
public FileNodeFILE(FileNode node, String envPath) {
this.node = node;
this.envPath = envPath;
this.hasFullAuth = NodeAuthProcessor.getInstance().fixFileNodeAuth(node);
this.hasFullAuth = NodeAuthProcessor.getInstance().checkFileNodeAuth(node);
}
public FileNodeFILE(FileNode node, String envPath, boolean hasFullAuth) {

62
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);
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]);
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]);
}
private class MockCptxApp extends AbstractAppProvider{
@Override
public String[] defaultExtensions() {
return new String[] {FileExtension.CPTX.getExtension()};
@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]);
}
@Override
public JTemplate openTemplate(FILE tplFile) {
return null;
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;
}
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
@ -250,7 +250,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();

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save