Browse Source

Merge pull request #1441 in DESIGN/design from ~NEIL/design:release/10.0 to release/10.0

* commit '194810931f6510ffe7b45c20658a5d8c34f35eb9': (150 commits)
  ct
  ct
  ct
  ct
  ct
  ct
  ct
  ct
  ct
  ct
  去掉是否连接弹出框
  CHART-12733 图表数据结构 地图相关 回退
  通过内部类来做异常处理
  CHART-12733 线型支持虚线 补充网格线 警戒线 趋势线。 回退
  RPC调用自定义异常处理方法做抽象
  CHART-12733 图表数据结构 回退
  CHART-12733 大数据模式 回退
  CHART-12733 线型支持虚线 回退
  CHART-12733 轴标签缩略间隔显示 回退
  CHART-12733 标签的自动调整 回退
  ...
feature/big-screen
neil 5 years ago
parent
commit
9806e23955
  1. 15
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 121
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  3. 3
      designer-base/src/main/java/com/fr/design/RestartHelper.java
  4. 2
      designer-base/src/main/java/com/fr/design/actions/help/FineUIAction.java
  5. 2
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindDialog.java
  6. 2
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindPane.java
  7. 43
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  8. 1
      designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java
  9. 2
      designer-base/src/main/java/com/fr/design/condition/ContinuousTreeSelectionModel.java
  10. 2
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  11. 6
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  12. 1
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePaneSupportFormula.java
  13. 1
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  14. 6
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  15. 3
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java
  16. 10
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/AutoStoreProcedureTableModel.java
  17. 3
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java
  18. 25
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/CustomDictModel.java
  19. 6
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  20. 21
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  21. 5
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
  22. 11
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  23. 2
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java
  24. 1
      designer-base/src/main/java/com/fr/design/designer/EditingState.java
  25. 4
      designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java
  26. 94
      designer-base/src/main/java/com/fr/design/dialog/ErrorDialog.java
  27. 1
      designer-base/src/main/java/com/fr/design/dialog/JWizardDialog.java
  28. 2
      designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java
  29. 92
      designer-base/src/main/java/com/fr/design/dialog/TipDialog.java
  30. 19
      designer-base/src/main/java/com/fr/design/editor/editor/WidgetNameEditor.java
  31. 2
      designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java
  32. 1
      designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java
  33. 20
      designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java
  34. 4
      designer-base/src/main/java/com/fr/design/extra/AppStoreBuilder.java
  35. 9
      designer-base/src/main/java/com/fr/design/extra/LoginDialog.java
  36. 7
      designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java
  37. 3
      designer-base/src/main/java/com/fr/design/extra/PluginAbstractLoadingViewPane.java
  38. 5
      designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java
  39. 10
      designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java
  40. 3
      designer-base/src/main/java/com/fr/design/extra/PluginUpdatePane.java
  41. 10
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  42. 2
      designer-base/src/main/java/com/fr/design/extra/QQLoginDialog.java
  43. 1
      designer-base/src/main/java/com/fr/design/extra/ShopDialog.java
  44. 38
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  45. 2
      designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java
  46. 22
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  47. 23
      designer-base/src/main/java/com/fr/design/fun/MultiStyleUIConfigProvider.java
  48. 39
      designer-base/src/main/java/com/fr/design/fun/StyleUIConfigProvider.java
  49. 26
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractMultiStyleUIConfigProvider.java
  50. 41
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractStyleUIConfigProvider.java
  51. 8
      designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java
  52. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java
  53. 8
      designer-base/src/main/java/com/fr/design/gui/frpane/UnitInputPane.java
  54. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/SpecialUIButton.java
  55. 1
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIBasicButtonUI.java
  56. 4
      designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java
  57. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java
  58. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIPasswordField.java
  59. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIPreviewButton.java
  60. 14
      designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java
  61. 8
      designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java
  62. 6
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java
  63. 18
      designer-base/src/main/java/com/fr/design/gui/icombobox/ComboCheckBox.java
  64. 1
      designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java
  65. 21
      designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java
  66. 4
      designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java
  67. 10
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  68. 24
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java
  69. 12
      designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java
  70. 42
      designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java
  71. 3
      designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java
  72. 2
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java
  73. 44
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java
  74. 8
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java
  75. 41
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java
  76. 6
      designer-base/src/main/java/com/fr/design/gui/itable/UITable.java
  77. 14
      designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java
  78. 36
      designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java
  79. 6
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxUtilities.java
  80. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java
  81. 4
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java
  82. 9
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java
  83. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/folding/HtmlFoldParser.java
  84. 1
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/modes/FormulaTokenMaker.java
  85. 4
      designer-base/src/main/java/com/fr/design/icon/BorderIcon.java
  86. 2
      designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java
  87. 6
      designer-base/src/main/java/com/fr/design/layout/TableLayout.java
  88. 3
      designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java
  89. 4
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  90. 2
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java
  91. 2
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionDialog.java
  92. 4
      designer-base/src/main/java/com/fr/design/scrollruler/VerticalRulerUI.java
  93. 6
      designer-base/src/main/java/com/fr/design/style/background/impl/PatternBackgroundPane.java
  94. 8
      designer-base/src/main/java/com/fr/design/style/background/impl/TextureBackgroundPane.java
  95. 99
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  96. 87
      designer-base/src/main/java/com/fr/design/utils/DesignerPort.java
  97. 97
      designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java
  98. 30
      designer-base/src/main/java/com/fr/exit/DesignerExiter.java
  99. 8
      designer-base/src/main/java/com/fr/file/FileNodeFILE.java
  100. 6
      designer-base/src/main/java/com/fr/start/BaseDesigner.java
  101. Some files were not shown because too many files have changed in this diff Show More

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

