Browse Source

Merge branch 'feature/10.0' of https://cloud.finedevelop.com/scm/~lanlan/design into feature/10.0

research/11.0
Lanlan 5 years ago
parent
commit
9f97d36919
  1. 14
      designer-base/src/main/java/com/fr/design/DesignModelAdapter.java
  2. 53
      designer-base/src/main/java/com/fr/design/RestartHelper.java
  3. 39
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  4. 63
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  5. 15
      designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java
  6. 23
      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. 6
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  9. 3
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  10. 12
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  11. 8
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/AutoStoreProcedureTableModel.java
  12. 3
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java
  13. 25
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/CustomDictModel.java
  14. 6
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  15. 23
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  16. 5
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
  17. 11
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  18. 2
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java
  19. 1
      designer-base/src/main/java/com/fr/design/designer/EditingState.java
  20. 6
      designer-base/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptor.java
  21. 4
      designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java
  22. 1
      designer-base/src/main/java/com/fr/design/dialog/JWizardDialog.java
  23. 2
      designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java
  24. 19
      designer-base/src/main/java/com/fr/design/editor/editor/WidgetNameEditor.java
  25. 2
      designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java
  26. 1
      designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java
  27. 4
      designer-base/src/main/java/com/fr/design/extra/AppStoreBuilder.java
  28. 9
      designer-base/src/main/java/com/fr/design/extra/LoginDialog.java
  29. 7
      designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java
  30. 3
      designer-base/src/main/java/com/fr/design/extra/PluginAbstractLoadingViewPane.java
  31. 5
      designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java
  32. 10
      designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java
  33. 3
      designer-base/src/main/java/com/fr/design/extra/PluginUpdatePane.java
  34. 10
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  35. 2
      designer-base/src/main/java/com/fr/design/extra/QQLoginDialog.java
  36. 1
      designer-base/src/main/java/com/fr/design/extra/ShopDialog.java
  37. 38
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  38. 13
      designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java
  39. 22
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  40. 1
      designer-base/src/main/java/com/fr/design/fun/ParameterWidgetOptionProvider.java
  41. 40
      designer-base/src/main/java/com/fr/design/fun/ReportSupportedFileUIProvider.java
  42. 40
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportSupportedFileUIProvider.java
  43. 8
      designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java
  44. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/RegPane.java
  45. 8
      designer-base/src/main/java/com/fr/design/gui/frpane/UnitInputPane.java
  46. 4
      designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java
  47. 14
      designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java
  48. 6
      designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java
  49. 4
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java
  50. 21
      designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java
  51. 4
      designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java
  52. 2
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java
  53. 12
      designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java
  54. 42
      designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java
  55. 3
      designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java
  56. 10
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  57. 2
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java
  58. 44
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java
  59. 8
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java
  60. 41
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java
  61. 19
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  62. 28
      designer-base/src/main/java/com/fr/design/gui/ispinner/UnsignedIntUISpinner.java
  63. 6
      designer-base/src/main/java/com/fr/design/gui/itable/UITable.java
  64. 8
      designer-base/src/main/java/com/fr/design/gui/itextfield/UINumberField.java
  65. 21
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java
  66. 35
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java
  67. 14
      designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java
  68. 34
      designer-base/src/main/java/com/fr/design/gui/style/FormatePaneNumField.java
  69. 36
      designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java
  70. 6
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxUtilities.java
  71. 4
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java
  72. 4
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java
  73. 9
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java
  74. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/folding/HtmlFoldParser.java
  75. 1
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/FormulaTokenMaker.java
  76. 8
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaEditorKit.java
  77. 3
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaUI.java
  78. 4
      designer-base/src/main/java/com/fr/design/gui/toast/Toast.java
  79. 2
      designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java
  80. 4
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java
  81. 16
      designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java
  82. 6
      designer-base/src/main/java/com/fr/design/layout/TableLayout.java
  83. 2
      designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java
  84. 87
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  85. 32
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  86. 29
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  87. 4
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/PatternBackgroundQuickPane.java
  88. 4
      designer-base/src/main/java/com/fr/design/mainframe/backgroundpane/TextureBackgroundQuickPane.java
  89. 188
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  90. 2
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java
  91. 6
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java
  92. 13
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  93. 23
      designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsHelper.java
  94. 2
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java
  95. 2
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/MobileTemplateStylePane.java
  96. 3
      designer-base/src/main/java/com/fr/design/mainframe/widget/accessibles/TemplateStylePane.java
  97. 5
      designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java
  98. 77
      designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java
  99. 58
      designer-base/src/main/java/com/fr/design/os/impl/DemoAction.java
  100. 30
      designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.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);
}
/**
* 更新缓存的参数
*/

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

