Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~maksim/design into release/10.0

 Conflicts:
	designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java
feature/big-screen
Maksim 5 years ago
parent
commit
7909aa2a74
  1. 15
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 141
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  3. 3
      designer-base/src/main/java/com/fr/design/RestartHelper.java
  4. 73
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  5. 2
      designer-base/src/main/java/com/fr/design/actions/help/FineUIAction.java
  6. 2
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindDialog.java
  7. 2
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindPane.java
  8. 43
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  9. 1
      designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java
  10. 2
      designer-base/src/main/java/com/fr/design/condition/ContinuousTreeSelectionModel.java
  11. 2
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  12. 49
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  13. 6
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  14. 1
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePaneSupportFormula.java
  15. 1
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  16. 82
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  17. 6
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  18. 3
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java
  19. 10
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/AutoStoreProcedureTableModel.java
  20. 9
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java
  21. 25
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/CustomDictModel.java
  22. 6
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  23. 21
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  24. 5
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
  25. 11
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  26. 1
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java
  27. 2
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java
  28. 1
      designer-base/src/main/java/com/fr/design/designer/EditingState.java
  29. 4
      designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java
  30. 94
      designer-base/src/main/java/com/fr/design/dialog/ErrorDialog.java
  31. 3
      designer-base/src/main/java/com/fr/design/dialog/FineJOptionPane.java
  32. 1
      designer-base/src/main/java/com/fr/design/dialog/JWizardDialog.java
  33. 2
      designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java
  34. 90
      designer-base/src/main/java/com/fr/design/dialog/TipDialog.java
  35. 19
      designer-base/src/main/java/com/fr/design/editor/editor/WidgetNameEditor.java
  36. 2
      designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java
  37. 15
      designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java
  38. 20
      designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java
  39. 4
      designer-base/src/main/java/com/fr/design/extra/AppStoreBuilder.java
  40. 9
      designer-base/src/main/java/com/fr/design/extra/LoginDialog.java
  41. 7
      designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java
  42. 3
      designer-base/src/main/java/com/fr/design/extra/PluginAbstractLoadingViewPane.java
  43. 5
      designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java
  44. 10
      designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java
  45. 3
      designer-base/src/main/java/com/fr/design/extra/PluginUpdatePane.java
  46. 5
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  47. 10
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  48. 2
      designer-base/src/main/java/com/fr/design/extra/QQLoginDialog.java
  49. 1
      designer-base/src/main/java/com/fr/design/extra/ShopDialog.java
  50. 13
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  51. 40
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  52. 2
      designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java
  53. 22
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  54. 34
      designer-base/src/main/java/com/fr/design/fun/MobileBookMarkStyleProvider.java
  55. 23
      designer-base/src/main/java/com/fr/design/fun/MultiStyleUIConfigProvider.java
  56. 39
      designer-base/src/main/java/com/fr/design/fun/StyleUIConfigProvider.java
  57. 24
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileBookMarkStyleProvider.java
  58. 26
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractMultiStyleUIConfigProvider.java
  59. 41
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractStyleUIConfigProvider.java
  60. 37
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java
  61. 8
      designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java
  62. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupPane.java
  63. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java
  64. 8
      designer-base/src/main/java/com/fr/design/gui/frpane/UnitInputPane.java
  65. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/SpecialUIButton.java
  66. 1
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIBasicButtonUI.java
  67. 452
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java
  68. 4
      designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java
  69. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java
  70. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIPasswordField.java
  71. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIPreviewButton.java
  72. 11
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java
  73. 14
      designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java
  74. 8
      designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java
  75. 6
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java
  76. 20
      designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java
  77. 18
      designer-base/src/main/java/com/fr/design/gui/icombobox/ComboCheckBox.java
  78. 1
      designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java
  79. 21
      designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java
  80. 4
      designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java
  81. 18
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java
  82. 10
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  83. 24
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java
  84. 12
      designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java
  85. 42
      designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java
  86. 3
      designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java
  87. 2
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/UIProgressBorder.java
  88. 44
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIBasicScrollBarUI.java
  89. 8
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UISBChooser.java
  90. 41
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java
  91. 6
      designer-base/src/main/java/com/fr/design/gui/itable/UITable.java
  92. 53
      designer-base/src/main/java/com/fr/design/gui/itextfield/TextFieldUI.java
  93. 14
      designer-base/src/main/java/com/fr/design/gui/style/AlignmentPane.java
  94. 5
      designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java
  95. 24
      designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java
  96. 36
      designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java
  97. 6
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxUtilities.java
  98. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java
  99. 4
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java
  100. 9
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.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.style.color.ColorSelectConfigManager;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.DesignerPort;
import com.fr.file.FILEFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogFormatter;
@ -1545,7 +1546,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readDesignerPushUpdateAttr(reader);
} else if (name.equals(vcsConfigManager.XML_TAG)) {
readVcsAttr(reader);
} else {
} else if (DesignerPort.XML_TAG.equals(name)) {
readDesignerPort(reader);
}
else {
readLayout(reader, name);
}
}
@ -1736,6 +1740,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
reader.readXMLObject(vcsConfigManager);
}
public void readDesignerPort(XMLableReader reader) {
reader.readXMLObject(DesignerPort.getInstance());
}
/**
* Write XML.<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);
writeDesignerPushUpdateAttr(writer);
writeVcsAttr(writer);
writeDesignerPort(writer);
writer.end();
}
@ -2010,6 +2019,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.vcsConfigManager.writeXML(writer);
}
private void writeDesignerPort(XMLPrintWriter writer) {
DesignerPort.getInstance().writeXML(writer);
}
public VcsConfigManager getVcsConfigManager() {
return vcsConfigManager;

141
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.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.RemoteWorkspace;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.DesignUtils;
import com.fr.design.write.submit.CheckServiceDialog;
import com.fr.env.EnvListPane;
import com.fr.exit.DesignerExiter;
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.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.rpc.Result;
import com.fr.stable.AssistUtils;
import com.fr.stable.EnvChangedListener;
import com.fr.start.server.ServerTray;
import com.fr.workspace.WorkContext;
import com.fr.workspace.WorkContextCallback;
import com.fr.workspace.Workspace;
import com.fr.workspace.base.WorkspaceAPI;
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.exception.WorkspaceAuthException;
import com.fr.workspace.engine.exception.WorkspaceConnectionException;
import com.fr.workspace.engine.rpc.WorkspaceProxyPool;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.HashSet;
import static javax.swing.JOptionPane.ERROR_MESSAGE;
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
@ -84,6 +99,7 @@ public class EnvChangeEntrance {
private boolean switch2Env(final String envName, PopTipStrategy strategy) {
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName);
WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection();
try {
Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv);
@ -98,12 +114,7 @@ public class EnvChangeEntrance {
});
return false;
}
// 如果版本不一致,且确认 不继续 连接,这里返回 false.
if (!versionCheckAndConfirm(selectedEnv)) {
return false;
}
WorkContext.switchTo(workspace, new WorkContextCallback() {
@Override
public void done() {
@ -121,7 +132,7 @@ public class EnvChangeEntrance {
if (template != null) {
template.refreshToolArea();
}
showServiceDialog(selectedEnv);
} catch (WorkspaceAuthException | RegistEditionException e) {
// String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed");
// String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote");
@ -154,6 +165,7 @@ public class EnvChangeEntrance {
}
/**
* 这个功能留着可能会加回来先做注释处理
* 切换远程环境之前进行版本检测当版本不一致的时候提示
* 当用户确认选择 ok 才继续
*
@ -197,6 +209,118 @@ public class EnvChangeEntrance {
return true;
}
/**
* 对选择的环境做服务检测
* @param selectedEnv 选择的工作环境
*/
public void showServiceDialog(DesignerWorkspaceInfo selectedEnv) throws Exception {
//是否需要做服务校验
if(needCheckBranch(selectedEnv)) {
String localBranch;
String remoteBranch;
WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection();
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);
}
}
}
/**
* 判断是否需要做版本验证判断依据为
* 1选择的环境为远程环境
* 2一个月内不弹出是否勾选这里预留还未实际增加
* @param selectedEnv 选择的环境
* @return
*/
private boolean needCheckBranch(DesignerWorkspaceInfo selectedEnv){
return selectedEnv.getType() == DesignerWorkspaceType.Remote;
}
/**
* 获取不存在的服务列表
* @param info 环境连接信息
* @return 以Set形式返回不存在的服务
*/
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;
}
}
/**
* 格式化分支版本号
* @param branch 初始的分支版本号
* @return 格式化后的版本号
*/
private String formatBranch(String branch){
if(branch.contains("#")){
return branch.substring(branch.lastIndexOf("#") + 1, branch.length() - 13);
}
return branch;
}
/**
* 编辑items
*
@ -244,14 +368,13 @@ public class EnvChangeEntrance {
@Override
public void doOk() {
if (!envListOkAction(envListPane, PopTipStrategy.NOW)) {
System.exit(0);
DesignerExiter.getInstance().execute();
}
}
@Override
public void doCancel() {
System.exit(0);
}
DesignerExiter.getInstance().execute(); }
});
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.os.impl.RestartAction;
import com.fr.exit.DesignerExiter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory;
@ -152,7 +153,7 @@ public class RestartHelper {
} finally {
WorkContext.getCurrent().close();
frame.dispose();
System.exit(0);
DesignerExiter.getInstance().execute();
}
}

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

@ -223,17 +223,16 @@ public class PreferencePane extends BasicPane {
upmSelectorPane.add(useOptimizedUPMCheckbox);
advancePane.add(upmSelectorPane);
//REPORT-23578 先屏蔽掉
//JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Database_Manager"));
//useUniverseDBMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_Universe_Database_Manager"));
//dbmSelectorPane.add(useUniverseDBMCheckbox);
//advancePane.add(dbmSelectorPane);
JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Database_Manager"));
useUniverseDBMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_Universe_Database_Manager"));
dbmSelectorPane.add(useUniverseDBMCheckbox);
advancePane.add(dbmSelectorPane);
JPanel improvePane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Basic_Product_Improve"));
joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve"));
improvePane.add(joinProductImproveCheckBox);
if(SupportOSImpl.AUTOPUSHUPDATE.support()){
if (SupportOSImpl.AUTOPUSHUPDATE.support()) {
autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update"));
improvePane.add(autoPushUpdateCheckBox);
}
@ -511,23 +510,8 @@ public class PreferencePane extends BasicPane {
JPanel logLevelPane = FRGUIPaneFactory.createTitledBorderPane("log" + i18nText("Fine-Design_Basic_Level_Setting"));
logPane.add(logLevelPane);
logLevelComboBox = new UIComboBox(LOG);
logLevelComboBox.setEnabled(WorkContext.getCurrent().isLocal());
logLevelPane.add(logLevelComboBox);
logLevelComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Configurations.update(new Worker() {
@Override
public void run() {
Log4jConfig.getInstance().setRootLevel((Level) logLevelComboBox.getSelectedItem());
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{Log4jConfig.class};
}
});
}
});
}
private void createLanPane(JPanel generalPane) {
@ -555,8 +539,8 @@ public class PreferencePane extends BasicPane {
});
UILabel noticeLabel = new UILabel(i18nText("Fine-Design_Basic_Work_After_Restart_Designer"));//sail:提示重启后生效
double p = TableLayout.PREFERRED;
double rowSize[] = {p};
double columnSize[] = {p, p, p};
double[] rowSize = {p};
double[] columnSize = {p, p, p};
Component[][] components = {
{languageLabel, languageComboBox, noticeLabel},
};
@ -596,7 +580,7 @@ public class PreferencePane extends BasicPane {
private void createLengthPane(JPanel advancePane) {
double p = TableLayout.PREFERRED;
double rowSize[] = {p};
double[] rowSize = {p};
// 长度单位选择
JPanel lengthPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Setting_Ruler_Units"));
@ -618,8 +602,8 @@ public class PreferencePane extends BasicPane {
private void createServerPane(JPanel advancePane) {
double p = TableLayout.PREFERRED;
double rowSize[] = {p};
double columnSize[] = {p, p, p};
double[] rowSize = {p};
double[] columnSize = {p, p, p};
JPanel serverPortPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Web_Preview_Port_Setting"));
advancePane.add(serverPortPane);
@ -658,7 +642,7 @@ public class PreferencePane extends BasicPane {
/**
* The method of populate.
*
* @param designerEnvManager
* @param designerEnvManager 设计器环境管理器
*/
public void populate(DesignerEnvManager designerEnvManager) {
if (designerEnvManager == null) {
@ -687,7 +671,7 @@ public class PreferencePane extends BasicPane {
defaultStringToFormulaBox.setSelected(false);
}
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager();
if (WorkContext.getCurrent().isCluster()) {
if (WorkContext.getCurrent().isCluster()){
vcsEnableCheckBox.setEnabled(false);
gcEnableCheckBox.setEnabled(false);
}
@ -729,7 +713,7 @@ public class PreferencePane extends BasicPane {
useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM());
//useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM());
useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM());
this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace());
this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit());
@ -826,23 +810,30 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50);
}
Configurations.update(new Worker() {
@Override
public void run() {
Log4jConfig.getInstance().setRootLevel(((Level) logLevelComboBox.getSelectedItem()));
}
if (WorkContext.getCurrent().isLocal()) {
Configurations.update(new Worker() {
@Override
public void run() {
Level level = (Level) logLevelComboBox.getSelectedItem();
if (level != null) {
Log4jConfig.getInstance().setRootLevel(level);
}
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{Log4jConfig.class};
}
});
@Override
public Class<? extends Configuration>[] targets() {
@SuppressWarnings("unchecked")
Class<? extends Configuration>[] classes = new Class[]{Log4jConfig.class};
return classes;
}
});
}
Configurations.update(new Worker() {
@Override
public void run() {
ServerPreferenceConfig.getInstance().setUseOptimizedUPM(useOptimizedUPMCheckbox.isSelected());
//ServerPreferenceConfig.getInstance().setUseUniverseDBM(useUniverseDBMCheckbox.isSelected());
ServerPreferenceConfig.getInstance().setUseUniverseDBM(useUniverseDBMCheckbox.isSelected());
}
@Override

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

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

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

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 ContinuousTreeSelectionModel() {
}
public void addSelectionPaths(TreePath[] paths) {
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
public void editingCanceled(ChangeEvent e) {
// Do nothing
}
@Override
public void editingStopped(ChangeEvent e) {
// Do nothing
}
}

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

@ -83,6 +83,7 @@ public abstract class DesignTableDataManager {
//用于记录是否要弹出参数框
private static ThreadLocal<String> threadLocal = new ThreadLocal<String>();
private static Map<TableDataSource, Map<String, String[]>> columnCache = new HashMap<>();
/**
* 清除全局 数据集缓存.
@ -113,11 +114,13 @@ public abstract class DesignTableDataManager {
public static void closeTemplate(JTemplate<?, ?> template) {
if (template != null) {
columnCache.remove(getEditingTableDataSource());
dsListenersMap.remove(template.getPath());
}
}
public static void envChange() {
columnCache.clear();
dsListenersMap.clear();
dsNameChangedMap.clear();
clearGlobalDs();
@ -197,7 +200,51 @@ public abstract class DesignTableDataManager {
java.util.Map<String, TableDataWrapper> resMap = getAllEditingDataSet(source);
java.util.Map<String, TableDataWrapper> dsMap = getAllDataSetIncludingProcedure(resMap);
TableDataWrapper tabledataWrapper = dsMap.get(dsName);
return tabledataWrapper == null ? new String[0] : tabledataWrapper.calculateColumnNameList().toArray(new String[0]);
if (tabledataWrapper == null) {
return new String[0];
} else {
return getSelectedColumnNamesFromCache(source, dsName, tabledataWrapper);
}
}
private static String[] getSelectedColumnNamesFromCache(TableDataSource dataSource, String dsName, TableDataWrapper tableDataWrapper) {
Map<String, String[]> map = columnCache.get(dataSource);
if (map == null) {
map = new HashMap<>();
String[] columnNames = tableDataWrapper.calculateColumnNameList().toArray(new String[0]);
map.put(dsName, columnNames);
columnCache.put(dataSource, map);
return columnNames;
} else {
String[] columnNames = map.get(dsName);
if (columnNames == null) {
columnNames = tableDataWrapper.calculateColumnNameList().toArray(new String[0]);
map.put(dsName, columnNames);
return columnNames;
} else {
return columnNames;
}
}
}
public static void removeSelectedColumnNames(String dsName) {
Map<String, String[]> map = columnCache.get(getEditingTableDataSource());
if (map == null) {
return;
}
map.remove(dsName);
}
public static void addDsColumnNames(String dsName, String[] columnNames) {
TableDataSource dataSource = getEditingTableDataSource();
Map<String, String[]> map = columnCache.get(dataSource);
if (map == null) {
map = new HashMap<>();
map.put(dsName, columnNames);
columnCache.put(dataSource, map);
} else {
map.put(dsName, columnNames);
}
}
/**

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

82
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -17,6 +17,8 @@ import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.TableDataDefineProvider;
import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
@ -25,12 +27,12 @@ import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.NameObject;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
@ -39,8 +41,13 @@ import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.dnd.DnDConstants;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
@ -90,23 +97,9 @@ public class TableDataTreePane extends BasicTableDataTreePane {
createAddMenuDef();
GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) {
@Override
public void on(PluginEvent event) {
addMenuDef.clearShortCuts();
createAddMenuDef();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
// 创建插件监听
createPluginListener();
return context.contain(PluginModule.ExtraDesign);
}
});
editAction = new EditAction();
removeAction = new RemoveAction();
previewTableDataAction = new PreviewTableDataAction(dataTree);
@ -146,8 +139,57 @@ public class TableDataTreePane extends BasicTableDataTreePane {
new TableDataTreeDragSource(dataTree, DnDConstants.ACTION_COPY);
checkButtonEnabled();
}
private void createPluginListener() {
//菜单栏监听
GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) {
@Override
public void on(PluginEvent event) {
addMenuDef.clearShortCuts();
createAddMenuDef();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign);
}
});
//监听数据集插件
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
//REPORT-25577
//如果数据集插件禁用或启用。需要清空当前模板中的缓存
reloadCurrTemplate();
}
private void reloadCurrTemplate() {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (accept(jt)) {
jt.refreshResource();
}
}
private boolean accept(JTemplate<?, ?> jt) {
return jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext pluginContext) {
return pluginContext.contain(TableDataDefineProvider.XML_TAG);
}
});
}
protected void checkButtonEnabled() {
super.checkButtonEnabled(editAction, previewTableDataAction, removeAction, op, dataTree);
}
@ -244,6 +286,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
if (selectedNO == null) {
return;
}
DesignTableDataManager.removeSelectedColumnNames(selectedNO.getName());
dgEdit(((AbstractTableDataWrapper) selectedNO.getObject()).creatTableDataPane(), selectedNO.getName(), false);
}
}
@ -275,6 +318,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
dataTree.setSelectionRow(dataTree.getRowCount() - 1);
fireDSChanged();
checkButtonEnabled();
DesignTableDataManager.removeSelectedColumnNames(selectedNO.getName());
}
}
}

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

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

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

@ -140,8 +140,6 @@ public class PreviewTableModel extends AbstractTableModel {
* 就是由于预览的JTable在不停的getRowCount来显示数据.
*/
private static class ErrorResultSet extends AbstractDataModel {
public ErrorResultSet() {
}
public int getRowCount() {
return 0;
@ -160,6 +158,7 @@ public class PreviewTableModel extends AbstractTableModel {
}
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.setDefaultRenderer(StoreProcedureParameterValueEditor.class, new ProcedureParameterValueRenderer());
}
@Override
public boolean isCellEditable(int row, int col) {
if (ComparatorUtils.equals(getValueAt(row, col -1), "OUT")) {
return false;
@ -48,6 +49,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
return false;
}
@Override
public boolean shouldResponseDoubleClickAction () {
return false;
}
@ -60,7 +62,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
editor = ValueEditorPaneFactory.createStoreProcedValueEditorPane();
editor.getMenu().addPopupMenuListener(new PopupMenuListener() {
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
// Do nothing
}
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
@ -77,15 +79,16 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
}, 100);
}
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
//do nothing
}
});
this.addCellEditorListener(new CellEditorListener() {
@Override
public void editingCanceled(ChangeEvent e) {
//do nothing
}
@Override
@ -147,6 +150,7 @@ public class AutoStoreProcedureTableModel extends StoreProcedureTableModel {
editor = ValueEditorPaneFactory.createStoreProcedValueEditorPane();
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
editor.setCurrentEditor(0);
editor.populate(value);

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

@ -57,8 +57,10 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
(Dialog) SwingUtilities.getWindowAncestor(ClassTableDataPane.this),
new DialogActionAdapter() {
public void doOk() {
classNameTextField.setText(bPane.getClassPath());
}
String classPath = bPane.getClassPath();
ClassTableData tableData = new ClassTableData(classPath);
populateBean(tableData);
}
});
dlg.setVisible(true);
}
@ -124,6 +126,7 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
}
@Override
public void actionPerformed(ActionEvent e) {
java.util.List<ParameterProvider> oldParas = editorPane.update();
oldParas.add(new Parameter());
@ -132,6 +135,7 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
@Override
public void checkEnabled() {
//do nothing
}
}
private class RemoveParaAction extends UITableEditAction {
@ -149,6 +153,7 @@ public class ClassTableDataPane extends AbstractTableDataPane<ClassTableData> {
@Override
public void checkEnabled() {
//do nothing
}
}

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

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

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

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

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

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

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

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

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

1
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java

@ -65,6 +65,7 @@ public abstract class AbstractTableDataWrapper implements TableDataWrapper {
}
}
columnNameList = DesignTableDataManager.getColumnNamesByTableData(embeddedTableData);
DesignTableDataManager.addDsColumnNames(name, columnNameList.toArray(new String[0]));
return columnNameList;
}

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

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

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

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

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

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

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

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

