Browse Source

Merge branch 'release/10.0' into final/10.0

# Conflicts:
#	designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
#	designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java
final/10.0
jeo 5 years ago
parent
commit
4ab79ba721
  1. 59
      designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java
  2. 21
      designer-base/src/main/java/com/fr/common/report/ReportState.java
  3. 50
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  4. 188
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  5. 16
      designer-base/src/main/java/com/fr/design/RestartHelper.java
  6. 14
      designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java
  7. 92
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  8. 2
      designer-base/src/main/java/com/fr/design/actions/help/FineUIAction.java
  9. 2
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindDialog.java
  10. 2
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/RemindPane.java
  11. 43
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  12. 1
      designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java
  13. 2
      designer-base/src/main/java/com/fr/design/condition/ContinuousTreeSelectionModel.java
  14. 2
      designer-base/src/main/java/com/fr/design/constants/UIConstants.java
  15. 2
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  16. 9
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  17. 6
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  18. 1
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePaneSupportFormula.java
  19. 3
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  20. 2
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  21. 3
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java
  22. 10
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/AutoStoreProcedureTableModel.java
  23. 7
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ClassTableDataPane.java
  24. 25
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/CustomDictModel.java
  25. 6
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  26. 21
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  27. 5
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
  28. 11
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  29. 11
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/TableDataManagerPane.java
  30. 13
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java
  31. 2
      designer-base/src/main/java/com/fr/design/dcm/UniversalDatabaseDialog.java
  32. 1
      designer-base/src/main/java/com/fr/design/designer/EditingState.java
  33. 4
      designer-base/src/main/java/com/fr/design/dialog/BasicScrollPane.java
  34. 94
      designer-base/src/main/java/com/fr/design/dialog/ErrorDialog.java
  35. 1
      designer-base/src/main/java/com/fr/design/dialog/JWizardDialog.java
  36. 2
      designer-base/src/main/java/com/fr/design/dialog/JWizardPanel.java
  37. 98
      designer-base/src/main/java/com/fr/design/dialog/TipDialog.java
  38. 19
      designer-base/src/main/java/com/fr/design/editor/editor/WidgetNameEditor.java
  39. 73
      designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java
  40. 3
      designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java
  41. 7
      designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java
  42. 14
      designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java
  43. 39
      designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java
  44. 4
      designer-base/src/main/java/com/fr/design/extra/AppStoreBuilder.java
  45. 9
      designer-base/src/main/java/com/fr/design/extra/LoginDialog.java
  46. 7
      designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java
  47. 3
      designer-base/src/main/java/com/fr/design/extra/PluginAbstractLoadingViewPane.java
  48. 5
      designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java
  49. 10
      designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java
  50. 3
      designer-base/src/main/java/com/fr/design/extra/PluginUpdatePane.java
  51. 10
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  52. 2
      designer-base/src/main/java/com/fr/design/extra/QQLoginDialog.java
  53. 1
      designer-base/src/main/java/com/fr/design/extra/ShopDialog.java
  54. 3
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  55. 38
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  56. 2
      designer-base/src/main/java/com/fr/design/file/NodeAuthProcessor.java
  57. 22
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  58. 6
      designer-base/src/main/java/com/fr/design/formula/FunctionManagerPane.java
  59. 23
      designer-base/src/main/java/com/fr/design/fun/MultiStyleUIConfigProvider.java
  60. 39
      designer-base/src/main/java/com/fr/design/fun/StyleUIConfigProvider.java
  61. 26
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractMultiStyleUIConfigProvider.java
  62. 41
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractStyleUIConfigProvider.java
  63. 12
      designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java
  64. 8
      designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java
  65. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/UITabbedPaneUI.java
  66. 8
      designer-base/src/main/java/com/fr/design/gui/frpane/UnitInputPane.java
  67. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/SpecialUIButton.java
  68. 1
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIBasicButtonUI.java
  69. 24
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButton.java
  70. 38
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java
  71. 4
      designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java
  72. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIHeadGroup.java
  73. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIPasswordField.java
  74. 2
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIPreviewButton.java
  75. 12
      designer-base/src/main/java/com/fr/design/gui/ibutton/UISliderButtonUI.java
  76. 6
      designer-base/src/main/java/com/fr/design/gui/ibutton/UITabButton.java
  77. 4
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java
  78. 18
      designer-base/src/main/java/com/fr/design/gui/icombobox/ComboCheckBox.java
  79. 62
      designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java
  80. 19
      designer-base/src/main/java/com/fr/design/gui/icombobox/LineComboBox.java
  81. 4
      designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.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. 77
      designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java
  95. 36
      designer-base/src/main/java/com/fr/design/gui/syntax/print/RPrintUtilities.java
  96. 6
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxUtilities.java
  97. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java
  98. 4
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java
  99. 9
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java
  100. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/folding/HtmlFoldParser.java
  101. Some files were not shown because too many files have changed in this diff Show More

59
designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java

@ -0,0 +1,59 @@
package com.fr.common.detect;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.log.FineLoggerFactory;
import com.fr.module.ModuleContext;
import com.fr.web.WebSocketConfig;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/10
*/
public class CommonPortDetector {
private static final CommonPortDetector INSTANCE = new CommonPortDetector();
private ExecutorService service = ModuleContext.getExecutor().newSingleThreadExecutor(new NamedThreadFactory("CommonPortDetector"));
public static CommonPortDetector getInstance() {
return INSTANCE;
}
public void execute() {
service.submit(new Runnable() {
@Override
public void run() {
detectTomcatPort();
detectWebSocketPort();
}
});
}
private void detectTomcatPort() {
int port = DesignerEnvManager.getEnvManager().getEmbedServerPort();
if (checkPort(port)) {
FineLoggerFactory.getLogger().error("EmbedTomcat Port: {} is not available, maybe occupied by other programs, please check it!", port);
}
}
private void detectWebSocketPort() {
Integer[] ports = WebSocketConfig.getInstance().getPort();
for (int port : ports) {
if (checkPort(port)) {
FineLoggerFactory.getLogger().error("WebSocKet Port: {} is not available, maybe occupied by other programs, please check it!", port);
}
}
}
private boolean checkPort(int port) {
try (Socket socket = new Socket("localhost", port)) {
return true;
} catch (Exception e) {
return false;
}
}
}

21
designer-base/src/main/java/com/fr/common/report/ReportState.java

@ -0,0 +1,21 @@
package com.fr.common.report;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/27
*/
public enum ReportState {
STOP("stop"), ACTIVE("active");
private String value;
ReportState(String value) {
this.value = value;
}
public String getValue() {
return this.value;
}
}

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