@ -1,14 +1,17 @@
package com.fr.design;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.RestartAction;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.workspace.WorkContext;
import javax.swing.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@ -16,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;
@ -30,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中
@ -143,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);
}
}
/**
* 重启设计器并删除某些特定的文件
*
@ -168,11 +183,7 @@ public class RestartHelper {
}catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (OperatingSystem.isMacOS()) {
restartInMacOS(installHome, filesToBeDelete);
} else {
restartInWindows(installHome, filesToBeDelete);
}
restartAction.execute(filesToBeDelete);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
@ -186,28 +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();
}
}

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

@ -1,5 +1,6 @@
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;
@ -28,7 +29,7 @@ import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.update.push.DesignerPushUpdateManager;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.ComparatorUtils;
@ -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);
@ -213,10 +208,15 @@ public class PreferencePane extends BasicPane {
joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve"));
improvePane.add(joinProductImproveCheckBox);
if (DesignerPushUpdateManager.getInstance().isAutoPushUpdateSupported()) {
if(SupportOSImpl.AUTOPUSHUPDATE.support()){
autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update"));
improvePane.add(autoPushUpdateCheckBox);
}
/*
if (DesignerPushUpdateManager.getInstance().isAutoPushUpdateSupported()) {
autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update"));
improvePane.add(autoPushUpdateCheckBox);
}*/
JPanel spaceUpPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
spaceUpPane.add(oraclePane, BorderLayout.NORTH);
@ -258,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);
@ -302,15 +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 (FineClusterConfig.getInstance().isCluster()) {
gcEnableCheckBox.setEnabled(false);
gcButton.setEnabled(false);
}
return gcControlPane;
}
@ -668,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 {
@ -703,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());
@ -773,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());
@ -887,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);
@ -1050,7 +1046,7 @@ public class PreferencePane extends BasicPane {
if (size > Math.pow(n, 2)) {
return df.format(size / Math.pow(n, 2)) + "MB";
}
return new StringBuilder().append(df.format(size / n)).append("KB").toString();
return df.format(size / n) + "KB";
}
/**
@ -1066,3 +1062,4 @@ public class PreferencePane extends BasicPane {
}
}

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

@ -1,24 +1,17 @@
package com.fr.design.actions.server;
import com.fr.config.ServerPreferenceConfig;
import com.fr.data.impl.Connection;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionManagerPane;
import com.fr.design.data.datapane.connect.ConnectionShowPane;
import com.fr.design.data.datapane.connect.DatabaseConnectionPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.NameInspector;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.dcm.UniversalDatabaseOpener;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.design.os.impl.DatabaseDialogAction;
import com.fr.file.ConnectionConfig;
import com.fr.general.IOUtils;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import javax.swing.*;
import java.awt.event.ActionEvent;
@ -60,56 +53,10 @@ public class ConnectionListAction extends UpdateAction {
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
if (ServerPreferenceConfig.getInstance().isUseUniverseDBM()) {
UniversalDatabaseOpener.showUniverseDatabaseDialog();
} else {
openDesignDatabaseManager();
}
OSBasedAction osBasedAction = OSSupportCenter.getAction(DatabaseDialogAction.class);
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
*

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

@ -1,11 +1,11 @@
package com.fr.design.actions.server;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.actions.UpdateAction;
import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.upm.UpmFinder;
import com.fr.design.os.impl.PMDialogAction;
import com.fr.general.IOUtils;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import javax.swing.*;
import java.awt.event.ActionEvent;
@ -16,22 +16,17 @@ import java.awt.event.ActionEvent;
* @since 8.0
*/
public class PluginManagerAction extends UpdateAction {
public PluginManagerAction() {
this.setMenuKeySet(PLUGIN_MANAGER);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/server/plugin.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
// 可以启用新版本的插件商店(使用JxBrowser作为容器)
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM()) {
UpmFinder.showUPMDialog();
} else {
WebViewDlgHelper.createPluginDialog();
}
OSBasedAction osBasedAction = OSSupportCenter.getAction(PMDialogAction.class);
osBasedAction.execute();
}
public static final MenuKeySet PLUGIN_MANAGER = new MenuKeySet() {

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

@ -2,6 +2,7 @@ package com.fr.design.data;
import com.fr.base.StoreProcedureParameter;
import com.fr.base.TableData;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.data.TableDataSource;
import com.fr.data.TableDataSourceTailor;
import com.fr.data.core.DataCoreXmlUtils;
@ -30,12 +31,14 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.data.DataModel;
import com.fr.general.data.TableDataException;
import com.fr.log.FineLoggerFactory;
import com.fr.module.ModuleContext;
import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils;
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;
@ -48,8 +51,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* 设计器管理操作数据集的类:
@ -420,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());
@ -444,11 +447,18 @@ public abstract class DesignTableDataManager {
} catch (Exception e) {
throw new TableDataException(e.getMessage(), e);
} finally {
new Timer().schedule(new TimerTask() {
ScheduledExecutorService scheduledExecutorService = ModuleContext
.getExecutor()
.newSingleThreadScheduledExecutor(new NamedThreadFactory(""));
scheduledExecutorService.schedule(new Runnable() {
@Override
public void run() {
loadingBar.close();
if (loadingBar != null) {
loadingBar.close();
}
}
}, 100);
}, 100, TimeUnit.MILLISECONDS);
scheduledExecutorService.shutdown();
}
}
@ -513,6 +523,7 @@ public abstract class DesignTableDataManager {
if (inParameters.length > 0 && !ComparatorUtils.equals(threadLocal.get(), NO_PARAMETER)) {// 检查Parameter.
final ParameterInputPane pPane = new ParameterInputPane(inParameters);
pPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
parameterMap.putAll(pPane.update());
}

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

@ -443,6 +443,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);
}
}
@ -466,7 +468,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;
}

6
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java