@ -158,8 +158,9 @@ public class FineJOptionPane extends JOptionPane {
public static int showConfirmDialog(Component parentComponent, Object message,
String title, int optionType, int messageType, Icon icon)
throws HeadlessException {
String[] options = OPTION_MAP.get(optionType);
return showConfirmDialog(parentComponent, message, title, optionType,
messageType, icon, OPTION_MAP.get(optionType), null);
messageType, icon, options, options[0]);
}
/**

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

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

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

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

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

@ -0,0 +1,90 @@
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.*;
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, String tip, String endText, String cancelText) {
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/error2.png"));
iconPane.add(iconLabel);
iconPane.setPreferredSize(new Dimension(50, 50));
JPanel tipPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
UILabel tipLabel = new UILabel(tip);
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(endText);
endButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
endEvent();
}
});
buttonPane.add(endButton);
cancelButton = new UIButton(cancelText);
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;
import java.awt.BorderLayout;
import java.awt.Component;
import javax.swing.JList;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import com.fr.design.DesignModelAdapter;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.icombobox.FilterComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.js.WidgetName;
import javax.swing.JList;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.BorderLayout;
import java.awt.Component;
/**
* the editor to edit WidgetName
*
@ -43,12 +42,12 @@ public class WidgetNameEditor extends Editor<WidgetName> {
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
//do nothing
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
//do nothing
}
@Override

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

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

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

@ -1,10 +1,12 @@
package com.fr.design.env;
import com.fr.log.FineLoggerFactory;
import com.fr.security.SecurityToolbox;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
@ -79,6 +81,7 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
}
@Override
@SuppressWarnings("squid:S2975")
public Object clone() throws CloneNotSupportedException {
RemoteDesignerWorkspaceInfo object = (RemoteDesignerWorkspaceInfo) super.clone();
@ -89,8 +92,14 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
@Override
public boolean checkValid(){
return true;
public boolean checkValid() {
boolean result = false;
try {
result = WorkContext.getConnector().testConnection(connection);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return result;
}
return result;
}
}

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.design.i18n.Toolkit;
import com.fr.rpc.ExceptionHandler;
import com.fr.stable.AssistUtils;
import com.fr.workspace.WorkContext;
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.WorkspaceConnectionInfo;
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.
@ -84,6 +87,19 @@ public class RemoteWorkspace implements Workspace {
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
public void close() {
@ -102,4 +118,8 @@ public class RemoteWorkspace implements Workspace {
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 void checkStoreJavaSciptVersion() {
//do nothing
}
public void updateStoreJavaScript() {
//do nothing
}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -13,6 +13,7 @@ import com.fr.plugin.basic.version.VersionIntervalFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.error.PluginBaseErrorCode;
import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.view.PluginView;
import com.fr.stable.EncodeConstants;
@ -194,7 +195,7 @@ public class PluginUtils {
}
}
public static String getMessageByErrorCode(PluginErrorCode errorCode) {
public static String getMessageByErrorCode(PluginBaseErrorCode errorCode) {
if(errorCode == PluginErrorCode.None){
return "";
}
@ -202,7 +203,7 @@ public class PluginUtils {
return com.fr.design.i18n.Toolkit.i18nCompatibleServerText(getInterKeyByErrorCode(errorCode));
}
private static String getInterKeyByErrorCode(PluginErrorCode errorCode) {
private static String getInterKeyByErrorCode(PluginBaseErrorCode errorCode) {
return errorCode.getDescription();
}

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

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

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

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

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

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

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

@ -386,4 +386,17 @@ public class HistoryTemplateListCache implements CallbackEvent {
}
FineLoggerFactory.getLogger().info("Env Change Template Loaded.");
}
/**
* 重新载入当前模板刷新数据/对象
*/
public void reloadCurrentTemplate() {
JTemplate<?, ?> jt = getCurrentEditingTemplate();
boolean access = jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists();
if (access) {
closeSelectedReport(jt);
DesignerContext.getDesignerFrame().openTemplate(jt.getEditingFILE());
}
}
}