@ -8,17 +8,21 @@ import com.fr.base.Utils;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.ErrorDialog;
import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.LocalDesignerWorkspaceInfo; import com.fr.design.env.LocalDesignerWorkspaceInfo;
import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.locale.impl.ProductImproveMark;
import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.update.push.DesignerPushUpdateConfigManager;
import com.fr.design.style.color.ColorSelectConfigManager; import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.DesignerPort;
import com.fr.exit.DesignerExiter;
import com.fr.file.FILEFactory; import com.fr.file.FILEFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogFormatter; import com.fr.general.FRLogFormatter;
@ -81,6 +85,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private static final String VERSION_80 = "80"; private static final String VERSION_80 = "80";
private static final int CACHINGTEMPLATE_LIMIT = 5; private static final int CACHINGTEMPLATE_LIMIT = 5;
private static final String WEB_NAME = "webapps"; private static final String WEB_NAME = "webapps";
/**
* 指定默认工作空间
*/
public static final String DEFAULT_WORKSPACE_PATH = "fr.designer.workspace.default";
private static DesignerEnvManager designerEnvManager; // gui. private static DesignerEnvManager designerEnvManager; // gui.
private String activationKey = null; private String activationKey = null;
@ -194,6 +202,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile()); XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile());
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
XmlHandler.Self.handle(e);
} }
// james:如果没有env定义,要设置一个默认的 // james:如果没有env定义,要设置一个默认的
@ -340,6 +349,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} catch (IOException e) { } catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
XmlHandler.Self.handle(e);
} finally { } finally {
if (null != fileWriter) { if (null != fileWriter) {
try { try {
@ -554,6 +564,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private String getDefaultenvPath(String installHome) { private String getDefaultenvPath(String installHome) {
String defaultWorkspacePath = System.getProperty(DEFAULT_WORKSPACE_PATH);
if (defaultWorkspacePath != null) {
return defaultWorkspacePath;
}
//这里需要转成反斜杠和生成默认路径一致 //这里需要转成反斜杠和生成默认路径一致
return new File(StableUtils.pathJoin(installHome, WEB_NAME, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME)).getPath(); return new File(StableUtils.pathJoin(installHome, WEB_NAME, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME)).getPath();
} }
@ -1396,6 +1410,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
/** /**
* 对国际化进行校验 * 对国际化进行校验
* 非简繁英日韩的默认环境 设计器全部默认为英文版本 * 非简繁英日韩的默认环境 设计器全部默认为英文版本
*
* @param locale * @param locale
* @return * @return
*/ */
@ -1545,6 +1560,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readDesignerPushUpdateAttr(reader); readDesignerPushUpdateAttr(reader);
} else if (name.equals(vcsConfigManager.XML_TAG)) { } else if (name.equals(vcsConfigManager.XML_TAG)) {
readVcsAttr(reader); readVcsAttr(reader);
} else if (DesignerPort.XML_TAG.equals(name)) {
readDesignerPort(reader);
} else { } else {
readLayout(reader, name); readLayout(reader, name);
} }
@ -1736,6 +1753,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
reader.readXMLObject(vcsConfigManager); reader.readXMLObject(vcsConfigManager);
} }
public void readDesignerPort(XMLableReader reader) {
reader.readXMLObject(DesignerPort.getInstance());
}
/** /**
* Write XML.<br> * Write XML.<br>
* The method will be invoked when save data to XML file.<br> * The method will be invoked when save data to XML file.<br>
@ -1761,6 +1782,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
writeOpenDebug(writer); writeOpenDebug(writer);
writeDesignerPushUpdateAttr(writer); writeDesignerPushUpdateAttr(writer);
writeVcsAttr(writer); writeVcsAttr(writer);
writeDesignerPort(writer);
writer.end(); writer.end();
} }
@ -2010,6 +2032,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.vcsConfigManager.writeXML(writer); this.vcsConfigManager.writeXML(writer);
} }
private void writeDesignerPort(XMLPrintWriter writer) {
DesignerPort.getInstance().writeXML(writer);
}
public VcsConfigManager getVcsConfigManager() { public VcsConfigManager getVcsConfigManager() {
return vcsConfigManager; return vcsConfigManager;
@ -2018,4 +2044,28 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
public void setVcsConfigManager(VcsConfigManager vcsConfigManager) { public void setVcsConfigManager(VcsConfigManager vcsConfigManager) {
this.vcsConfigManager = vcsConfigManager; this.vcsConfigManager = vcsConfigManager;
} }
enum XmlHandler {
Self;
public void handle(Throwable throwable) {
ErrorDialog dialog = new ErrorDialog(null,
Toolkit.i18nText("Fine-Design_Error_Start_Apology_Message"),
Toolkit.i18nText("Fine-Design_Error_Start_Report"),
throwable.getMessage()) {
@Override
protected void okEvent() {
dispose();
DesignerExiter.getInstance().execute();
}
@Override
protected void restartEvent() {
dispose();
RestartHelper.restart();
}
};
dialog.setVisible(true);
DesignerExiter.getInstance().execute();
}
};
} }

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

@ -1,5 +1,6 @@
package com.fr.design; package com.fr.design;
import com.fr.common.report.ReportState;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -7,32 +8,55 @@ import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.RemoteWorkspace;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.TemplateTreePane; import com.fr.design.file.TemplateTreePane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.env.CheckServiceDialog;
import com.fr.env.EnvListPane; import com.fr.env.EnvListPane;
import com.fr.exit.DesignerExiter;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.GeneralUtils;
import com.fr.invoke.Reflect;
import com.fr.json.JSONArray;
import com.fr.license.exception.RegistEditionException; import com.fr.license.exception.RegistEditionException;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.process.ProcessEventPipe;
import com.fr.process.engine.core.CarryMessageEvent;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.rpc.Result;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.stable.StringUtils;
import com.fr.start.server.ServerTray; import com.fr.start.server.ServerTray;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.WorkContextCallback; import com.fr.workspace.WorkContextCallback;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.base.WorkspaceAPI;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.base.FineObjectPool;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest; import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
import com.fr.workspace.engine.exception.WorkspaceAuthException; import com.fr.workspace.engine.exception.WorkspaceAuthException;
import com.fr.workspace.engine.exception.WorkspaceConnectionException;
import com.fr.workspace.engine.rpc.WorkspaceProxyPool;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
import java.lang.reflect.Method;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.HashSet;
import static javax.swing.JOptionPane.ERROR_MESSAGE; import static javax.swing.JOptionPane.ERROR_MESSAGE;
import static javax.swing.JOptionPane.QUESTION_MESSAGE; import static javax.swing.JOptionPane.QUESTION_MESSAGE;
@ -84,6 +108,7 @@ public class EnvChangeEntrance {
private boolean switch2Env(final String envName, PopTipStrategy strategy) { private boolean switch2Env(final String envName, PopTipStrategy strategy) {
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName); DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName);
WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection();
try { try {
Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv); Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv);
@ -98,11 +123,6 @@ public class EnvChangeEntrance {
}); });
return false; return false;
} }
// 如果版本不一致,且确认 不继续 连接,这里返回 false.
if (!versionCheckAndConfirm(selectedEnv)) {
return false;
}
WorkContext.switchTo(workspace, new WorkContextCallback() { WorkContext.switchTo(workspace, new WorkContextCallback() {
@Override @Override
@ -116,12 +136,17 @@ public class EnvChangeEntrance {
} }
} }
}); });
// REPORT-25688如果是war包部署的服务器,给与提示
if (WorkContext.getCurrent().isWarDeploy()) {
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_War_Deploy_Tip"),
Toolkit.i18nText("Fine-Design_Basic_Message"), JOptionPane.INFORMATION_MESSAGE);
}
//REPORT-13810如果只是添加了工作目录,没有切换,这里ToolArea也是要显示新建的工作目录 //REPORT-13810如果只是添加了工作目录,没有切换,这里ToolArea也是要显示新建的工作目录
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) { if (template != null) {
template.refreshToolArea(); template.refreshToolArea();
} }
showServiceDialog(selectedEnv);
} catch (WorkspaceAuthException | RegistEditionException e) { } catch (WorkspaceAuthException | RegistEditionException e) {
// String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed"); // String title = Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Auth_Failed");
// String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote"); // String title = Toolkit.i18nText("Fine-Design_Basic_Lic_Does_Not_Support_Remote");
@ -154,6 +179,7 @@ public class EnvChangeEntrance {
} }
/** /**
* 这个功能留着可能会加回来先做注释处理
* 切换远程环境之前进行版本检测当版本不一致的时候提示 * 切换远程环境之前进行版本检测当版本不一致的时候提示
* 当用户确认选择 ok 才继续 * 当用户确认选择 ok 才继续
* *
@ -197,6 +223,148 @@ public class EnvChangeEntrance {
return true; 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);
if(workspaceAPI == null){
FineLoggerFactory.getLogger().info("workspace service {} get annotation failed", clazz);
continue;
}
if(workspaceAPI.ignore()){
continue;
}
String descriptionOfCN = InterProviderFactory.getProvider().getLocText(workspaceAPI.description());
textBuilder.append(descriptionOfCN).append("\n");
}
String areaText = textBuilder.toString();
if(StringUtils.isEmpty(areaText)){
return;
}
CheckServiceDialog dialog = new CheckServiceDialog(DesignerContext.getDesignerFrame(), areaText, localBranch, remoteBranch);
dialog.setVisible(true);
}
}
}
/**
* 判断是否需要做版本验证判断依据为
* 1选择的环境为远程环境
* 2一个月内不弹出是否勾选
* @param selectedEnv 选择的环境
* @return
*/
private boolean needCheckBranch(DesignerWorkspaceInfo selectedEnv){
if(selectedEnv.getType() == DesignerWorkspaceType.Remote){
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
if(StringUtils.isEmpty(selectedEnv.getRemindTime())){
return true;
}
//获取记录的时间
Date remindTime = format.parse(selectedEnv.getRemindTime());
calendar.setTime(remindTime);
//获取一个月后的时间
calendar.add(Calendar.MONTH,1);
//与当前时间作对比,然后判断是否提示
if(new Date().after(calendar.getTime())){
return true;
}
} catch (ParseException e) {
return true;
}
}
return false;
}
/**
* 获取不存在的服务列表
* @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 noExistServiceSet;
}
}
/**
* 格式化分支版本号
* @param branch 初始的分支版本号
* @return 格式化后的版本号
*/
private String formatBranch(String branch){
if(branch.contains("#")){
return branch.substring(branch.lastIndexOf("#") + 1, branch.length() - 13);
}
return branch;
}
/** /**
* 编辑items * 编辑items
* *
@ -243,14 +411,18 @@ public class EnvChangeEntrance {
@Override @Override
public void doOk() { public void doOk() {
ProcessEventPipe pipe = FineProcessContext.getParentPipe();
if (FineProcessContext.getParentPipe() != null) {
pipe.fire(new CarryMessageEvent(ReportState.ACTIVE.getValue()));
}
if (!envListOkAction(envListPane, PopTipStrategy.NOW)) { if (!envListOkAction(envListPane, PopTipStrategy.NOW)) {
System.exit(0); DesignerExiter.getInstance().execute();
} }
} }
@Override @Override
public void doCancel() { public void doCancel() {
System.exit(0); DesignerExiter.getInstance().execute();
} }
}); });
envListDialog.setVisible(true); envListDialog.setVisible(true);

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

@ -2,6 +2,7 @@ package com.fr.design;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.RestartAction; import com.fr.design.os.impl.RestartAction;
import com.fr.exit.DesignerExiter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -152,7 +153,14 @@ public class RestartHelper {
} finally { } finally {
WorkContext.getCurrent().close(); WorkContext.getCurrent().close();
frame.dispose(); frame.dispose();
System.exit(0); try {
// 更新升级过渡用 供当前测试 后面可删除
Class.forName("com.fr.exit.DesignerExiter");
DesignerExiter.getInstance().execute();
} catch (Exception ignore) {
} finally {
System.exit(0);
}
} }
} }
@ -194,7 +202,11 @@ public class RestartHelper {
} catch (IOException e) { } catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
DesignerContext.getDesignerFrame().exit(); if (DesignerContext.getDesignerFrame() != null) {
DesignerContext.getDesignerFrame().exit();
} else {
DesignerExiter.getInstance().execute();
}
} }
} }
} }

14
designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java

@ -260,6 +260,13 @@ public class ActionFactory {
} }
} }
public static void referCellInsertActionClass(Class<?>[] cls) {
if (cls != null) {
actionClasses.clear();
Collections.addAll(actionClasses, cls);
}
}
/** /**
* 生成单元格插入相关的Action * 生成单元格插入相关的Action
* 表单中报表块编辑需要屏蔽掉"插入子报表" * 表单中报表块编辑需要屏蔽掉"插入子报表"
@ -318,6 +325,13 @@ public class ActionFactory {
} }
} }
public static void referFloatInsertActionClass(Class<?>[] cls) {
if (cls != null) {
floatActionClasses.clear();
Collections.addAll(floatActionClasses, cls);
}
}
/** /**
* 生成悬浮元素插入相关的Action * 生成悬浮元素插入相关的Action
* *

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

@ -38,6 +38,7 @@ import com.fr.general.log.Log4jConfig;
import com.fr.locale.InterProviderFactory; import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.os.OperatingSystem;
import com.fr.third.apache.log4j.Level; import com.fr.third.apache.log4j.Level;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
@ -218,22 +219,23 @@ public class PreferencePane extends BasicPane {
oracleSpace = new UICheckBox(i18nText("Fine-Design_Basic_Show_All_Oracle_Tables")); oracleSpace = new UICheckBox(i18nText("Fine-Design_Basic_Show_All_Oracle_Tables"));
oraclePane.add(oracleSpace); oraclePane.add(oracleSpace);
JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Update_Plugin_Manager")); if (!OperatingSystem.isLinux()) {
useOptimizedUPMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager")); JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Update_Plugin_Manager"));
upmSelectorPane.add(useOptimizedUPMCheckbox); useOptimizedUPMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager"));
advancePane.add(upmSelectorPane); upmSelectorPane.add(useOptimizedUPMCheckbox);
advancePane.add(upmSelectorPane);
}
//REPORT-23578 先屏蔽掉 JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Database_Manager"));
//JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Database_Manager")); useUniverseDBMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_Universe_Database_Manager"));
//useUniverseDBMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_Universe_Database_Manager")); dbmSelectorPane.add(useUniverseDBMCheckbox);
//dbmSelectorPane.add(useUniverseDBMCheckbox); advancePane.add(dbmSelectorPane);
//advancePane.add(dbmSelectorPane);
JPanel improvePane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Basic_Product_Improve")); JPanel improvePane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Basic_Product_Improve"));
joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve")); joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve"));
improvePane.add(joinProductImproveCheckBox); improvePane.add(joinProductImproveCheckBox);
if(SupportOSImpl.AUTOPUSHUPDATE.support()){ if (SupportOSImpl.AUTOPUSHUPDATE.support()) {
autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update")); autoPushUpdateCheckBox = new UICheckBox(i18nText("Fine-Design_Automatic_Push_Update"));
improvePane.add(autoPushUpdateCheckBox); improvePane.add(autoPushUpdateCheckBox);
} }
@ -511,23 +513,8 @@ public class PreferencePane extends BasicPane {
JPanel logLevelPane = FRGUIPaneFactory.createTitledBorderPane("log" + i18nText("Fine-Design_Basic_Level_Setting")); JPanel logLevelPane = FRGUIPaneFactory.createTitledBorderPane("log" + i18nText("Fine-Design_Basic_Level_Setting"));
logPane.add(logLevelPane); logPane.add(logLevelPane);
logLevelComboBox = new UIComboBox(LOG); logLevelComboBox = new UIComboBox(LOG);
logLevelComboBox.setEnabled(WorkContext.getCurrent().isLocal());
logLevelPane.add(logLevelComboBox); 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) { private void createLanPane(JPanel generalPane) {
@ -555,8 +542,8 @@ public class PreferencePane extends BasicPane {
}); });
UILabel noticeLabel = new UILabel(i18nText("Fine-Design_Basic_Work_After_Restart_Designer"));//sail:提示重启后生效 UILabel noticeLabel = new UILabel(i18nText("Fine-Design_Basic_Work_After_Restart_Designer"));//sail:提示重启后生效
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double rowSize[] = {p}; double[] rowSize = {p};
double columnSize[] = {p, p, p}; double[] columnSize = {p, p, p};
Component[][] components = { Component[][] components = {
{languageLabel, languageComboBox, noticeLabel}, {languageLabel, languageComboBox, noticeLabel},
}; };
@ -596,7 +583,7 @@ public class PreferencePane extends BasicPane {
private void createLengthPane(JPanel advancePane) { private void createLengthPane(JPanel advancePane) {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double rowSize[] = {p}; double[] rowSize = {p};
// 长度单位选择 // 长度单位选择
JPanel lengthPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Setting_Ruler_Units")); JPanel lengthPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Setting_Ruler_Units"));
@ -618,8 +605,8 @@ public class PreferencePane extends BasicPane {
private void createServerPane(JPanel advancePane) { private void createServerPane(JPanel advancePane) {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double rowSize[] = {p}; double[] rowSize = {p};
double columnSize[] = {p, p, p}; double[] columnSize = {p, p, p};
JPanel serverPortPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Web_Preview_Port_Setting")); JPanel serverPortPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Web_Preview_Port_Setting"));
advancePane.add(serverPortPane); advancePane.add(serverPortPane);
@ -658,7 +645,7 @@ public class PreferencePane extends BasicPane {
/** /**
* The method of populate. * The method of populate.
* *
* @param designerEnvManager * @param designerEnvManager 设计器环境管理器
*/ */
public void populate(DesignerEnvManager designerEnvManager) { public void populate(DesignerEnvManager designerEnvManager) {
if (designerEnvManager == null) { if (designerEnvManager == null) {
@ -687,7 +674,7 @@ public class PreferencePane extends BasicPane {
defaultStringToFormulaBox.setSelected(false); defaultStringToFormulaBox.setSelected(false);
} }
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager();
if (WorkContext.getCurrent().isCluster()) { if (WorkContext.getCurrent().isCluster()){
vcsEnableCheckBox.setEnabled(false); vcsEnableCheckBox.setEnabled(false);
gcEnableCheckBox.setEnabled(false); gcEnableCheckBox.setEnabled(false);
} }
@ -727,9 +714,11 @@ public class PreferencePane extends BasicPane {
this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort())); this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort()));
useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM()); if (useOptimizedUPMCheckbox != null) {
useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM());
}
//useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM()); useUniverseDBMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseUniverseDBM());
this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace()); this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace());
this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit()); this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit());
@ -826,23 +815,32 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50); designerEnvManager.setUndoLimit(MAX_UNDO_LIMIT_50);
} }
Configurations.update(new Worker() { if (WorkContext.getCurrent().isLocal()) {
@Override Configurations.update(new Worker() {
public void run() { @Override
Log4jConfig.getInstance().setRootLevel(((Level) logLevelComboBox.getSelectedItem())); public void run() {
} Level level = (Level) logLevelComboBox.getSelectedItem();
if (level != null) {
Log4jConfig.getInstance().setRootLevel(level);
}
}
@Override @Override
public Class<? extends Configuration>[] targets() { public Class<? extends Configuration>[] targets() {
return new Class[]{Log4jConfig.class}; @SuppressWarnings("unchecked")
} Class<? extends Configuration>[] classes = new Class[]{Log4jConfig.class};
}); return classes;
}
});
}
Configurations.update(new Worker() { Configurations.update(new Worker() {
@Override @Override
public void run() { public void run() {
ServerPreferenceConfig.getInstance().setUseOptimizedUPM(useOptimizedUPMCheckbox.isSelected()); if (useOptimizedUPMCheckbox != null) {
//ServerPreferenceConfig.getInstance().setUseUniverseDBM(useUniverseDBMCheckbox.isSelected()); ServerPreferenceConfig.getInstance().setUseOptimizedUPM(useOptimizedUPMCheckbox.isSelected());
}
ServerPreferenceConfig.getInstance().setUseUniverseDBM(useUniverseDBMCheckbox.isSelected());
} }
@Override @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() { BasicDialog dialog = pane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
// Do nothing
} }
}); });
dialog.setVisible(true); dialog.setVisible(true);

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

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

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

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

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

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

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

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

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

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