@ -98,7 +98,7 @@ public class ConnectionTableProcedurePane extends BasicPane {
}
protected void addKeyMonitor() {
//do nothing
}
protected JPanel createCheckBoxgroupPane() {
@ -137,7 +137,7 @@ public class ConnectionTableProcedurePane extends BasicPane {
/**
* itemComboBox 加上 itemListener
*
*
* @param itemListener
*/
public void addItemListener(ItemListener itemListener) {
@ -214,7 +214,7 @@ public class ConnectionTableProcedurePane extends BasicPane {
public static interface DoubleClickSelectedNodeOnTreeListener {
/**
* 处理双击事件
*
*
* @param target
*/
public void actionPerformed(TableProcedure target);

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

6
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -101,10 +101,10 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
@Override
protected void addKeyMonitor() {
searchField.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
//do nothing
}
@Override
@ -117,7 +117,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
@Override
public void keyReleased(KeyEvent e) {
//do nothing
}
});
}

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
}
/**

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

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

8
designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java

@ -437,18 +437,18 @@ public class UICalendarPanel extends JPanel {
};
}
protected EventListenerList listenerList = new EventListenerList();
protected EventListenerList eventlistenerList = new EventListenerList();
public void addDateChangeListener(ChangeListener l) {
listenerList.add(ChangeListener.class, l);
eventlistenerList.add(ChangeListener.class, l);
}
public void removeDateChangeListener(ChangeListener l) {
listenerList.remove(ChangeListener.class, l);
eventlistenerList.remove(ChangeListener.class, l);
}
protected void fireDateChanged(ChangeEvent e) {
Object[] listeners = listenerList.getListenerList();
Object[] listeners = eventlistenerList.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == ChangeListener.class) {
((ChangeListener) listeners[i + 1]).stateChanged(e);

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

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

8
designer-base/src/main/java/com/fr/design/gui/frpane/UnitInputPane.java

@ -133,14 +133,17 @@ public abstract class UnitInputPane extends BasicPane {
@Override
public void keyTyped(KeyEvent arg0) {
// 敲击键盘,发生在按键按下后,按键放开前
}
@Override
public void keyReleased(KeyEvent arg0) {
// 松开按键时
}
@Override
public void keyPressed(KeyEvent arg0) {
// 按下按键时
changed = true;
}
};
@ -149,23 +152,28 @@ public abstract class UnitInputPane extends BasicPane {
@Override
public void mouseReleased(MouseEvent arg0) {
// 鼠标按键在组件上释放时
}
@Override
public void mousePressed(MouseEvent arg0) {
// 鼠标按键在组件上按下时
changed = true;
}
@Override
public void mouseExited(MouseEvent arg0) {
// 鼠标离开组件时
}
@Override
public void mouseEntered(MouseEvent arg0) {
// 鼠标进入到组件时
}
@Override
public void mouseClicked(MouseEvent arg0) {
// 鼠标按键在组件上单击时
}
};
}

4
designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java

@ -18,11 +18,11 @@ public class UICombinationButton extends JPanel{
protected UIButton rightButton;
protected void leftButtonClickEvent() {
// 左边按钮点击事件
}
protected void rightButtonClickEvent() {
// 右边按钮点击事件
}
public UICombinationButton() {

14
designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java

@ -176,11 +176,11 @@ public class UISliderButtonUI extends BasicButtonUI {
private void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) {
GradientPaint gp;
if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) {
gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1f, UIConstants.AUTHORITY_DARK_BLUE);
gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1F, UIConstants.AUTHORITY_DARK_BLUE);
} else if (isPressedPainted) {
gp = new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, height - 1, UIConstants.SELECT_TAB);
gp = new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, height - 1F, UIConstants.SELECT_TAB);
}else{
gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER);
gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1F, UIConstants.POP_DIALOG_BORDER);
}
fillPaint(g2d, x, y, width, height, isRound, rectDirection, gp, UIConstants.ARC);
@ -189,11 +189,11 @@ public class UISliderButtonUI extends BasicButtonUI {
private void fillRollOver(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) {
GradientPaint gp;
if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) {
gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.HOVER_BLUE);
gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1F, UIConstants.HOVER_BLUE);
} else if (isPressedPainted) {
gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER);
gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1F, UIConstants.POP_DIALOG_BORDER);
}else {
gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER);
gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1F, UIConstants.POP_DIALOG_BORDER);
}
fillPaint(g2d, x, y, width, height, isRound, rectDirection, gp, UIConstants.ARC);
}
@ -225,4 +225,4 @@ public class UISliderButtonUI extends BasicButtonUI {
g2d.setColor(oldColor);
}
}
}

6
designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java

@ -162,12 +162,12 @@ public class UITabButton extends UILabel implements UISelectedComponent {
Color blue = UIConstants.LIGHT_BLUE;
g2d.setColor(blue);
g2d.fillRect(0, 1, w - 1, h / 2);
GradientPaint gp = new GradientPaint(1, 1, UIConstants.OCEAN_BLUE, 1, h - 1, blue);
GradientPaint gp = new GradientPaint(1, 1, UIConstants.OCEAN_BLUE, 1, h - 1F, blue);
g2d.setPaint(gp);
g2d.fillRect(0, h / 2, w - 1, h / 2);
this.setForeground(UIConstants.FONT_COLOR);
} else if (!isSelected() && !isRollover) {
GradientPaint gp = new GradientPaint(1, 1, TOP, 1, h - 1, DOWN);
GradientPaint gp = new GradientPaint(1, 1, TOP, 1, h - 1F, DOWN);
g2d.setPaint(gp);
g2d.fillRect(0, h / 2, w - 1, h / 2);
this.setForeground(UIConstants.FONT_COLOR);
@ -178,4 +178,4 @@ public class UITabButton extends UILabel implements UISelectedComponent {
}
}
}

4
designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java

@ -220,7 +220,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
protected void paintOtherBorder(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setStroke(UIConstants.BS);
Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1, getHeight() - 1, UIConstants.ARC, UIConstants.ARC);
Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1F, getHeight() - 1F, UIConstants.ARC, UIConstants.ARC);
g2d.setColor(UIConstants.LINE_COLOR);
g2d.draw(shape);
}
@ -252,4 +252,4 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
return true;
}
}
}

21
designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java

@ -3,6 +3,11 @@
*/
package com.fr.design.gui.icombobox;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.general.FRFont;
import com.fr.stable.Constants;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
@ -11,18 +16,10 @@ import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JLabel;
import javax.swing.JList;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.general.FRFont;
import com.fr.stable.Constants;
/**
* Combobox for selecting line styles.
@ -88,13 +85,13 @@ public class LineComboBox extends UIComboBox {
FontMetrics fm = GraphHelper.getFontMetrics(rfont);
if (style == Constants.LINE_NONE) {
//draw "none" string
GraphHelper.drawString(g2d, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"), 4, (d.height - fm.getHeight()) / 2 + fm.getAscent());
GraphHelper.drawString(g2d, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"), 4, (d.height - fm.getHeight()) / 2D + fm.getAscent());
} else {
GraphHelper.drawLine(g2d, 4, d.height / 2, d.width - 8, d.height / 2, style);
GraphHelper.drawLine(g2d, 4, d.height / 2D, d.width - 8D, d.height / 2D, style);
}
if(isShowAxisWithLineStyle()) { // 带有坐标轴箭头的样式.
drawArrow(g2d, new Point2D.Double(4, d.height / 2), new Point2D.Double(d.width - 8, d.height/2));
drawArrow(g2d, new Point2D.Double(4, d.height / 2D), new Point2D.Double(d.width - 8D, d.height / 2D));
}
}
@ -142,4 +139,4 @@ public class LineComboBox extends UIComboBox {
private int style = Constants.LINE_NONE;
}
}
}

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 {

10
designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java

@ -3,6 +3,9 @@ package com.fr.design.gui.iprogressbar;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ilable.UILabel;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
@ -28,7 +31,12 @@ public class ProgressDialog extends UIDialog {
setUndecorated(true);
setSize(parent.getSize());
setLocationRelativeTo(null);
setOpacity(0.5f);
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute(Object... objects) {
setOpacity(0.5f);
}
}, SupportOSImpl.OPACITY);
initComponent();
}

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

19
designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

@ -39,6 +39,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
private String spinnerName = StringUtils.EMPTY;
private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null;
private boolean lessMinValue = false;
public UISpinner(double minValue, double maxValue, double dierta) {
@ -93,6 +94,18 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
return textField;
}
public UIButton getNextButton() {
return nextButton;
}
public boolean isLessMinValue() {
return lessMinValue;
}
public void resetLessMinValue() {
lessMinValue = false;
}
public void setValue(double value) {
setValue(value, true);
}
@ -109,7 +122,8 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(spinnerName);
}
value = value < minValue ? minValue : value;
lessMinValue = value < minValue;
value = lessMinValue ? minValue : value;
value = value > maxValue ? maxValue : value;
if (CommonUtils.equals(value, this.value)) {
return;
@ -131,7 +145,8 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(spinnerName);
}
value = value < minValue ? minValue : value;
lessMinValue = value < minValue;
value = lessMinValue ? minValue : value;
value = value > maxValue ? maxValue : value;
if (CommonUtils.equals(value, this.value)) {

28
designer-base/src/main/java/com/fr/design/gui/ispinner/UnsignedIntUISpinner.java

@ -3,8 +3,6 @@ package com.fr.design.gui.ispinner;
import com.fr.design.gui.itextfield.UIIntNumberField;
import com.fr.design.gui.itextfield.UINumberField;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
/**
* Created by IntelliJ IDEA.
@ -31,7 +29,7 @@ public class UnsignedIntUISpinner extends UISpinner {
@Override
protected UINumberField initNumberField() {
final UIIntNumberField numberField = new UIIntNumberField() {
return new UIIntNumberField() {
public boolean shouldResponseChangeListener() {
return false;
}
@ -44,29 +42,5 @@ public class UnsignedIntUISpinner extends UISpinner {
};
}
};
numberField.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
}
/**
* 失去焦点后再做范围限制不然最小值为 100 输个 1 都不让....
* @param e
*/
@Override
public void focusLost(FocusEvent e) {
double value = numberField.getValue();
if (!isOverMaxOrMinValue(value)) {
return;
}
numberField.setValue(value < minValue ? minValue : maxValue);
}
private boolean isOverMaxOrMinValue(double value) {
return value < minValue || value > maxValue;
}
});
return numberField;
}
}