@ -19,6 +19,7 @@ import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.update.push.DesignerPushUpdateConfigManager;
import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.DesignerPort;
import com.fr.file.FILEFactory; import com.fr.file.FILEFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogFormatter; import com.fr.general.FRLogFormatter;
@ -1545,7 +1546,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readDesignerPushUpdateAttr(reader); readDesignerPushUpdateAttr(reader);
} else if (name.equals(vcsConfigManager.XML_TAG)) { } else if (name.equals(vcsConfigManager.XML_TAG)) {
readVcsAttr(reader); readVcsAttr(reader);
} else { } else if (DesignerPort.XML_TAG.equals(name)) {
readDesignerPort(reader);
}
else {
readLayout(reader, name); readLayout(reader, name);
} }
} }
@ -1736,6 +1740,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
reader.readXMLObject(vcsConfigManager); reader.readXMLObject(vcsConfigManager);
} }
public void readDesignerPort(XMLableReader reader) {
reader.readXMLObject(DesignerPort.getInstance());
}
/** /**
* Write XML.<br> * Write XML.<br>
* The method will be invoked when save data to XML file.<br> * The method will be invoked when save data to XML file.<br>
@ -1761,6 +1769,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
writeOpenDebug(writer); writeOpenDebug(writer);
writeDesignerPushUpdateAttr(writer); writeDesignerPushUpdateAttr(writer);
writeVcsAttr(writer); writeVcsAttr(writer);
writeDesignerPort(writer);
writer.end(); writer.end();
} }
@ -2010,6 +2019,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.vcsConfigManager.writeXML(writer); this.vcsConfigManager.writeXML(writer);
} }
private void writeDesignerPort(XMLPrintWriter writer) {
DesignerPort.getInstance().writeXML(writer);
}
public VcsConfigManager getVcsConfigManager() { public VcsConfigManager getVcsConfigManager() {
return vcsConfigManager; return vcsConfigManager;

121
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -7,32 +7,47 @@ import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.RemoteWorkspace;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.write.submit.CheckServiceDialog;
import com.fr.env.EnvListPane; import com.fr.env.EnvListPane;
import com.fr.exit.DesignerExiter;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.GeneralUtils;
import com.fr.invoke.Reflect;
import com.fr.json.JSONArray;
import com.fr.license.exception.RegistEditionException; import com.fr.license.exception.RegistEditionException;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.rpc.Result;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.start.server.ServerTray; import com.fr.start.server.ServerTray;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.WorkContextCallback; import com.fr.workspace.WorkContextCallback;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.base.WorkspaceAPI;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.base.FineObjectPool;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
import com.fr.workspace.engine.exception.WorkspaceAuthException; import com.fr.workspace.engine.exception.WorkspaceAuthException;
import com.fr.workspace.engine.exception.WorkspaceConnectionException;
import com.fr.workspace.engine.rpc.WorkspaceProxyPool;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.HashSet;
import static javax.swing.JOptionPane.ERROR_MESSAGE; import static javax.swing.JOptionPane.ERROR_MESSAGE;
import static javax.swing.JOptionPane.QUESTION_MESSAGE; import static javax.swing.JOptionPane.QUESTION_MESSAGE;
@ -84,6 +99,7 @@ public class EnvChangeEntrance {
private boolean switch2Env(final String envName, PopTipStrategy strategy) { private boolean switch2Env(final String envName, PopTipStrategy strategy) {
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName); DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName);
WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection();
try { try {
Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv); Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv);
@ -98,12 +114,7 @@ public class EnvChangeEntrance {
}); });
return false; return false;
} }
// 如果版本不一致,且确认 不继续 连接,这里返回 false.
if (!versionCheckAndConfirm(selectedEnv)) {
return false;
}
WorkContext.switchTo(workspace, new WorkContextCallback() { WorkContext.switchTo(workspace, new WorkContextCallback() {
@Override @Override
public void done() { public void done() {
@ -122,6 +133,35 @@ public class EnvChangeEntrance {
template.refreshToolArea(); template.refreshToolArea();
} }
//是否需要做服务校验
if(needCheckBranch(selectedEnv)) {
String localBranch;
String remoteBranch;
localBranch = GeneralUtils.readFullBuildNO();
try {
remoteBranch = new FunctionalHttpRequest(connectionInfo).getServerBranch();
} catch (WorkspaceConnectionException e) {
remoteBranch = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") + formatBranch(localBranch);
}
//通过是否包含#来避免当前版本为非安装版本(主要是内部开发版本)
if (localBranch.contains("#") && localBranch.equals(remoteBranch)) {
//说明版本一致,仅做日志记录
FineLoggerFactory.getLogger().info("Remote Designer version consistency");
} else {
localBranch = formatBranch(localBranch);
remoteBranch = formatBranch(remoteBranch);
Set<Class> noExistServiceSet = getNoExistServiceSet(connectionInfo);
StringBuilder textBuilder = new StringBuilder();
for (Class clazz : noExistServiceSet) {
WorkspaceAPI workspaceAPI = (WorkspaceAPI) clazz.getAnnotation(WorkspaceAPI.class);
String descriptionOfCN = InterProviderFactory.getProvider().getLocText(workspaceAPI.description());
textBuilder.append(descriptionOfCN).append("\n");
}
String areaText = textBuilder.toString();
CheckServiceDialog dialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), areaText, localBranch, remoteBranch);
dialog.setVisible(true);
}
}
} catch (WorkspaceAuthException | RegistEditionException e) { } catch (WorkspaceAuthException | RegistEditionException e) {
// String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed"); // String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed");
// String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote"); // String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote");
@ -154,6 +194,7 @@ public class EnvChangeEntrance {
} }
/** /**
* 这个功能留着可能会加回来先做注释处理
* 切换远程环境之前进行版本检测当版本不一致的时候提示 * 切换远程环境之前进行版本检测当版本不一致的时候提示
* 当用户确认选择 ok 才继续 * 当用户确认选择 ok 才继续
* *
@ -197,6 +238,71 @@ public class EnvChangeEntrance {
return true; return true;
} }
/**
* 判断是否需要做版本验证判断依据为
* 1选择的环境为远程环境
* 2一个月内不弹出是否勾选这里预留还未实际增加
* @param selectedEnv 选择的环境
* @return
*/
private boolean needCheckBranch(DesignerWorkspaceInfo selectedEnv){
return selectedEnv.getType() == DesignerWorkspaceType.Remote;
}
public Set<Class> getNoExistServiceSet(WorkspaceConnectionInfo info){
Set<Class> noExistServiceSet = new HashSet<Class>();
Set<Class> remoteServiceSet = new HashSet<Class>();
Set<Class> localServiceSet = FineObjectPool.getInstance().getServerPool().keySet();
try {
JSONArray serviceArray = new FunctionalHttpRequest(info).getServiceList();
for(int i = 0; i < serviceArray.size(); i++){
try{
Class clazz = Class.forName((String) serviceArray.get(i));
remoteServiceSet.add(clazz);
} catch (Exception e){
continue;
}
}
noExistServiceSet.addAll(localServiceSet);
noExistServiceSet.removeAll(remoteServiceSet);
return noExistServiceSet;
} catch (WorkspaceConnectionException e) {
FineLoggerFactory.getLogger().info(e.getMessage());
//根据本地的服务列表做逐一检测
for(Class clazz : localServiceSet) {
Method testMethod = Reflect.on(Method.class).create(clazz, "connectTest", new Class[0], String.class, new Class[0], 1025, 8, null, null, null, null).get();
WorkspaceProxyPool proxyPool = (WorkspaceProxyPool) (((RemoteWorkspace) WorkContext.getCurrent()).getClient()).getPool();
Result result = proxyPool.testInvoker(testMethod);
Exception invokeException = (Exception) result.getException();
if(invokeException != null){
Exception cause = (Exception) invokeException.getCause();
//获取被包装最底层的异常
while (cause != null) {
invokeException = cause;
cause = (Exception) invokeException.getCause();
}
//该异常表示服务不存在
if(invokeException instanceof ClassNotFoundException){
noExistServiceSet.add(clazz);
}
}
}
return noExistServiceSet;
} catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(),e);
return null;
}
}
private String formatBranch(String branch){
if(branch.contains("#")){
return branch.substring(branch.lastIndexOf("#") + 1, branch.length() - 13);
}
return branch;
}
/** /**
* 编辑items * 编辑items
* *
@ -244,14 +350,13 @@ public class EnvChangeEntrance {
@Override @Override
public void doOk() { public void doOk() {
if (!envListOkAction(envListPane, PopTipStrategy.NOW)) { if (!envListOkAction(envListPane, PopTipStrategy.NOW)) {
System.exit(0); DesignerExiter.getInstance().execute();
} }
} }
@Override @Override
public void doCancel() { public void doCancel() {
System.exit(0); DesignerExiter.getInstance().execute(); }
}
}); });
envListDialog.setVisible(true); envListDialog.setVisible(true);
} }

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

@ -2,6 +2,7 @@ package com.fr.design;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.RestartAction; import com.fr.design.os.impl.RestartAction;
import com.fr.exit.DesignerExiter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -152,7 +153,7 @@ public class RestartHelper {
} finally { } finally {
WorkContext.getCurrent().close(); WorkContext.getCurrent().close();
frame.dispose(); frame.dispose();
System.exit(0); DesignerExiter.getInstance().execute();
} }
} }

2
designer-base/src/main/java/com/fr/design/actions/help/FineUIAction.java

@ -51,7 +51,7 @@ public class FineUIAction extends UpdateAction {
BasicDialog dialog = pane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { BasicDialog dialog = pane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
// Do nothing
} }
}); });
dialog.setVisible(true); dialog.setVisible(true);

2
designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindDialog.java

@ -31,7 +31,7 @@ public class RemindDialog extends UIDialog {
@Override @Override
public void checkValid() throws Exception { public void checkValid() throws Exception {
// Do nothing
} }
public RemindPane getRemindPane() { public RemindPane getRemindPane() {

2
designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindPane.java

@ -114,6 +114,7 @@ public class RemindPane extends JPanel {
@Override @Override
public void removeLayoutComponent(Component comp) { public void removeLayoutComponent(Component comp) {
// Do nothing
} }
@Override @Override
@ -139,6 +140,7 @@ public class RemindPane extends JPanel {
@Override @Override
public void addLayoutComponent(String name, Component comp) { public void addLayoutComponent(String name, Component comp) {
// Do nothing
} }
}; };
} }

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

@ -57,49 +57,6 @@ public class ConnectionListAction extends UpdateAction {
osBasedAction.execute(); 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 * 更新datasourceManager
* *

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

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

2
designer-base/src/main/java/com/fr/design/condition/ContinuousTreeSelectionModel.java

@ -16,8 +16,6 @@ import com.fr.design.utils.gui.GUICoreUtils;
* 一个层次连续节点. * 一个层次连续节点.
*/ */
public class ContinuousTreeSelectionModel extends DefaultTreeSelectionModel { public class ContinuousTreeSelectionModel extends DefaultTreeSelectionModel {
public ContinuousTreeSelectionModel() {
}
public void addSelectionPaths(TreePath[] paths) { public void addSelectionPaths(TreePath[] paths) {
if (paths == null || paths.length == 0) { if (paths == null || paths.length == 0) {

2
designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java

@ -272,10 +272,12 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
*/ */
@Override @Override
public void editingCanceled(ChangeEvent e) { public void editingCanceled(ChangeEvent e) {
// Do nothing
} }
@Override @Override
public void editingStopped(ChangeEvent e) { public void editingStopped(ChangeEvent e) {
// Do nothing
} }
} }

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

@ -104,10 +104,12 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
@Override @Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
// Do nothing
} }
@Override @Override
public void popupMenuCanceled(PopupMenuEvent e) { public void popupMenuCanceled(PopupMenuEvent e) {
// Do nothing
} }
}; };
@ -115,10 +117,12 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
private PopupMenuListener listener = new PopupMenuListener() { private PopupMenuListener listener = new PopupMenuListener() {
@Override @Override
public void popupMenuCanceled(PopupMenuEvent e) { public void popupMenuCanceled(PopupMenuEvent e) {
// Do nothing
} }
@Override @Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
// Do nothing
} }
@Override @Override
@ -200,6 +204,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
} }
protected void addFocusListener() { protected void addFocusListener() {
// Do nothing
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -493,6 +498,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
} }
protected void failedToFindTable() { protected void failedToFindTable() {
// Do nothing
} }
protected String getTableName() { protected String getTableName() {

1
designer-base/src/main/java/com/fr/design/data/datapane/ChoosePaneSupportFormula.java

@ -75,6 +75,7 @@ public class ChoosePaneSupportFormula extends ChoosePane {
} }
protected void addFocusListener() { protected void addFocusListener() {
// Do nothing
} }
/** /**

1
designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java

@ -256,6 +256,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
} }
protected void checkRepeatedDSName(List<String> exsitTableDataNameList) { protected void checkRepeatedDSName(List<String> exsitTableDataNameList) {
// Do nothing
} }
/** /**

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

3
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java

@ -140,8 +140,6 @@ public class PreviewTableModel extends AbstractTableModel {
* 就是由于预览的JTable在不停的getRowCount来显示数据. * 就是由于预览的JTable在不停的getRowCount来显示数据.
*/ */
private static class ErrorResultSet extends AbstractDataModel { private static class ErrorResultSet extends AbstractDataModel {
public ErrorResultSet() {
}
public int getRowCount() { public int getRowCount() {
return 0; return 0;
@ -160,6 +158,7 @@ public class PreviewTableModel extends AbstractTableModel {
} }
public void release() throws Exception { public void release() throws Exception {
// Do nothing
} }
} }

10
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.setDefaultEditor(ParameterTableModel.ParameterEditor.class, new ParameterTableModel().new ParameterEditor());
this.setDefaultRenderer(StoreProcedureParameterValueEditor.class, new ProcedureParameterValueRenderer()); this.setDefaultRenderer(StoreProcedureParameterValueEditor.class, new ProcedureParameterValueRenderer());
} }
@Override
public boolean isCellEditable(int row, int col) { public boolean isCellEditable(int row, int col) {
if (ComparatorUtils.equals(getValueAt(row, col -1), "OUT")) { if (ComparatorUtils.equals(getValueAt(row, col -1), "OUT")) {
return false; return false;
@ -48,6 +49,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
return false; return false;
} }
@Override
public boolean shouldResponseDoubleClickAction () { public boolean shouldResponseDoubleClickAction () {
return false; return false;
} }
@ -60,7 +62,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
editor = ValueEditorPaneFactory.createStoreProcedValueEditorPane(); editor = ValueEditorPaneFactory.createStoreProcedValueEditorPane();
editor.getMenu().addPopupMenuListener(new PopupMenuListener() { editor.getMenu().addPopupMenuListener(new PopupMenuListener() {
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
// Do nothing
} }
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
@ -77,15 +79,16 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
}, 100); }, 100);
} }
@Override
public void popupMenuCanceled(PopupMenuEvent e) { public void popupMenuCanceled(PopupMenuEvent e) {
//do nothing
} }
}); });
this.addCellEditorListener(new CellEditorListener() { this.addCellEditorListener(new CellEditorListener() {
@Override @Override
public void editingCanceled(ChangeEvent e) { public void editingCanceled(ChangeEvent e) {
//do nothing
} }
@Override @Override
@ -147,6 +150,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
editor = ValueEditorPaneFactory.createStoreProcedValueEditorPane(); editor = ValueEditorPaneFactory.createStoreProcedValueEditorPane();
} }
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
editor.setCurrentEditor(0); editor.setCurrentEditor(0);
editor.populate(value); 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")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
} }
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
java.util.List<ParameterProvider> oldParas = editorPane.update(); java.util.List<ParameterProvider> oldParas = editorPane.update();
oldParas.add(new Parameter()); oldParas.add(new Parameter());
@ -132,6 +133,7 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
@Override @Override
public void checkEnabled() { public void checkEnabled() {
//do nothing
} }
} }
private class RemoveParaAction extends UITableEditAction { private class RemoveParaAction extends UITableEditAction {
@ -149,6 +151,7 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
@Override @Override
public void checkEnabled() { 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; package com.fr.design.data.tabledata.tabledatapane;
import java.awt.Component; import com.fr.design.gui.itableeditorpane.ActionStyle;
import java.awt.event.ActionEvent; import com.fr.design.gui.itableeditorpane.UIArrayTableModel;
import java.awt.event.ActionListener; import com.fr.design.gui.itableeditorpane.UITableEditAction;
import java.util.ArrayList; import com.fr.design.gui.itableeditorpane.UITableModelAdapter;
import java.util.List; import com.fr.design.gui.itextfield.UITextField;
import javax.swing.AbstractCellEditor; import javax.swing.AbstractCellEditor;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.event.CellEditorListener; import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellEditor;
import java.awt.Component;
import com.fr.design.gui.itableeditorpane.ActionStyle; import java.awt.event.ActionEvent;
import com.fr.design.gui.itableeditorpane.UIArrayTableModel; import java.awt.event.ActionListener;
import com.fr.design.gui.itableeditorpane.UITableEditAction; import java.util.ArrayList;
import com.fr.design.gui.itableeditorpane.UITableModelAdapter; import java.util.List;
import com.fr.design.gui.itextfield.UITextField;
public class CustomDictModel extends UITableModelAdapter<Object[]> implements ActionStyle { 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()); this.setDefaultEditor(ParameterEditor.class, new ParameterEditor());
} }
@Override
public Object getValueAt(int row, int column) { public Object getValueAt(int row, int column) {
Object[] os = this.getList().get(row); Object[] os = this.getList().get(row);
return os[column]; return os[column];
} }
@Override
public void setValueAt(Object value, int row, int column) { public void setValueAt(Object value, int row, int column) {
Object[] os = this.getList().get(row); Object[] os = this.getList().get(row);
os[column] = value; os[column] = value;
@ -104,7 +105,7 @@ public class CustomDictModel extends UITableModelAdapter<Object[]> implements Ac
@Override @Override
public void editingCanceled(ChangeEvent e) { public void editingCanceled(ChangeEvent e) {
//do nothing
} }
@Override @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 @Override
protected void addKeyMonitor() { protected void addKeyMonitor() {
searchField.addKeyListener(new KeyListener() { searchField.addKeyListener(new KeyListener() {
@Override @Override
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
//do nothing
} }
@Override @Override
@ -117,7 +117,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
@Override @Override
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
//do nothing
} }
}); });
} }

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

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

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