2
designer-base/src/main/java/com/fr/design/constants/UIConstants.java

@ -145,7 +145,6 @@ public interface UIConstants {
public static final Color LIST_ITEM_SPLIT_LINE = new Color(0xf0f0f3); public static final Color LIST_ITEM_SPLIT_LINE = new Color(0xf0f0f3);
public static final BufferedImage DRAG_BAR = IOUtils.readImage("com/fr/design/images/control/bar.png"); public static final BufferedImage DRAG_BAR = IOUtils.readImage("com/fr/design/images/control/bar.png");
public static final BufferedImage DRAG_BAR_LIGHT = IOUtils.readImage("com/fr/design/images/control/bar-light.png"); public static final BufferedImage DRAG_BAR_LIGHT = IOUtils.readImage("com/fr/design/images/control/bar-light.png");
public static final BufferedImage ARROW_NORTH = IOUtils.readImage("com/fr/design/images/control/up_arrow.png"); public static final BufferedImage ARROW_NORTH = IOUtils.readImage("com/fr/design/images/control/up_arrow.png");
@ -196,6 +195,7 @@ public interface UIConstants {
public static final Icon ANA_SMALL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/anas.png"); public static final Icon ANA_SMALL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/anas.png");
public static final Icon REFRESH_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/refresh.png"); public static final Icon REFRESH_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/refresh.png");
public static final Icon FONT_ICON = IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"); public static final Icon FONT_ICON = IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png");
public static final Icon AUTO_FONT_ICON = IOUtils.readIcon("/com/fr/design/images/gui/color/autoForeground.png");
public static final Icon HISTORY_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/history.png"); public static final Icon HISTORY_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/history.png");
public static final Icon DELETE_ICON = IOUtils.readIcon("com/fr/design/images/m_file/close.png"); public static final Icon DELETE_ICON = IOUtils.readIcon("com/fr/design/images/m_file/close.png");
public static final Icon EDIT_ICON = IOUtils.readIcon("com/fr/design/images/m_file/edit.png"); public static final Icon EDIT_ICON = IOUtils.readIcon("com/fr/design/images/m_file/edit.png");

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

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

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