6
designer-base/src/main/java/com/fr/design/gui/itable/UITable.java

@ -291,8 +291,7 @@ public class UITable extends JTable implements UIObserver {
*
*/
public TableCellEditor getDefaultEditor(Class<?> columnClass) {
columnClass = UITable.class;
return super.getDefaultEditor(columnClass);
return super.getDefaultEditor(UITable.class);
}
@Override
@ -300,8 +299,7 @@ public class UITable extends JTable implements UIObserver {
*
*/
public TableCellRenderer getDefaultRenderer(Class<?> columnClass) {
columnClass = UITable.class;
return super.getDefaultRenderer(columnClass);
return super.getDefaultRenderer(UITable.class);
}
/**

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

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

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

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

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

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

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/style/FormatePaneNumField.java

@ -1,10 +1,14 @@
package com.fr.design.gui.style;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.module.ModuleContext;
import com.fr.value.ClearableLazyValue;
import org.jetbrains.annotations.NotNull;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* Created with IntelliJ IDEA.
@ -14,31 +18,35 @@ import java.util.TimerTask;
* To change this template use File | Settings | File Templates.
*/
public class FormatePaneNumField extends UITextField {
private Timer timer;
private ClearableLazyValue<ScheduledExecutorService> ses = new ClearableLazyValue<ScheduledExecutorService>() {
@NotNull
@Override
protected ScheduledExecutorService compute() {
return ModuleContext.getExecutor()
.newSingleThreadScheduledExecutor(new NamedThreadFactory("FormatePaneNumFieldRunChange"));
}
};
public FormatePaneNumField() {
super();
}
@Override
protected void attributeChange() {
if (!AbstractAttrNoScrollPane.isHasChangeListener()) {
return;
}
if(timer != null){
timer.cancel();
}
timer = new Timer();
timer.schedule(new TimerTask() {
ses.getValue().schedule(new Runnable() {
@Override
public void run() {
runChange();
}
},100);
}, 100, TimeUnit.MILLISECONDS);
}
protected void runChange(){
protected void runChange() {
super.attributeChange();
timer.cancel();
ses.getValue().shutdown();
ses.drop();
}
}

36
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) + " - " +
(currentLineStart+startingOffset+currentPos));
ble.printStackTrace();
FineLoggerFactory.getLogger().error("BadLocationException in print (a):" + "==> currentLineStart: " + currentLineStart +
"; startingOffset: " + startingOffset + "; currentPos: " + currentPos +
"==> Range: " + (currentLineStart+startingOffset) + " - " +
(currentLineStart+startingOffset+currentPos));
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
}
}

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

@ -374,7 +374,7 @@ public class SyntaxView extends View implements TabExpander,
if (host.isCodeFoldingEnabled()) {
visibleLineCount -= host.getFoldManager().getHiddenLineCount();
}
return visibleLineCount * lineHeight;
return (float) visibleLineCount * lineHeight;
default:
throw new IllegalArgumentException("Invalid axis: " + axis);
}
@ -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 */

8
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaEditorKit.java