@ -188,6 +188,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
} }
populateWorker = new SwingWorker<Void, Void>() { populateWorker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception { protected Void doInBackground() throws Exception {
try { try {
storeProcedureContext.setText(StringUtils.EMPTY); storeProcedureContext.setText(StringUtils.EMPTY);
@ -205,6 +206,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
return null; return null;
} }
@Override
public void done() { public void done() {
editorPane.populate(storeprocedure.getParameters()); editorPane.populate(storeprocedure.getParameters());
} }
@ -219,6 +221,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
* *
* @param listener 监听器 * @param listener 监听器
*/ */
@Override
public void addStoreProcedureWorkerListener(StoreProcedureWorkerListener listener) { public void addStoreProcedureWorkerListener(StoreProcedureWorkerListener listener) {
this.storeProcedureWorkerListener = listener; this.storeProcedureWorkerListener = listener;
@ -228,6 +231,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
/** /**
* 去除存储过程监听器 * 去除存储过程监听器
*/ */
@Override
public void removeStoreProcedureWorkerListener() { public void removeStoreProcedureWorkerListener() {
this.storeProcedureWorkerListener = null; this.storeProcedureWorkerListener = null;
@ -265,6 +269,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
} }
updateWorker = new SwingWorker<Void, Void>() { updateWorker = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception { protected Void doInBackground() throws Exception {
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
sp.setCalculating(true); sp.setCalculating(true);
@ -272,6 +277,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
return null; return null;
} }
@Override
public void done() { public void done() {
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
sp.setCalculating(false); sp.setCalculating(false);
@ -329,6 +335,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
/** /**
* 响应数据集改变 * 响应数据集改变
*/ */
@Override
public void fireDSChanged() { public void fireDSChanged() {
fireDSChanged(new HashMap<String, String>()); fireDSChanged(new HashMap<String, String>());
} }
@ -338,6 +345,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
* *
* @param map 改变的map * @param map 改变的map
*/ */
@Override
public void fireDSChanged(Map<String, String> map) { public void fireDSChanged(Map<String, String> map) {
DesignTableDataManager.fireDSChanged(map); DesignTableDataManager.fireDSChanged(map);
} }
@ -349,6 +357,7 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/preview.png"));
} }
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
StoreProcedure sp = updateBeanWithOutExecute(); StoreProcedure sp = updateBeanWithOutExecute();
StoreProcedureDataWrapper storeProcedureDataWrappe = new StoreProcedureDataWrapper(sp, StringUtils.EMPTY, queryText.getText()); StoreProcedureDataWrapper storeProcedureDataWrappe = new StoreProcedureDataWrapper(sp, StringUtils.EMPTY, queryText.getText());
@ -362,12 +371,14 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"));
} }
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
refresh(); refresh();
} }
@Override @Override
public void checkEnabled() { 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 @Override
public void checkValid() throws Exception { 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 @Override
public void revert() { public void revert() {
//do nothing
} }
}; };

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 @Override
public void addLayoutComponent(String name, Component comp) { public void addLayoutComponent(String name, Component comp) {
//do nothing
} }
@Override @Override
public void removeLayoutComponent(Component comp) { public void removeLayoutComponent(Component comp) {
//do nothing
} }
@Override @Override

94
designer-base/src/main/java/com/fr/design/dialog/ErrorDialog.java

@ -0,0 +1,94 @@
package com.fr.design.dialog;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/1/8
*/
public abstract class ErrorDialog extends JDialog implements ActionListener {
private UIButton okButton;
private UIButton restartButton;
public ErrorDialog(Frame parent, String message, String title, String detail) {
super(parent, true);
JPanel northPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel messagePane = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true);
UILabel boldFontLabel = new UILabel(message);
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Send_Report_To_Us"));
Font font = FRFont.getInstance("Dialog", Font.BOLD, 20);
boldFontLabel.setFont(font);
messagePane.add(boldFontLabel);
messagePane.add(label);
northPane.add(messagePane);
JTextArea area = new JTextArea(detail);
area.setPreferredSize(new Dimension(400, 100));
area.setEnabled(true);
area.setEditable(false);
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
UILabel detailLabel = new UILabel(Toolkit.i18nText("Fine-Design_Problem_Detail_Message"));
centerPane.add(detailLabel, BorderLayout.NORTH);
centerPane.add(area, BorderLayout.CENTER);
JPanel southPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0));
okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Ok"));
okButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
okEvent();
}
});
buttonPane.add(okButton);
restartButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Restart"));
restartButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
restartEvent();
}
});
buttonPane.add(restartButton);
controlPane.add(buttonPane, BorderLayout.EAST);
southPane.add(controlPane);
this.setTitle(title);
this.setResizable(false);
this.add(northPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER);
this.add(southPane, BorderLayout.SOUTH);
this.setSize(new Dimension(600, 500));
GUICoreUtils.centerWindow(this);
}
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
protected abstract void okEvent();
protected abstract void restartEvent();
}

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

@ -363,5 +363,6 @@ public class JWizardDialog extends BasicDialog {
@Override @Override
public void checkValid() throws Exception { 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() { public void addNotify() {
if (firstNotify) { if (firstNotify) {
Font font = stepTitleLabel.getFont(); 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); stepTitleLabel.setFont(font);
firstNotify = false; firstNotify = false;
} }

92
designer-base/src/main/java/com/fr/design/dialog/TipDialog.java

@ -0,0 +1,92 @@
package com.fr.design.dialog;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/1/8
*/
public abstract class TipDialog extends JDialog implements ActionListener {
private UIButton endButton;
private UIButton cancelButton;
public TipDialog(Frame parent, String type) {
super(parent, true);
JPanel northPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel iconPane = new JPanel();
UILabel iconLabel = new UILabel();
iconLabel.setIcon(IOUtils.readIcon("com/fr/design/images/error/error.png"));
iconPane.add(iconLabel);
iconPane.setPreferredSize(new Dimension(100, 100));
JPanel tipPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
UILabel tipLabel = new UILabel(Toolkit.i18nText("Fine-Design_Last_Designer_Process_Not_Exist"));
tipPane.add(tipLabel);
northPane.add(iconPane, BorderLayout.WEST);
northPane.add(tipPane, BorderLayout.CENTER);
JTextArea area = new JTextArea(type);
area.setPreferredSize(new Dimension(400, 100));
area.setEnabled(true);
area.setEditable(false);
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
centerPane.add(area);
JPanel southPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel controlPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 0));
endButton = new UIButton(Toolkit.i18nText("Fine-Design_End_Occupied_Process"));
endButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
endEvent();
}
});
buttonPane.add(endButton);
cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel"));
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
cancelEvent();
}
});
buttonPane.add(cancelButton);
controlPane.add(buttonPane, BorderLayout.EAST);
southPane.add(controlPane);
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Error_Tittle"));
this.setResizable(false);
this.add(northPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER);
this.add(southPane, BorderLayout.SOUTH);
this.setSize(new Dimension(600, 500));
GUICoreUtils.centerWindow(this);
}
protected abstract void endEvent();
protected abstract void cancelEvent();
@Override
public void actionPerformed(ActionEvent e) {
dispose();
}
}

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

@ -1,18 +1,17 @@
package com.fr.design.editor.editor; 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.DesignModelAdapter;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.icombobox.FilterComboBox; import com.fr.design.gui.icombobox.FilterComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.js.WidgetName; 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 * the editor to edit WidgetName
* *
@ -43,12 +42,12 @@ public class WidgetNameEditor extends Editor<WidgetName> {
@Override @Override
public void popupMenuCanceled(PopupMenuEvent e) { public void popupMenuCanceled(PopupMenuEvent e) {
//do nothing
} }
@Override @Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
//do nothing
} }
@Override @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); writer.attr("path", path);
} }
@Override @Override
@SuppressWarnings("squid:S2975")
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
LocalDesignerWorkspaceInfo object = (LocalDesignerWorkspaceInfo)super.clone(); LocalDesignerWorkspaceInfo object = (LocalDesignerWorkspaceInfo)super.clone();

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

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

20
designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java vendored