@ -248,6 +248,15 @@ public abstract class DesignTableDataManager {
} }
} }
public static String[] getDsColumnNames(String dsName) {
TableDataSource dataSource = getEditingTableDataSource();
Map<String, String[]> map = columnCache.get(dataSource);
if (map == null) {
return new String[0];
}
return map.get(dsName);
}
/** /**
* august:返回当前正在编辑的具有报表数据源的模板(基本报表聚合报表) 包括 : 图表模板 * august:返回当前正在编辑的具有报表数据源的模板(基本报表聚合报表) 包括 : 图表模板
* *

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

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

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

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

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

@ -69,7 +69,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
} }
if (nameableList.getSelectedValue() instanceof ListModelElement) { if (nameableList.getSelectedValue() instanceof ListModelElement) {
Nameable selected = ((ListModelElement) nameableList.getSelectedValue()).wrapper; Nameable selected = ((ListModelElement) nameableList.getSelectedValue()).wrapper;
if (!ComparatorUtils.equals(tempName, selected.getName())) { if (!ComparatorUtils.equals(tempName, selected.getName()) && !isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) {
rename(selected.getName(), tempName); rename(selected.getName(), tempName);
} }
@ -256,6 +256,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
} }
protected void checkRepeatedDSName(List<String> exsitTableDataNameList) { protected void checkRepeatedDSName(List<String> exsitTableDataNameList) {
// Do nothing
} }
/** /**

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

@ -98,7 +98,7 @@ public class ConnectionTableProcedurePane extends BasicPane {
} }
protected void addKeyMonitor() { protected void addKeyMonitor() {
//do nothing
} }
protected JPanel createCheckBoxgroupPane() { protected JPanel createCheckBoxgroupPane() {

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

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

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

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

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

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

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

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

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

@ -104,7 +104,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
@Override @Override
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
//do nothing
} }
@Override @Override
@ -117,7 +117,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
@Override @Override
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
//do nothing
} }
}); });
} }
@ -240,7 +240,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
maxPanel.setBorder(null); maxPanel.setBorder(null);
JPanel wrapMaxPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel wrapMaxPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
wrapMaxPanel.add(maxPanel); wrapMaxPanel.add(maxPanel);
wrapMaxPanel.setPreferredSize(new Dimension(250, 20)); wrapMaxPanel.setPreferredSize(new Dimension(350, 20));
UIToolbar editToolBar = ToolBarDef.createJToolBar(); UIToolbar editToolBar = ToolBarDef.createJToolBar();
toolBarDef.updateToolBar(editToolBar); toolBarDef.updateToolBar(editToolBar);
editToolBar.add(isShareCheckBox); editToolBar.add(isShareCheckBox);

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

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

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

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

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

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

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

@ -33,9 +33,16 @@ public class TableDataManagerPane extends LoadingBasicPane {
); );
} }
tableDataPane = pane == null ? new TableDataPaneListPane() { tableDataPane = pane == null ? new TableDataPaneListPane() {
public void rename(String oldName, String newName) { @Override
public void rename(final String oldName, final String newName) {
super.rename(oldName, newName); super.rename(oldName, newName);
renameConnection(oldName, newName); new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() {
renameConnection(oldName, newName);
return null;
}
}.execute();
} }
} : pane; } : pane;
container.add(tableDataPane.getPanel(), BorderLayout.CENTER); container.add(tableDataPane.getPanel(), BorderLayout.CENTER);

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

@ -50,10 +50,11 @@ public abstract class AbstractTableDataWrapper implements TableDataWrapper {
DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter(); DesignModelAdapter adapter = DesignModelAdapter.getCurrentModelAdapter();
TableDataSource tds = adapter == null ? null : adapter.getBook(); TableDataSource tds = adapter == null ? null : adapter.getBook();
String[] colNames = tabledata.getColumnNames(tds); String[] colNames = tabledata.getColumnNames(tds);
String[] colNamesInCache = DesignTableDataManager.getDsColumnNames(name);
if(ArrayUtils.isNotEmpty(colNames)){ if(ArrayUtils.isNotEmpty(colNames)){
columnNameList = new ArrayList<String>(); return toColumnNameList(colNames);
columnNameList.addAll(Arrays.asList(colNames)); } else if (ArrayUtils.isNotEmpty(colNamesInCache)) {
return columnNameList; return toColumnNameList(colNamesInCache);
} }
EmbeddedTableData embeddedTableData = null; EmbeddedTableData embeddedTableData = null;
@ -69,6 +70,12 @@ public abstract class AbstractTableDataWrapper implements TableDataWrapper {
return columnNameList; return columnNameList;
} }
private List<String> toColumnNameList(String[] colNames) {
columnNameList = new ArrayList<>();
columnNameList.addAll(Arrays.asList(colNames));
return columnNameList;
}
/** /**
* 生成子节点 * 生成子节点
* *

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -0,0 +1,98 @@
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 com.fr.stable.StringUtils;
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);
JTextPane area = new JTextPane();
UILabel typeLabel = new UILabel(type);
area.insertComponent(typeLabel);
if (StringUtils.isNotEmpty(type)) {
UILabel logoIconLabel = new UILabel();
logoIconLabel.setIcon(IOUtils.readIcon("com/fr/base/images/oem/logo.png"));
area.insertComponent(logoIconLabel);
}
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; package com.fr.design.editor.editor;
import java.awt.BorderLayout;
import java.awt.Component;
import javax.swing.JList;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.icombobox.FilterComboBox; import com.fr.design.gui.icombobox.FilterComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.js.WidgetName; import com.fr.stable.js.WidgetName;
import javax.swing.JList;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.BorderLayout;
import java.awt.Component;
/** /**
* the editor to edit WidgetName * the editor to edit WidgetName
* *
@ -43,12 +42,12 @@ public class WidgetNameEditor extends Editor<WidgetName> {
@Override @Override
public void popupMenuCanceled(PopupMenuEvent e) { public void popupMenuCanceled(PopupMenuEvent e) {
//do nothing
} }
@Override @Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
//do nothing
} }
@Override @Override

73
designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java vendored

@ -1,15 +1,39 @@
package com.fr.design.env; package com.fr.design.env;
import com.fr.common.report.ReportState;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.EnvChangeEntrance;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.messagecollect.StartErrorMessageCollector;
import com.fr.design.mainframe.messagecollect.entity.DesignerErrorMessage;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.process.ProcessEventPipe;
import com.fr.process.engine.core.CarryMessageEvent;
import com.fr.process.engine.core.FineProcessContext;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.connect.WorkspaceClient; import com.fr.workspace.connect.WorkspaceClient;
import javax.swing.*;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
/** /**
* 根据配置生成运行环境 * 根据配置生成运行环境
*/ */
public class DesignerWorkspaceGenerator { public class DesignerWorkspaceGenerator {
public static Workspace generate(DesignerWorkspaceInfo config) throws Exception { private static final int WAIT_FREQ = 60;
private static ExecutorService service = Executors.newCachedThreadPool(
new NamedThreadFactory("DesignerWorkspaceGenerator"));
public static Workspace generate(final DesignerWorkspaceInfo config) throws Exception {
if (config == null || config.getType() == null) { if (config == null || config.getType() == null) {
return null; return null;
@ -22,7 +46,19 @@ public class DesignerWorkspaceGenerator {
break; break;
} }
case Remote: { case Remote: {
WorkspaceClient client = WorkContext.getConnector().connect(config.getConnection()); Future<WorkspaceClient> future = service.submit(new Callable<WorkspaceClient>() {
@Override
public WorkspaceClient call() throws Exception {
return WorkContext.getConnector().connect(config.getConnection());
}
});
WorkspaceClient client = null;
try {
client = future.get(WAIT_FREQ, TimeUnit.SECONDS);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
RemoteHandler.handle(config);
}
if (client != null) { if (client != null) {
workspace = new RemoteWorkspace(client, config.getConnection()); workspace = new RemoteWorkspace(client, config.getConnection());
} }
@ -31,4 +67,37 @@ public class DesignerWorkspaceGenerator {
} }
return workspace; return workspace;
} }
enum RemoteHandler {
SELF;
public static void handle(DesignerWorkspaceInfo config) {
ProcessEventPipe eventPipe = FineProcessContext.getParentPipe();
if (eventPipe != null) {
eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue()));
}
StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.REMOTE_DESIGN_NO_RESPONSE.getId(),
DesignerErrorMessage.REMOTE_DESIGN_NO_RESPONSE.getMessage(),
StringUtils.EMPTY);
int result = FineJOptionPane.showOptionDialog(null,
Toolkit.i18nText("Fine-Design_Error_Remote_No_Response_Tip"),
Toolkit.i18nText("Fine-Design_Basic_Error_Tittle"),
JOptionPane.YES_NO_OPTION,
JOptionPane.ERROR_MESSAGE,
IOUtils.readIcon("com/fr/design/images/error/error2.png"),
new Object[] {Toolkit.i18nText("Fine-Design_Error_Remote_No_Response_Wait"), Toolkit.i18nText("Fine-Design_Error_Remote_No_Response_Switch")},
null);
if (result == JOptionPane.YES_OPTION) {
try {
generate(config);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
} else {
}
}
}
public static void stop() {
service.shutdown();
}
} }