@ -741,10 +741,10 @@ public class RTextAreaEditorKit extends DefaultEditorKit {
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
Font font = textArea.getFont();
float oldSize = font.getSize2D();
float newSize = oldSize - decreaseAmount;
double newSize = (double)oldSize - (double)decreaseAmount;
if (newSize>=MINIMUM_SIZE) {
// Shrink by decreaseAmount.
font = font.deriveFont(newSize);
font = font.deriveFont((float)newSize);
textArea.setFont(font);
}
else if (oldSize>MINIMUM_SIZE) {
@ -1329,10 +1329,10 @@ public class RTextAreaEditorKit extends DefaultEditorKit {
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
Font font = textArea.getFont();
float oldSize = font.getSize2D();
float newSize = oldSize + increaseAmount;
double newSize = (double)oldSize + (double)increaseAmount;
if (newSize<=MAXIMUM_SIZE) {
// Grow by increaseAmount.
font = font.deriveFont(newSize);
font = font.deriveFont((float)newSize);
textArea.setFont(font);
}
else if (oldSize<MAXIMUM_SIZE) {

3
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaUI.java

@ -463,9 +463,10 @@ public class RTextAreaUI extends BasicTextAreaUI {
if (textArea.getFadeCurrentLineHighlight()) {
Graphics2D g2d = (Graphics2D)g;
Color bg = textArea.getBackground();
float visibleWidth = (float)(visibleRect.x + visibleRect.width);
GradientPaint paint = new GradientPaint(
visibleRect.x,0, highlight,
visibleRect.x+visibleRect.width,0,
visibleWidth,0,
bg==null ? Color.WHITE : bg);
g2d.setPaint(paint);
g2d.fillRect(visibleRect.x,textArea.currentCaretY,

4
designer-base/src/main/java/com/fr/design/gui/toast/Toast.java

@ -42,7 +42,7 @@ public class Toast extends JFrame {
//int x = (int) (owner.getLocation().getX() + (owner.getWidth() / 2));
int x = (int) (owner.getLocation().getX() + owner.getWidth() - textWidth);
int y = (int) (owner.getLocation().getY() + owner.getHeight() / 2);
int y = (int) (owner.getLocation().getY() + (double)owner.getHeight() / 2);
setLocation(new Point(x, y));
@ -110,7 +110,7 @@ public class Toast extends JFrame {
try {
Toast toastFrame = new Toast(owner, toastText);
toastFrame.fadeIn();
Thread.sleep(durationSec * 1000);
Thread.sleep((long)durationSec * 1000);
toastFrame.fadeOut();
} catch (Exception ex) {
ex.printStackTrace();

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

16
designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java

@ -558,15 +558,15 @@ public class FRGUIPaneFactory {
*/
public static int caculateWidth(int width) {
int w = 0;
float m = (width + WIDTH_OFFSET_M) / WIDTH_PARA_F;
float n = (width + WIDTH_OFFSET_N) / WIDTH_PARA_F;
float i = Math.abs((((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m);
float j = Math.abs((((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n);
float x = i > j ? i : j;
double m = (double)(width + WIDTH_OFFSET_M) / (double)WIDTH_PARA_F;
double n = (double)(width + WIDTH_OFFSET_N ) / (double)WIDTH_PARA_F;
double i = Math.abs(((double) ((int) m + (int) (m + 1)) / WIDTHABS_PARA_F) - m);
double j = Math.abs(((double) ((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n);
double x = i > j ? i : j;
if (AssistUtils.equals(x, i)) {
w = Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M;
w = (int) (Math.round(m) * WIDTH_PARA_INT - WIDTH_OFFSET_M);
} else if (AssistUtils.equals(x, j)) {
w = Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N;
w = (int) (Math.round(n) * WIDTH_PARA_INT - WIDTH_OFFSET_N);
}
return w;
}
@ -579,7 +579,7 @@ public class FRGUIPaneFactory {
*/
public static int caculateHeight(int height) {
int h = 0;
float x = (height + HEIGHT_OFFSET) / HEIGHT_PARA;
double x = (double)(height + HEIGHT_OFFSET) / HEIGHT_PARA;
h = ((int) x + 1) * HEIGHT_PARA;
return h;
}

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];
}

2
designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java

@ -372,7 +372,7 @@ public class TableLayoutHelper {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
JPanel jp1 = TableLayoutHelper.createTableLayoutPane(createTestComponents("jp1"), TableLayoutHelper.FILL_NONE);
JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp2"), TableLayoutHelper.FILL_LASTCOL_AND_ROW, 2 * TEN, 2 * TEN);
JPanel jp2 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp2"), TableLayoutHelper.FILL_LASTCOL_AND_ROW, (double)2 * TEN, (double)2 * TEN);
JPanel jp3 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp3"),
new double[]{f, p, f, p}, new double[]{f, f}, 4, 4);
JPanel jp4 = TableLayoutHelper.createGapTableLayoutPane(createTestComponents("jp4"),

87
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;
@ -40,6 +39,7 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.menu.MenuManager;
import com.fr.design.menu.ShortCut;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.EventDispatcher;
import com.fr.exception.DecryptTemplateException;
@ -58,6 +58,8 @@ import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.stable.image4j.codec.ico.ICODecoder;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.stable.project.ProjectConstants;
import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext;
@ -83,6 +85,7 @@ import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Component;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.DnDConstants;
@ -109,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;
@ -141,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();
@ -180,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();
@ -314,7 +317,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
public void componentResized(ComponentEvent e) {
reCalculateFrameSize();
if (DesignerMode.isAuthorityEditing()) {
if (DesignModeContext.isAuthorityEditing()) {
doResize();
}
}
@ -330,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() {
@ -412,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的时候修改右上的组件构成
@ -449,20 +452,33 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
return northEastPane;
}
private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) {
private void refreshNorthEastPane(final JPanel northEastPane, final ToolBarMenuDock ad) {
northEastPane.removeAll();
northEastPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
northEastPane.add(LogMessageBar.getInstance());
TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING);
if (processor != null) {
processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane());
final Component[] bbsLoginPane = {null};
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute(Object... objects) {
bbsLoginPane[0] = ad.createBBSLoginPane();
}
}, SupportOSImpl.USERINFOPANE);
processor.hold(northEastPane, LogMessageBar.getInstance(), bbsLoginPane[0]);
}
northEastPane.add(ad.createAlphaFinePane());
if (!DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) {
ad.createAlphaFinePane().setVisible(false);
}
northEastPane.add(ad.createBBSLoginPane());
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute(Object... objects) {
northEastPane.add(ad.createBBSLoginPane());
}
}, SupportOSImpl.USERINFOPANE);
}
public void initTitleIcon() {
@ -498,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;
}
@ -576,7 +592,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*/
public void refreshDottedLine() {
if (DesignerMode.isAuthorityEditing()) {
if (DesignModeContext.isAuthorityEditing()) {
populateAuthorityArea();
populateCloseButton();
addDottedLine();
@ -616,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()) {
@ -659,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) {
@ -675,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;
}
@ -692,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;
}
@ -767,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());
}
}
}
@ -794,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(" ");
@ -892,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;
}
@ -1075,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);
}
@ -1089,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 {
@ -1098,11 +1114,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
}
}
/**
* Exit退出
*/
public void exit() {
public void prepareForExit() {
Thread thread = new Thread() {
@Override
@ -1121,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());
@ -1133,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();
@ -1234,7 +1253,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
/**
* 更新进度框进度
*
* @param progress
* @param progress 进度值
*/
public void updateProgress(int progress) {

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

@ -1,7 +1,9 @@
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;
@ -242,6 +244,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
/**
* 响应数据集改变
*/
@Override
public void fireDSChanged() {
fireDSChanged(new HashMap<String, String>());
@ -252,6 +255,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
*
* @param map 改变名字的数据集
*/
@Override
public void fireDSChanged(Map<String, String> map) {
DesignTableDataManager.fireDSChanged(map);
@ -307,7 +311,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
return selectedOperation;
}
/*
/**
* 新建文件夹
*/
private class NewFolderAction extends UpdateAction {
@ -363,17 +367,20 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
* 版本管理可用状态的监控
*/
private void fireVcsActionChange() {
if (!DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable() || VcsHelper.getInstance().isUnSelectedTemplate() || FineClusterConfig.getInstance().isCluster()) {
if (!DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable()
|| VcsHelper.getInstance().isUnSelectedTemplate()
|| 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 {
@ -384,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)) {
@ -549,14 +563,17 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
nameField = new UITextField(oldName);
nameField.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void changedUpdate(DocumentEvent e) {
validInput();
}
@Override
public void insertUpdate(DocumentEvent e) {
validInput();
}
@Override
public void removeUpdate(DocumentEvent e) {
validInput();
}
@ -597,6 +614,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Confirm"));
confirmButton.setPreferredSize(new Dimension(60, 25));
confirmButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
confirmClose();
}
@ -608,6 +626,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
@ -764,14 +783,17 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
nameField = new UITextField();
nameField.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void changedUpdate(DocumentEvent e) {
validInput();
}
@Override
public void insertUpdate(DocumentEvent e) {
validInput();
}
@Override
public void removeUpdate(DocumentEvent e) {
validInput();
}
@ -812,6 +834,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
confirmButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Confirm"));
confirmButton.setPreferredSize(new Dimension(60, 25));
confirmButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
confirmClose();
}
@ -824,6 +847,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}

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

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

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

@ -164,11 +164,11 @@ public class PatternBackgroundQuickPane extends BackgroundQuickPane {
Graphics2D g2d = (Graphics2D) g;
Dimension d = getSize();
this.patternBackground.paint(g2d, new Rectangle2D.Double(0, 0, d.width - 1, d.height - 1));
this.patternBackground.paint(g2d, new Rectangle2D.Double(0, 0, (double)d.width - 1, (double)d.height - 1));
if (this.pIndex == patternIndex) {// it's selected.
g2d.setPaint(UIConstants.LINE_COLOR);
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1, d.height - 1));
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, (double)d.width - 1, (double)d.height - 1));
}
}

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

@ -101,7 +101,7 @@ public class TextureBackgroundQuickPane extends BackgroundQuickPane {
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, (double) d.width - 1, (double)d.height - 1));
if (ComparatorUtils.equals(texturePaint, this.buttonTexturePaint)) {// it's
// selected.
@ -109,7 +109,7 @@ public class TextureBackgroundQuickPane extends BackgroundQuickPane {
} else {
g2d.setPaint(null);
}
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, d.width - 1, d.height - 1));
GraphHelper.draw(g2d, new Rectangle2D.Double(0, 0, (double)d.width - 1, (double) d.height - 1));
}
public Dimension getPreferredSize() {

188
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;
@ -41,66 +42,66 @@ import java.util.Date;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class DesignerLogHandler {
private final SimpleDateFormat LOG_SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static final int GAP_X = -150;
private static final int INFO_GAP_Y = -60;
private static final int ERRO_GAP_Y = -40;
private static final int SERVER_GAP_Y = -20;
public static DesignerLogHandler getInstance() {
return HOLDER.singleton;
}
private static class HOLDER {
private static DesignerLogHandler singleton = new DesignerLogHandler();
}
// 所有的面板
private LogHandlerBar caption;
private JCheckBoxMenuItem showInfo;
private JCheckBoxMenuItem showError;
private JCheckBoxMenuItem showServer;
private LogHandlerArea logHandlerArea;
public DesignerLogHandler() {
logHandlerArea = new LogHandlerArea();
caption = new LogHandlerBar(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Log"));
caption.addClearListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
logHandlerArea.jTextArea.setText("");
caption.clearMessage();
}
});
caption.addSelectedListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
logHandlerArea.jTextArea.requestFocus();
logHandlerArea.jTextArea.selectAll();
}
});
ItemListener itemlistener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
logHandlerArea.jTextArea.setText("");
caption.clearMessage();
}
@ -112,12 +113,12 @@ public class DesignerLogHandler {
showServer = new JCheckBoxMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Log_Level_Error"), true);
showServer.addItemListener(itemlistener);
caption.addSetListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JPopupMenu jPopupMenu = new JPopupMenu();
int logLevelInt = Log4jConfig.getInstance().getRootLevel().toInt();
if (logLevelInt <= DesignerLogger.INFO_INT) {
jPopupMenu.add(showInfo);
@ -135,72 +136,73 @@ public class DesignerLogHandler {
}
});
}
public JComponent getLogHandlerArea() {
return logHandlerArea;
}
public JComponent getCaption() {
return caption;
}
public void printRemoteLog(String message, Level level, Date date) {
logHandlerArea.printStackTrace(message, level, date);
}
private class LogHandlerArea extends JPanel {
private static final long serialVersionUID = 8215630927304621660L;
private JTextPane jTextArea;
private JPopupMenu popup;
private UIMenuItem selectAll;
private UIMenuItem copy;
private UIMenuItem clear;
private LogHandlerArea() {
jTextArea = initLogJTextArea();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UIScrollPane js = new UIScrollPane(jTextArea);
this.add(js, BorderLayout.CENTER);
this.setPreferredSize(new Dimension(super.getPreferredSize().width, 150));
jTextArea.setEditable(false);
jTextArea.setBackground(Color.WHITE);
popup = new JPopupMenu();
selectAll = new UIMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select_All"));
selectAll.addActionListener(popupListener);
selectAll.setIcon(BaseUtils.readIcon("/com/fr/design/images/log/selectedall.png"));
popup.add(selectAll);
copy = new UIMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy"));
copy.addActionListener(popupListener);
copy.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/copy.png"));
popup.add(copy);
clear = new UIMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Clear_All"));
clear.addActionListener(popupListener);
clear.setIcon(BaseUtils.readIcon("/com/fr/design/images/log/clear.png"));
popup.add(clear);
selectAll.setAccelerator(KeyStroke.getKeyStroke('A', DEFAULT_MODIFIER));
copy.setAccelerator(KeyStroke.getKeyStroke('C', DEFAULT_MODIFIER));
clear.setAccelerator(KeyStroke.getKeyStroke('L', DEFAULT_MODIFIER));
jTextArea.addMouseListener(new MouseAdapter() {
// check for right click
@Override
public void mousePressed(MouseEvent event) {
if (event.getButton() == MouseEvent.BUTTON3) {
popup.show(jTextArea, event.getX(), event.getY());
checkEnabled();
@ -208,9 +210,9 @@ public class DesignerLogHandler {
}
});
}
private JTextPane initLogJTextArea() {
final JTextPane resultPane = new JTextPane();
InputMap inputMap = resultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction);
@ -218,18 +220,19 @@ public class DesignerLogHandler {
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_L, DEFAULT_MODIFIER), "clear");
ActionMap actionMap = resultPane.getActionMap();
actionMap.put("clear", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) {
resultPane.setText("");
caption.clearMessage();
}
});
return resultPane;
}
public void printStackTrace(LoggingEvent event) {
int intLevel = event.getLevel().toInt();
Date date = new Date(event.getTimeStamp());
ThrowableInformation information = event.getThrowableInformation();
@ -241,9 +244,9 @@ public class DesignerLogHandler {
printMessage(event.getRenderedMessage(), intLevel, date, information == null ? null : information.getThrowable());
}
}
public void printStackTrace(String message, Level level, Date date) {
int intLevel = level.toInt();
if (intLevel == DesignerLogger.INFO_INT && showInfo.isSelected()) {
printMessage(message, intLevel, date);
@ -252,32 +255,36 @@ public class DesignerLogHandler {
} else if (intLevel == DesignerLogger.WARN_INT && showServer.isSelected()) {
printMessage(message, intLevel, date);
}
}
private void printMessage(String message, int intLevel, Date date) {
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);
String message = appendLocaleMark(msg, intLevel);
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);
}
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);
LogHandlerArea.this.log(message, intLevel);
setMessage(message, intLevel);
if (e == null) {
return;
}
StackTraceElement[] traceElements = e.getStackTrace();
for (StackTraceElement traceElement : traceElements) {
LogHandlerArea.this.log("\t" + "at " + traceElement.toString() + "\n", 0);
}
}
});
}
private void log(String str, int style) {
SimpleAttributeSet attrSet = new SimpleAttributeSet();
if (style == DesignerLogger.ERROR_INT) {
StyleConstants.setForeground(attrSet, new Color(247, 148, 29));
@ -299,9 +306,9 @@ public class DesignerLogHandler {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
private String appendLocaleMark(String str, int style) {
if (style == DesignerLogger.ERROR_INT) {
str = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert") + ":" + str + "\n";
} else if (style == DesignerLogger.WARN_INT) {
@ -311,9 +318,9 @@ public class DesignerLogHandler {
}
return str;
}
private void setMessage(String message, int level) {
LogMessageBar.getInstance().setMessage(message);
if (level == DesignerLogger.INFO_INT && showInfo.isSelected()) {
caption.infoAdd();
@ -323,31 +330,32 @@ public class DesignerLogHandler {
caption.serverAdd();
}
}
private void checkEnabled() {
this.selectAll.setEnabled(true);
this.copy.setEnabled(true);
this.clear.setEnabled(true);
if (ComparatorUtils.equals(this.jTextArea.getText(), "")) {
this.selectAll.setEnabled(false);
this.clear.setEnabled(false);
}
if (ComparatorUtils.equals(this.jTextArea.getSelectionStart(), this.jTextArea.getSelectionEnd())) {
this.copy.setEnabled(false);
}
if (this.jTextArea.getSelectionStart() == 0 && ComparatorUtils.equals(this.jTextArea.getSelectionEnd(), this.jTextArea.getText().length())) {
this.selectAll.setEnabled(false);
}
}
ActionListener popupListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.selectAll.getText())) {
LogHandlerArea.this.jTextArea.selectAll();
} else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.copy.getText())) {
@ -358,6 +366,6 @@ public class DesignerLogHandler {
}
}
};
}
}

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