40
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.server.lock.TplOperator;
import javax.swing.BorderFactory;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.*;
import javax.swing.plaf.basic.BasicMenuItemUI;
import java.awt.AWTEvent;
import java.awt.AlphaComposite;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.*;
import java.awt.event.AWTEventListener;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -258,7 +241,7 @@ public class MutilTempalteTabPane extends JComponent {
private String tempalteShowName(JTemplate<?, ?> template) {
String name = template.getEditingFILE().getName();
String name = template.getTemplateName();
if (!template.isSaved() && !name.endsWith(" *")) {
name += " *";
}
@ -399,8 +382,8 @@ public class MutilTempalteTabPane extends JComponent {
//画下面的那条线
if (templateStartX < maxWidth) {
GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, 2);
generalPath.moveTo((float) templateStartX, getHeight() - 1.0F);
generalPath.lineTo((float) maxWidth, getHeight() - 1.0F);
generalPath.moveTo((float) templateStartX, (float) (getHeight() - 1.0D));
generalPath.lineTo((float) maxWidth, (float) (getHeight() - 1.0D));
g2d.fill(generalPath);
//TODO hzzz delete
// g2d.setPaint(UIConstants.LINE_COLOR);
@ -410,7 +393,7 @@ public class MutilTempalteTabPane extends JComponent {
private void paintDefaultBackground(Graphics2D g2d) {
//画默认背景
g2d.setPaint(new GradientPaint(1, 1, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND, 1, getHeight() - 1.0F, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND));
g2d.setPaint(new GradientPaint(1, 1, UIConstants.TEMPLATE_TAB_PANE_BACKGROUND, 1, (float) (getHeight() - 1.0D), UIConstants.TEMPLATE_TAB_PANE_BACKGROUND));
g2d.fillRect(0, 0, getWidth(), getHeight());
}
@ -536,7 +519,7 @@ public class MutilTempalteTabPane extends JComponent {
double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX};
double[] y = {1, getHeight() + 1, getHeight() + 1, 1, 1};
RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(templateStartX, 1, this.getWidth(), this.getHeight(), 7, 7);
g2d.setPaint(new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, getHeight() - 1.0F, UIConstants.SELECT_TAB));
g2d.setPaint(new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, (float) (getHeight() - 1.0D), UIConstants.SELECT_TAB));
//选了30度和60度的特殊角度的x,y作为经过的两个点的坐标
double specialLocation1 = 2.5;
double specialLocation2 = 4.330127;
@ -591,9 +574,9 @@ public class MutilTempalteTabPane extends JComponent {
double[] x = {templateStartX, templateStartX, templateStartX + realWidth, templateStartX + realWidth, templateStartX};
double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1};
if (selfIndex == mouseOveredIndex) {
g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, getHeight() - 1.0F, UIConstants.HOVER_BLUE));
g2d.setPaint(new GradientPaint(1, 1, UIConstants.HOVER_BLUE, 1, (float) (getHeight() - 1.0D), UIConstants.HOVER_BLUE));
} else {
g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, getHeight() - 1.0F, UIConstants.SHADOW_GREY));
g2d.setPaint(new GradientPaint(1, 1, UIConstants.SHADOW_GREY, 1, (float) (getHeight() - 1.0D), UIConstants.SHADOW_GREY));
}
@ -855,7 +838,7 @@ public class MutilTempalteTabPane extends JComponent {
*/
@Override
public void mouseEntered(MouseEvent e) {
// do nothing
}
/**
@ -878,6 +861,7 @@ public class MutilTempalteTabPane extends JComponent {
*/
@Override
public void mouseReleased(MouseEvent e) {
// do nothing
}
/**
@ -887,6 +871,7 @@ public class MutilTempalteTabPane extends JComponent {
*/
@Override
public void mouseClicked(MouseEvent e) {
// do nothing
}
/**
@ -958,6 +943,7 @@ public class MutilTempalteTabPane extends JComponent {
*/
@Override
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
* @return 带权限信息的文件节点
*/
public boolean fixFileNodeAuth(FileNode fileNode) {
public boolean checkFileNodeAuth(FileNode fileNode) {
boolean isLocal = WorkContext.getCurrent().isLocal();
boolean isRoot = WorkContext.getCurrent().isRoot();

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

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

34
designer-base/src/main/java/com/fr/design/fun/MobileBookMarkStyleProvider.java

@ -0,0 +1,34 @@
package com.fr.design.fun;
import com.fr.design.beans.BasicBeanPane;
import com.fr.form.ui.mobile.MobileBookMarkStyle;
import com.fr.stable.fun.mark.Mutable;
/**
* 移动端书签样式扩展接口
*
* @author hades
* @version 10.0
* Created by hades on 2019/12/23
*/
public interface MobileBookMarkStyleProvider extends Mutable {
String XML_TAG = "MobileBookMarkStyleProvider";
int CURRENT_LEVEL = 1;
/**
* 书签样式
* @return
*/
Class<? extends MobileBookMarkStyle> classForMobileBookMarkStyle();
/**
* 书签样式面板
* @return
*/
Class<? extends BasicBeanPane<MobileBookMarkStyle>> classForMobileBookMarkStyleAppearance();
String displayName();
}

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

24
designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileBookMarkStyleProvider.java

@ -0,0 +1,24 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.MobileBookMarkStyleProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author hades
* @version 10.0
* Created by hades on 2019/12/24
*/
@API(level = MobileBookMarkStyleProvider.CURRENT_LEVEL)
public abstract class AbstractMobileBookMarkStyleProvider extends AbstractProvider implements MobileBookMarkStyleProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

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

37
designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java

@ -11,14 +11,25 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.ShortCut;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.invoke.Reflect;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
@ -26,14 +37,6 @@ import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.border.EmptyBorder;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
@ -243,6 +246,20 @@ abstract class UIControlPane extends JControlPane {
return;
}
}
try {
//没有指定owner的弹出框用的是SwingUtilities.getSharedOwnerFrame()
Frame sharedOwnerFrame = Reflect.on(SwingUtilities.class).call("getSharedOwnerFrame").get();
for (Window window : sharedOwnerFrame.getOwnedWindows()) {
if (window instanceof JDialog && window.isVisible() && ((JDialog) window).isModal()) {
// 如果有可见模态对话框,则不隐藏
return;
}
}
} catch (Exception ignore) {
//do nothing
}
// 要隐藏 先检查有没有非法输入
// 非法输入检查放在最后,因为可能出现面板弹出新弹框而失去焦点的情况,比如 输入公式时,弹出公式编辑对话框
try {
@ -263,7 +280,9 @@ abstract class UIControlPane extends JControlPane {
@Override
public void windowLostFocus(WindowEvent e) {
//在Linux上拉回焦点,不然导致一些面板关不掉
requestFocus();
if(OperatingSystem.isLinux()) {
requestFocus();
}
hideDialog();
}
});

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

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

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

@ -2,6 +2,7 @@ package com.fr.design.gui.frpane;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListControlPane;
@ -45,6 +46,7 @@ public abstract class HyperlinkGroupPane extends UIListControlPane {
@Override
public void on(PluginEvent event) {
refreshNameableCreator(createNameableCreators());
HistoryTemplateListCache.getInstance().reloadCurrentTemplate();
}
}, new PluginFilter() {

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

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)
*/
@Override
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;
public UIBasicButtonUI() {
// do nothing
}
/**

452
designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java

@ -1,19 +1,5 @@
package com.fr.design.gui.ibutton;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
import com.fr.base.Utils;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.GlobalNameListener;
@ -21,231 +7,223 @@ import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ipoppane.PopupHider;
import com.fr.general.ComparatorUtils;
import com.fr.design.style.color.ColorControlWindow;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class UIColorButton extends UIButton implements PopupHider, UIObserver, GlobalNameObserver {
private static final int SIZE = 16;
private static final int SIZE_2 = 2;
private static final int SIZE_4 = 4;
private static final int SIZE_6 = 6;
private static final int POPUP_MENU_SHIFT = -70;
private Color color = Color.BLACK;
private ColorControlWindow popupWin;
private EventListenerList colorChangeListenerList = new EventListenerList();
private boolean isEventBanned = false;
private String colorButtonName = "";
private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null;
public UIColorButton() {
this(UIConstants.FONT_ICON);
}
public UIColorButton(Icon icon) {
super(icon);
setUI(getButtonUI());
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
showPopupMenu();
}
});
iniListener();
}
private void iniListener() {
if (shouldResponseChangeListener()) {
this.addColorChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (uiObserverListener == null) {
return;
}
if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(colorButtonName);
}
uiObserverListener.doChange();
}
});
}
}
private UIButtonUI getButtonUI() {
return new UIButtonUI() {
@Override
protected void paintIcon(Graphics g, JComponent c) {
super.paintIcon(g, c);
AbstractButton b = (AbstractButton) c;
ButtonModel model = b.getModel();
if (model.isEnabled()) {
g.setColor(UIColorButton.this.getColor());
} else {
g.setColor(new Color(Utils.filterRGB(UIColorButton.this.getColor().getRGB(), 50)));
}
g.fillRect((b.getWidth() - SIZE) / SIZE_2, b.getHeight() - SIZE_6, SIZE, SIZE_4);
}
};
}
public void setEventBanned(boolean isEventBanned) {
this.isEventBanned = isEventBanned;
}
public void setGlobalName(String name) {
colorButtonName = name;
}
public Color getColor() {
return color;
}
public void setColor(Color color) {
if (ComparatorUtils.equals(this.color, color)) {
return;
}
this.color = color;
hidePopupMenu();
fireColorStateChanged();
}
private void showPopupMenu() {
if (isEventBanned) {
return;
}
if (popupWin != null && popupWin.isVisible()) {
hidePopupMenu();
return;
}
if (!this.isEnabled()) {
return;
}
popupWin = this.getColorControlWindow();
GUICoreUtils.showPopupMenu(popupWin, this, POPUP_MENU_SHIFT, this.getSize().height);
}
/**
* 隐藏popupmenu
*/
public void hidePopupMenu() {
if (popupWin != null) {
popupWin.setVisible(false);
repaint();
}
popupWin = null;
}
private ColorControlWindow getColorControlWindow() {
//find parant.
if (this.popupWin == null) {
this.popupWin = new ColorControlWindow(UIColorButton.this) {
@Override
protected void colorChanged() {
UIColorButton.this.setColor(this.getColor());
}
};
}
return popupWin;
}
/**
* 添加监听
*
* @param changeListener 监听列表
*/
public void addColorChangeListener(ChangeListener changeListener) {
colorChangeListenerList.add(ChangeListener.class, changeListener);
}
/**
* 移除监听
* Removes an old ColorChangeListener.
* @param changeListener 监听列表
*/
public void removeColorChangeListener(ChangeListener changeListener) {
colorChangeListenerList.remove(ChangeListener.class, changeListener);
}
/**
* 颜色状态改变
*/
public void fireColorStateChanged() {
Object[] listeners = colorChangeListenerList.getListenerList();
ChangeEvent e = null;
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == ChangeListener.class) {
if (e == null) {
e = new ChangeEvent(this);
}
((ChangeListener) listeners[i + 1]).stateChanged(e);
}
}
}
/**
* 注册状态改变监听
*
* @param listener 观察者监听事件
*/
public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener;
}
/**
* 是否需要响应监听
*
* @return 是否响应
*/
public boolean shouldResponseChangeListener() {
return true;
}
/**
* 注册监听
*
* @param listener 观察者监听事件
*/
public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener;
}
/**
* 是否需要相应
*
* @return 是否响应
*/
public boolean shouldResponseNameListener() {
return true;
}
/**
* 主函数
*
* @param args 参数
*/
public static void main(String... args) {
LayoutManager layoutManager = null;
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(layoutManager);
UIColorButton bb = new UIColorButton(UIConstants.FONT_ICON);
bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height);
content.add(bb);
GUICoreUtils.centerWindow(jf);
jf.setSize(400, 400);
jf.setVisible(true);
}
private static final int SIZE = 16;
private static final int SIZE_2 = 2;
private static final int SIZE_4 = 4;
private static final int SIZE_6 = 6;
private static final int POPUP_MENU_SHIFT = -70;
private Color color = Color.BLACK;
private ColorControlWindow popupWin;
private EventListenerList colorChangeListenerList = new EventListenerList();
private boolean isEventBanned = false;
private String colorButtonName = "";
private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null;
public UIColorButton() {
this(UIConstants.FONT_ICON);
}
public UIColorButton(Icon icon) {
super(icon);
setUI(getButtonUI());
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
showPopupMenu();
}
});
iniListener();
}
private void iniListener() {
if (shouldResponseChangeListener()) {
this.addColorChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (uiObserverListener == null) {
return;
}
if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(colorButtonName);
}
uiObserverListener.doChange();
}
});
}
}
private UIButtonUI getButtonUI() {
return new UIButtonUI() {
@Override
protected void paintIcon(Graphics g, JComponent c) {
super.paintIcon(g, c);
AbstractButton b = (AbstractButton) c;
ButtonModel model = b.getModel();
if (model.isEnabled()) {
g.setColor(UIColorButton.this.getColor());
} else {
g.setColor(new Color(Utils.filterRGB(UIColorButton.this.getColor().getRGB(), 50)));
}
g.fillRect((b.getWidth() - SIZE) / SIZE_2, b.getHeight() - SIZE_6, SIZE, SIZE_4);
}
};
}
public void setEventBanned(boolean isEventBanned) {
this.isEventBanned = isEventBanned;
}
public void setGlobalName(String name) {
colorButtonName = name;
}
public Color getColor() {
return color;
}
public void setColor(Color color) {
if (ComparatorUtils.equals(this.color, color)) {
return;
}
this.color = color;
hidePopupMenu();
fireColorStateChanged();
}
private void showPopupMenu() {
if (isEventBanned) {
return;
}
if (popupWin != null && popupWin.isVisible()) {
hidePopupMenu();
return;
}
if (!this.isEnabled()) {
return;
}
popupWin = this.getColorControlWindow();
GUICoreUtils.showPopupMenu(popupWin, this, POPUP_MENU_SHIFT, this.getSize().height);
}
/**
* 隐藏popupmenu
*/
public void hidePopupMenu() {
if (popupWin != null) {
popupWin.setVisible(false);
}
popupWin = null;
repaint();
}
private ColorControlWindow getColorControlWindow() {
//find parant.
if (this.popupWin == null) {
this.popupWin = new ColorControlWindow(UIColorButton.this) {
@Override
protected void colorChanged() {
UIColorButton.this.setColor(this.getColor());
}
};
}
return popupWin;
}
/**
* 添加监听
*
* @param changeListener 监听列表
*/
public void addColorChangeListener(ChangeListener changeListener) {
colorChangeListenerList.add(ChangeListener.class, changeListener);
}
/**
* 移除监听
* Removes an old ColorChangeListener.
*
* @param changeListener 监听列表
*/
public void removeColorChangeListener(ChangeListener changeListener) {
colorChangeListenerList.remove(ChangeListener.class, changeListener);
}
/**
* 颜色状态改变
*/
public void fireColorStateChanged() {
Object[] listeners = colorChangeListenerList.getListenerList();
ChangeEvent e = null;
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == ChangeListener.class) {
if (e == null) {
e = new ChangeEvent(this);
}
((ChangeListener) listeners[i + 1]).stateChanged(e);
}
}
}
/**
* 注册状态改变监听
*
* @param listener 观察者监听事件
*/
public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener;
}
/**
* 是否需要响应监听
*
* @return 是否响应
*/
public boolean shouldResponseChangeListener() {
return true;
}
/**
* 注册监听
*
* @param listener 观察者监听事件
*/
public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener;
}
/**
* 是否需要相应
*
* @return 是否响应
*/
public boolean shouldResponseNameListener() {
return true;
}
}

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

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

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 void tabChanged(int newSelectedIndex) {
// do nothing
}
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); } }