@ -2,6 +2,7 @@ package com.fr.design.env;
import com.fr.cluster.engine.base.FineClusterConfig; import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.rpc.ExceptionHandler;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
@ -9,6 +10,8 @@ import com.fr.workspace.connect.WorkspaceClient;
import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnection;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.server.authority.decision.DecisionOperator; import com.fr.workspace.server.authority.decision.DecisionOperator;
import com.fr.workspace.engine.rpc.WorkspaceProxyPool;
import com.fr.workspace.pool.WorkObjectPool;
/** /**
* Created by juhaoyu on 2018/6/14. * Created by juhaoyu on 2018/6/14.
@ -84,6 +87,19 @@ public class RemoteWorkspace implements Workspace {
return client.getPool().get(type); return client.getPool().get(type);
} }
@Override
public <T> T get(Class<T> type, ExceptionHandler exceptionHandler){
if(exceptionHandler != null) {
WorkObjectPool objectPool = client.getPool();
if (objectPool instanceof WorkspaceProxyPool) {
return ((WorkspaceProxyPool) objectPool).get(type, exceptionHandler);
}else {
return client.getPool().get(type);
}
}
return client.getPool().get(type);
}
@Override @Override
public void close() { public void close() {
@ -102,4 +118,8 @@ public class RemoteWorkspace implements Workspace {
return obj instanceof RemoteWorkspace && AssistUtils.equals(((RemoteWorkspace) obj).connection, this.connection); return obj instanceof RemoteWorkspace && AssistUtils.equals(((RemoteWorkspace) obj).connection, this.connection);
} }
public WorkspaceClient getClient(){
return client;
}
} }

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 class AppStoreBuilder {
public void checkStoreJavaSciptVersion() { public void checkStoreJavaSciptVersion() {
//do nothing
} }
public void updateStoreJavaScript() { 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.design.utils.gui.GUICoreUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import javax.swing.JPanel; import javax.swing.*;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Frame;
/** /**
* Created by vito on 2017/5/5. * Created by vito on 2017/5/5.
@ -41,5 +37,6 @@ public class LoginDialog extends UIDialog {
@Override @Override
public void checkValid() throws Exception { 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 javafx.scene.web.WebEngine;
import netscape.javascript.JSObject; import netscape.javascript.JSObject;
import javax.swing.JDialog; import javax.swing.*;
import javax.swing.SwingUtilities; import java.awt.*;
import java.awt.Color;
import java.awt.Desktop;
import java.net.URI; import java.net.URI;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
@ -221,5 +219,6 @@ public class LoginWebBridge {
} }
public void openUrlAtLocalWebBrowser(WebEngine eng, String url) { 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.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -88,7 +87,7 @@ public abstract class PluginAbstractLoadingViewPane<V, T> extends PluginAbstract
@Override @Override
public void pressInstallButton() { public void pressInstallButton() {
// do nothing
} }
@Override @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.gui.itextfield.UITextField;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.license.Licensed; import com.fr.plugin.license.Licensed;
import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.PluginManager;
@ -23,7 +22,7 @@ import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import java.awt.*; import java.awt.*;
import java.util.*; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -155,7 +154,7 @@ public class PluginControlPane extends BasicPane {
PluginManager.getController().uninstall(PluginMarker.create(id, version), true, new PluginTaskCallback() { PluginManager.getController().uninstall(PluginMarker.create(id, version), true, new PluginTaskCallback() {
@Override @Override
public void done(PluginTaskResult result) { public void done(PluginTaskResult result) {
// do nothing
} }
}); });
} }

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

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

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

@ -5,7 +5,6 @@ import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.tradition.callback.UpdateOnlineCallback; import com.fr.design.extra.tradition.callback.UpdateOnlineCallback;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarker;
@ -193,7 +192,7 @@ public class PluginUpdatePane extends PluginAbstractLoadingViewPane<List<PluginV
PluginManager.getController().update(chosenFile, new ProgressCallback() { PluginManager.getController().update(chosenFile, new ProgressCallback() {
@Override @Override
public void updateProgress(String description, double progress) { public void updateProgress(String description, double progress) {
// do nothing
} }
@Override @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 static PluginWebBridge helper;
private UIDialog uiDialog; private UIDialog uiDialog;
private ACTIONS action; private ACTIONS actions;
private Map<String, Object> config; private Map<String, Object> config;
private WebEngine webEngine; private WebEngine webEngine;
@ -94,10 +94,10 @@ public class PluginWebBridge {
* @return 配置信息 * @return 配置信息
*/ */
public String getRunConfig() { public String getRunConfig() {
if (action != null) { if (actions != null) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
try { try {
jsonObject.put(ACTION, action.getContext()); jsonObject.put(ACTION, actions.getContext());
Set<String> keySet = config.keySet(); Set<String> keySet = config.keySet();
for (String key : keySet) { for (String key : keySet) {
jsonObject.put(key, config.get(key).toString()); jsonObject.put(key, config.get(key).toString());
@ -117,7 +117,7 @@ public class PluginWebBridge {
* @param config 参数 * @param config 参数
*/ */
public void setRunConfig(ACTIONS action, Map<String, Object> config) { public void setRunConfig(ACTIONS action, Map<String, Object> config) {
this.action = action; this.actions = action;
this.config = config; this.config = config;
} }
@ -125,7 +125,7 @@ public class PluginWebBridge {
* 清楚打开动作 * 清楚打开动作
*/ */
public void clearRunConfig() { public void clearRunConfig() {
this.action = null; this.actions = null;
this.config = 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.dialog.UIDialog;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -27,6 +26,7 @@ public class QQLoginDialog extends UIDialog {
@Override @Override
public void checkValid() throws Exception { 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 @Override
public void checkValid() throws Exception { public void checkValid() throws Exception {
// do nothing
} }
} }

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

@ -22,26 +22,9 @@ import com.fr.third.javax.annotation.Nonnull;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator; import com.fr.workspace.server.lock.TplOperator;
import javax.swing.BorderFactory; import javax.swing.*;
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.plaf.basic.BasicMenuItemUI; import javax.swing.plaf.basic.BasicMenuItemUI;
import java.awt.AWTEvent; import java.awt.*;
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.event.AWTEventListener; import java.awt.event.AWTEventListener;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -399,8 +382,8 @@ public class MutilTempalteTabPane extends JComponent {
//画下面的那条线 //画下面的那条线
if (templateStartX < maxWidth) { if (templateStartX < maxWidth) {
GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, 2); GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, 2);
generalPath.moveTo((float) templateStartX, getHeight() - 1.0F); generalPath.moveTo((float) templateStartX, (float) (getHeight() - 1.0D));
generalPath.lineTo((float) maxWidth, getHeight() - 1.0F); generalPath.lineTo((float) maxWidth, (float) (getHeight() - 1.0D));
g2d.fill(generalPath); g2d.fill(generalPath);
//TODO hzzz delete //TODO hzzz delete
// g2d.setPaint(UIConstants.LINE_COLOR); // g2d.setPaint(UIConstants.LINE_COLOR);
@ -410,7 +393,7 @@ public class MutilTempalteTabPane extends JComponent {
private void paintDefaultBackground(Graphics2D g2d) { 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()); g2d.fillRect(0, 0, getWidth(), getHeight());
} }
@ -536,7 +519,7 @@ public class MutilTempalteTabPane extends JComponent {
double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX};
double[] y = {1, getHeight() + 1, getHeight() + 1, 1, 1}; double[] y = {1, getHeight() + 1, getHeight() + 1, 1, 1};
RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(templateStartX, 1, this.getWidth(), this.getHeight(), 7, 7); 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作为经过的两个点的坐标 //选了30度和60度的特殊角度的x,y作为经过的两个点的坐标
double specialLocation1 = 2.5; double specialLocation1 = 2.5;
double specialLocation2 = 4.330127; double specialLocation2 = 4.330127;
@ -591,9 +574,9 @@ public class MutilTempalteTabPane extends JComponent {
double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX}; double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX};
double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1}; double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1};
if (selfIndex == mouseOveredIndex) { 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 { } 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));
} }
@ -855,7 +838,7 @@ public class MutilTempalteTabPane extends JComponent {
*/ */
@Override @Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
// do nothing
} }
/** /**
@ -878,6 +861,7 @@ public class MutilTempalteTabPane extends JComponent {
*/ */
@Override @Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
// do nothing
} }
/** /**
@ -887,6 +871,7 @@ public class MutilTempalteTabPane extends JComponent {
*/ */
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
// do nothing
} }
/** /**
@ -958,6 +943,7 @@ public class MutilTempalteTabPane extends JComponent {
*/ */
@Override @Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
// do nothing
} }
/** /**

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

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

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

@ -29,17 +29,7 @@ import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.script.Expression; import com.fr.stable.script.Expression;
import javax.swing.BorderFactory; import javax.swing.*;
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.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionEvent;
@ -49,10 +39,7 @@ import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.MutableTreeNode; import javax.swing.tree.MutableTreeNode;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
@ -150,10 +137,12 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
keyWordTextField.addKeyListener(new KeyListener() { keyWordTextField.addKeyListener(new KeyListener() {
@Override @Override
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
//do nothing
} }
@Override @Override
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
//do nothing
} }
@Override @Override
@ -238,7 +227,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
protected void extendCheckBoxPane(JPanel checkBoxPane) { protected void extendCheckBoxPane(JPanel checkBoxPane) {
// do nothing
} }
private void configFormulaArea() { private void configFormulaArea() {
@ -414,6 +403,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
@Override @Override
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
// do nothing
} }
protected void search(String keyWord, boolean findDescription) { protected void search(String keyWord, boolean findDescription) {

23
designer-base/src/main/java/com/fr/design/fun/MultiStyleUIConfigProvider.java

@ -0,0 +1,23 @@
package com.fr.design.fun;
import com.fr.common.annotations.Open;
import com.fr.stable.fun.mark.Mutable;
import java.util.List;
/**
* Created by kerry on 2019-11-11
*/
@Open
public interface MultiStyleUIConfigProvider extends Mutable {
String XML_TAG = "MultiStyleUIConfigProvider";
int CURRENT_LEVEL = 1;
/**
* 获取配置项list
*
* @return 配置项list
*/
List<StyleUIConfigProvider> getConfigList();
}

39
designer-base/src/main/java/com/fr/design/fun/StyleUIConfigProvider.java

@ -0,0 +1,39 @@
package com.fr.design.fun;
import com.fr.base.Style;
import com.fr.common.annotations.Open;
import com.fr.stable.fun.mark.Mutable;
import javax.swing.JComponent;
import javax.swing.event.ChangeListener;
/**
* Created by kerry on 2019-11-11
*/
@Open
public interface StyleUIConfigProvider extends Mutable {
String XML_TAG = "CustomStyleUIConfigProvider";
int CURRENT_LEVEL = 1;
/**
* @return 配置名
*/
String configName();
/**
* @param changeListener 需要添加的listener
* @return 对应的component
*/
JComponent uiComponent(ChangeListener changeListener);
/**
* @return 更新后的样式
*/
Style updateConfig();
/**
* @param style 待渲染的样式
*/
void populateConfig(Style style);
}

26
designer-base/src/main/java/com/fr/design/fun/impl/AbstractMultiStyleUIConfigProvider.java

@ -0,0 +1,26 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.StyleUIConfigProvider;
import com.fr.design.fun.MultiStyleUIConfigProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
import java.util.ArrayList;
import java.util.List;
/**
* Created by kerry on 2019-11-11
*/
@API(level = MultiStyleUIConfigProvider.CURRENT_LEVEL)
public abstract class AbstractMultiStyleUIConfigProvider extends AbstractProvider implements MultiStyleUIConfigProvider {
@Override
public List<StyleUIConfigProvider> getConfigList() {
return new ArrayList<StyleUIConfigProvider>();
}
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
}

41
designer-base/src/main/java/com/fr/design/fun/impl/AbstractStyleUIConfigProvider.java

@ -0,0 +1,41 @@
package com.fr.design.fun.impl;
import com.fr.base.Style;
import com.fr.design.fun.StyleUIConfigProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
import javax.swing.JComponent;
import javax.swing.event.ChangeListener;
/**
* Created by kerry on 2019-11-11
*/
@API(level = StyleUIConfigProvider.CURRENT_LEVEL)
public class AbstractStyleUIConfigProvider extends AbstractProvider implements StyleUIConfigProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String configName() {
return StringUtils.EMPTY;
}
@Override
public JComponent uiComponent(ChangeListener changeListener) {
return null;
}
@Override
public Style updateConfig() {
return null;
}
@Override
public void populateConfig(Style style) {
}
}

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) { public void addDateChangeListener(ChangeListener l) {
listenerList.add(ChangeListener.class, l); eventlistenerList.add(ChangeListener.class, l);
} }
public void removeDateChangeListener(ChangeListener l) { public void removeDateChangeListener(ChangeListener l) {
listenerList.remove(ChangeListener.class, l); eventlistenerList.remove(ChangeListener.class, l);
} }
protected void fireDateChanged(ChangeEvent e) { protected void fireDateChanged(ChangeEvent e) {
Object[] listeners = listenerList.getListenerList(); Object[] listeners = eventlistenerList.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) { for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == ChangeListener.class) { if (listeners[i] == ChangeListener.class) {
((ChangeListener) listeners[i + 1]).stateChanged(e); ((ChangeListener) listeners[i + 1]).stateChanged(e);

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

@ -330,7 +330,9 @@ public class UITabbedPaneUI extends BasicTabbedPaneUI {
g.drawLine(x + 1, y + h - 2, x + w - 3, y + h - 2); // bottom g.drawLine(x + 1, y + h - 2, x + w - 3, y + h - 2); // bottom
} }
@Override
protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex) { protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex) {
// do nothing
} }
/** /**

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

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

2
designer-base/src/main/java/com/fr/design/gui/ibutton/SpecialUIButton.java

@ -25,6 +25,8 @@ public class SpecialUIButton extends JButton {
* *
* @see javax.swing.AbstractButton#setUI(ButtonUI) * @see javax.swing.AbstractButton#setUI(ButtonUI)
*/ */
@Override
public void setUI(ButtonUI ui) { public void setUI(ButtonUI ui) {
// do nothing
} }
} }

1
designer-base/src/main/java/com/fr/design/gui/ibutton/UIBasicButtonUI.java