3
designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceInfo.java vendored

@ -10,6 +10,9 @@ public interface DesignerWorkspaceInfo extends XMLable {
String getPath(); String getPath();
//获取提醒时间,用于判断是否做服务检测
String getRemindTime();
WorkspaceConnectionInfo getConnection(); WorkspaceConnectionInfo getConnection();
boolean checkValid(); boolean checkValid();

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

@ -43,6 +43,11 @@ public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
return path; return path;
} }
@Override
public String getRemindTime() {
return null;
}
@Override @Override
public WorkspaceConnectionInfo getConnection() { public WorkspaceConnectionInfo getConnection() {
return null; return null;
@ -64,7 +69,9 @@ public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
writer.attr("path", path); writer.attr("path", path);
} }
@Override @Override
@SuppressWarnings("squid:S2975")
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
LocalDesignerWorkspaceInfo object = (LocalDesignerWorkspaceInfo)super.clone(); LocalDesignerWorkspaceInfo object = (LocalDesignerWorkspaceInfo)super.clone();

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

@ -13,6 +13,8 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
private String name; private String name;
private String remindTime;
private WorkspaceConnectionInfo connection; private WorkspaceConnectionInfo connection;
public static RemoteDesignerWorkspaceInfo create(WorkspaceConnectionInfo connection) { public static RemoteDesignerWorkspaceInfo create(WorkspaceConnectionInfo connection) {
@ -45,11 +47,21 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
return connection; return connection;
} }
public void setRemindTime(String remindTime){
this.remindTime = remindTime;
}
@Override
public String getRemindTime(){
return remindTime;
}
@Override @Override
public void readXML(XMLableReader reader) { public void readXML(XMLableReader reader) {
if (reader.isAttr()) { if (reader.isAttr()) {
this.name = reader.getAttrAsString("name", StringUtils.EMPTY); this.name = reader.getAttrAsString("name", StringUtils.EMPTY);
this.remindTime = reader.getAttrAsString("remindTime", StringUtils.EMPTY);
} }
if (reader.isChildNode()) { if (reader.isChildNode()) {
String tagName = reader.getTagName(); String tagName = reader.getTagName();
@ -69,6 +81,7 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
public void writeXML(XMLPrintWriter writer) { public void writeXML(XMLPrintWriter writer) {
writer.attr("name", name); writer.attr("name", name);
writer.attr("remindTime", remindTime);
if (this.connection != null) { if (this.connection != null) {
writer.startTAG("Connection"); writer.startTAG("Connection");
writer.attr("url", connection.getUrl()); writer.attr("url", connection.getUrl());
@ -81,6 +94,7 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
} }
@Override @Override
@SuppressWarnings("squid:S2975")
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
RemoteDesignerWorkspaceInfo object = (RemoteDesignerWorkspaceInfo) super.clone(); RemoteDesignerWorkspaceInfo object = (RemoteDesignerWorkspaceInfo) super.clone();

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

@ -1,7 +1,10 @@
package com.fr.design.env; package com.fr.design.env;
import com.fr.cluster.engine.base.FineClusterConfig; import com.fr.cluster.engine.remote.ClusterOperator;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.base.operator.common.CommonOperator;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
@ -9,6 +12,8 @@ import com.fr.workspace.connect.WorkspaceClient;
import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnection;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.server.authority.decision.DecisionOperator; import com.fr.workspace.server.authority.decision.DecisionOperator;
import com.fr.workspace.engine.rpc.WorkspaceProxyPool;
import com.fr.workspace.pool.WorkObjectPool;
/** /**
* Created by juhaoyu on 2018/6/14. * Created by juhaoyu on 2018/6/14.
@ -45,8 +50,12 @@ public class RemoteWorkspace implements Workspace {
@Override @Override
public boolean isWarDeploy() { public boolean isWarDeploy() {
return WorkContext.getCurrent().get(CommonOperator.class, new ExceptionHandler<Boolean>() {
return false; @Override
public Boolean callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) {
return false;
}
}).isWarDeploy();
} }
@Override @Override
@ -70,7 +79,12 @@ public class RemoteWorkspace implements Workspace {
@Override @Override
public boolean isCluster() { public boolean isCluster() {
return FineClusterConfig.getInstance().isCluster(); return WorkContext.getCurrent().get(ClusterOperator.class, new ExceptionHandler<Boolean>() {
@Override
public Boolean callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) {
return false;
}
}).isCluster();
} }
@Override @Override
@ -85,6 +99,19 @@ public class RemoteWorkspace implements Workspace {
return client.getPool().get(type); return client.getPool().get(type);
} }
@Override
public <T> T get(Class<T> type, ExceptionHandler exceptionHandler){
if(exceptionHandler != null) {
WorkObjectPool objectPool = client.getPool();
if (objectPool instanceof WorkspaceProxyPool) {
return ((WorkspaceProxyPool) objectPool).get(type, exceptionHandler);
}else {
return client.getPool().get(type);
}
}
return client.getPool().get(type);
}
@Override @Override
public void close() { public void close() {
@ -102,4 +129,8 @@ public class RemoteWorkspace implements Workspace {
return obj instanceof RemoteWorkspace && AssistUtils.equals(((RemoteWorkspace) obj).connection, this.connection); return obj instanceof RemoteWorkspace && AssistUtils.equals(((RemoteWorkspace) obj).connection, this.connection);
} }
public WorkspaceClient getClient(){
return client;
}
} }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -407,8 +407,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
JTemplate<?, ?> jt = getCurrentEditingTemplate(); JTemplate<?, ?> jt = getCurrentEditingTemplate();
boolean access = jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists(); boolean access = jt != null && jt.getEditingFILE() != null && jt.getEditingFILE().exists();
if (access) { if (access) {
closeSelectedReport(jt); jt.refreshResource();
DesignerContext.getDesignerFrame().openTemplate(jt.getEditingFILE());
} }
} }

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

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

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

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

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

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

6
designer-base/src/main/java/com/fr/design/formula/FunctionManagerPane.java

@ -142,8 +142,10 @@ public class FunctionManagerPane extends BasicPane {
editorButton.setPreferredSize(new Dimension(editorButton.getPreferredSize().width, classNameTextField.getPreferredSize().height)); editorButton.setPreferredSize(new Dimension(editorButton.getPreferredSize().width, classNameTextField.getPreferredSize().height));
reportletNamePane.add(editorButton); reportletNamePane.add(editorButton);
editorButton.addActionListener(createEditorButtonActionListener()); editorButton.addActionListener(createEditorButtonActionListener());
northPane.add(GUICoreUtils.createFlowPane(new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Class_Name") + ":"), JPanel classNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
reportletNamePane}, FlowLayout.LEFT)); classNamePane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Class_Name") + ":"), BorderLayout.NORTH);
classNamePane.add(reportletNamePane, BorderLayout.CENTER);
northPane.add(classNamePane);
DescriptionTextArea descriptionArea = new DescriptionTextArea(); DescriptionTextArea descriptionArea = new DescriptionTextArea();
descriptionArea.setWrapStyleWord(true); descriptionArea.setWrapStyleWord(true);
descriptionArea.setLineWrap(true); descriptionArea.setLineWrap(true);

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

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

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

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

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

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

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

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

12
designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java

@ -1,10 +1,13 @@
package com.fr.design.gui.controlpane; package com.fr.design.gui.controlpane;
import com.fr.design.DesignerEnvManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.tabledata.tabledatapane.GlobalMultiTDTableDataPane; import com.fr.design.data.tabledata.tabledatapane.GlobalMultiTDTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.GlobalTreeTableDataPane; import com.fr.design.data.tabledata.tabledatapane.GlobalTreeTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.MultiTDTableDataPane; import com.fr.design.data.tabledata.tabledatapane.MultiTDTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane; import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -99,6 +102,15 @@ class JControlUpdatePane extends JPanel {
if (pane != null && pane.isVisible()) { if (pane != null && pane.isVisible()) {
Object bean = pane.updateBean(); Object bean = pane.updateBean();
try {
if (bean instanceof RemoteDesignerWorkspaceInfo) {
DesignerWorkspaceInfo info = DesignerEnvManager.getEnvManager().getWorkspaceInfo(elEditing.wrapper.getName());
String remindTime = info.getRemindTime();
((RemoteDesignerWorkspaceInfo) bean).setRemindTime(remindTime);
}
}catch (Exception e){
FineLoggerFactory.getLogger().info("remindTime is not exist");
}
if (i < creators.length) { if (i < creators.length) {
creators[i].saveUpdatedBean(elEditing, bean); creators[i].saveUpdatedBean(elEditing, bean);
} }

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

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

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

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

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

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

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

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

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

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

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

@ -24,10 +24,10 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
public class UIColorButton extends UIButton implements PopupHider, UIObserver, GlobalNameObserver { public class UIColorButton extends UIButton implements PopupHider, UIObserver, GlobalNameObserver {
private static final int SIZE = 16; public static final int SIZE = 16;
private static final int SIZE_2 = 2; public static final int SIZE_2 = 2;
private static final int SIZE_4 = 4; public static final int SIZE_4 = 4;
private static final int SIZE_6 = 6; public static final int SIZE_6 = 6;
private static final int POPUP_MENU_SHIFT = -70; private static final int POPUP_MENU_SHIFT = -70;
private Color color = Color.BLACK; private Color color = Color.BLACK;
private ColorControlWindow popupWin; private ColorControlWindow popupWin;
@ -53,6 +53,14 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G
iniListener(); iniListener();
} }
public ColorControlWindow getPopupWin() {
return popupWin;
}
public void setPopupWin(ColorControlWindow popupWin) {
this.popupWin = popupWin;
}
private void iniListener() { private void iniListener() {
if (shouldResponseChangeListener()) { if (shouldResponseChangeListener()) {
this.addColorChangeListener(new ChangeListener() { this.addColorChangeListener(new ChangeListener() {
@ -103,8 +111,12 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G
if (ComparatorUtils.equals(this.color, color)) { if (ComparatorUtils.equals(this.color, color)) {
return; return;
} }
Color oldColor = this.color;
this.color = color; this.color = color;
checkColorChange(oldColor, this.color);
}
protected void checkColorChange(Color oldColor, Color newColor) {
hidePopupMenu(); hidePopupMenu();
fireColorStateChanged(); fireColorStateChanged();
} }
@ -139,7 +151,7 @@ public class UIColorButton extends UIButton implements PopupHider, UIObserver, G
repaint(); repaint();
} }
private ColorControlWindow getColorControlWindow() { protected ColorControlWindow getColorControlWindow() {
//find parant. //find parant.
if (this.popupWin == null) { if (this.popupWin == null) {
this.popupWin = new ColorControlWindow(UIColorButton.this) { this.popupWin = new ColorControlWindow(UIColorButton.this) {

38
designer-base/src/main/java/com/fr/design/gui/ibutton/UIColorButtonWithAuto.java

@ -0,0 +1,38 @@
package com.fr.design.gui.ibutton;
import com.fr.chart.base.ChartConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.style.color.ColorControlWindow;
import com.fr.design.style.color.ColorControlWindowWithAuto;
import com.fr.general.ComparatorUtils;
import java.awt.Color;
public class UIColorButtonWithAuto extends UIColorButton {
protected void checkColorChange(Color oldColor, Color newColor) {
if (ComparatorUtils.equals(oldColor, ChartConstants.AUTO_FONT_COLOR) && !ComparatorUtils.equals(newColor, ChartConstants.AUTO_FONT_COLOR)) {
setIcon(UIConstants.FONT_ICON);
}
if (!ComparatorUtils.equals(oldColor, ChartConstants.AUTO_FONT_COLOR) && ComparatorUtils.equals(newColor, ChartConstants.AUTO_FONT_COLOR)) {
setIcon(UIConstants.AUTO_FONT_ICON);
}
super.checkColorChange(oldColor, newColor);
}
protected ColorControlWindow getColorControlWindow() {
if (getPopupWin() == null) {
ColorControlWindowWithAuto colorControlWindowWithAuto = new ColorControlWindowWithAuto(UIColorButtonWithAuto.this) {
protected void colorChanged() {
UIColorButtonWithAuto.this.setColor(this.getColor());
}
};
setPopupWin(colorControlWindowWithAuto);
}
return getPopupWin();
}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1,22 +1,14 @@
package com.fr.design.gui.icombobox; package com.fr.design.gui.icombobox;
import java.awt.BorderLayout; import com.fr.design.constants.UIConstants;
import java.awt.Color; import com.fr.design.gui.ibutton.UIButton;
import java.awt.Component; import com.fr.design.gui.ilable.UILabel;
import java.awt.Dimension; import com.fr.design.gui.itextfield.UITextField;
import java.awt.Graphics; import com.fr.design.layout.FRGUIPaneFactory;
import java.awt.Graphics2D; import com.fr.general.ComparatorUtils;
import java.awt.IllegalComponentStateException; import com.fr.general.NameObject;
import java.awt.RenderingHints; import com.fr.stable.Constants;
import java.awt.event.KeyAdapter; import com.fr.stable.StringUtils;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseMotionListener;
import java.util.Enumeration;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListCellRenderer;
@ -38,16 +30,23 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.util.Enumeration;
import com.fr.design.constants.UIConstants; import java.awt.BorderLayout;
import com.fr.design.gui.ibutton.UIButton; import java.awt.Color;
import com.fr.design.gui.ilable.UILabel; import java.awt.Component;
import com.fr.design.gui.itextfield.UITextField; import java.awt.Dimension;
import com.fr.design.layout.FRGUIPaneFactory; import java.awt.Graphics;
import com.fr.general.ComparatorUtils; import java.awt.Graphics2D;
import com.fr.general.NameObject; import java.awt.IllegalComponentStateException;
import com.fr.stable.Constants; import java.awt.RenderingHints;
import com.fr.stable.StringUtils; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseMotionListener;
public class FRTreeComboBox extends UIComboBox { public class FRTreeComboBox extends UIComboBox {
@ -79,7 +78,7 @@ public class FRTreeComboBox extends UIComboBox {
boolean showRoot, boolean editable) { boolean showRoot, boolean editable) {
this.setTree(tree); this.setTree(tree);
this.tree.setCellRenderer(renderer); this.tree.setCellRenderer(renderer);
this.setEditor(new FrTreeSearchComboBoxEditor(this)); this.setEditor(createEditor());
if (!showRoot) { if (!showRoot) {
tree.expandPath(new TreePath(tree.getModel().getRoot())); tree.expandPath(new TreePath(tree.getModel().getRoot()));
tree.setRootVisible(false); tree.setRootVisible(false);
@ -101,6 +100,10 @@ public class FRTreeComboBox extends UIComboBox {
return true; return true;
} }
protected UIComboBoxEditor createEditor() {
return new FrTreeSearchComboBoxEditor(this);
}
public void setTree(JTree tree) { public void setTree(JTree tree) {
this.tree = tree; this.tree = tree;
if (tree != null) { if (tree != null) {
@ -318,6 +321,7 @@ public class FRTreeComboBox extends UIComboBox {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
// do nothing
} }
@Override @Override
@ -528,7 +532,7 @@ public class FRTreeComboBox extends UIComboBox {
} }
} }
class FrTreeSearchComboBoxEditor extends UIComboBoxEditor implements DocumentListener { public class FrTreeSearchComboBoxEditor extends UIComboBoxEditor implements DocumentListener {
private volatile boolean setting = false; private volatile boolean setting = false;
private FRTreeComboBox comboBox; private FRTreeComboBox comboBox;
private Object item; private Object item;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

77
designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java

@ -6,6 +6,7 @@ import com.fr.base.Style;
import com.fr.base.TextFormat; import com.fr.base.TextFormat;
import com.fr.data.core.FormatField; import com.fr.data.core.FormatField;
import com.fr.data.core.FormatField.FormatContents; import com.fr.data.core.FormatField.FormatContents;
import com.fr.design.i18n.Toolkit;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
@ -36,20 +37,23 @@ import java.text.SimpleDateFormat;
* @author zhou * @author zhou
* @since 2012-5-24上午10:57:00 * @since 2012-5-24上午10:57:00
*/ */
public class FormatPane extends AbstractBasicStylePane implements GlobalNameObserver { public class FormatPane extends AbstractBasicStylePane implements GlobalNameObserver {
private static final long serialVersionUID = 724330854437726751L; private static final long serialVersionUID = 724330854437726751L;
private static final int LABLE_X = 4; private static final int LABEL_X = 4;
private static final int LABLE_Y = 18; private static final int LABEL_Y = 18;
private static final int LABLE_DELTA_WIDTH = 8; private static final int LABEL_DELTA_WIDTH = 8;
private static final int LABLE_HEIGHT = 15; //标签背景的范围 private static final int LABEL_HEIGHT = 15; //标签背景的范围
private static final int CURRENCY_FLAG_POINT = 6; private static final int CURRENCY_FLAG_POINT = 6;
private static final Border LEFT_BORDER = BorderFactory.createEmptyBorder(0,30,0,0); private static final Border LEFT_BORDER = BorderFactory.createEmptyBorder(0, 30, 0, 0);
private static final Integer[] TYPES = new Integer[]{FormatContents.NULL, FormatContents.NUMBER, FormatContents.CURRENCY, FormatContents.PERCENT, FormatContents.SCIENTIFIC, private static final Integer[] TYPES = new Integer[]{
FormatContents.DATE, FormatContents.TIME, FormatContents.TEXT}; FormatContents.NULL, FormatContents.NUMBER,
FormatContents.CURRENCY, FormatContents.PERCENT,
FormatContents.SCIENTIFIC, FormatContents.DATE,
FormatContents.TIME, FormatContents.TEXT};
private static final Integer[] DATETYPES = new Integer[]{FormatContents.NULL, FormatContents.DATE, FormatContents.TIME,}; private static final Integer[] DATE_TYPES = new Integer[]{FormatContents.NULL, FormatContents.DATE, FormatContents.TIME};
private Format format; private Format format;
@ -61,7 +65,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
private JPanel centerPane; private JPanel centerPane;
private JPanel formatFontPane; private JPanel formatFontPane;
private FRFontPane frFontPane; private FRFontPane frFontPane;
private boolean isRightFormate; private boolean isRightFormat;
private boolean isDate = false; private boolean isDate = false;
private GlobalNameListener globalNameListener = null; private GlobalNameListener globalNameListener = null;
@ -78,7 +82,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
protected void initComponents(Integer[] types) { protected void initComponents(Integer[] types) {
this.setLayout(new BorderLayout(0, 4)); this.setLayout(new BorderLayout(0, 4));
iniSampleLable(); initSampleLabel();
contentPane = new JPanel(new BorderLayout(0, 4)) { contentPane = new JPanel(new BorderLayout(0, 4)) {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
@ -108,7 +112,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
frFontPane = new FRFontPane(); frFontPane = new FRFontPane();
UILabel font = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FR_Font"), SwingConstants.LEFT); UILabel font = new UILabel(Toolkit.i18nText("Fine-Design_Form_FR_Font"), SwingConstants.LEFT);
JPanel fontPane = new JPanel(new BorderLayout()); JPanel fontPane = new JPanel(new BorderLayout());
fontPane.add(font, BorderLayout.NORTH); fontPane.add(font, BorderLayout.NORTH);
@ -136,7 +140,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
protected Component[][] getComponent (JPanel fontPane, JPanel centerPane, JPanel typePane) { protected Component[][] getComponent (JPanel fontPane, JPanel centerPane, JPanel typePane) {
return new Component[][]{ return new Component[][]{
new Component[]{null, null}, new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), typePane}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), typePane},
new Component[]{centerPane, null}, new Component[]{centerPane, null},
new Component[]{fontPane, frFontPane}, new Component[]{fontPane, frFontPane},
}; };
@ -155,24 +159,24 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
}; };
} }
private void iniSampleLable() { private void initSampleLabel() {
Border innterborder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4); Border interBorder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4);
Font tmpFont = null; String title = Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample");
Border border = BorderFactory.createTitledBorder(innterborder, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"), TitledBorder.LEFT, 0, tmpFont, UIConstants.LINE_COLOR); Border border = BorderFactory.createTitledBorder(interBorder, title, TitledBorder.LEFT, 0, null, UIConstants.LINE_COLOR);
sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()) { sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()) {
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
super.paint(g); super.paint(g);
int width = getWidth(); int width = getWidth();
Color orignal = g.getColor(); Color original = g.getColor();
g.setColor(getBackground()); g.setColor(getBackground());
g.fillRect(LABLE_X, LABLE_Y, width - LABLE_DELTA_WIDTH, LABLE_HEIGHT); g.fillRect(LABEL_X, LABEL_Y, width - LABEL_DELTA_WIDTH, LABEL_HEIGHT);
g.setColor(UIConstants.LINE_COLOR); g.setColor(UIConstants.LINE_COLOR);
FontMetrics cellFM = g.getFontMetrics(); FontMetrics cellFM = g.getFontMetrics();
int textWidth = cellFM.stringWidth(getText()); int textWidth = cellFM.stringWidth(getText());
GraphHelper.drawString(g, getText(), (width - textWidth) / 2, 26); GraphHelper.drawString(g, getText(), (width - textWidth) / 2, 26);
g.setColor(orignal); g.setColor(original);
} }
}; };
sampleLabel.setHorizontalAlignment(UILabel.CENTER); sampleLabel.setHorizontalAlignment(UILabel.CENTER);
@ -197,7 +201,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
* @return 标题 * @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"); return Toolkit.i18nText("Fine-Design_Report_Text");
} }
/** /**
@ -212,13 +216,9 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
if (format instanceof CoreDecimalFormat) { if (format instanceof CoreDecimalFormat) {
// check all value // check all value
String pattern = ((CoreDecimalFormat) format).toPattern(); String pattern = ((CoreDecimalFormat) format).toPattern();
boolean isCurrency1 = (pattern.length() > 0 && pattern.charAt(0) == '¤'); if (isCurrencyFormatStyle(pattern)) {
boolean isCurrency2 = (pattern.length() > 0 && pattern.charAt(0) == '$');
boolean isCurrency = isCurrency1 || isCurrency2;
boolean isCurrency4 = (pattern.length() > CURRENCY_FLAG_POINT && ComparatorUtils.equals(pattern.substring(0, CURRENCY_FLAG_POINT), "#,##0;"));
if (isCurrency || isCurrency4) {
setPatternComboBoxAndList(FormatContents.CURRENCY, pattern); setPatternComboBoxAndList(FormatContents.CURRENCY, pattern);
} else if (pattern.endsWith("%")) { } else if (pattern.indexOf("%") > 0) {
setPatternComboBoxAndList(FormatContents.PERCENT, pattern); setPatternComboBoxAndList(FormatContents.PERCENT, pattern);
} else if (pattern.indexOf("E") > 0) { } else if (pattern.indexOf("E") > 0) {
setPatternComboBoxAndList(FormatContents.SCIENTIFIC, pattern); setPatternComboBoxAndList(FormatContents.SCIENTIFIC, pattern);
@ -238,6 +238,17 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
} }
} }
private boolean isCurrencyFormatStyle(String pattern) {
if (pattern.length() == 0) {
return false;
}
if (pattern.charAt(0) == '¤' || pattern.charAt(0) == '$') {
return true;
}
return pattern.length() > CURRENCY_FLAG_POINT && pattern.startsWith("#,##0;");
}
/** /**
* 判断是否是数组有模式 * 判断是否是数组有模式
@ -273,7 +284,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
if (getFormatContents() == FormatContents.TEXT) { if (getFormatContents() == FormatContents.TEXT) {
return FormatField.getInstance().getFormat(getFormatContents(), patternString); return FormatField.getInstance().getFormat(getFormatContents(), patternString);
} }
if (isRightFormate) { if (isRightFormat) {
if (StringUtils.isNotEmpty(patternString)) { if (StringUtils.isNotEmpty(patternString)) {
return FormatField.getInstance().getFormat(getFormatContents(), patternString); return FormatField.getInstance().getFormat(getFormatContents(), patternString);
} }
@ -292,7 +303,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
this.sampleLabel.setText(FormatField.getInstance().getFormatValue()); this.sampleLabel.setText(FormatField.getInstance().getFormatValue());
this.sampleLabel.setForeground(UIManager.getColor("Label.foreground")); this.sampleLabel.setForeground(UIManager.getColor("Label.foreground"));
try { try {
isRightFormate = true; isRightFormat = true;
if (StringUtils.isEmpty(String.valueOf(textField.getSelectedItem()))) { if (StringUtils.isEmpty(String.valueOf(textField.getSelectedItem()))) {
return; return;
} }
@ -300,7 +311,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
} catch (Exception e) { } catch (Exception e) {
this.sampleLabel.setForeground(Color.red); this.sampleLabel.setForeground(Color.red);
this.sampleLabel.setText(e.getMessage()); this.sampleLabel.setText(e.getMessage());
isRightFormate = false; isRightFormat = false;
} }
} }
@ -401,8 +412,8 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
this.isDate = isDate; this.isDate = isDate;
this.typeComboBox.setSelectedIndex(0); this.typeComboBox.setSelectedIndex(0);
if (isDate) { if (isDate) {
for (int i = 0; i < DATETYPES.length; i++) { for (int i = 0; i < DATE_TYPES.length; i++) {
this.typeComboBox.addItem(DATETYPES[i]); this.typeComboBox.addItem(DATE_TYPES[i]);
} }
for (int i = 0; i < TYPES.length; i++) { for (int i = 0; i < TYPES.length; i++) {
this.typeComboBox.removeItemAt(1); this.typeComboBox.removeItemAt(1);
@ -411,7 +422,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObs
for (int i = 0; i < TYPES.length; i++) { for (int i = 0; i < TYPES.length; i++) {
this.typeComboBox.addItem(TYPES[i]); this.typeComboBox.addItem(TYPES[i]);
} }
for (int i = 0; i < DATETYPES.length; i++) { for (int i = 0; i < DATE_TYPES.length; i++) {
this.typeComboBox.removeItemAt(1); this.typeComboBox.removeItemAt(1);
} }
} }

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save