11
designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java

@ -25,36 +25,43 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam
public UIRadioButton() {
super();
initListener();
initComponent();
}
public UIRadioButton(Icon icon) {
super(icon);
initListener();
initComponent();
}
public UIRadioButton(Action a) {
super(a);
initListener();
initComponent();
}
public UIRadioButton(Icon icon, boolean selected) {
super(icon, selected);
initListener();
initComponent();
}
public UIRadioButton(String text) {
super(text);
initListener();
initComponent();
}
public UIRadioButton(String text, boolean selected) {
super(text, selected);
initListener();
initComponent();
}
public UIRadioButton(String text, Icon icon) {
super(text, icon);
initListener();
initComponent();
}
@ -81,6 +88,10 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam
}
}
private void initComponent() {
this.setFocusPainted(false);
}
/**
* 给组件登记一个观察者监听事件
*

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

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

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;
g2d.setColor(blue);
g2d.fillRect(0, 1, w - 1, h / 2);
GradientPaint gp = new GradientPaint(1, 1, UIConstants.OCEAN_BLUE, 1, h - 1, blue);
GradientPaint gp = new GradientPaint(1, 1, UIConstants.OCEAN_BLUE, 1, h - 1F, blue);
g2d.setPaint(gp);
g2d.fillRect(0, h / 2, w - 1, h / 2);
this.setForeground(UIConstants.FONT_COLOR);
} else if (!isSelected() && !isRollover) {
GradientPaint gp = new GradientPaint(1, 1, TOP, 1, h - 1, DOWN);
GradientPaint gp = new GradientPaint(1, 1, TOP, 1, h - 1F, DOWN);
g2d.setPaint(gp);
g2d.fillRect(0, h / 2, w - 1, h / 2);
this.setForeground(UIConstants.FONT_COLOR);
@ -175,7 +175,7 @@ public class UITabButton extends UILabel implements UISelectedComponent {
}
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
protected void fireStateChanged() {
// do nothing
}
@ -220,7 +220,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
protected void paintOtherBorder(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setStroke(UIConstants.BS);
Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1, getHeight() - 1, UIConstants.ARC, UIConstants.ARC);
Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1F, getHeight() - 1F, UIConstants.ARC, UIConstants.ARC);
g2d.setColor(UIConstants.LINE_COLOR);
g2d.draw(shape);
}
@ -252,4 +252,4 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
return true;
}
}
}

20
designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java

@ -59,24 +59,28 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
initListener();
}
private void initListener() {
protected void initListener() {
if (shouldResponseChangeListener()) {
this.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (uiObserverListener == null) {
return;
}
if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(checkboxName);
}
uiObserverListener.doChange();
attributeChange();
}
});
}
}
protected void attributeChange() {
if (uiObserverListener == null) {
return;
}
if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(checkboxName);
}
uiObserverListener.doChange();
}
/**
* 给组件登记一个观察者监听事件
*

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 JScrollPane scrollPane;
protected MouseListener mouseListener;
protected MouseMotionListener mouseMotionListener;
protected MouseListener checkListMouseListener;
protected MouseMotionListener checkListMouseMotionListener;
public CheckListPopup(JComboBox comboBox) {
this.comboBox = (ComboCheckBox) comboBox;
@ -157,22 +157,22 @@ public class ComboCheckBox extends UIComboBox {
@Override
public MouseListener getMouseListener() {
if (mouseListener == null) {
mouseListener = new InvocationMouseHandler();
if (checkListMouseListener == null) {
checkListMouseListener = new InvocationMouseHandler();
}
return mouseListener;
return checkListMouseListener;
}
public MouseMotionListener getMouseMotionListener() {
if (mouseMotionListener == null) {
mouseMotionListener = new MouseMotionAdapter() {
if (checkListMouseMotionListener == null) {
checkListMouseMotionListener = new MouseMotionAdapter() {
};
}
return mouseMotionListener;
return checkListMouseMotionListener;
}
public void uninstallingUI() {
// do nothing
}
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
public void mouseClicked(MouseEvent e) {
// do nothing
}
@Override

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

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

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

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

18
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java

@ -15,6 +15,8 @@ import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
@ -149,6 +151,22 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
attributeChange();
}
});
UIComboCheckBox.this.popup.addPopupMenuListener(new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
// do nothing
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
attributeChange();
}
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
// do nothing
}
});
}
};
editor.setEditable(false);

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

@ -1,12 +1,11 @@
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.gui.ibutton.UIButton;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Constants;
import javax.swing.*;
import java.awt.*;
@ -174,6 +173,7 @@ public class UIEastResizableContainer extends JPanel {
@Override
public void addLayoutComponent(String name, Component comp) {
// do nothing
}
};
@ -238,6 +238,7 @@ public class UIEastResizableContainer extends JPanel {
* 伸缩右子面板时触发此方法
*/
public void onResize() {
// do nothing here
}
private class TopToolPane extends JPanel {
@ -261,6 +262,7 @@ public class UIEastResizableContainer extends JPanel {
@Override
public void mouseDragged(MouseEvent e) {
// do nothing
}
});
addMouseListener(new MouseAdapter() {
@ -282,7 +284,7 @@ public class UIEastResizableContainer extends JPanel {
}
onResize();
refreshContainer();
if (DesignerMode.isAuthorityEditing()) {
if (DesignModeContext.isAuthorityEditing()) {
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;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
@ -46,7 +47,7 @@ public class UIModeControlContainer extends JLayeredPane {
private boolean isHideMode = false;
private boolean isSheeetCovered = false;
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 30 / 100.0F);
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f);
public UIModeControlContainer() {
this(new JPanel(), new JPanel());
@ -85,7 +86,7 @@ public class UIModeControlContainer extends JLayeredPane {
public void needToShowCoverAndHidPane() {
if (DesignerMode.isAuthorityEditing()) {
if (DesignModeContext.isAuthorityEditing()) {
this.remove(coverPane);
this.remove(hidePane);
} else {
@ -128,7 +129,7 @@ public class UIModeControlContainer extends JLayeredPane {
if (isHideMode || !upEditMode) {
return;
}
if (DesignerMode.isAuthorityEditing()) {
if (DesignModeContext.isAuthorityEditing()) {
return;
}
setCursor(Cursor.getPredefinedCursor(Cursor.N_RESIZE_CURSOR));
@ -151,11 +152,12 @@ public class UIModeControlContainer extends JLayeredPane {
MouseMotionListener mouseMotionListener = new MouseMotionListener() {
@Override
public void mouseMoved(MouseEvent e) {
//do nothing
}
@Override
public void mouseDragged(MouseEvent e) {
if (DesignerMode.isAuthorityEditing()) {
if (DesignModeContext.isAuthorityEditing()) {
return;
}
boolean notUpEditMode = isHideMode || !upEditMode;
@ -174,7 +176,7 @@ public class UIModeControlContainer extends JLayeredPane {
@Override
public void removeLayoutComponent(Component comp) {
//do nothing
}
@Override
@ -234,11 +236,12 @@ public class UIModeControlContainer extends JLayeredPane {
@Override
public void addLayoutComponent(String name, Component comp) {
// do nothing
}
};
protected void onModeChanged() {
//do nothing here
}
/**
@ -309,7 +312,7 @@ public class UIModeControlContainer extends JLayeredPane {
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
// do nothing
}
});
}
@ -319,6 +322,7 @@ public class UIModeControlContainer extends JLayeredPane {
@Override
public void removeLayoutComponent(Component comp) {
// do nothing
}
@Override
@ -333,10 +337,12 @@ public class UIModeControlContainer extends JLayeredPane {
@Override
public void layoutContainer(Container parent) {
// do nothing
}
@Override
public void addLayoutComponent(String name, Component comp) {
// do nothing
}
};
@ -366,7 +372,7 @@ public class UIModeControlContainer extends JLayeredPane {
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
// do nothing
}
});
@ -407,6 +413,7 @@ public class UIModeControlContainer extends JLayeredPane {
@Override
public void removeLayoutComponent(Component comp) {
// do nothing
}
@Override
@ -437,6 +444,7 @@ public class UIModeControlContainer extends JLayeredPane {
@Override
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;
import javax.swing.event.MouseInputAdapter;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Graphics;
@ -7,9 +8,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.event.MouseInputAdapter;
/**
* Action label
*/
@ -31,6 +29,7 @@ public class ActionLabel extends UILabel {
/**
* Repaints the text.
*/
@Override
public void paintComponent(Graphics _gfx) {
super.paintComponent(_gfx);
@ -39,12 +38,17 @@ public class ActionLabel extends UILabel {
}
private MouseInputAdapter mouseInputAdapter = new MouseInputAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
//do nothing
}
@Override
public void mousePressed(MouseEvent e) {
//do nothing
}
@Override
public void mouseReleased(MouseEvent evt) {
Object source = evt.getSource();
@ -65,6 +69,7 @@ public class ActionLabel extends UILabel {
}
}
@Override
public void mouseExited(MouseEvent evt) {
Object source = evt.getSource();
@ -73,6 +78,7 @@ public class ActionLabel extends UILabel {
}
}
@Override
public void mouseDragged(MouseEvent e) {
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

53
designer-base/src/main/java/com/fr/design/gui/itextfield/TextFieldUI.java

@ -1,53 +0,0 @@
package com.fr.design.gui.itextfield;
import java.awt.Graphics;
import javax.swing.plaf.metal.MetalTextFieldUI;
import javax.swing.text.JTextComponent;
import de.muntjak.tinylookandfeel.Theme;
public class TextFieldUI extends MetalTextFieldUI {
protected void paintBackground(Graphics g) {
JTextComponent editor = getComponent();
// We will only be here if editor is opaque, so we don't have to test
if(editor.isEnabled()) {
if(editor.isEditable()) {
g.setColor(editor.getBackground());
}
else {
// not editable
if(editor.getBackground().equals(Theme.textBgColor[Theme.style].getColor())) {
// set default panel background
g.setColor(Theme.backColor[Theme.style].getColor());
}
else {
// color changed by user - set textfield background
g.setColor(editor.getBackground());
}
}
g.fillRect(0, 0, editor.getWidth(), editor.getHeight());
}
else {
if(editor.getBackground().equals(Theme.textBgColor[Theme.style].getColor())) {
g.setColor(Theme.textDisabledBgColor[Theme.style].getColor());
}
else {
// color changed by user - set textfield background
g.setColor(editor.getBackground());
}
g.fillRect(0, 0, editor.getWidth(), editor.getHeight());
if(Theme.style != Theme.YQ_STYLE) return;
g.setColor(Theme.backColor[Theme.style].getColor());
g.drawRect(1, 1, editor.getWidth() - 3, editor.getHeight() - 3);
g.drawRect(2, 2, editor.getWidth() - 5, editor.getHeight() - 5);
}
}
}

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

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

5
designer-base/src/main/java/com/fr/design/gui/style/BackgroundPane.java

@ -32,7 +32,7 @@ public class BackgroundPane extends AbstractBasicStylePane {
protected BackgroundQuickPane[] paneList;
//获取当前面板
protected JPanel currentPane = null;
protected BackgroundQuickPane currentPane = null;
public BackgroundPane() {
@ -43,7 +43,6 @@ public class BackgroundPane extends AbstractBasicStylePane {
this.setLayout(new BorderLayout(0, 6));
typeComboBox = new UIComboBox();
final CardLayout cardlayout = new CardLayout();
// this.add(typeComboBox, BorderLayout.NORTH);
paneList = supportKindsOfBackgroundUI();
@ -58,12 +57,12 @@ public class BackgroundPane extends AbstractBasicStylePane {
typeComboBox.addItem(pane.title4PopupWindow());
centerPane.add(pane, pane.title4PopupWindow());
}
// this.add(centerPane, BorderLayout.CENTER);
typeComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
cardlayout.show(centerPane, (String) typeComboBox.getSelectedItem());
currentPane = paneList[typeComboBox.getSelectedIndex()];
fireStateChanged();
}
});

24
designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java

@ -16,7 +16,6 @@ import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.stable.Constants;
@ -28,6 +27,7 @@ import javax.swing.event.ChangeListener;
import java.awt.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
/**
* @author zhou
@ -37,6 +37,7 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
private static final String[] BORDERARRAY = {"currentLineCombo", "currentLineColorPane", "outerToggleButton", "topToggleButton",
"leftToggleButton", "bottomToggleButton", "rightToggleButton", "innerToggleButton", "horizontalToggleButton", "verticalToggleButton"};
private static final Set<String> BORDER_SET = new HashSet<>(Arrays.asList(BORDERARRAY));
private boolean insideMode = false;
private UIToggleButton topToggleButton;
@ -193,25 +194,20 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
this.verticalToggleButton.setEnabled(this.insideMode);
}
@Override
public Style update(Style style) {
if (style == null) {
style = Style.DEFAULT_STYLE;
}
CellBorderStyle cellBorderStyle = this.update();
HashSet<String> borderSet = new HashSet<String>(Arrays.asList(BORDERARRAY));
style = style.deriveBackground(backgroundPane.update());
if (backgroundPane.currentPane != backgroundPane.paneList[1]){
if (borderSet.contains(globalNameListener.getGlobalName())) {
style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(),
cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
}
}else {
if (borderSet.contains(globalNameListener.getGlobalName()) && !((ColorBackgroundQuickPane) backgroundPane.currentPane).isBackGroundColor()){
style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(),
cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
}
if (backgroundPane.currentPane.isBackgroundChange()) {
style = style.deriveBackground(backgroundPane.update());
}
if (BORDER_SET.contains(globalNameListener.getGlobalName())) {
CellBorderStyle cellBorderStyle = this.update();
style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(),
cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
}
return style;

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save