@ -43,6 +43,7 @@ public class UIBasicButtonUI extends MetalButtonUI {
private boolean isDefault; private boolean isDefault;
public UIBasicButtonUI() { public UIBasicButtonUI() {
// do nothing
} }
/** /**

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 UIButton rightButton;
protected void leftButtonClickEvent() { protected void leftButtonClickEvent() {
// 左边按钮点击事件
} }
protected void rightButtonClickEvent() { protected void rightButtonClickEvent() {
// 右边按钮点击事件
} }
public UICombinationButton() { public UICombinationButton() {

2
designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java

@ -25,7 +25,7 @@ public class UIHeadGroup extends JPanel {
protected int selectedIndex = -1; protected int selectedIndex = -1;
protected void tabChanged(int newSelectedIndex) { protected void tabChanged(int newSelectedIndex) {
// do nothing
} }
public UIHeadGroup(String[] textArray) { public UIHeadGroup(String[] textArray) {

2
designer-base/src/main/java/com/fr/design/gui/ibutton/UIPasswordField.java

@ -1 +1 @@
package com.fr.design.gui.ibutton; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import javax.swing.*; /** * Author : Shockway * Date: 13-10-21 * Time: 下午3:23 */ public class UIPasswordField extends JPasswordField implements UIObserver { public void registerChangeListener(UIObserverListener listener) { } public boolean shouldResponseChangeListener() { return false; } } package com.fr.design.gui.ibutton; import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserverListener; import javax.swing.*; /** * Author : Shockway * Date: 13-10-21 * Time: 下午3:23 */ public class UIPasswordField extends JPasswordField implements UIObserver { public void registerChangeListener(UIObserverListener listener) { // do nothing } public boolean shouldResponseChangeListener() { return false; } }

2
designer-base/src/main/java/com/fr/design/gui/ibutton/UIPreviewButton.java

@ -1 +1 @@
package com.fr.design.gui.ibutton; import com.fr.design.constants.UIConstants; import com.fr.stable.Constants; import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.*; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; /** * Author : daisy * Date: 13-8-1 * Time: 下午3:41 */ public class UIPreviewButton extends JPanel { private static final int START_X = -7; protected UIButton upButton; protected UIButton downButton; protected void upButtonClickEvent() { } protected void downButtonClickEvent() { } public UIPreviewButton() { this(new UIButton(), new UIButton()); } public UIPreviewButton(UIButton up, UIButton down) { upButton = up; downButton = down; upButton.setRoundBorder(true, Constants.CENTER); downButton.setRoundBorder(true, Constants.CENTER); upButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { downButton.getModel().setPressed(true); downButton.getModel().setSelected(true); downButton.repaint(); } @Override public void mouseReleased(MouseEvent e) { downButton.getModel().setPressed(false); downButton.getModel().setSelected(false); downButton.repaint(); } @Override public void mouseClicked(MouseEvent e) { upButtonClickEvent(); } }); downButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { upButton.getModel().setPressed(true); upButton.getModel().setSelected(true); upButton.repaint(); } @Override public void mouseReleased(MouseEvent e) { upButton.getModel().setPressed(false); upButton.getModel().setSelected(false); upButton.repaint(); } @Override public void mouseClicked(MouseEvent e) { downButtonClickEvent(); } }); this.setLayout(new FlowLayout(FlowLayout.CENTER,5,0)); this.add(upButton); this.add(downButton); } public UIPreviewButton(Icon left, Icon right) { this(); upButton.setIcon(left); downButton.setIcon(right); } public UIButton getUpButton() { return upButton; } public void setExtraPainted(boolean isExtraPainted) { if (!isExtraPainted) { upButton.setBackground(null); downButton.setBackground(null); upButton.setOpaque(false); downButton.setOpaque(false); } } public UIButton getDownButton() { return downButton; } public void set4Toolbar() { upButton.setNormalPainted(false); downButton.setNormalPainted(false); upButton.setBorderPaintedOnlyWhenPressed(true); downButton.setBorderPaintedOnlyWhenPressed(true); } protected void showPopWindow(JPopupMenu menu) { GUICoreUtils.showPopupMenu(menu, this, START_X, getY() + getHeight() - 3); } public static void main(String... args) { JFrame jf = new JFrame("test"); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel content = (JPanel) jf.getContentPane(); content.setLayout(null); UIPreviewButton bb = new UIPreviewButton(UIConstants.PAGE_BIG_ICON, UIConstants.PREVIEW_DOWN); bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height); content.add(bb); GUICoreUtils.centerWindow(jf); jf.setSize(100, 100); jf.setVisible(true); } } package com.fr.design.gui.ibutton; import com.fr.design.constants.UIConstants; import com.fr.stable.Constants; import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.*; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; /** * Author : daisy * Date: 13-8-1 * Time: 下午3:41 */ public class UIPreviewButton extends JPanel { private static final int START_X = -7; protected UIButton upButton; protected UIButton downButton; protected void upButtonClickEvent() { // do nothing } protected void downButtonClickEvent() { // do nothing } public UIPreviewButton() { this(new UIButton(), new UIButton()); } public UIPreviewButton(UIButton up, UIButton down) { upButton = up; downButton = down; upButton.setRoundBorder(true, Constants.CENTER); downButton.setRoundBorder(true, Constants.CENTER); upButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { downButton.getModel().setPressed(true); downButton.getModel().setSelected(true); downButton.repaint(); } @Override public void mouseReleased(MouseEvent e) { downButton.getModel().setPressed(false); downButton.getModel().setSelected(false); downButton.repaint(); } @Override public void mouseClicked(MouseEvent e) { upButtonClickEvent(); } }); downButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { upButton.getModel().setPressed(true); upButton.getModel().setSelected(true); upButton.repaint(); } @Override public void mouseReleased(MouseEvent e) { upButton.getModel().setPressed(false); upButton.getModel().setSelected(false); upButton.repaint(); } @Override public void mouseClicked(MouseEvent e) { downButtonClickEvent(); } }); this.setLayout(new FlowLayout(FlowLayout.CENTER,5,0)); this.add(upButton); this.add(downButton); } public UIPreviewButton(Icon left, Icon right) { this(); upButton.setIcon(left); downButton.setIcon(right); } public UIButton getUpButton() { return upButton; } public void setExtraPainted(boolean isExtraPainted) { if (!isExtraPainted) { upButton.setBackground(null); downButton.setBackground(null); upButton.setOpaque(false); downButton.setOpaque(false); } } public UIButton getDownButton() { return downButton; } public void set4Toolbar() { upButton.setNormalPainted(false); downButton.setNormalPainted(false); upButton.setBorderPaintedOnlyWhenPressed(true); downButton.setBorderPaintedOnlyWhenPressed(true); } protected void showPopWindow(JPopupMenu menu) { GUICoreUtils.showPopupMenu(menu, this, START_X, getY() + getHeight() - 3); } public static void main(String... args) { JFrame jf = new JFrame("test"); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel content = (JPanel) jf.getContentPane(); content.setLayout(null); UIPreviewButton bb = new UIPreviewButton(UIConstants.PAGE_BIG_ICON, UIConstants.PREVIEW_DOWN); bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height); content.add(bb); GUICoreUtils.centerWindow(jf); jf.setSize(100, 100); jf.setVisible(true); } }

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) { private void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) {
GradientPaint gp; GradientPaint gp;
if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { 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) { } 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{ }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); 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) { private void fillRollOver(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) {
GradientPaint gp; GradientPaint gp;
if (DesignerMode.isAuthorityEditing() && isAuthorityEdited) { 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) { } 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 { }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); fillPaint(g2d, x, y, width, height, isRound, rectDirection, gp, UIConstants.ARC);
} }
@ -225,4 +225,4 @@ public class UISliderButtonUI extends BasicButtonUI {
g2d.setColor(oldColor); g2d.setColor(oldColor);
} }
} }

8
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; Color blue = UIConstants.LIGHT_BLUE;
g2d.setColor(blue); g2d.setColor(blue);
g2d.fillRect(0, 1, w - 1, h / 2); 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.setPaint(gp);
g2d.fillRect(0, h / 2, w - 1, h / 2); g2d.fillRect(0, h / 2, w - 1, h / 2);
this.setForeground(UIConstants.FONT_COLOR); this.setForeground(UIConstants.FONT_COLOR);
} else if (!isSelected() && !isRollover) { } 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.setPaint(gp);
g2d.fillRect(0, h / 2, w - 1, h / 2); g2d.fillRect(0, h / 2, w - 1, h / 2);
this.setForeground(UIConstants.FONT_COLOR); this.setForeground(UIConstants.FONT_COLOR);
@ -175,7 +175,7 @@ public class UITabButton extends UILabel implements UISelectedComponent {
} }
protected void paintOther(Graphics2D g2d, int w, int h) { protected void paintOther(Graphics2D g2d, int w, int h) {
// do nothing
} }
} }

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

@ -187,7 +187,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
@Override @Override
protected void fireStateChanged() { protected void fireStateChanged() {
// do nothing
} }
@ -220,7 +220,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
protected void paintOtherBorder(Graphics g) { protected void paintOtherBorder(Graphics g) {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
g2d.setStroke(UIConstants.BS); 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.setColor(UIConstants.LINE_COLOR);
g2d.draw(shape); g2d.draw(shape);
} }
@ -252,4 +252,4 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
return true; return true;
} }
} }

18
designer-base/src/main/java/com/fr/design/gui/icombobox/ComboCheckBox.java