13
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -54,6 +54,7 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.update.actions.SoftwareUpdateAction;
import com.fr.design.utils.ThemeUtils;
@ -70,6 +71,8 @@ import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.stable.os.support.OSSupportCenter;
import com.fr.start.OemHandler;
import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.Nullable;
@ -524,7 +527,7 @@ public abstract class ToolBarMenuDock {
* @return 帮组菜单的子菜单
*/
public ShortCut[] createHelpShortCuts() {
java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
final java.util.List<ShortCut> shortCuts = new ArrayList<ShortCut>();
shortCuts.add(new WebDemoAction());
// 英文,把 video 和帮助文档放到 Help 下面
if (GeneralContext.getLocale().equals(Locale.US)) {
@ -541,7 +544,13 @@ public abstract class ToolBarMenuDock {
shortCuts.add(SeparatorDef.DEFAULT);
if (DesignerEnvManager.getEnvManager().isOpenDebug()) {
shortCuts.add(new FineUIAction());
OSSupportCenter.buildAction(new OSBasedAction() {
@Override
public void execute(Object... objects) {
shortCuts.add(new FineUIAction());
}
}, SupportOSImpl.FINEUI);
}
shortCuts.add(new AboutAction());

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

@ -1,6 +1,8 @@
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;
import com.fr.design.file.TemplateTreePane;
@ -25,9 +27,9 @@ import com.fr.workspace.server.vcs.git.config.GcConfig;
import javax.swing.Icon;
import javax.swing.border.EmptyBorder;
import java.awt.Color;
import java.util.Date;
import static com.fr.stable.StableUtils.pathJoin;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created by XiaXiang on 2019/4/17.
@ -49,10 +51,10 @@ public class VcsHelper implements JTemplateActionListener {
public final static int OFFSET = 2;
private static final int MINUTE = 60 * 1000;
private final static String VCS_PLUGIN_ID = "com.fr.plugin.vcs.v10";
private static final VcsHelper instance = new VcsHelper();
private static final VcsHelper INSTANCE = new VcsHelper();
public static VcsHelper getInstance() {
return instance;
return INSTANCE;
}
private int containsFolderCounts() {
@ -111,7 +113,7 @@ public class VcsHelper implements JTemplateActionListener {
if (configManager.isSaveCommit() && StringUtils.isNotBlank(entity.getCommitMsg())) {
return false;
}
return new Date().getTime() - entity.getTime().getTime() < DesignerEnvManager.getEnvManager().getVcsConfigManager().getSaveInterval() * MINUTE;
return System.currentTimeMillis() - entity.getTime().getTime() < DesignerEnvManager.getEnvManager().getVcsConfigManager().getSaveInterval() * MINUTE;
}
public boolean needInit() {
@ -125,7 +127,8 @@ public class VcsHelper implements JTemplateActionListener {
* @param jt
*/
public void fireVcs(final JTemplate jt) {
new Thread(new Runnable() {
ExecutorService fireVcs = Executors.newSingleThreadExecutor(new NamedThreadFactory("fireVcs"));
fireVcs.execute(new Runnable() {
@Override
public void run() {
@ -152,8 +155,8 @@ public class VcsHelper implements JTemplateActionListener {
}
}
}).start();
});
fireVcs.shutdown();
}
@ -169,7 +172,9 @@ public class VcsHelper implements JTemplateActionListener {
*/
@Override
public void templateSaved(JTemplate<?, ?> jt) {
if (needInit() && DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable() && !FineClusterConfig.getInstance().isCluster()) {
if (needInit()
&& DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable()
&& !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());
}
});

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

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

77
designer-base/src/main/java/com/fr/design/os/impl/DatabaseDialogAction.java

@ -0,0 +1,77 @@
package com.fr.design.os.impl;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.data.datapane.connect.ConnectionManagerPane;
import com.fr.design.dcm.UniversalDatabaseOpener;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.file.ConnectionConfig;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import static com.fr.design.actions.server.ConnectionListAction.doWithDatasourceManager;
/**
* 数据连接窗口
* @author pengda
* @date 2019/10/9
*/
public class DatabaseDialogAction implements OSBasedAction {
@Override
public void execute(Object... objects) {
if (ServerPreferenceConfig.getInstance().isUseUniverseDBM() && !OperatingSystem.isLinux()) {
UniversalDatabaseOpener.showUniverseDatabaseDialog();
} else {
openDesignDatabaseManager();
}
}
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);
}
}

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

@ -0,0 +1,58 @@
package com.fr.design.os.impl;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
import java.io.IOException;
/**
* @author pengda
* @date 2019/10/9
*/
public class DemoAction implements OSBasedAction {
@Override
public void execute(Object... objects) {
String installHome = StableUtils.getInstallHome();
if (installHome == null) {
FineLoggerFactory.getLogger().error("Can not find the install home, please check it.");
return;
}
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 demo");
}
if (OperatingSystem.isMacos()) {
ProcessBuilder builder = new ProcessBuilder();
builder.command("open", "-a", executorPath, "--args", "demo");
try {
builder.start();
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} else if(OperatingSystem.isWindows()){
// ProcessBuilder这种方式在window下报错:系统找不到指定文件
Runtime rt = Runtime.getRuntime();
try {
rt.exec(executorPath);
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}else{
//先用和win一样的方式
Runtime rt = Runtime.getRuntime();
try {
rt.exec(executorPath);
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
}

30
designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java

@ -0,0 +1,30 @@
package com.fr.design.os.impl;
import com.fr.config.ServerPreferenceConfig;
import com.fr.design.extra.WebViewDlgHelper;
import com.fr.design.upm.UpmFinder;
import com.fr.design.utils.DesignUtils;
import com.fr.stable.os.Arch;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
/**
* 插件管理窗口
* @author pengda
* @date 2019/10/9
*/
public class PMDialogAction implements OSBasedAction {
private static String PLUGIN_MANAGER_ROUTE = "#management/plugin";
@Override
public void execute(Object... objects) {
if(Arch.getArch() == Arch.ARM){
DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null);
return;
}
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() && !OperatingSystem.isLinux()) {
UpmFinder.showUPMDialog();
} else {
WebViewDlgHelper.createPluginDialog();
}
}
}

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

Loading…
Cancel
Save