@ -77,8 +77,8 @@ public class ComboCheckBox extends UIComboBox {
protected ComboCheckBox comboBox; protected ComboCheckBox comboBox;
protected JScrollPane scrollPane; protected JScrollPane scrollPane;
protected MouseListener mouseListener; protected MouseListener checkListMouseListener;
protected MouseMotionListener mouseMotionListener; protected MouseMotionListener checkListMouseMotionListener;
public CheckListPopup(JComboBox comboBox) { public CheckListPopup(JComboBox comboBox) {
this.comboBox = (ComboCheckBox) comboBox; this.comboBox = (ComboCheckBox) comboBox;
@ -157,22 +157,22 @@ public class ComboCheckBox extends UIComboBox {
@Override @Override
public MouseListener getMouseListener() { public MouseListener getMouseListener() {
if (mouseListener == null) { if (checkListMouseListener == null) {
mouseListener = new InvocationMouseHandler(); checkListMouseListener = new InvocationMouseHandler();
} }
return mouseListener; return checkListMouseListener;
} }
public MouseMotionListener getMouseMotionListener() { public MouseMotionListener getMouseMotionListener() {
if (mouseMotionListener == null) { if (checkListMouseMotionListener == null) {
mouseMotionListener = new MouseMotionAdapter() { checkListMouseMotionListener = new MouseMotionAdapter() {
}; };
} }
return mouseMotionListener; return checkListMouseMotionListener;
} }
public void uninstallingUI() { public void uninstallingUI() {
// do nothing
} }
protected class InvocationMouseHandler extends MouseAdapter { protected class InvocationMouseHandler extends MouseAdapter {

1
designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java

@ -318,6 +318,7 @@ public class FRTreeComboBox extends UIComboBox {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
// do nothing
} }
@Override @Override

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

@ -3,6 +3,11 @@
*/ */
package com.fr.design.gui.icombobox; 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.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font; import java.awt.Font;
@ -11,18 +16,10 @@ import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.geom.GeneralPath; import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import javax.swing.DefaultComboBoxModel; import javax.swing.DefaultComboBoxModel;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JList; 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. * Combobox for selecting line styles.
@ -88,13 +85,13 @@ public class LineComboBox extends UIComboBox {
FontMetrics fm = GraphHelper.getFontMetrics(rfont); FontMetrics fm = GraphHelper.getFontMetrics(rfont);
if (style == Constants.LINE_NONE) { if (style == Constants.LINE_NONE) {
//draw "none" string //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 { } 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()) { // 带有坐标轴箭头的样式. 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; 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")); c.setBackground(UIManager.getColor("ComboBox.focusBackground"));
if (c instanceof JComponent) { if (c instanceof JComponent) {
mustResetOpaque = true;
JComponent jc = (JComponent) c; JComponent jc = (JComponent) c;
savedOpaque = jc.isOpaque(); jc.isOpaque();
jc.setOpaque(true); jc.setOpaque(true);
paintFocus = true;
} }
} else { } else {
c.setForeground(comboBox.getForeground()); c.setForeground(comboBox.getForeground());

10
designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java

@ -1,12 +1,11 @@
package com.fr.design.gui.icontainer; package com.fr.design.gui.icontainer;
import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Constants;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -174,6 +173,7 @@ public class UIEastResizableContainer extends JPanel {
@Override @Override
public void addLayoutComponent(String name, Component comp) { public void addLayoutComponent(String name, Component comp) {
// do nothing
} }
}; };
@ -238,6 +238,7 @@ public class UIEastResizableContainer extends JPanel {
* 伸缩右子面板时触发此方法 * 伸缩右子面板时触发此方法
*/ */
public void onResize() { public void onResize() {
// do nothing here
} }
private class TopToolPane extends JPanel { private class TopToolPane extends JPanel {
@ -261,6 +262,7 @@ public class UIEastResizableContainer extends JPanel {
@Override @Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
// do nothing
} }
}); });
addMouseListener(new MouseAdapter() { addMouseListener(new MouseAdapter() {
@ -282,7 +284,7 @@ public class UIEastResizableContainer extends JPanel {
} }
onResize(); onResize();
refreshContainer(); refreshContainer();
if (DesignerMode.isAuthorityEditing()) { if (DesignModeContext.isAuthorityEditing()) {
DesignerContext.getDesignerFrame().doResize(); DesignerContext.getDesignerFrame().doResize();
} }
} }

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

@ -1,6 +1,7 @@
package com.fr.design.gui.icontainer; package com.fr.design.gui.icontainer;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -46,7 +47,7 @@ public class UIModeControlContainer extends JLayeredPane {
private boolean isHideMode = false; private boolean isHideMode = false;
private boolean isSheeetCovered = 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() { public UIModeControlContainer() {
this(new JPanel(), new JPanel()); this(new JPanel(), new JPanel());
@ -85,7 +86,7 @@ public class UIModeControlContainer extends JLayeredPane {
public void needToShowCoverAndHidPane() { public void needToShowCoverAndHidPane() {
if (DesignerMode.isAuthorityEditing()) { if (DesignModeContext.isAuthorityEditing()) {
this.remove(coverPane); this.remove(coverPane);
this.remove(hidePane); this.remove(hidePane);
} else { } else {
@ -128,7 +129,7 @@ public class UIModeControlContainer extends JLayeredPane {
if (isHideMode || !upEditMode) { if (isHideMode || !upEditMode) {
return; return;
} }
if (DesignerMode.isAuthorityEditing()) { if (DesignModeContext.isAuthorityEditing()) {
return; return;
} }
setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR));
@ -151,11 +152,12 @@ public class UIModeControlContainer extends JLayeredPane {
MouseMotionListener mouseMotionListener = new MouseMotionListener() { MouseMotionListener mouseMotionListener = new MouseMotionListener() {
@Override @Override
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
//do nothing
} }
@Override @Override
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (DesignerMode.isAuthorityEditing()) { if (DesignModeContext.isAuthorityEditing()) {
return; return;
} }
boolean notUpEditMode = isHideMode || !upEditMode; boolean notUpEditMode = isHideMode || !upEditMode;
@ -174,7 +176,7 @@ public class UIModeControlContainer extends JLayeredPane {
@Override @Override
public void removeLayoutComponent(Component comp) { public void removeLayoutComponent(Component comp) {
//do nothing
} }
@Override @Override
@ -234,11 +236,12 @@ public class UIModeControlContainer extends JLayeredPane {
@Override @Override
public void addLayoutComponent(String name, Component comp) { public void addLayoutComponent(String name, Component comp) {
// do nothing
} }
}; };
protected void onModeChanged() { protected void onModeChanged() {
//do nothing here
} }
/** /**
@ -309,7 +312,7 @@ public class UIModeControlContainer extends JLayeredPane {
addMouseListener(new MouseAdapter() { addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
// do nothing
} }
}); });
} }
@ -319,6 +322,7 @@ public class UIModeControlContainer extends JLayeredPane {
@Override @Override
public void removeLayoutComponent(Component comp) { public void removeLayoutComponent(Component comp) {
// do nothing
} }
@Override @Override
@ -333,10 +337,12 @@ public class UIModeControlContainer extends JLayeredPane {
@Override @Override
public void layoutContainer(Container parent) { public void layoutContainer(Container parent) {
// do nothing
} }
@Override @Override
public void addLayoutComponent(String name, Component comp) { public void addLayoutComponent(String name, Component comp) {
// do nothing
} }
}; };
@ -366,7 +372,7 @@ public class UIModeControlContainer extends JLayeredPane {
addMouseListener(new MouseAdapter() { addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
// do nothing
} }
}); });
@ -407,6 +413,7 @@ public class UIModeControlContainer extends JLayeredPane {
@Override @Override
public void removeLayoutComponent(Component comp) { public void removeLayoutComponent(Component comp) {
// do nothing
} }
@Override @Override
@ -437,6 +444,7 @@ public class UIModeControlContainer extends JLayeredPane {
@Override @Override
public void addLayoutComponent(String name, Component comp) { public void addLayoutComponent(String name, Component comp) {
// do nothing
} }
}; };

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

@ -1,5 +1,6 @@
package com.fr.design.gui.ilable; package com.fr.design.gui.ilable;
import javax.swing.event.MouseInputAdapter;
import java.awt.Color; import java.awt.Color;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Graphics; import java.awt.Graphics;
@ -7,9 +8,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.event.MouseInputAdapter;
/** /**
* Action label * Action label
*/ */
@ -31,6 +29,7 @@ public class ActionLabel extends UILabel {
/** /**
* Repaints the text. * Repaints the text.
*/ */
@Override
public void paintComponent(Graphics _gfx) { public void paintComponent(Graphics _gfx) {
super.paintComponent(_gfx); super.paintComponent(_gfx);
@ -39,12 +38,17 @@ public class ActionLabel extends UILabel {
} }
private MouseInputAdapter mouseInputAdapter = new MouseInputAdapter() { private MouseInputAdapter mouseInputAdapter = new MouseInputAdapter() {
@Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
//do nothing
} }
@Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
//do nothing
} }
@Override
public void mouseReleased(MouseEvent evt) { public void mouseReleased(MouseEvent evt) {
Object source = evt.getSource(); Object source = evt.getSource();
@ -65,6 +69,7 @@ public class ActionLabel extends UILabel {
} }
} }
@Override
public void mouseExited(MouseEvent evt) { public void mouseExited(MouseEvent evt) {
Object source = evt.getSource(); Object source = evt.getSource();
@ -73,6 +78,7 @@ public class ActionLabel extends UILabel {
} }
} }
@Override
public void mouseDragged(MouseEvent e) { 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); View v = (View) c.getClientProperty(BasicHTML.propertyKey);
if (v != null) { if (v != null) {
d = getPreferredSize(c); 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; return d;
} }
@ -345,7 +345,7 @@ public class UIBasicMenuItemUI extends MenuItemUI {
View v = (View) c.getClientProperty(BasicHTML.propertyKey); View v = (View) c.getClientProperty(BasicHTML.propertyKey);
if (v != null) { if (v != null) {
d = getPreferredSize(c); 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; return d;
} }
@ -816,7 +816,6 @@ public class UIBasicMenuItemUI extends MenuItemUI {
// get Accelerator text // get Accelerator text
KeyStroke accelerator = b.getAccelerator(); KeyStroke accelerator = b.getAccelerator();
String acceleratorText = ""; String acceleratorText = "";
drawMenu(acceleratorText, accelerator, c, ic, maxValue, offset, paintIcon, b);
String text = layoutMenuItem(fm, b.getText(), fmAccel, acceleratorText, ic, null, String text = layoutMenuItem(fm, b.getText(), fmAccel, acceleratorText, ic, null,
arrowIcon, b.getVerticalAlignment(), b.getHorizontalAlignment(), arrowIcon, b.getVerticalAlignment(), b.getHorizontalAlignment(),
b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect, b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect,
@ -834,43 +833,6 @@ public class UIBasicMenuItemUI extends MenuItemUI {
g.setFont(holdf); 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) { private void drawAccText(String acceleratorText, Graphics g, JComponent p, ButtonModel model, FontMetrics fmAccel, JComponent c) {
if (acceleratorText != null && !ComparatorUtils.equals(acceleratorText, "")) { if (acceleratorText != null && !ComparatorUtils.equals(acceleratorText, "")) {
//Get the maxAccWidth from the parent to calculate the offset. //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 @Override
public TableCellRenderer getDefaultRenderer(Class<?> columnClass) { public TableCellRenderer getDefaultRenderer(Class<?> columnClass) {
columnClass = UITable.class; return super.getDefaultRenderer(UITable.class);
return super.getDefaultRenderer(columnClass);
} }
private class UITableRender implements TableCellRenderer { private class UITableRender implements TableCellRenderer {

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

@ -72,6 +72,7 @@ public class UIProgressBorder extends UIRoundedBorder {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); 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) { private void paintBorderShadow(Graphics2D g2, int shadowWidth, int x, int y, int width, int height) {
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
shadowWidth = Math.max(shadowWidth, 2); 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) { private static Color getMixedColor(Color c1, float pct1, Color c2, float pct2) {
float[] clr1 = c1.getComponents(null); float[] clr1 = c1.getComponents(null);
float[] clr2 = c2.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); // 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, private void drawVertical(Graphics g, Rectangle t, int xs, int ys, int x2,
Color pressedColor, Color rolloverColor, Color pressedColor, Color rolloverColor,
Color normalColor) { 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); (frame.getHeight() - getSize().height) / 2);
} }
@SuppressWarnings("squid:S1226")
private void initP3(JPanel p3, JPanel p1) { private void initP3(JPanel p3, JPanel p1) {
p3 = new JPanel(new FlowLayout(FlowLayout.LEFT, 3, 8)); p3 = new JPanel(new FlowLayout(FlowLayout.LEFT, 3, 8));
p3.add(new JLabel("R:")); p3.add(new JLabel("R:"));
@ -198,6 +199,7 @@ public class UISBChooser extends JDialog {
twoColorField.setUpperColor(outColor); twoColorField.setUpperColor(outColor);
} }
@SuppressWarnings("squid:S2164")
public static Color getAdjustedColor(Color inColor, int sat, int bri) { public static Color getAdjustedColor(Color inColor, int sat, int bri) {
Color briColor = inColor; Color briColor = inColor;
@ -219,9 +221,9 @@ public class UISBChooser extends JDialog {
int dg = briColor.getGreen() - satColor.getGreen(); int dg = briColor.getGreen() - satColor.getGreen();
int db = briColor.getBlue() - satColor.getBlue(); int db = briColor.getBlue() - satColor.getBlue();
r = briColor.getRed() - (int) Math.round(dr * 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); g = briColor.getGreen() - (int) Math.round(dg * sat / (VALUE * 1.0));
b = briColor.getBlue() - (int) Math.round(db * sat / VALUE * 1.0); b = briColor.getBlue() - (int) Math.round(db * sat / (VALUE * 1.0));
} else { } else {
float d = ColorRoutines.getGreyValue(briColor); float d = ColorRoutines.getGreyValue(briColor);
float dr = briColor.getRed() - d; 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.design.constants.UIConstants;
import com.fr.stable.StringUtils; 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.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Container; import java.awt.Container;
@ -22,24 +41,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; 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 * Like BasicScrollBarUI,but without two buttons
@ -590,6 +591,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* will cause a repaint. * will cause a repaint.
*/ */
@SuppressWarnings("squid:S2164")
protected void layoutVScrollbar(JScrollBar sb) { protected void layoutVScrollbar(JScrollBar sb) {
Dimension sbSize = sb.getSize(); Dimension sbSize = sb.getSize();
Insets sbInsets = sb.getInsets(); 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 * Make sure the thumb fits between the buttons. Note that setting the
* thumbs bounds causes a repaint. * thumbs bounds causes a repaint.
*/ */
@SuppressWarnings("squid:S2164")
protected void layoutHScrollbar(JScrollBar sb) { protected void layoutHScrollbar(JScrollBar sb) {
Dimension sbSize = sb.getSize(); Dimension sbSize = sb.getSize();
Insets sbInsets = sb.getInsets(); Insets sbInsets = sb.getInsets();
@ -1080,7 +1083,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
scrollbar.repaint(); scrollbar.repaint();
} }
@SuppressWarnings("squid:S2164")
private void setValueFrom(MouseEvent e) { private void setValueFrom(MouseEvent e) {
boolean active = isThumbRollover(); boolean active = isThumbRollover();
BoundedRangeModel model = scrollbar.getModel(); BoundedRangeModel model = scrollbar.getModel();

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

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/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")}}; {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}; 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"), 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")}); 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)); 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_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")}}; {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}; 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")}); 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(); initOtherComponent();
initAllNames(); initAllNames();
@ -174,7 +174,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
} }
private void initTextRotationCombox() { 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")); selectOption.add(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Angle"));
VerticalTextProcessor processor = ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class); VerticalTextProcessor processor = ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class);
selectOption.addAll(Arrays.asList(processor.getComboxOption())); selectOption.addAll(Arrays.asList(processor.getComboxOption()));
@ -343,8 +343,8 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
int rightPadding = indentationUnitProcessor.paddingUnitProcessor(style.getPaddingRight()); int rightPadding = indentationUnitProcessor.paddingUnitProcessor(style.getPaddingRight());
// alex:indent // alex:indent
this.leftIndentSpinner.setValue(new Integer(leftPadding)); this.leftIndentSpinner.setValue(leftPadding);
this.rightIndentSpinner.setValue(new Integer(rightPadding)); this.rightIndentSpinner.setValue(rightPadding);
this.spaceBeforeSpinner.setValue(style.getSpacingBefore()); this.spaceBeforeSpinner.setValue(style.getSpacingBefore());
this.spaceAfterSpinner.setValue(style.getSpacingAfter()); this.spaceAfterSpinner.setValue(style.getSpacingAfter());
@ -360,7 +360,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
public Style update(Style style) { public Style update(Style style) {
// peter:需要判断传递进来的值是否为null. // peter:需要判断传递进来的值是否为null.
if (style == 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"))) { 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) { public void setGlobalName(String name) {
} }

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; package com.fr.design.gui.syntax.print;
import com.fr.log.FineLoggerFactory;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.Document; import javax.swing.text.Document;
import javax.swing.text.Element; import javax.swing.text.Element;
@ -62,8 +64,8 @@ public abstract class RPrintUtilities {
private static int getLineBreakPoint(String line, final int maxCharsPerLine) { private static int getLineBreakPoint(String line, final int maxCharsPerLine) {
int breakPoint = -1; int breakPoint = -1;
for (int i=0; i<breakChars.length; i++) { for (char breakChar : breakChars) {
int breakCharPos = line.lastIndexOf(breakChars[i], maxCharsPerLine-1); int breakCharPos = line.lastIndexOf(breakChar, maxCharsPerLine - 1);
if (breakCharPos > breakPoint) if (breakCharPos > breakPoint)
breakPoint = breakCharPos; breakPoint = breakCharPos;
} }
@ -147,11 +149,11 @@ public abstract class RPrintUtilities {
int tabIndex = curLineString.indexOf('\t'); int tabIndex = curLineString.indexOf('\t');
while (tabIndex > -1) { while (tabIndex > -1) {
int spacesNeeded = tabSizeInSpaces - (tabIndex % tabSizeInSpaces); int spacesNeeded = tabSizeInSpaces - (tabIndex % tabSizeInSpaces);
String replacementString = ""; StringBuilder replacementString = new StringBuilder();
for (int i=0; i<spacesNeeded; i++) for (int i=0; i<spacesNeeded; i++)
replacementString += ' '; replacementString.append(' ');
// Note that "\t" is actually a regex for this method. // 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'); tabIndex = curLineString.indexOf('\t');
} }
} }
@ -385,7 +387,7 @@ public abstract class RPrintUtilities {
doc.getText(currentLineStart+startingOffset, currentLineEnd-(currentLineStart+startingOffset), doc.getText(currentLineStart+startingOffset, currentLineEnd-(currentLineStart+startingOffset),
currentLineSeg); currentLineSeg);
} catch (BadLocationException ble) { } 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; 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 will be the last position in the current text of a "line break character."
currentPos = -1; currentPos = -1;
String currentLineString = currentLineSeg.toString(); 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. // "+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) //if (pos>-1 && pos>currentPos)
// currentPos = pos; // currentPos = pos;
if (pos>0 && pos>currentPos & pos!=currentLineString.length()) if (pos > 0 && pos > currentPos & pos != currentLineString.length())
currentPos = pos; currentPos = pos;
} }
@ -440,7 +442,7 @@ public abstract class RPrintUtilities {
try { try {
doc.getText(currentLineStart+startingOffset, currentPos, currentLineSeg); doc.getText(currentLineStart+startingOffset, currentPos, currentLineSeg);
} catch (BadLocationException ble) { } catch (BadLocationException ble) {
System.err.println(ble); FineLoggerFactory.getLogger().error(ble.getMessage());
return Printable.NO_SUCH_PAGE; return Printable.NO_SUCH_PAGE;
} }
currentLineLengthInPixels = Utilities. currentLineLengthInPixels = Utilities.
@ -453,12 +455,11 @@ public abstract class RPrintUtilities {
try { try {
doc.getText((currentLineStart+startingOffset), currentPos, currentLineSeg); doc.getText((currentLineStart+startingOffset), currentPos, currentLineSeg);
} catch (BadLocationException ble) { } catch (BadLocationException ble) {
System.err.println("BadLocationException in print (a):"); FineLoggerFactory.getLogger().error("BadLocationException in print (a):" + "==> currentLineStart: " + currentLineStart +
System.err.println("==> currentLineStart: " + currentLineStart + "; startingOffset: " + startingOffset + "; currentPos: " + currentPos +
"; startingOffset: " + startingOffset + "; currentPos: " + currentPos); "==> Range: " + (currentLineStart+startingOffset) + " - " +
System.err.println("==> Range: " + (currentLineStart+startingOffset) + " - " + (currentLineStart+startingOffset+currentPos));
(currentLineStart+startingOffset+currentPos)); FineLoggerFactory.getLogger().error(ble.getMessage());
ble.printStackTrace();
return Printable.NO_SUCH_PAGE; return Printable.NO_SUCH_PAGE;
} }
@ -521,7 +522,8 @@ public abstract class RPrintUtilities {
return x; return x;
int tabSizeInPixels = tabSizeInSpaces * fm.charWidth(' '); int tabSizeInPixels = tabSizeInSpaces * fm.charWidth(' ');
int ntabs = (((int) x) - xOffset) / tabSizeInPixels; 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--; numEmbedded--;
} }
} else {
//do nothing
} }
} // End of for (int i=segOffset; i<segOffset+charSegment.count; i++). } // End of for (int i=segOffset; i<segOffset+charSegment.count; i++).
@ -584,6 +586,8 @@ public class RSyntaxUtilities implements SwingConstants {
} }
numEmbedded--; numEmbedded--;
} }
} else {
//do nothing
} }
} }
@ -961,6 +965,8 @@ public class RSyntaxUtilities implements SwingConstants {
i--; i--;
} }
offs = lineStart + i; offs = lineStart + i;
} else {
//do nothing
} }
} }

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

@ -656,7 +656,7 @@ public class SyntaxView extends View implements TabExpander,
if (tabSize == 0) if (tabSize == 0)
return x; return x;
int ntabs = (((int) x) - tabBase) / tabSize; 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; package com.fr.design.gui.syntax.ui.rsyntaxtextarea;
import java.util.Iterator; import java.util.Iterator;
import java.util.NoSuchElementException;
/** /**
@ -73,6 +74,9 @@ class TokenIterator implements Iterator<Token> {
token = null; token = null;
} }
} }
else {
throw new NoSuchElementException();
}
return t; 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()) { if (host.getEOLMarkersVisible()) {
g.setColor(host.getForegroundForTokenType(Token.WHITESPACE)); g.setColor(host.getForegroundForTokenType(Token.WHITESPACE));
g.setFont(host.getFontForTokenType(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()) { if (host.getEOLMarkersVisible()) {
g.setColor(host.getForegroundForTokenType(Token.WHITESPACE)); g.setColor(host.getForegroundForTokenType(Token.WHITESPACE));
g.setFont(host.getFontForTokenType(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 * @return the tab stop, measured in points >= 0
*/ */
public float nextTabStop(float x, int tabOffset) { public float nextTabStop(float x, int tabOffset) {
if (tabSize == 0) if (tabSize == 0) {
return x; return x;
}
int ntabs = ((int) x - tabBase) / tabSize; 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 // Continuing an MLC from a previous line
if (inMLC) { if (inMLC) {
// Found the end of the MLC starting on a previous line... // 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; int mlcEnd = t.getEndOffset() - 1;
currentFold.setEndOffset(mlcEnd); currentFold.setEndOffset(mlcEnd);
Fold parentFold = currentFold.getParent(); 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 * 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> * <tt>/Users/3dot141/Downloads/FolxDownload/App/jflex-1.4.1/bin/FormulaTokenMaker.flex</tt>
*/ */
@SuppressWarnings("squid:S1192")
public class FormulaTokenMaker extends AbstractJFlexCTokenMaker { public class FormulaTokenMaker extends AbstractJFlexCTokenMaker {
/** This character denotes the end of file */ /** This character denotes the end of file */

4
designer-base/src/main/java/com/fr/design/icon/BorderIcon.java

@ -85,9 +85,9 @@ public class BorderIcon implements Icon {
cellBorderStyle.getBottomColor()); cellBorderStyle.getBottomColor());
drawLine(gr, x1, y1, x1, y2, cellBorderStyle.getLeftStyle(), drawLine(gr, x1, y1, x1, y2, cellBorderStyle.getLeftStyle(),
cellBorderStyle.getLeftColor()); cellBorderStyle.getLeftColor());
drawLine(gr, defaultWidth / 2, y1, defaultWidth / 2, y2, drawLine(gr, defaultWidth / 2.0, y1, defaultWidth / 2.0, y2,
cellBorderStyle.getVerticalStyle(), cellBorderStyle.getVerticalColor()); cellBorderStyle.getVerticalStyle(), cellBorderStyle.getVerticalColor());
drawLine(gr, x1, defaultHeight / 2, x2, defaultHeight / 2, drawLine(gr, x1, defaultHeight / 2.0, x2, defaultHeight / 2.0,
cellBorderStyle.getHorizontalStyle(), cellBorderStyle.getHorizontalColor()); cellBorderStyle.getHorizontalStyle(), cellBorderStyle.getHorizontalColor());
} }

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

@ -562,7 +562,7 @@ public class FRGUIPaneFactory {
double n = (double)(width + WIDTH_OFFSET_N ) / (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 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 j = Math.abs(((double) ((int) n + (int) (n + 1)) / WIDTHABS_PARA_F) - n);
double x = i > j ? i : j; double x = Math.max(i,j);
if (AssistUtils.equals(x, i)) { if (AssistUtils.equals(x, i)) {
w = (int) (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)) { } else if (AssistUtils.equals(x, j)) {

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++) for (counter = 0; counter < numCr; counter++)
if ((crSpec[z][counter] > 0.0) && (crSpec[z][counter] < 1.0)) if ((crSpec[z][counter] > 0.0) && (crSpec[z][counter] < 1.0))
fillSizeRatio -= crSpec[z][counter]; fillSizeRatio -= crSpec[z][counter];
else if (crSpec[z][counter] == FILL) else if (AssistUtils.equals(crSpec[z][counter], FILL))
numFillSize++; numFillSize++;
// Adjust fill ratios to reflect number of fill rows/columns // 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]; int crPrefMin[] = new int[numCr];
for (counter = 0; counter < numCr; counter++) for (counter = 0; counter < numCr; counter++)
if ((crSpec[z][counter] == PREFERRED) || if ((AssistUtils.equals(crSpec[z][counter], PREFERRED)) ||
(crSpec[z][counter] == MINIMUM)) { (AssistUtils.equals(crSpec[z][counter], MINIMUM))) {
crPrefMin[counter] = crSize[z][counter]; crPrefMin[counter] = crSize[z][counter];
} }

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

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

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

@ -44,6 +44,7 @@ import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.exception.DecryptTemplateException; import com.fr.exception.DecryptTemplateException;
import com.fr.exit.DesignerExiter;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEFactory; import com.fr.file.FILEFactory;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
@ -1161,8 +1162,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
this.dispose(); this.dispose();
this.ad.shutDown(); this.ad.shutDown();
DesignerExiter.getInstance().execute();
System.exit(0);
} }
// harry:添加程序外拖拽文件进来打开的功能 // harry:添加程序外拖拽文件进来打开的功能

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 w = button.getWidth();
int h = button.getHeight(); int h = button.getHeight();
Graphics2D g2d = (Graphics2D) g; 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.setPaint(gp);
g2d.fillRect(0, 0, w, h); g2d.fillRect(0, 0, w, h);
} }

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 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 okBtn;
private UIButton cancelBtn; private UIButton cancelBtn;
private DateEditor dateEditor; private DateEditor dateEditor;

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

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

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

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

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

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

99
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -9,6 +9,7 @@ import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.UILookAndFeel; import com.fr.design.gui.UILookAndFeel;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.exit.DesignerExiter;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
@ -30,7 +31,9 @@ import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.net.ServerSocket; import java.net.ServerSocket;
@ -39,15 +42,21 @@ import java.net.URI;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Locale; import java.util.Locale;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/** /**
* Some util method of Designer * Some util method of Designer
*/ */
public class DesignUtils { public class DesignUtils {
private static int port = DesignerPort.MESSAGE_PORT; private static int port = DesignerPort.getInstance().getMessagePort();
private static boolean started = false;
private DesignUtils() { private DesignUtils() {
} }
@ -62,15 +71,54 @@ public class DesignUtils {
} }
/** /**
* 通过端口是否被占用判断设计器有没有启动 * 判断设计器有没有启动
* s
* *
* @return 启动了返回true * @return 启动了返回true
*/ */
public static boolean isStarted() { public static boolean isStarted() {
try (Socket socket = new Socket("localhost", port)) { return started;
}
/**
* 判断设计器端口是否被其他程序占用
* 尝试去通信无回应就是其他程序占用端口否则需要继续判断是否为设计器进程未关闭
* @return
*/
public static boolean isPortOccupied() {
ExecutorService executor = null;
Future<String> future = null;
try (Socket socket = new Socket("localhost", port);
BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8));
PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), StandardCharsets.UTF_8)))) {
writer.println("check");
writer.flush();
executor = Executors.newSingleThreadExecutor();
future = executor.submit(new Callable<String>() {
@Override
public String call() throws Exception {
String line;
while ((line = reader.readLine()) != null) {
if ("response".equals(line)) {
// 正常通信 上一次设计器进程未关闭
started = true;
return line;
}
}
return StringUtils.EMPTY;
}
});
future.get(2, TimeUnit.SECONDS);
return false;
} catch (TimeoutException e) {
future.cancel(true);
return true; return true;
} catch (Exception ignored) { } catch (Exception ignore) {
} finally {
if (executor != null) {
executor.shutdownNow();
}
} }
return false; return false;
} }
@ -80,15 +128,12 @@ public class DesignUtils {
* *
* @param lines 命令行 * @param lines 命令行
*/ */
public static void clientSend(String[] lines) { public static void clientSend(String[] lines, Socket socket) {
if (lines == null || lines.length == 0) { if (lines == null || lines.length == 0) {
return; return;
} }
Socket socket = null;
PrintWriter writer = null; PrintWriter writer = null;
try { try {
socket = new Socket("localhost", port);
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), StandardCharsets.UTF_8))); writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), StandardCharsets.UTF_8)));
for (int i = 0; i < lines.length; i++) { for (int i = 0; i < lines.length; i++) {
writer.println(lines[i]); writer.println(lines[i]);
@ -97,19 +142,23 @@ public class DesignUtils {
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally { } finally {
try { if (writer != null) {
if (writer != null) { writer.close();
writer.close();
}
if (socket != null) {
socket.close();
}
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
} }
public static void clientSend(String[] lines) {
if (lines == null || lines.length == 0) {
return;
}
try (Socket socket = new Socket("localhost", port)) {
clientSend(lines, socket);
} catch (Exception ignore) {
}
}
/** /**
* 建立监听端口 * 建立监听端口
* *
@ -139,7 +188,11 @@ public class DesignUtils {
if (line.startsWith("demo")) { if (line.startsWith("demo")) {
DesignerEnvManager.getEnvManager().setCurrentEnv2Default(); DesignerEnvManager.getEnvManager().setCurrentEnv2Default();
ServerStarter.browserDemoURL(); ServerStarter.browserDemoURL();
} else if (StringUtils.isNotEmpty(line)) { } else if ("check".equals(line)) {
clientSend(new String[] {"response"}, socket);
} else if ("end".equals(line)) {
DesignerExiter.getInstance().execute(); }
else if (StringUtils.isNotEmpty(line)) {
File f = new File(line); File f = new File(line);
String path = f.getAbsolutePath(); String path = f.getAbsolutePath();
@ -166,6 +219,14 @@ public class DesignUtils {
} }
public static void responseToClient(Socket socket) {
try (OutputStream outputStream = socket.getOutputStream()) {
outputStream.write("reponse".getBytes(StandardCharsets.UTF_8));
outputStream.flush();
} catch (IOException ignore) {
}
}
/** /**
* 弹出对话框,显示报错 * 弹出对话框,显示报错
* *

87
designer-base/src/main/java/com/fr/design/utils/DesignerPort.java

@ -1,26 +1,95 @@
package com.fr.design.utils; package com.fr.design.utils;
import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader;
import javax.swing.JOptionPane;
/** /**
* 为的就是能替换 DesignPort.class 实现多开,因此避免编译器常量编译展开优化 * 为的就是能替换 DesignPort.class 实现多开,因此避免编译器常量编译展开优化
*/ */
public class DesignerPort { public class DesignerPort implements XMLReadable, XMLWriter {
public static final String XML_TAG = "DesignerPort";
private static final int MIN_PORT = 1024;
private static final int MAX_PORT = 65536;
public static final DesignerPort INSTANCE = new DesignerPort();
public static DesignerPort getInstance() {
return INSTANCE;
}
private DesignerPort() { private DesignerPort() {
} }
/** /**
* 设计器端口避免编译期常量优化展开 * 设计器端口
*/ */
public static final int MESSAGE_PORT = getMessagePort(); private int messagePort = 51462;
/** /**
* 设计器端口避免编译期常量优化展开 * 设计器端口debug模式下
*/ */
public static final int DEBUG_MESSAGE_PORT = getDebugMessagePort(); private int debugMessagePort = 51463;
public int getMessagePort() {
return messagePort;
}
private static int getMessagePort() { public int getDebugMessagePort() {
return 51462; return debugMessagePort;
} }
private static int getDebugMessagePort() { public void setMessagePort(int messagePort) {
return 51463; this.messagePort = messagePort;
} }
public void setDebugMessagePort(int debugMessagePort) {
this.debugMessagePort = debugMessagePort;
}
@Override
public void readXML(XMLableReader reader) {
if (reader.isAttr()) {
this.setMessagePort(reader.getAttrAsInt("messagePort", 51462));
this.setDebugMessagePort(reader.getAttrAsInt("debugMessagePort", 51463));
}
}
@Override
public void writeXML(XMLPrintWriter writer) {
writer.startTAG(XML_TAG);
writer.attr("messagePort", this.messagePort);
writer.attr("debugMessagePort", this.debugMessagePort);
writer.end();
}
public int resetPort() {
String port = JOptionPane.showInputDialog(null,
Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Tip"),
Toolkit.i18nText("Fine-Design_Modify_Designer_Port"), JOptionPane.INFORMATION_MESSAGE);
int value;
try {
value = Integer.parseInt(port);
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Not_Number_Tip"));
value = resetPort();
}
if (value < MIN_PORT || value > MAX_PORT) {
JOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Modify_Designer_Port_Out_Of_Range_Tip"));
value = resetPort();
}
if (ComparatorUtils.equals("true", System.getProperty("debug"))) {
setDebugMessagePort(value);
} else {
setMessagePort(value);
}
return value;
}
} }

97
designer-base/src/main/java/com/fr/design/write/submit/CheckServiceDialog.java

@ -0,0 +1,97 @@
package com.fr.design.write.submit;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.IOUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author: Maksim
* @Date: Created in 2020/2/3
* @Description: 远程连接时服务检测提醒对话框
*/
public class CheckServiceDialog extends JDialog implements ActionListener {
private JPanel topPanel;
private JPanel centerPanel;
private JPanel bottomPanel;
public CheckServiceDialog(Frame parent, String areaText, String localBranch, String remoteBranch){
super(parent,true);
//上面的标签面板
topPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel imagePanel = new JPanel();
Icon icon = IOUtils.readIcon("com/fr/design/images/warnings/warning4.png");
JLabel imageLabel = new JLabel();
imageLabel.setIcon(icon);
imagePanel.add(imageLabel);
imagePanel.setPreferredSize(new Dimension(100,80));
JPanel verticalPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true);
FRFont font = FRFont.getInstance();
font = font.applySize(15).applyStyle(1);
JLabel label = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Inconsistency"));
label.setFont(font);
label.setPreferredSize(new Dimension(500,30));
JLabel label2 = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer")
+ localBranch + "/" + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") + remoteBranch);
label2.setPreferredSize(new Dimension(500,20));
JLabel label3 = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Need_Update"));
label3.setPreferredSize(new Dimension(500,20));
verticalPanel.add(label);
verticalPanel.add(label2);
verticalPanel.add(label3);
topPanel.add(imagePanel,BorderLayout.WEST);
topPanel.add(verticalPanel,BorderLayout.CENTER);
//中间的文本域面板
centerPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
centerPanel.setBorder(BorderFactory.createEmptyBorder(0,10,10,10));
centerPanel.setPreferredSize(new Dimension(480,320));
JLabel titleLabel = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Affected_Function"));
titleLabel.setPreferredSize(new Dimension(400,40));
JTextArea checkArea = new JTextArea(areaText);
checkArea.setEnabled(false);
centerPanel.add(titleLabel,BorderLayout.NORTH);
centerPanel.add(checkArea,BorderLayout.CENTER);
//下面的按钮面板
UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Button_Confirm"));
JPanel buttonPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
buttonPanel.add(okButton);
okButton.addActionListener(this );
bottomPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
bottomPanel.add(buttonPanel);
this.setTitle(Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Title_Hint"));
this.setResizable(false);
this.add(topPanel,BorderLayout.NORTH);
this.add(centerPanel, BorderLayout.CENTER);
this.add(buttonPanel,BorderLayout.SOUTH);
this.setSize(new Dimension(600, 500));
GUICoreUtils.centerWindow(this);
}
@Override
public void actionPerformed(ActionEvent e) {
this.dispose();
}
}

30
designer-base/src/main/java/com/fr/exit/DesignerExiter.java

@ -0,0 +1,30 @@
package com.fr.exit;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.process.engine.core.FineProcessEngineEvent;
import com.fr.stable.StableUtils;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/2/12
*/
public class DesignerExiter {
public static final DesignerExiter INSTANCE = new DesignerExiter();
private static final String DOT = ".";
public static DesignerExiter getInstance() {
return INSTANCE;
}
public void execute() {
if (FineProcessContext.getParentPipe() == null && DOT.equals(StableUtils.getInstallHome())) {
System.exit(0);
} else {
FineProcessContext.getParentPipe().fire(FineProcessEngineEvent.DESTROY);
}
}
}

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

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

6
designer-base/src/main/java/com/fr/start/BaseDesigner.java

@ -14,11 +14,11 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.event.Null; import com.fr.event.Null;
import com.fr.exit.DesignerExiter;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEFactory; import com.fr.file.FILEFactory;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
@ -47,8 +47,6 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
private void init() { private void init() {
prepare(); prepare();
// 初始化look and feel.这个在预加载之前执行是因为lookAndFeel里的东西,预加载时也要用到
DesignUtils.initLookAndFeel();
// 初始化Log Handler // 初始化Log Handler
DesignerEnvManager.loadLogSetting(); DesignerEnvManager.loadLogSetting();
createDesignerFrame(); createDesignerFrame();
@ -137,7 +135,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
if (!isException) { if (!isException) {
showDesignerFrame(true); showDesignerFrame(true);
} else { } else {
System.exit(0); DesignerExiter.getInstance().execute();
} }
} }
} }

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

Loading…
Cancel
Save