Browse Source

Pull request #1771: 无jira任务, final -> bugfix

Merge in DESIGN/design from final/10.0 to bugfix/10.0

* commit '5d1dc866ca8087a4c62ea078c72d622d1ac79550': (334 commits)
  CHART-14399 坐标轴切换类型时,保留网格线类型和颜色	同步到final
  REPORT-34222 报表设计器给容器插件开个复制粘贴的接口 同步到final
  MOBILE-27698 移动端控件类插件设置边框不生效
  REPORT-33599 设计器菜单栏导出txt,当修改导出的参数时模版会被刷新为待保存状态 && REPORT-33525 删除引用的Js或者css 有歧义
  REPORT-33616 填报属性设置-智能添加单元格,确认和取消效果一样
  CHART-14104 坐标轴切换前后,传递网格线属性
  import设置不对
  REPORT-33858 日志死循环的问题
  CHART-13666 国际化修改
  CHART-13666
  CHART-13666 图表自动类型推荐
  删除无用方法
  代码简化
  REPORT-31758【frm自适应重构05.25周】frm设计界面支持缩放
  REPORT-33575 改下方法名称
  REPORT-33575 远程连接启用https的环境,服务器关掉之后没有跳出切换工作目录的弹窗 && REPORT-33454 切换远程目录成功,弹窗提示切换失败
  REPORT-33731 带参存储过程预览没有弹出参数输入框
  MOBILE-27532 单选/复选按钮组自适应高度
  REPORT-33459 启动后 设计器显示异常
  CHART-14264 修改配色面板样式
  ...
bugfix/10.0
neil 4 years ago
parent
commit
adee41c26b
  1. 8
      .gitignore
  2. 82
      build.gradle
  3. 27
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  4. 65
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  5. 37
      designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java
  6. 30
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  7. 9
      designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java
  8. 10
      designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java
  9. 6
      designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
  10. 50
      designer-base/src/main/java/com/fr/design/base/clipboard/ClipboardFilter.java
  11. 68
      designer-base/src/main/java/com/fr/design/base/clipboard/DesignerClipboard.java
  12. 3
      designer-base/src/main/java/com/fr/design/bridge/exec/JSExecutor.java
  13. 32
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  14. 33
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  15. 3
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataCreatorProducer.java
  16. 15
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataNameObjectCreator.java
  17. 39
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  18. 11
      designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java
  19. 5
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  20. 20
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java
  21. 6
      designer-base/src/main/java/com/fr/design/editor/editor/WidgetNameEditor.java
  22. 5
      designer-base/src/main/java/com/fr/design/env/DesignerWorkspaceGenerator.java
  23. 4
      designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java
  24. 12
      designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java
  25. 22
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java
  26. 86
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  27. 7
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  28. 234
      designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java
  29. 22
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  30. 3
      designer-base/src/main/java/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java
  31. 4
      designer-base/src/main/java/com/fr/design/extra/exe/GetPluginFromStoreExecutor.java
  32. 10
      designer-base/src/main/java/com/fr/design/extra/exe/SearchOnlineExecutor.java
  33. 19
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  34. 34
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  35. 28
      designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java
  36. 28
      designer-base/src/main/java/com/fr/design/fun/CellExpandAttrPanelProvider.java
  37. 14
      designer-base/src/main/java/com/fr/design/fun/ChartWidgetOptionProvider.java
  38. 45
      designer-base/src/main/java/com/fr/design/fun/ClipboardHandlerProvider.java
  39. 57
      designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java
  40. 23
      designer-base/src/main/java/com/fr/design/fun/DesignerStartClassProcessor.java
  41. 40
      designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java
  42. 7
      designer-base/src/main/java/com/fr/design/fun/FormWidgetOptionProvider.java
  43. 25
      designer-base/src/main/java/com/fr/design/fun/MobileTemplateStyleProvider.java
  44. 50
      designer-base/src/main/java/com/fr/design/fun/PropertyItemPaneProvider.java
  45. 39
      designer-base/src/main/java/com/fr/design/fun/ReportLengthUNITProvider.java
  46. 43
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractCellExpandAttrPanelProvider.java
  47. 29
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractChartWidgetOptionProvider.java
  48. 17
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractClipboardHandlerProvider.java
  49. 23
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractDesignerStartClassProcessorProcessor.java
  50. 23
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormAdaptiveConfigUIProcessor.java
  51. 5
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormWidgetOptionProvider.java
  52. 25
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileTemplateStyleProvider.java
  53. 31
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractPropertyItemPaneProvider.java
  54. 42
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java
  55. 10
      designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java
  56. 6
      designer-base/src/main/java/com/fr/design/gui/frpane/EditingStringListPane.java
  57. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java
  58. 13
      designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataConfigPane.java
  59. 16
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButton.java
  60. 121
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButtonUI.java
  61. 18
      designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java
  62. 52
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java
  63. 34
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java
  64. 103
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/AbstractFileChooser.java
  65. 154
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java
  66. 10
      designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java
  67. 75
      designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java
  68. 81
      designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItemUI.java
  69. 2
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java
  70. 10
      designer-base/src/main/java/com/fr/design/gui/style/BorderPane.java
  71. 39
      designer-base/src/main/java/com/fr/design/gui/style/FormatPane.java
  72. 13
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java
  73. 6
      designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java
  74. 46
      designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java
  75. 3
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java
  76. 83
      designer-base/src/main/java/com/fr/design/mainframe/DesignerContext.java
  77. 15
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  78. 188
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  79. 7
      designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java
  80. 73
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  81. 2
      designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java
  82. 17
      designer-base/src/main/java/com/fr/design/mainframe/PaneHolder.java
  83. 78
      designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java
  84. 17
      designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java
  85. 9
      designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointInfo.java
  86. 88
      designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java
  87. 108
      designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java
  88. 2
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  89. 327
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java
  90. 9
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBarUI.java
  91. 5
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java
  92. 50
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java
  93. 153
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java
  94. 5
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java
  95. 140
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java
  96. 122
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleFontConfigPane.java
  97. 76
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java
  98. 57
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java
  99. 2
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java
  100. 251
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java
  101. Some files were not shown because too many files have changed in this diff Show More

8
.gitignore vendored

@ -3,6 +3,14 @@
.DS_Store
.classpath
.project
.gradle
target/
*/build
designer-base/${web-inf-path}
designer-chart/${web-inf-path}
designer-form/${web-inf-path}
designer-realize/${web-inf-path}

82
build.gradle

@ -0,0 +1,82 @@
import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel
plugins {
id 'java'
id 'java-library'
id 'com.fr.common' version '1.0-SNAPSHOT'
}
//
ext {
frVersion = ""
outputPath = "build"
ignoreTestFailureSetting = true
languageLevelSetting = 1.8
}
applyGlobalConfigPathIfExist()
if (versions.frVersion) {
frVersion = versions.frVersion
}
def frDevVersion = "DEV" + frVersion
dependencies {
api project(':designer-base')
api project(':designer-chart')
api project(':designer-form')
api project(':designer-realize')
}
allprojects {
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'idea'
group 'com.fr.design'
version frDevVersion
sourceCompatibility = languageLevelSetting
targetCompatibility = languageLevelSetting
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
repositories {
mavenLocal()
}
idea {
module {
inheritOutputDirs = false
outputDir = file(outputPath +"/classes")
testOutputDir = file(outputPath +"/test-classes")
languageLevel = new IdeaLanguageLevel(sourceCompatibility)
targetBytecodeVersion = targetCompatibility
}
}
dependencies {
implementation 'com.fr.third:jxbrowser:6.23'
implementation 'com.fr.third:jxbrowser-swing:6.23'
implementation 'com.fr.third:jxbrowser-mac:6.23'
implementation 'com.fr.third:jxbrowser-win64:6.23'
implementation 'com.fr.third.server:servlet-api:3.0'
implementation 'org.swingexplorer:swexpl:2.0.1'
implementation 'org.swingexplorer:swag:1.0'
implementation 'net.java.dev.jna:jna:5.4.0'
implementation 'org.apache.tomcat:tomcat-catalina:8.5.32'
implementation 'io.socket:socket.io-client:0.7.0'
implementation 'com.fr.third:fine-third:' + frVersion
implementation 'com.fr.core:fine-core:' + frDevVersion
implementation 'com.fr.activator:fine-activator:' + frVersion
implementation 'com.fr.datasource:fine-datasource:' + frVersion
implementation 'com.fr.decision:fine-decision:' + frVersion
implementation 'com.fr.schedule:fine-schedule:' + frVersion
implementation 'com.fr.report:fine-report-engine:' + frDevVersion
testImplementation 'org.easymock:easymock:3.5.1'
testImplementation 'org.powermock:powermock-module-junit4:1.7.1'
testImplementation 'org.powermock:powermock-api-easymock:1.7.1'
testImplementation 'junit:junit:4.12'
}
}

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

@ -18,6 +18,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.locale.impl.ProductImproveMark;
import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.notification.SnapChatConfig;
import com.fr.design.update.push.DesignerPushUpdateConfigManager;
import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.design.utils.DesignUtils;
@ -57,6 +58,7 @@ import javax.swing.SwingWorker.StateValue;
import java.awt.Color;
import java.awt.Rectangle;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
@ -161,6 +163,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* alphafine
*/
private AlphaFineConfigManager alphaFineConfigManager = AlphaFineConfigManager.getInstance();
/**
* 阅后即焚的配置项
*/
private SnapChatConfig snapChatConfig = SnapChatConfig.getInstance();
private DesignerPushUpdateConfigManager designerPushUpdateConfigManager = DesignerPushUpdateConfigManager.getInstance();
@ -200,9 +207,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
GeneralContext.setLocale(designerEnvManager.getLanguage());
try {
XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile());
} catch (Exception e) {
} catch (FileNotFoundException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
XmlHandler.Self.handle(e);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
// james:如果没有env定义,要设置一个默认的
@ -1562,11 +1571,17 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readVcsAttr(reader);
} else if (DesignerPort.XML_TAG.equals(name)) {
readDesignerPort(reader);
}else if (name.equals(SnapChatConfig.XML_TAG)) {
readSnapChatConfig(reader);
} else {
readLayout(reader, name);
}
}
}
private void readSnapChatConfig(XMLableReader reader) {
reader.readXMLObject(this.snapChatConfig = SnapChatConfig.getInstance());
}
private void readAlphaFineAttr(XMLableReader reader) {
reader.readXMLObject(this.alphaFineConfigManager = AlphaFineConfigManager.getInstance());
@ -1783,9 +1798,17 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
writeDesignerPushUpdateAttr(writer);
writeVcsAttr(writer);
writeDesignerPort(writer);
writeSnapChatConfig(writer);
writer.end();
}
private void writeSnapChatConfig(XMLPrintWriter writer) {
if (this.snapChatConfig != null) {
this.snapChatConfig.writeXML(writer);
}
}
private void writeAlphaFineAttr(XMLPrintWriter writer) {
if (this.alphaFineConfigManager != null) {
this.alphaFineConfigManager.writeXML(writer);

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

@ -8,6 +8,7 @@ import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.design.env.RemoteWorkspace;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.TemplateTreePane;
@ -18,7 +19,6 @@ import com.fr.design.utils.DesignUtils;
import com.fr.env.CheckServiceDialog;
import com.fr.env.EnvListPane;
import com.fr.exit.DesignerExiter;
import com.fr.general.GeneralContext;
import com.fr.general.GeneralUtils;
import com.fr.invoke.Reflect;
import com.fr.json.JSONArray;
@ -30,7 +30,6 @@ 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.EnvChangedListener;
import com.fr.stable.StringUtils;
import com.fr.start.server.ServerTray;
import com.fr.workspace.WorkContext;
@ -54,6 +53,7 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.HashSet;
@ -63,8 +63,6 @@ import static javax.swing.JOptionPane.QUESTION_MESSAGE;
public class EnvChangeEntrance {
private String currentEnvName = "";
public static EnvChangeEntrance getInstance() {
return HOLDER.singleton;
}
@ -75,13 +73,7 @@ public class EnvChangeEntrance {
private EnvChangeEntrance() {
currentEnvName = DesignerEnvManager.getEnvManager().getCurEnvName();
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
@Override
public void envChanged() {
currentEnvName = DesignerEnvManager.getEnvManager().getCurEnvName();
}
});
}
private boolean envListOkAction(EnvListPane envListPane, PopTipStrategy strategy) {
@ -359,7 +351,7 @@ public class EnvChangeEntrance {
*/
private String formatBranch(String branch){
if(branch.contains("#")){
return branch.substring(branch.lastIndexOf("#") + 1, branch.length() - 13);
return branch.substring(branch.lastIndexOf("-") + 1, branch.length() - 13);
}
return branch;
}
@ -380,15 +372,21 @@ public class EnvChangeEntrance {
* 出现对话框选择使用的工作环境
*/
public void chooseEnv() {
chooseEnv(DesignerEnvManager.getEnvManager().getCurEnvName());
}
public void chooseEnv(final String envName) {
final EnvListPane envListPane = new EnvListPane();
final BasicDialog envListDialog = envListPane.showWindow(SwingUtilities.getWindowAncestor(DesignerContext.getDesignerFrame()));
envListPane.populateEnvManager(currentEnvName);
envListPane.populateEnvManager(envName);
envListDialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
envListOkAction(envListPane, PopTipStrategy.LATER);
// 切换完成后清理密码
updateNotRememberPwdEnv();
}
@Override
@ -404,19 +402,22 @@ public class EnvChangeEntrance {
* 处理异常
*/
public void dealEvnExceptionWhenStartDesigner() {
ProcessEventPipe eventPipe = FineProcessContext.getParentPipe();
if (eventPipe != null) {
eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue()));
}
final EnvListPane envListPane = new EnvListPane();
envListPane.populateEnvManager(currentEnvName);
envListPane.populateEnvManager(DesignerEnvManager.getEnvManager().getCurEnvName());
BasicDialog envListDialog = envListPane.showWindow(SwingUtilities.getWindowAncestor(DesignerContext.getDesignerFrame()));
envListDialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
ProcessEventPipe pipe = FineProcessContext.getParentPipe();
if (FineProcessContext.getParentPipe() != null) {
pipe.fire(new CarryMessageEvent(ReportState.ACTIVE.getValue()));
}
FineProcessContext.getParentPipe().fire(new CarryMessageEvent(ReportState.ACTIVE.getValue()));
if (!envListOkAction(envListPane, PopTipStrategy.NOW)) {
DesignerExiter.getInstance().execute();
} else {
updateNotRememberPwdEnv();
}
}
@ -428,6 +429,34 @@ public class EnvChangeEntrance {
envListDialog.setVisible(true);
}
/**
* 切换环境后 刷新远程目录需要忘记密码的情况
*/
private void updateNotRememberPwdEnv() {
DesignerEnvManager mgr = DesignerEnvManager.getEnvManager();
Iterator<String> iterator = mgr.getEnvNameIterator();
while (iterator.hasNext()) {
String envName = iterator.next();
DesignerWorkspaceInfo info = mgr.getWorkspaceInfo(envName);
if (isNotRememberPwd(info)) {
WorkspaceConnectionInfo connection = info.getConnection();
DesignerWorkspaceInfo workspaceInfo = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo(
connection.getUrl(), connection.getUserName(), StringUtils.EMPTY, connection.getCertPath(), connection.getCertSecretKey(), false));
mgr.putEnv(envName, workspaceInfo);
}
}
}
private boolean isNotRememberPwd(DesignerWorkspaceInfo info) {
if (info != null && info.getType() == DesignerWorkspaceType.Remote) {
WorkspaceConnectionInfo connection = info.getConnection();
return connection != null && !connection.isRememberPwd();
}
return false;
}
/**
* 提示显示策略

37
designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java

@ -8,6 +8,7 @@ import com.fr.base.BaseUtils;
import com.fr.common.annotations.Open;
import com.fr.design.data.datapane.TableDataNameObjectCreator;
import com.fr.design.fun.CellWidgetOptionProvider;
import com.fr.design.fun.ChartWidgetOptionProvider;
import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.fun.MobileWidgetStyleProvider;
import com.fr.design.fun.ParameterWidgetOptionProvider;
@ -193,6 +194,42 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
return result.toArray(new WidgetOption[result.size()]);
}
public Map<Class<? extends Widget>, Class<?>> getChartWidgetOptionsMap() {
Set<ChartWidgetOptionProvider> set = getArray(ChartWidgetOptionProvider.XML_TAG);
Map<Class<? extends Widget>, Class<?>> map = new HashMap<>();
for (ChartWidgetOptionProvider provider : set) {
map.put(provider.classForWidget(), provider.appearanceForWidget());
}
return map;
}
public WidgetOption[] getBeforeChartWidgetOptions() {
return getChartUnits(true);
}
public WidgetOption[] getAfterChartWidgetOptions() {
return getChartUnits(false);
}
private WidgetOption[] getChartUnits(boolean isBefore) {
Set<ChartWidgetOptionProvider> set = getArray(ChartWidgetOptionProvider.XML_TAG);
if (set.isEmpty()) {
return new WidgetOption[0];
}
Set<WidgetOption> result = new HashSet<>();
for (ChartWidgetOptionProvider provider : set) {
if (provider.isBefore() == isBefore) {
WidgetOption option = WidgetOptionFactory.createByWidgetClass(
provider.nameForWidget(),
BaseUtils.readIcon(provider.iconPathForWidget()),
provider.classForWidget()
);
result.add(option);
}
}
return result.toArray(new WidgetOption[result.size()]);
}
public WidgetOption[] getCellWidgetOptions() {
Set<CellWidgetOptionProvider> set = getArray(CellWidgetOptionProvider.XML_TAG);

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

@ -28,6 +28,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.unit.UnitConvertUtil;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.ComparatorUtils;
@ -149,9 +150,6 @@ public class PreferencePane extends BasicPane {
private UIColorButton paginationLineColorTBButton;
private UICheckBox supportCellEditorDefCheckBox;
private UICheckBox isDragPermitedCheckBox;
private UITextField logExportDirectoryField;
private UIComboBox logLevelComboBox, pageLengthComboBox, reportLengthComboBox;
@ -199,7 +197,6 @@ public class PreferencePane extends BasicPane {
createFunctionPane(generalPane);
createEditPane(generalPane);
createGuiOfGridPane(generalPane);
createColorSettingPane(generalPane);
createVcsSettingPane(generalPane);
@ -228,8 +225,8 @@ public class PreferencePane extends BasicPane {
JPanel dbmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Database_Manager"));
useUniverseDBMCheckbox = new UICheckBox(i18nText("Fine-Design_Basic_Use_Universe_Database_Manager"));
dbmSelectorPane.add(useUniverseDBMCheckbox);
advancePane.add(dbmSelectorPane);
//dbmSelectorPane.add(useUniverseDBMCheckbox);
//advancePane.add(dbmSelectorPane);
JPanel improvePane = FRGUIPaneFactory.createVerticalTitledBorderPane(i18nText("Fine-Design_Basic_Product_Improve"));
joinProductImproveCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Join_Product_Improve"));
@ -447,18 +444,6 @@ public class PreferencePane extends BasicPane {
}
private void createGuiOfGridPane(JPanel generalPane) {
// GridPane
JPanel guiOfGridPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Setting_Grid"));
generalPane.add(guiOfGridPane);
supportCellEditorDefCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Support_Cell_Editor_Definition"));
guiOfGridPane.add(supportCellEditorDefCheckBox);
isDragPermitedCheckBox = new UICheckBox(i18nText("Fine-Design_Basic_Preference_Is_Drag_Permited"));
guiOfGridPane.add(isDragPermitedCheckBox);
}
private void createColorSettingPane(JPanel generalPane) {
// Color Setting Pane
JPanel colorSettingPane = FRGUIPaneFactory.createTitledBorderPane(i18nText("Fine-Design_Basic_Preference_Setting_Colors"));
@ -591,7 +576,7 @@ public class PreferencePane extends BasicPane {
pageLengthComboBox = new UIComboBox(new String[]{i18nText("Fine-Design_Basic_Page_Setup_MM"), i18nText("Fine-Design_Report_Unit_CM"), i18nText("Fine-Design_Report_Unit_INCH")});
pageLengthComboBox.setPreferredSize(new Dimension(80, 20));
pageLengthComboBox.setMinimumSize(new Dimension(80, 20));
reportLengthComboBox = new UIComboBox(new String[]{i18nText("Fine-Design_Basic_Page_Setup_MM"), i18nText("Fine-Design_Report_Unit_CM"), i18nText("Fine-Design_Report_Unit_INCH"), i18nText("Fine-Design_Report_Unit_PT_Duplicate")});
reportLengthComboBox = new UIComboBox(UnitConvertUtil.getUnitItems());
reportLengthComboBox.setPreferredSize(new Dimension(80, 20));
reportLengthComboBox.setMinimumSize(new Dimension(80, 20));
UILabel pagelengthLabel = new UILabel(i18nText("Fine-Design_Basic_Page_Setup_Scale_Units") + ":");
@ -696,9 +681,6 @@ public class PreferencePane extends BasicPane {
useIntervalCheckBox.setSelected(vcsConfigManager.isUseInterval());
gcEnableCheckBox.setSelected(GcConfig.getInstance().isGcEnable());
gcButton.setEnabled(gcEnableCheckBox.isSelected());
supportCellEditorDefCheckBox.setSelected(designerEnvManager.isSupportCellEditorDef());
isDragPermitedCheckBox.setSelected(designerEnvManager.isDragPermited());
gridLineColorTBButton.setColor(designerEnvManager.getGridLineColor());
paginationLineColorTBButton.setColor(designerEnvManager.getPaginationLineColor());
@ -768,12 +750,8 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setDefaultStringToFormula(defaultStringToFormulaBox.isSelected());
designerEnvManager.setSupportCellEditorDef(supportCellEditorDefCheckBox.isSelected());
designerEnvManager.setAutoCompleteShortcuts(shortCutKeyStore != null ? shortCutKeyStore.toString().replace(TYPE, DISPLAY_TYPE) : shortCutLabel.getText());
designerEnvManager.setDragPermited(isDragPermitedCheckBox.isSelected());
designerEnvManager.setGridLineColor(gridLineColorTBButton.getColor());
designerEnvManager.setPaginationLineColor(paginationLineColorTBButton.getColor());

9
designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java

@ -59,7 +59,14 @@ public class SwitchExistEnv extends MenuDef {
*/
public void actionPerformed(ActionEvent e) {
final String envName = getName();
EnvChangeEntrance.getInstance().switch2Env(envName);
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(envName);
if (selectedEnv.getConnection() != null && !selectedEnv.getConnection().isRememberPwd()) {
// 打开配置目录面板
EnvChangeEntrance.getInstance().chooseEnv(envName);
} else {
EnvChangeEntrance.getInstance().switch2Env(envName);
}
}
}
}

10
designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java

@ -72,11 +72,11 @@ public class AboutPane extends JPanel {
addPhoneAndQQPane(contentPane);
// 官网
JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), CloudCenter.getInstance().acquireUrlByKind("website." + GeneralContext.getLocale(), ProductConstants.WEBSITE_URL));
JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Official_Website"), CloudCenter.getInstance().acquireConf("website." + GeneralContext.getLocale(), ProductConstants.WEBSITE_URL));
// 支持邮箱
String defaultEmail = CloudCenter.getInstance().acquireUrlByKind("support.email", ProductConstants.SUPPORT_EMAIL);
JPanel emailPane = getEmailActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Support_Email"), CloudCenter.getInstance().acquireUrlByKind("support.email." + GeneralContext.getLocale(), defaultEmail));
String defaultEmail = CloudCenter.getInstance().acquireConf("support.email", ProductConstants.SUPPORT_EMAIL);
JPanel emailPane = getEmailActionPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Support_Email"), CloudCenter.getInstance().acquireConf("support.email." + GeneralContext.getLocale(), defaultEmail));
contentPane.add(urlActionPane);
contentPane.add(emailPane);
@ -96,7 +96,7 @@ public class AboutPane extends JPanel {
if (GeneralContext.getLocale().equals(Locale.US)) {
return;
}
boxCenterAlignmentPane = new BoxCenterAligmentPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Service_Phone") + CloudCenter.getInstance().acquireUrlByKind("service.phone." + FRContext.getLocale(), COMPANY_TELEPHONE));
boxCenterAlignmentPane = new BoxCenterAligmentPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Service_Phone") + CloudCenter.getInstance().acquireConf("service.phone." + FRContext.getLocale(), COMPANY_TELEPHONE));
contentPane.add(boxCenterAlignmentPane);
// 繁体版不显示QQ
if (GeneralContext.getLocale().equals(Locale.TAIWAN)) {
@ -176,7 +176,7 @@ public class AboutPane extends JPanel {
private String getCopyRight() {
return append(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_About_CopyRight"), COPYRIGHT_LABEL,
ProductConstants.HISTORY, StringUtils.BLANK, CloudCenter.getInstance().acquireUrlByKind("company.name", ProductConstants.COMPANY_NAME));
ProductConstants.HISTORY, StringUtils.BLANK, CloudCenter.getInstance().acquireConf("company.name", ProductConstants.COMPANY_NAME));
}
private String getBuildTitle() {

6
designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java

@ -27,6 +27,7 @@ import com.fr.transaction.Worker;
import com.fr.transaction.WorkerFacade;
import javax.swing.KeyStroke;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.Map;
@ -35,7 +36,8 @@ import java.util.Map;
* Global TableData.
*/
public class GlobalTableDataAction extends UpdateAction implements ResponseDataSourceChange {
//private static TableDataManagerPane globalTableDataPane = new TableDataManagerPane();
private static final Dimension DEFAULT_DIMENSION = new Dimension(1000, 600);
public GlobalTableDataAction() {
this.setMenuKeySet(SERVER_TABLEDATA);
@ -80,7 +82,7 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
tableDataConfig.renameTableData(oldName, newName);
}
};
final BasicDialog globalTableDataDialog = globalTableDataPane.showLargeWindow(designerFrame, null);
final BasicDialog globalTableDataDialog = globalTableDataPane.showWindowWithCustomSize(designerFrame, null, DEFAULT_DIMENSION);
globalTableDataDialog.addDialogActionListener(new DialogActionAdapter() {

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

@ -0,0 +1,50 @@
package com.fr.design.base.clipboard;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.ClipboardHandlerProvider;
import com.fr.plugin.injectable.PluginModule;
import java.util.Set;
/**
* created by Harrison on 2020/05/14
**/
@SuppressWarnings({"rawtypes", "unchecked"})
public abstract class ClipboardFilter {
public static <T> T cut(T selection) {
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG);
for (ClipboardHandlerProvider provider : providers) {
if (provider.support(selection)) {
selection = ((ClipboardHandlerProvider<T>) provider).cut(selection);
}
}
return selection;
}
public static <T> T copy(T selection) {
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG);
for (ClipboardHandlerProvider provider : providers) {
if (provider.support(selection)) {
selection = ((ClipboardHandlerProvider<T>) provider).copy(selection);
}
}
return selection;
}
public static <T> T paste(T selection) {
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG);
for (ClipboardHandlerProvider provider : providers) {
if (provider.support(selection)) {
selection = ((ClipboardHandlerProvider<T>) provider).paste(selection);
}
}
return selection;
}
}

68
designer-base/src/main/java/com/fr/design/base/clipboard/DesignerClipboard.java

@ -0,0 +1,68 @@
package com.fr.design.base.clipboard;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.ClipboardOwner;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.FlavorListener;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
/**
* created by Harrison on 2020/05/11
**/
public class DesignerClipboard extends Clipboard {
private Clipboard clipboard;
public DesignerClipboard(Clipboard clipboard) {
super(clipboard.getName());
this.clipboard = clipboard;
}
@Override
public synchronized void setContents(Transferable contents, ClipboardOwner owner) {
//处理 contents/owner
Transferable filtered = ClipboardFilter.copy(contents);
clipboard.setContents(filtered, owner);
}
@Override
public synchronized Transferable getContents(Object requestor) {
Transferable contents = clipboard.getContents(requestor);
//处理 contents
Transferable filtered = ClipboardFilter.paste(contents);
return filtered;
}
@Override
public DataFlavor[] getAvailableDataFlavors() {
return clipboard.getAvailableDataFlavors();
}
@Override
public boolean isDataFlavorAvailable(DataFlavor flavor) {
return clipboard.isDataFlavorAvailable(flavor);
}
@Override
public Object getData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
return clipboard.getData(flavor);
}
@Override
public synchronized void addFlavorListener(FlavorListener listener) {
clipboard.addFlavorListener(listener);
}
@Override
public synchronized void removeFlavorListener(FlavorListener listener) {
clipboard.removeFlavorListener(listener);
}
@Override
public synchronized FlavorListener[] getFlavorListeners() {
return clipboard.getFlavorListeners();
}
}

3
designer-base/src/main/java/com/fr/design/bridge/exec/JSExecutor.java

@ -4,5 +4,8 @@ package com.fr.design.bridge.exec;
* Created by ibm on 2017/6/21.
*/
public interface JSExecutor {
String CALLBACK_FUNCTION_NAME = "action";
void executor(String newValue);
}

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

@ -22,7 +22,6 @@ import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.iprogressbar.AutoProgressBar;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.parameter.ParameterInputPane;
import com.fr.file.ProcedureConfig;
@ -484,15 +483,9 @@ public abstract class DesignTableDataManager {
if (ArrayUtils.isEmpty(parameters)) {
parameters = tabledata.getParameters(Calculator.createCalculator());
}
final Map<String, Object> parameterMap = new HashMap<>();
Map<String, Object> parameterMap = new HashMap<>();
if (needInputParams(isMustInputParameters, parameters)) {
final ParameterInputPane pPane = new ParameterInputPane(parameters);
pPane.showSmallWindow(new JFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
parameterMap.putAll(pPane.update());
}
}).setVisible(true);
showParaWindow(parameterMap, parameters);
} else {
for (ParameterProvider parameter : parameters) {
parameterMap.put(parameter.getName(), parameter.getValue());
@ -583,15 +576,10 @@ public abstract class DesignTableDataManager {
return storeProcedure.creatLazyDataModel();
}
ParameterProvider[] inParameters = DataOperator.getInstance().getStoreProcedureParameters(storeProcedure);
final Map<String, Object> parameterMap = new HashMap<String, Object>();
Map<String, Object> parameterMap = new HashMap<>();
if (inParameters.length > 0 && !ComparatorUtils.equals(threadLocal.get(), NO_PARAMETER)) {// 检查Parameter.
final ParameterInputPane pPane = new ParameterInputPane(inParameters);
pPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
parameterMap.putAll(pPane.update());
}
}).setVisible(true);
showParaWindow(parameterMap, inParameters);
}
storeProcedure.setFirstExpand(false);
@ -601,6 +589,16 @@ public abstract class DesignTableDataManager {
return DataOperator.getInstance().previewProcedureDataModel(storeProcedure, parameterMap, 0);
}
private static void showParaWindow(final Map<String, Object> parameterMap, ParameterProvider[] inParameters) {
final ParameterInputPane pPane = new ParameterInputPane(inParameters);
pPane.showSmallWindow(new JFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
parameterMap.putAll(pPane.update());
}
}).setVisible(true);
}
public static void setThreadLocal(String value) {
threadLocal.set(value);
}

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

@ -6,7 +6,6 @@ import com.fr.data.core.db.DBUtils;
import com.fr.data.core.db.TableProcedure;
import com.fr.data.core.db.dialect.Dialect;
import com.fr.data.core.db.dialect.DialectFactory;
import com.fr.data.impl.Connection;
import com.fr.data.impl.DBTableData;
import com.fr.data.operator.DataOperator;
import com.fr.design.DesignerEnvManager;
@ -37,6 +36,7 @@ import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.connection.DBConnectAuth;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
@ -55,9 +55,10 @@ import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author zhou
@ -204,10 +205,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
@SuppressWarnings("unchecked")
protected void initDsNameComboBox() {
dsNameComboBox.setRefreshingModel(true);
ConnectionConfig connectionConfig = ConnectionConfig.getInstance();
List<String> dsList = new ArrayList<>();
dsList.addAll(connectionConfig.getConnections().keySet());
FilterableComboBoxModel dsNameComboBoxModel = new FilterableComboBoxModel(dsList);
FilterableComboBoxModel dsNameComboBoxModel = new FilterableComboBoxModel(getHasAuthConnections());
dsNameComboBox.setModel(dsNameComboBoxModel);
dsNameComboBox.setRefreshingModel(false);
}
@ -316,14 +314,31 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
return null; // peter:选中了当前的零长度的节点,直接返回.
}
ConnectionConfig connectionConfig = ConnectionConfig.getInstance();
for (Map.Entry<String, Connection> entry : connectionConfig.getConnections().entrySet()) {
if (ComparatorUtils.equals(selectedDSName, entry.getKey())) {
return entry.getValue();
List<String> authConnections = getHasAuthConnections();
for (String name : authConnections) {
if (ComparatorUtils.equals(selectedDSName, name)) {
return connectionConfig.getConnection(name);
}
}
return null;
}
private List<String> getHasAuthConnections() {
List<String> authConnections = new ArrayList<>();
Set<String> allConnections = ConnectionConfig.getInstance().getConnections().keySet();
Collection<String> noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections();
if (noAuthConnections == null) {
return authConnections;
}
for (String name : allConnections) {
if (!noAuthConnections.contains(name)) {
authConnections.add(name);
}
}
return authConnections;
}
/**
* 刷新没多大用而且要刷新也不是这儿刷新
*/

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

@ -35,6 +35,7 @@ public class TableDataCreatorProducer {
"ds",
"/com/fr/design/images/data/database.png", DBTableData.class, DBTableDataPane.class);
TableDataNameObjectCreator ds_Class = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Class"),
"Class",
"/com/fr/design/images/data/source/classTableData.png", ClassTableData.class, ClassTableDataPane.class);
TableDataNameObjectCreator table = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Embedded"),
"Embedded",
@ -60,6 +61,7 @@ public class TableDataCreatorProducer {
"Proc",
"/com/fr/design/images/data/store_procedure.png",
StoreProcedure.class, ProcedureDataPane.class) {
@Override
public boolean shouldInsertSeparator() {
return true;
}
@ -92,6 +94,7 @@ public class TableDataCreatorProducer {
};
TableDataNameObjectCreator storeProcedure = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Stored_Procedure"), "/com/fr/design/images/data/store_procedure.png",
StoreProcedure.class, ProcedureDataPane.class) {
@Override
public boolean shouldInsertSeparator() {
return true;
}

15
designer-base/src/main/java/com/fr/design/data/datapane/TableDataNameObjectCreator.java

@ -5,10 +5,13 @@ import com.fr.data.impl.DBTableData;
import com.fr.design.actions.tabledata.TableDataAction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.UnrepeatedNameHelper;
import com.fr.design.icon.WarningIcon;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import javax.swing.Icon;
@ -95,6 +98,7 @@ public class TableDataNameObjectCreator extends NameObjectCreator {
*
* @return 图片
*/
@Override
public Icon menuIcon() {
return createMenuIcon();
}
@ -112,6 +116,7 @@ public class TableDataNameObjectCreator extends NameObjectCreator {
*
* @return 提示
*/
@Override
public String createTooltip() {
return b ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") : null;
}
@ -166,11 +171,21 @@ public class TableDataNameObjectCreator extends NameObjectCreator {
return false;
}
@Override
public boolean equals(Object obj) {
return obj instanceof TableDataNameObjectCreator
&& ComparatorUtils.equals(menuName, ((TableDataNameObjectCreator) obj).menuName);
}
@Override
public Nameable createNameable(UnrepeatedNameHelper helper) {
try {
return new NameObject(helper.createUnrepeatedName(this.getPrefix()), clazzOfInitCase.newInstance());
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}
@Override
public int hashCode() {
return menuName == null ? 0 : menuName.hashCode();

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

@ -15,6 +15,7 @@ import com.fr.file.ProcedureConfig;
import com.fr.file.TableDataConfig;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
@ -142,36 +143,28 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
return super.createUnrepeatedName(prefix);
}
String[] allDsNames = DesignTableDataManager.getAllDSNames(source);
// richer:生成的名字从1开始. kunsnat: 添加属性从0开始.
int count = 1;
while (isDsNameRepeated(prefix + count, allDsNames)) {
count++;
}
return prefix + count;
}
private boolean isDsNameRepeated(String name, String[] allDsNames) {
DefaultListModel model = this.getModel();
Nameable[] all = new Nameable[model.getSize()];
for (int i = 0; i < model.size(); i++) {
all[i] = ((ListModelElement) model.get(i)).wrapper;
}
// richer:生成的名字从1开始. kunsnat: 添加属性从0开始.
int count = all.length + 1;
while (true) {
String name_test = prefix + count;
boolean repeated = false;
for (int i = 0, len = model.size(); i < len; i++) {
Nameable nameable = all[i];
if (ComparatorUtils.equals(nameable.getName(), name_test)) {
repeated = true;
break;
}
}
for (String dsname : allDsNames) {
if (ComparatorUtils.equals(dsname, name_test)) {
repeated = true;
break;
}
for (int i = 0, len = model.size(); i < len; i++) {
Nameable nameable = all[i];
if (ComparatorUtils.equals(nameable.getName(), name)) {
return true;
}
if (!repeated) {
return name_test;
}
count++;
}
return ArrayUtils.contains(allDsNames, name);
}
@Override

11
designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java

@ -2,6 +2,7 @@ package com.fr.design.data.datapane;
import com.fr.data.TableDataSource;
import com.fr.data.impl.RecursionTableData;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.wrapper.ServerTableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
@ -70,8 +71,14 @@ public class TreeTableDataComboBox extends UIComboBox {
}
public void setSelectedTableDataByName(String name) {
TableDataWrapper tableDataWrappe = res_map.get(name);
this.getModel().setSelectedItem(tableDataWrappe);
TableDataWrapper tableDataWrapper;
if (res_map.get(name) != null) {
tableDataWrapper = res_map.get(name);
} else {
String changeName = DesignTableDataManager.getChangedDsNameByOldDsName(name);
tableDataWrapper = res_map.get(changeName);
}
this.getModel().setSelectedItem(tableDataWrapper);
}
@Override

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

@ -238,13 +238,10 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
isShareCheckBox.setBackground(Color.WHITE);
maxPanel = new MaxMemRowCountPanel();
maxPanel.setBorder(null);
JPanel wrapMaxPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
wrapMaxPanel.add(maxPanel);
wrapMaxPanel.setPreferredSize(new Dimension(350, 20));
UIToolbar editToolBar = ToolBarDef.createJToolBar();
toolBarDef.updateToolBar(editToolBar);
editToolBar.add(isShareCheckBox);
editToolBar.add(wrapMaxPanel);
editToolBar.add(maxPanel);
return editToolBar;
}

20
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java

@ -4,6 +4,7 @@ import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import com.fr.base.GraphHelper;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
@ -15,6 +16,20 @@ import com.fr.design.gui.itoolbar.UIToolbar;
public class MaxMemRowCountPanel extends UIToolbar {
private static final int ALL_IN_MEMORY = 0;
private static final int MAX_IN_MEMORY = 1;
private static final String[] CACHE_LIST = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Save_All_Records_In_Memory"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Max_Mem_Row_Count") };
private static final int MAX_WIDTH = getMaxComBoBoxWidth() > 200 ? 350 : 250;
private static int getMaxComBoBoxWidth() {
int maxWidth = GraphHelper.getWidth(CACHE_LIST[0]);
for (int i = 1; i < CACHE_LIST.length; i++) {
int width = GraphHelper.getWidth(CACHE_LIST[i]);
if (width > maxWidth) {
maxWidth = width;
}
}
return maxWidth;
}
private UISpinner numberSpinner;
private UIComboBox switchCache;
@ -44,7 +59,7 @@ public class MaxMemRowCountPanel extends UIToolbar {
@Override
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.width = 340;
dim.width = MAX_WIDTH;
return dim;
};
@ -52,8 +67,7 @@ public class MaxMemRowCountPanel extends UIToolbar {
this.setFloatable(false);
this.setRollover(true);
this.setBackground(UIConstants.NORMAL_BACKGROUND);
String[] cacheList = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Save_All_Records_In_Memory"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Max_Mem_Row_Count") };
switchCache = new UIComboBox(cacheList);
switchCache = new UIComboBox(CACHE_LIST);
switchCache.addActionListener(switchStateL);
numberSpinner = new UISpinner(0, Integer.MAX_VALUE, 1);
}

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

@ -4,6 +4,7 @@ import com.fr.design.DesignModelAdapter;
import com.fr.design.gui.icombobox.FilterComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.StringUtils;
import com.fr.stable.js.WidgetName;
import javax.swing.JList;
@ -19,6 +20,8 @@ import java.awt.Component;
* @since 2012-3-29下午6:04:37
*/
public class WidgetNameEditor extends Editor<WidgetName> {
static final WidgetName EMPTY_WIDGET_NAME = new WidgetName(StringUtils.EMPTY);
private FilterComboBox<WidgetName> comb;
@ -79,7 +82,8 @@ public class WidgetNameEditor extends Editor<WidgetName> {
@Override
public WidgetName getValue() {
return (WidgetName) comb.getSelectedItem();
WidgetName widgetName = (WidgetName) comb.getSelectedItem();
return widgetName == null ? EMPTY_WIDGET_NAME : widgetName;
}
@Override

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

@ -72,10 +72,7 @@ public class DesignerWorkspaceGenerator {
enum RemoteHandler {
SELF;
public static void handle(DesignerWorkspaceInfo config) {
ProcessEventPipe eventPipe = FineProcessContext.getParentPipe();
if (eventPipe != null) {
eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue()));
}
FineProcessContext.getParentPipe().fire(new CarryMessageEvent(ReportState.STOP.getValue()));
StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.REMOTE_DESIGN_NO_RESPONSE.getId(),
DesignerErrorMessage.REMOTE_DESIGN_NO_RESPONSE.getMessage(),
StringUtils.EMPTY);

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

@ -72,7 +72,8 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
String password = SecurityToolbox.defaultDecrypt(reader.getAttrAsString("password", StringUtils.EMPTY).replaceAll(" ", "\r\n"));
String certPath = reader.getAttrAsString("certPath", StringUtils.EMPTY);
String certSecretKey = reader.getAttrAsString("certSecretKey", StringUtils.EMPTY);
this.connection = new WorkspaceConnectionInfo(url, username, password, certPath, certSecretKey);
boolean rememberPwd = reader.getAttrAsBoolean("rememberPwd", true);
this.connection = new WorkspaceConnectionInfo(url, username, password, certPath, certSecretKey, rememberPwd);
}
}
}
@ -89,6 +90,7 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
writer.attr("password", SecurityToolbox.defaultEncrypt(connection.getPassword()));
writer.attr("certPath", connection.getCertPath());
writer.attr("certSecretKey", connection.getCertSecretKey());
writer.attr("rememberPwd", connection.isRememberPwd());
writer.end();
}
}

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

@ -196,18 +196,6 @@ public class LoginWebBridge {
uiLabel.setBackground(LOGIN_BACKGROUND);
}
/**
* 弹出QQ授权页面
*/
public void showQQ() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
WebViewDlgHelper.createQQLoginDialog();
}
});
}
/**
* 关闭QQ授权窗口
*/

22
designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java

@ -1,10 +1,10 @@
package com.fr.design.extra;
import com.fr.config.MarketConfig;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.exe.callback.InstallFromDiskCallback;
import com.fr.design.extra.exe.callback.InstallOnlineCallback;
import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.extra.exe.callback.ModifyStatusCallback;
import com.fr.design.extra.exe.callback.UninstallPluginCallback;
import com.fr.design.extra.exe.callback.UpdateFromDiskCallback;
@ -13,6 +13,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
@ -25,9 +26,9 @@ import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.*;
import java.io.File;
import java.net.HttpURLConnection;
import java.util.List;
@ -110,13 +111,18 @@ public class PluginOperateUtils {
public static String getRecommendPlugins() {
String plistUrl = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.feature");
JSONArray resultArray = JSONArray.create();
if (StringUtils.isBlank(plistUrl)) {
return resultArray.toString();
}
try {
HttpClient httpClient = new HttpClient(plistUrl);
String result = httpClient.getResponseText();
JSONArray jsonArray = new JSONArray(result);
resultArray = PluginUtils.filterPluginsFromVersion(jsonArray);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
String result = httpClient.getResponseText();
JSONArray jsonArray = new JSONArray(result);
resultArray = PluginUtils.filterPluginsFromVersion(jsonArray);
}
} catch (JSONException e) {
FineLoggerFactory.getLogger().info(e.getMessage(), e);
}
return resultArray.toString();
}

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

@ -2,6 +2,7 @@ package com.fr.design.extra;
import com.fr.base.TemplateUtils;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient;
import com.fr.json.JSONArray;
@ -12,8 +13,8 @@ import com.fr.plugin.basic.version.Version;
import com.fr.plugin.basic.version.VersionIntervalFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.error.PluginBaseErrorCode;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.PluginManager;
import com.fr.plugin.view.PluginView;
import com.fr.stable.EncodeConstants;
@ -21,11 +22,12 @@ import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javax.swing.JOptionPane;
import javax.swing.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
@ -38,7 +40,7 @@ import java.util.Map;
* Created by ibm on 2017/5/25.
*/
public class PluginUtils {
private static final String ERROR_CODE_I18N_PREFIX = "FR-Plugin_Error_";
public static final String FR_VERSION = "fr_version";
@ -46,8 +48,7 @@ public class PluginUtils {
public static PluginMarker createPluginMarker(String pluginInfo) {
//todo 判空
String[] plugin = pluginInfo.split("_");
PluginMarker pluginMarker = PluginMarker.create(plugin[0], plugin[1]);
return pluginMarker;
return PluginMarker.create(plugin[0], plugin[1]);
}
public static JSONObject getLatestPluginInfo(String pluginID) throws Exception {
@ -90,7 +91,11 @@ public class PluginUtils {
InputStream reader = null;
FileOutputStream writer = null;
try {
HttpClient httpClient = new HttpClient(getDownloadPath(id));
String downloadPath = getDownloadPath(id);
if (StringUtils.isBlank(downloadPath)) {
throw new PluginVerifyException(Toolkit.i18nText("Fine-Design_Basic_Plugin_Connect_Server_Error"));
}
HttpClient httpClient = new HttpClient(downloadPath);
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
int totalSize = httpClient.getContentLength();
reader = httpClient.getResponseStream();
@ -108,12 +113,12 @@ public class PluginUtils {
p.process(totalBytesRead / (double) totalSize);
}
} else {
throw new com.fr.plugin.PluginVerifyException(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Connect_Server_Error"));
throw new PluginVerifyException(Toolkit.i18nText("Fine-Design_Basic_Plugin_Connect_Server_Error"));
}
} catch (PluginVerifyException e) {
FineJOptionPane.showMessageDialog(null, e.getMessage(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE);
return false;
} catch (Exception e) {
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false;
} finally {
@ -122,7 +127,7 @@ public class PluginUtils {
return true;
}
private static void closeStream(InputStream reader, FileOutputStream writer){
private static void closeStream(InputStream reader, FileOutputStream writer) {
try {
if (null != reader) {
reader.close();
@ -136,18 +141,26 @@ public class PluginUtils {
}
}
private static String getDownloadPath(String id) throws Exception {
HashMap<String, String> map = new HashMap<String, String>();
map.put("id", id);
HttpClient httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("shop.script.download")+ "?" + FR_VERSION + "=" + ProductConstants.VERSION);
private static String getDownloadPath(String id) {
String url = CloudCenter.getInstance().acquireUrlByKind("shop.script.download");
if (StringUtils.isBlank(url)) {
return StringUtils.EMPTY;
}
HttpClient httpClient = new HttpClient(url + "?" + FR_VERSION + "=" + ProductConstants.VERSION);
httpClient.asGet();
String resText = httpClient.getResponseText();
JSONObject resultJSONObject = new JSONObject(resText);
String scriptUrl = resultJSONObject.optString("result");
String charSet = EncodeConstants.ENCODING_UTF_8;
scriptUrl = URLDecoder.decode(URLDecoder.decode(scriptUrl, charSet), charSet);
return scriptUrl;
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
String resText = httpClient.getResponseText();
JSONObject resultJSONObject = new JSONObject(resText);
String scriptUrl = resultJSONObject.optString("result");
String charSet = EncodeConstants.ENCODING_UTF_8;
try {
scriptUrl = URLDecoder.decode(URLDecoder.decode(scriptUrl, charSet), charSet);
} catch (UnsupportedEncodingException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return scriptUrl;
}
return StringUtils.EMPTY;
}
public static boolean isPluginMatch(PluginView pluginView, String text) {
@ -194,22 +207,22 @@ public class PluginUtils {
return StringUtils.EMPTY;
}
}
public static String getMessageByErrorCode(PluginBaseErrorCode errorCode) {
if(errorCode == PluginErrorCode.None){
if (errorCode == PluginErrorCode.None) {
return "";
}
return com.fr.design.i18n.Toolkit.i18nCompatibleServerText(getInterKeyByErrorCode(errorCode));
}
private static String getInterKeyByErrorCode(PluginBaseErrorCode errorCode) {
return errorCode.getDescription();
return errorCode.getDescription();
}
public static PluginMarker getInstalledPluginMarkerByID(String pluginID) {
PluginContext context = PluginManager.getContext(pluginID);
if (context != null) {
return context.getMarker();
@ -219,29 +232,30 @@ public class PluginUtils {
/**
* 在不同设计器版本下展示不同插件
*
* @return 插件
*/
public static JSONArray filterPluginsFromVersion(JSONArray oriJSONArray) throws Exception{
JSONArray resultJSONArray = JSONArray.create();
for(int i = 0; i < oriJSONArray.length(); i++){
public static JSONArray filterPluginsFromVersion(JSONArray oriJSONArray) {
JSONArray resultJSONArray = JSONArray.create();
for (int i = 0; i < oriJSONArray.length(); i++) {
JSONObject jo = oriJSONArray.getJSONObject(i);
String envVersion = jo.optString("envversion");
if(isCompatibleCurrentEnv(envVersion)){
if (isCompatibleCurrentEnv(envVersion)) {
resultJSONArray.put(jo);
}
}
return resultJSONArray;
}
private static boolean isCompatibleCurrentEnv(String envVersion){
private static boolean isCompatibleCurrentEnv(String envVersion) {
return VersionIntervalFactory.create(envVersion).contain(Version.currentEnvVersion());
}
public static JSONArray transferStorePluginToJson(PluginContext [] pluginContexts){
public static JSONArray transferStorePluginToJson(PluginContext[] pluginContexts) {
JSONArray ja = JSONArray.create();
try {
for(PluginContext pluginContext : pluginContexts){
for (PluginContext pluginContext : pluginContexts) {
JSONObject jo = JSONObject.create();
jo.put("id", pluginContext.getID());
jo.put("name", pluginContext.getName());
@ -265,7 +279,7 @@ public class PluginUtils {
jo.put("switchedReason", pluginContext.getSwitchedReason());
ja.put(jo);
}
}catch (Exception e){
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return ja;

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

@ -533,13 +533,6 @@ public class PluginWebBridge {
threadPoolExecutor.submit(task);
}
/**
* 弹出QQ授权页面
*/
public void showQQ() {
LoginWebBridge.getHelper().showQQ();
}
/**
* 通过QQ登录后通知登录
*/

234
designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java

@ -1,234 +0,0 @@
package com.fr.design.extra;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import javafx.application.Platform;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker;
import javafx.embed.swing.JFXPanel;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.ButtonBuilder;
import javafx.scene.control.LabelBuilder;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.HBoxBuilder;
import javafx.scene.paint.Color;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebEvent;
import javafx.scene.web.WebView;
import javafx.stage.Modality;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.WindowEvent;
import javafx.util.Callback;
import netscape.javascript.JSObject;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.awt.Toolkit;
/**
* Created by zhaohehe on 16/7/28.
*/
public class QQLoginWebPane extends JFXPanel {
private WebEngine webEngine;
private String url;
private static JSObject window;
private static int DEFAULT_PRIMARYSTAGE_WIDTH = 100;
private static int DEFAULT_PRIMARYSTAGE_HEIGHT = 100;
private static int DEFAULT_CONFIRM_WIDTH = 450;
private static int DEFAULT_CONFIRM_HEIGHT = 160;
private static int DEFAULT_OFFEST = 20;
class Delta {
double x, y;
}
public QQLoginWebPane(final String installHome) {
Platform.setImplicitExit(false);
Platform.runLater(new Runnable() {
@Override
public void run() {
BorderPane root = new BorderPane();
Scene scene = new Scene(root);
QQLoginWebPane.this.setScene(scene);
final WebView webView = new WebView();
webEngine = webView.getEngine();
url = "file:///" + installHome + "/scripts/qqLogin.html";
webEngine.load(url);
final Stage primaryStage = new Stage();
HBox layout = new HBox();
try {
primaryStage.initStyle(StageStyle.TRANSPARENT);
primaryStage.setScene(new Scene(layout));
webView.getScene().getStylesheets().add(IOUtils.getResource("modal-dialog.css", getClass()).toExternalForm());
primaryStage.initStyle(StageStyle.UTILITY);
primaryStage.setScene(new Scene(new Group(), DEFAULT_PRIMARYSTAGE_WIDTH, DEFAULT_PRIMARYSTAGE_HEIGHT));
primaryStage.setX(0);
primaryStage.setY(Screen.getPrimary().getBounds().getHeight() + DEFAULT_PRIMARYSTAGE_HEIGHT);
primaryStage.show();
} catch (Exception e) {
FineLoggerFactory.getLogger().info(e.getMessage());
}
webEngine.setConfirmHandler(new Callback<String, Boolean>() {
@Override
public Boolean call(String msg) {
Boolean confirmed = confirm(primaryStage, msg, webView);
return confirmed;
}
});
configWebEngine();
webView.setContextMenuEnabled(false);//屏蔽右键
root.setCenter(webView);
}
});
}
private void configWebEngine() {
webEngine.locationProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, final String oldValue, String newValue) {
disableLink(webEngine);
// webView好像默认以手机版显示网页,浏览器里过滤掉这个跳转
if (ComparatorUtils.equals(newValue, url) || ComparatorUtils.equals(newValue, CloudCenter.getInstance().acquireUrlByKind("bbs.mobile"))) {
return;
}
LoginWebBridge.getHelper().openUrlAtLocalWebBrowser(webEngine, newValue);
}
});
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() {
@Override
public void handle(WebEvent<String> event) {
showAlert(event.getData());
}
});
webEngine.getLoadWorker().stateProperty().addListener(
new ChangeListener<Worker.State>() {
public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) {
if (newState == Worker.State.SUCCEEDED) {
window = (JSObject) webEngine.executeScript("window");
window.setMember("QQLoginHelper", LoginWebBridge.getHelper());
}
}
}
);
}
private void showAlert(final String message) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
FineJOptionPane.showMessageDialog(QQLoginWebPane.this, message);
}
});
}
private void disableLink(final WebEngine eng) {
try {
// webView端不跳转 虽然webView可以指定本地浏览器打开某个链接,但是当本地浏览器跳转到指定链接的同时,webView也做了跳转,
// 为了避免出现在一个600*400的资讯框里加载整个网页的情况,webView不跳转到新网页
Platform.runLater(new Runnable() {
@Override
public void run() {
eng.executeScript("location.reload()");
LoginWebBridge.getHelper().closeQQWindow();
}
});
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
private Boolean confirm(final Stage parent, String msg, final WebView webView) {
final BooleanProperty confirmationResult = new SimpleBooleanProperty();
// initialize the confirmation dialog
final Stage dialog = new Stage(StageStyle.UTILITY);
dialog.setX(Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 2 - DEFAULT_CONFIRM_WIDTH / 2.0D + DEFAULT_OFFEST);
dialog.setY(Toolkit.getDefaultToolkit().getScreenSize().getHeight() / 2 + DEFAULT_OFFEST);
dialog.setHeight(DEFAULT_CONFIRM_HEIGHT);
dialog.setWidth(DEFAULT_CONFIRM_WIDTH);
dialog.setIconified(false);
dialog.initOwner(parent);
dialog.initModality(Modality.WINDOW_MODAL);
dialog.setScene(
new Scene(
HBoxBuilder.create().styleClass("modal-dialog").children(
LabelBuilder.create().text(msg).build(),
ButtonBuilder.create().text(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_BBSLogin_Switch_Account")).defaultButton(true).onAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
// take action and close the dialog.
confirmationResult.set(true);
webView.getEngine().reload();
dialog.close();
}
}).build(),
ButtonBuilder.create().text(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_Cancel")).cancelButton(true).onAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
// abort action and close the dialog.
confirmationResult.set(false);
dialog.close();
}
}).build()
).build()
, Color.TRANSPARENT
)
);
configDrag(dialog);
// style and show the dialog.
dialog.getScene().getStylesheets().add(IOUtils.getResource("modal-dialog.css", getClass()).toExternalForm());
dialog.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
event.consume();
dialog.close();
}
});
dialog.showAndWait();
return confirmationResult.get();
}
private void configDrag(final Stage dialog) {
// allow the dialog to be dragged around.
final Node root = dialog.getScene().getRoot();
final Delta dragDelta = new Delta();
root.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
// record a delta distance for the drag and drop operation.
dragDelta.x = dialog.getX() - mouseEvent.getScreenX();
dragDelta.y = dialog.getY() - mouseEvent.getScreenY();
}
});
root.setOnMouseDragged(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
dialog.setX(mouseEvent.getScreenX() + dragDelta.x);
dialog.setY(mouseEvent.getScreenY() + dragDelta.y);
}
});
}
}

22
designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java

@ -11,7 +11,6 @@ import com.fr.general.CommonIOUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.http.HttpClient;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
@ -32,7 +31,6 @@ import java.awt.Window;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.net.HttpURLConnection;
import java.util.concurrent.ExecutionException;
/**
@ -75,7 +73,7 @@ public class WebViewDlgHelper {
}
return;
}
String jar_version = PluginStoreConstants.getInstance().getProps(ENV_VERSION, StringUtils.EMPTY);
String jar_version = PluginStoreConstants.getProps(ENV_VERSION, StringUtils.EMPTY);
if (ComparatorUtils.equals(jar_version, ProductConstants.VERSION)) {
updateShopScripts(SHOP_SCRIPTS);
showPluginDlg();
@ -154,6 +152,7 @@ public class WebViewDlgHelper {
* @param keyword
* @param data
*/
@Deprecated
public static void showPluginInStore(String keyword, String data) {
PluginWebBridge.getHelper().showResultInStore(keyword, data);
createPluginDialog();
@ -184,21 +183,6 @@ public class WebViewDlgHelper {
}
}
public static void createQQLoginDialog() {
try {
Class<?> clazz = Class.forName("com.fr.design.extra.QQLoginWebPane");
Constructor constructor = clazz.getConstructor(String.class);
Component webPane = (Component) constructor.newInstance(new File(installHome).getAbsolutePath());
UIDialog qqLoginDialog = new QQLoginDialog(DesignerContext.getDesignerFrame(), webPane);
LoginWebBridge.getHelper().setQQDialog(qqLoginDialog);
qqLoginDialog.setVisible(true);
} catch (Throwable ignored) {
// ignored
}
}
private static void confirmDownLoadShopJS() {
int rv = FineJOptionPane.showConfirmDialog(
null,
@ -297,7 +281,7 @@ public class WebViewDlgHelper {
protected Void doInBackground() throws Exception {
String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.update");
if (url != null) {
String text = HttpToolbox.get(url + "?" + PluginUtils.FR_VERSION + "=" + ProductConstants.VERSION + "&version=" + PluginStoreConstants.getInstance().getProps("VERSION"));
String text = HttpToolbox.get(url + "?" + PluginUtils.FR_VERSION + "=" + ProductConstants.VERSION + "&version=" + PluginStoreConstants.getProps("VERSION"));
JSONObject resultJSONObject = new JSONObject(text);
String isLatest = resultJSONObject.optString("result");
if (!ComparatorUtils.equals(isLatest, LATEST)) {

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

@ -4,6 +4,7 @@ import com.fr.design.extra.PluginConstants;
import com.fr.design.extra.Process;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient;
import com.fr.stable.StringUtils;
/**
* Created by vito on 16/5/16.
@ -28,7 +29,7 @@ public class GetPluginCategoriesExecutor implements Executor {
@Override
public void run(Process<String> process) {
String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.category");
if (url != null) {
if (StringUtils.isNotEmpty(url)) {
HttpClient httpClient = new HttpClient(url);
result = httpClient.getResponseText();
} else {

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

@ -52,7 +52,7 @@ public class GetPluginFromStoreExecutor implements Executor {
@Override
public void run(Process<String> process) {
String plistUrl = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.plist") + "?";
String plistUrl = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.plist");
boolean getRecommend = StringUtils.isEmpty(category) && StringUtils.isEmpty(seller) && StringUtils.isEmpty(fee) && StringUtils.isEmpty(scope);
if (getRecommend) {
result = PluginOperateUtils.getRecommendPlugins();
@ -61,7 +61,7 @@ public class GetPluginFromStoreExecutor implements Executor {
if (StringUtils.isNotBlank(plistUrl)) {
StringBuilder url = new StringBuilder();
url.append(plistUrl);
url.append(plistUrl).append("?");
PluginOperateUtils.dealParams(url, category, seller, fee, scope);
try {
HttpClient httpClient = new HttpClient(url.toString());

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

@ -14,8 +14,8 @@ import com.fr.stable.StringUtils;
* Created by vito on 16/4/18.
*/
public class SearchOnlineExecutor implements Executor {
private String result = StringUtils.EMPTY;
private String keyword;
private String result = JSONArray.create().toString();
private final String keyword;
public SearchOnlineExecutor(String keyword) {
this.keyword = keyword;
@ -42,7 +42,11 @@ public class SearchOnlineExecutor implements Executor {
result = PluginOperateUtils.getRecommendPlugins();
return;
}
HttpClient httpClient = new HttpClient(CloudCenter.getInstance().acquireUrlByKind("shop.plugin.store") + "&keyword=" + keyword);
String url = CloudCenter.getInstance().acquireUrlByKind("shop.plugin.store");
if (StringUtils.isEmpty(url)) {
return;
}
HttpClient httpClient = new HttpClient(url + "&keyword=" + keyword);
httpClient.asGet();
String responseText = httpClient.getResponseText();
JSONObject jsonObject = new JSONObject(responseText);

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

@ -2,6 +2,7 @@ package com.fr.design.file;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.base.io.BaseBook;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.data.DesignTableDataManager;
@ -384,9 +385,14 @@ public class HistoryTemplateListCache implements CallbackEvent {
historyList.set(i, template);
// 替换当前正在编辑的模板,使用添加并激活的方式,以便使用统一的入口来处理监听事件
if (isCurrentEditingFile(template.getPath())) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(template);
setCurrentEditingTemplate(template);
FineLoggerFactory.getLogger().info("Env Change Current Editing Template.");
loadCurrentTemplate(template);
}
} else {
// 当模板为空时 说明是一个新建的未保存模板 但是内存中保存了该模板 可以从中获取
JTemplate jt = historyList.get(i);
// 另外如果该模板是正在编辑的模板,需要要激活
if (jt != null && isCurrentEditingFile(jt.getPath())) {
loadCurrentTemplate(jt);
}
}
} catch (Exception e) {
@ -400,6 +406,12 @@ public class HistoryTemplateListCache implements CallbackEvent {
FineLoggerFactory.getLogger().info("Env Change Template Loaded.");
}
private void loadCurrentTemplate(JTemplate<?, ?> template) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(template);
setCurrentEditingTemplate(template);
FineLoggerFactory.getLogger().info("Env Change Current Editing Template " + template.getTemplateName());
}
/**
* 重新载入当前模板刷新数据/对象
*/
@ -410,5 +422,4 @@ public class HistoryTemplateListCache implements CallbackEvent {
jt.refreshResource();
}
}
}

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

@ -2,7 +2,6 @@ package com.fr.design.formula;
import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.design.actions.UpdateAction;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
@ -25,7 +24,6 @@ import com.fr.log.FineLoggerFactory;
import com.fr.parser.FRLexer;
import com.fr.parser.FRParser;
import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.stable.script.Expression;
@ -54,7 +52,10 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
import java.util.Locale;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
* 公式编辑面板
@ -413,14 +414,19 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
if (keyWord.length() != 0) {
NameAndDescription[] descriptions = FunctionConstants.ALL.getDescriptions();
int lengthOfDes = descriptions.length;
List<String> list = new ArrayList<>();
for (int i = 0; i < lengthOfDes; i++) {
NameAndDescription and = descriptions[i];
String functionName = and.searchResult(keyWord, findDescription);
if (StringUtils.isNotBlank(functionName)) {
listModel.addElement(functionName);
list.add(functionName);
}
}
Collections.sort(list, new SimilarComparator(keyWord));
for (String name : list) {
listModel.addElement(name);
}
if (!listModel.isEmpty()) {
tipsList.setSelectedIndex(0);
@ -969,6 +975,26 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
}
}
public static class SimilarComparator implements Comparator<String> {
private String searchKey;
public SimilarComparator(String searchKey) {
this.searchKey = searchKey.toLowerCase();
}
@Override
public int compare(String o1, String o2) {
if (o1.toLowerCase().startsWith(searchKey)) {
return -1;
}
if (o2.toLowerCase().startsWith(searchKey)) {
return 1;
}
return o2.compareTo(o1);
}
}
public static class TextFolderUserObject {
private String text;

28
designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java

@ -220,8 +220,8 @@ public class JavaEditorPane extends BasicPane {
" }\n" +
"\n" +
" /**\n" +
" * 获取数据集的列数\n" +
" * @return 数据集的列\n" +
" * Get the number of columns in a dataset\n" +
" * @return Dataset columns\n" +
" * @throws TableDataException\n" +
" */\n" +
" public int getColumnCount() throws TableDataException {\n" +
@ -229,9 +229,9 @@ public class JavaEditorPane extends BasicPane {
" }\n" +
"\n" +
" /**\n" +
" * 获取数据集指定列的列名\n" +
" * @param columnIndex 指定列的索引\n" +
" * @return 指定列的列名\n" +
" * Get the column name of the specified column of the dataset\n" +
" * @param columnIndex The index of the specified column\n" +
" * @return The column name of the specified column\n" +
" * @throws TableDataException\n" +
" */\n" +
" public String getColumnName(int columnIndex) throws TableDataException {\n" +
@ -239,8 +239,8 @@ public class JavaEditorPane extends BasicPane {
" }\n" +
"\n" +
" /**\n" +
" * 获取数据集的行数\n" +
" * @return 数据集数据行数\n" +
" * Get the number of rows in the dataset\n" +
" * @return Dataset rows\n" +
" * @throws TableDataException\n" +
" */\n" +
" public int getRowCount() throws TableDataException {\n" +
@ -248,10 +248,10 @@ public class JavaEditorPane extends BasicPane {
" }\n" +
"\n" +
" /**\n" +
" * 获取数据集指定位置上的值\n" +
" * @param rowIndex 指定的行索引\n" +
" * @param columnIndex 指定的列索引\n" +
" * @return 指定位置的值\n" +
" * Get the value at the specified position in the dataset\n" +
" * @param rowIndex The specified row index\n" +
" * @param columnIndex The specified column index\n" +
" * @return The value of the specified location\n" +
" */\n" +
" public Object getValueAt(int rowIndex, int columnIndex) {\n" +
" return null;\n" +
@ -263,12 +263,12 @@ public class JavaEditorPane extends BasicPane {
"import com.fr.script.AbstractFunction;\n" +
"\n" +
"/**\n" +
" * 自定义函数\n" +
" * Custom function\n" +
" */\n" +
"public class CustomFun extends AbstractFunction {\n" +
" /**\n" +
" * @param args 函数的参数,是经过了算子处理了其中特殊参数的\n" +
" * @return 经过函数处理的值,用于参与最终计算\n" +
" * @param args The parameters of the function are processed by calculator with special parameters\n" +
" * @return The value processed by the function is used to participate in the final calculation\n" +
" */\n" +
" public Object run(Object[] args) {\n" +
" return null;\n" +

28
designer-base/src/main/java/com/fr/design/fun/CellExpandAttrPanelProvider.java

@ -0,0 +1,28 @@
package com.fr.design.fun;
import com.fr.design.beans.BasicBeanPane;
import com.fr.report.cell.TemplateCellElement;
import com.fr.stable.fun.mark.Mutable;
/**
* @author yaohwu
* created by yaohwu at 2020/4/26 15:50
*/
public interface CellExpandAttrPanelProvider extends Mutable {
String MARK_STRING = "CellExpandAttrPanelProvider";
int CURRENT_LEVEL = 1;
/**
* @return 创建单元格属性-扩展设置中的额外面板
*/
BasicBeanPane<TemplateCellElement> createPanel();
/**
* 是否应该展示
*
* @return return {@code true} if extra panel is displayable
*/
boolean isDisplayable();
}

14
designer-base/src/main/java/com/fr/design/fun/ChartWidgetOptionProvider.java

@ -0,0 +1,14 @@
package com.fr.design.fun;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-06-12
*/
public interface ChartWidgetOptionProvider extends ParameterWidgetOptionProvider {
String XML_TAG = "ChartWidgetOptionProvider";
//在图表区域的开头还是结尾插入
boolean isBefore();
}

45
designer-base/src/main/java/com/fr/design/fun/ClipboardHandlerProvider.java

@ -0,0 +1,45 @@
package com.fr.design.fun;
import com.fr.stable.fun.mark.Mutable;
/**
* created by Harrison on 2020/05/14
**/
public interface ClipboardHandlerProvider<T> extends Mutable {
String XML_TAG = "ClipboardHandlerProvider";
int CURRENT_LEVEL = 1;
/**
* 剪切
*
* @param selection 选中
* @return 处理后的内容
*/
T cut(T selection);
/**
* 复制
*
* @param selection 选中
* @return 处理后的内容
*/
T copy(T selection);
/**
* 粘贴
*
* @param selection 选中
* @return 处理后的内容
*/
T paste(T selection);
/**
* 支持的类型
*
* @param selection 内容
* @return 是否
*/
boolean support(Object selection);
}

57
designer-base/src/main/java/com/fr/design/fun/ComponentLibraryPaneProcessor.java

@ -0,0 +1,57 @@
package com.fr.design.fun;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.mainframe.DockingView;
import com.fr.stable.fun.mark.Immutable;
import javax.swing.JPanel;
/**
* 组件库面板处理器
*
* created by Harrison on 2020/03/16
**/
public interface ComponentLibraryPaneProcessor extends Immutable {
String XML_TAG = "ComponentLibraryPaneProcessor";
int CURRENT_LEVEL = 1;
/**
* 创建展示面板
*
* @param isEdit 是否可以编辑
* @return 展示面板
*/
UIScrollPane createShowPanel(boolean isEdit);
/**
* 创建菜单的上部面板
*
* @return 面板
*/
JPanel createMenuNorthPane();
/**
* 创建复选框
*
* @return 复选框
*/
UIComboBox createMenuComBox();
void parentView(DockingView dockingView);
/**
* 父面板
*
* @param panel 面板
*/
void parentPane(JPanel panel);
/**
* 创建完成
*/
void complete();
}

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

@ -0,0 +1,23 @@
package com.fr.design.fun;
import com.fr.stable.fun.mark.Mutable;
import com.fr.start.BaseDesigner;
/**
* 设计器启动类替换接口
*
* @author hades
* @version 10.0
* Created by hades on 2020/5/7
*/
public interface DesignerStartClassProcessor extends Mutable {
String MARK_STRING = "DesignerStartClassProcessor";
int CURRENT_LEVEL = 1;
Class<? extends BaseDesigner> transform();
}

40
designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java

@ -0,0 +1,40 @@
package com.fr.design.fun;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.ShortCut;
import com.fr.stable.fun.mark.Immutable;
import javax.swing.JComponent;
import java.awt.Dimension;
import java.awt.image.BufferedImage;
/**
* Created by kerry on 2020-04-09
* 临时接口后续自适应内置后删除
*/
public interface FormAdaptiveConfigUIProcessor extends Immutable {
String MARK_STRING = "FormAdaptiveConfigUIProcessor";
int CURRENT_LEVEL = 1;
/**
* 获取表单自适应配置菜单
* @return 表单自适应配置菜单
*/
ShortCut getConfigShortCut(JTemplate jTemplate);
/**
* 是否开启表单滑块缩放功能
* @return 是否开启表单滑块缩放
*/
boolean openFormSliderZoom();
/**
* 获取新自适应下字体显示的dpi
* @return dpi
*/
int fontResolution();
}

7
designer-base/src/main/java/com/fr/design/fun/FormWidgetOptionProvider.java

@ -16,4 +16,11 @@ public interface FormWidgetOptionProvider extends ParameterWidgetOptionProvider
*/
boolean isContainer();
/**
* 如果是布局容器要实现粘贴到容器中的操作
* @param t
* @param <T> 泛型参数 表示选中的组件 一般为FormSelection
*/
<T> void paste2Container(T t);
}

25
designer-base/src/main/java/com/fr/design/fun/MobileTemplateStyleProvider.java

@ -0,0 +1,25 @@
package com.fr.design.fun;
import com.fr.design.beans.BasicBeanPane;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.stable.fun.mark.Mutable;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/31
*/
public interface MobileTemplateStyleProvider extends Mutable {
String XML_TAG = "MobileTemplateStyleProvider";
int CURRENT_LEVEL = 1;
Class<? extends MobileTemplateStyle> classFroMobileTemplateStyle();
Class<? extends BasicBeanPane<MobileTemplateStyle>> classFroMobileTemplateStyleAppearance();
String displayName();
}

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

@ -0,0 +1,50 @@
package com.fr.design.fun;
import com.fr.design.mainframe.PaneHolder;
import com.fr.design.mainframe.PropertyItemBean;
import com.fr.stable.fun.mark.Mutable;
import org.jetbrains.annotations.Nullable;
/**
* created by Harrison on 2020/03/23
**/
public interface PropertyItemPaneProvider<T> extends Mutable {
int CURRENT_LEVEL = 1;
String XML_TAG = "PropertyItemPaneProvider";
int FIRST = 100;
int LAST = -100;
/**
* 独一无二的标志
*
* @return 标志
*/
String key();
/**
* 配置属性
*
* @return 熟悉
*/
PropertyItemBean getItem();
/**
* 面板持有者
*
* @param clazz 类型
* @return 持有者
*/
@Nullable
PaneHolder<T> getPaneHolder(Class<?> clazz);
/**
* 想要替代的类型
*
* @return 替代类型
*/
String replaceKey();
}

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

@ -0,0 +1,39 @@
package com.fr.design.fun;
import com.fr.stable.fun.mark.Mutable;
import com.fr.stable.unit.UNIT;
/**
* Created by kerry on 2020-04-09
*/
public interface ReportLengthUNITProvider extends Mutable {
String MARK_STRING = "ReportLengthUNITProvider";
int CURRENT_LEVEL = 1;
/**
* 标尺单位显示字符
* @return 标尺单位字符
*/
String unitText();
/**
* 标尺单位类型(之前是将int类型的值直接保存在数据库里面的)
* @return 返回标尺单位类型
*/
int unitType();
/**
* UNIT转标尺单位值
* @param value UNIT
* @return 标尺单位值
*/
float unit2Value4Scale(UNIT value);
/**
* 标尺单位值转UNIT
* @param value 标尺单位值
* @return UNIT
*/
UNIT float2UNIT(float value);
}

43
designer-base/src/main/java/com/fr/design/fun/impl/AbstractCellExpandAttrPanelProvider.java

@ -0,0 +1,43 @@
package com.fr.design.fun.impl;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.CellExpandAttrPanelProvider;
import com.fr.report.cell.TemplateCellElement;
import com.fr.stable.fun.mark.API;
/**
* @author yaohwu
* created by yaohwu at 2020/4/26 16:08
*/
@API(level = CellExpandAttrPanelProvider.CURRENT_LEVEL)
public class AbstractCellExpandAttrPanelProvider implements CellExpandAttrPanelProvider {
/**
* 当前接口的API等级,用于判断是否需要升级插件
*
* @return API等级
*/
@Override
public int currentAPILevel() {
return CellExpandAttrPanelProvider.CURRENT_LEVEL;
}
/**
* 获取当前provider的标记可以使用类路径保证唯一以避免provider的重复加载
*
* @return 当前provider的标记
*/
@Override
public String mark4Provider() {
return null;
}
@Override
public BasicBeanPane<TemplateCellElement> createPanel() {
return null;
}
public boolean isDisplayable() {
return true;
}
}

29
designer-base/src/main/java/com/fr/design/fun/impl/AbstractChartWidgetOptionProvider.java

@ -0,0 +1,29 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.ChartWidgetOptionProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-06-12
*/
@API(level = ChartWidgetOptionProvider.CURRENT_LEVEL)
public abstract class AbstractChartWidgetOptionProvider extends AbstractProvider implements ChartWidgetOptionProvider {
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
@Override
public boolean isBefore() {
return false;
}
}

17
designer-base/src/main/java/com/fr/design/fun/impl/AbstractClipboardHandlerProvider.java

@ -0,0 +1,17 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.ClipboardHandlerProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* created by Harrison on 2020/05/14
**/
@API(level = ClipboardHandlerProvider.CURRENT_LEVEL)
public abstract class AbstractClipboardHandlerProvider<T> extends AbstractProvider implements ClipboardHandlerProvider<T> {
@Override
public int currentAPILevel() {
return ClipboardHandlerProvider.CURRENT_LEVEL;
}
}

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

@ -0,0 +1,23 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.DesignerStartClassProcessor;
import com.fr.stable.fun.mark.API;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/5/7
*/
@API(level = DesignerStartClassProcessor.CURRENT_LEVEL)
public abstract class AbstractDesignerStartClassProcessorProcessor implements DesignerStartClassProcessor {
@Override
public String mark4Provider() {
return getClass().getName();
}
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
}

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

@ -0,0 +1,23 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.FormAdaptiveConfigUIProcessor;
import com.fr.stable.fun.mark.API;
/**
* Created by kerry on 2020-04-09
*/
@API(level = FormAdaptiveConfigUIProcessor.CURRENT_LEVEL)
public abstract class AbstractFormAdaptiveConfigUIProcessor implements FormAdaptiveConfigUIProcessor {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

5
designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormWidgetOptionProvider.java

@ -25,4 +25,9 @@ public abstract class AbstractFormWidgetOptionProvider extends AbstractProvider
public boolean isContainer() {
return false;
}
@Override
public <T> void paste2Container(T t) {
// do nothing
}
}

25
designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileTemplateStyleProvider.java

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

31
designer-base/src/main/java/com/fr/design/fun/impl/AbstractPropertyItemPaneProvider.java

@ -0,0 +1,31 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.PropertyItemPaneProvider;
import com.fr.design.mainframe.PaneHolder;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* created by Harrison on 2020/03/23
**/
@API(level = PropertyItemPaneProvider.CURRENT_LEVEL)
public abstract class AbstractPropertyItemPaneProvider<T> extends AbstractProvider implements PropertyItemPaneProvider<T> {
@Override
public PaneHolder<T> getPaneHolder(Class<?> clazz) {
if (sign().equals(clazz)) {
return getPathHolder0();
}
return null;
}
protected abstract PaneHolder<T> getPathHolder0();
protected abstract Class<T> sign();
@Override
public int currentAPILevel() {
return PropertyItemPaneProvider.CURRENT_LEVEL;
}
}

42
designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportLengthUNITProvider.java

@ -0,0 +1,42 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
import com.fr.stable.unit.UNIT;
/**
* Created by kerry on 2020-04-09
*/
@API(level = ReportLengthUNITProvider.CURRENT_LEVEL)
public abstract class AbstractReportLengthUNITProvider extends AbstractProvider implements ReportLengthUNITProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String unitText() {
return StringUtils.EMPTY;
}
@Override
public int unitType() {
return 0;
}
@Override
public float unit2Value4Scale(UNIT value) {
return 0;
}
@Override
public UNIT float2UNIT(float value) {
return UNIT.ZERO;
}
}

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

@ -29,11 +29,11 @@ import com.fr.design.gui.itoolbar.UIToolBarBorder;
import com.fr.design.gui.itoolbar.UIToolBarSeparatorUI;
import com.fr.design.gui.itooltip.UIToolTipBorder;
import com.fr.design.gui.itree.UITreeUI;
import com.fr.design.i18n.Toolkit;
import com.fr.log.FineLoggerFactory;
import com.fr.general.IOUtils;
import javax.swing.ImageIcon;
import javax.swing.UIDefaults;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.plaf.BorderUIResource;
@ -52,6 +52,12 @@ import java.net.URL;
*/
public class UILookAndFeel extends MetalLookAndFeel {
static {
UIManager.put("ProgressMonitor.progressText", Toolkit.i18nText("Fine-Design_Basic_ProgressBar_Title"));
UIManager.put("OptionPane.cancelButtonText", Toolkit.i18nText("Fine-Design_Basic_Cancel"));
}
public static boolean CONTROL_PANEL_INSTANTIATED = false;

6
designer-base/src/main/java/com/fr/design/gui/frpane/EditingStringListPane.java

@ -3,6 +3,7 @@ package com.fr.design.gui.frpane;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.JListUtils;
@ -150,7 +151,10 @@ public abstract class EditingStringListPane extends BasicBeanPane<List<String>>
public void actionPerformed(ActionEvent e) {
Object selected = jlist.getSelectedValue();
if (selected != null) {
int re = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(EditingStringListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sure_To_Delete") + selected.toString() + "?");
int re = FineJOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(EditingStringListPane.this),
Toolkit.i18nText("Fine-Design_Basic_Sure_To_Delete") + selected.toString() + "?",
Toolkit.i18nText("Fine-Design_Basic_Confirm"),
JOptionPane.OK_CANCEL_OPTION);
if (re == JOptionPane.OK_OPTION) {
JListUtils.removeSelectedListItems(jlist);
}

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

@ -2,9 +2,9 @@ package com.fr.design.gui.frpane;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.UIDialog;
import com.fr.design.utils.AWTUtilities;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Constants;
import com.sun.awt.AWTUtilities;
import javax.swing.JComponent;
import javax.swing.JPanel;

13
designer-base/src/main/java/com/fr/design/gui/frpane/tree/layer/config/LayerDataConfigPane.java

@ -7,6 +7,7 @@ import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.present.dict.TableDataDictPane;
import com.fr.form.ui.tree.LayerConfig;
import com.fr.form.ui.tree.LayerDependence;
import com.fr.stable.StringUtils;
import java.awt.*;
import java.util.*;
@ -73,13 +74,19 @@ public class LayerDataConfigPane extends BasicBeanPane<LayerConfig> {
if (wrapper != null) {
columnNames = wrapper.calculateColumnNameList();
} else {
columnNames = new ArrayList<String>();
columnNames = new ArrayList<>();
}
String viewColStr = tableDataDictPane.updateBean().getValueColumnName();
String modelColStr = tableDataDictPane.updateBean().getKeyColumnName();
TableDataDictionary dictionary = tableDataDictPane.updateBean();
String viewColStr = dictionary.getValueColumnName();
String modelColStr = dictionary.getKeyColumnName();
int viewCol = columnNames.indexOf(viewColStr);
int modelCol = columnNames.indexOf(modelColStr);
if (StringUtils.EMPTY.equals(viewColStr)) {
viewCol = dictionary.getValueColumnIndex();
}
if (StringUtils.EMPTY.equals(modelColStr)) {
modelCol = dictionary.getKeyColumnIndex();
}
//将数据设置到当前正在修改的layerData中
this.layerConfig.setDictionary(dictionary);
this.layerConfig.setModelColumn(modelCol);

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

@ -22,6 +22,8 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam
private GlobalNameListener globalNameListener = null;
private String radioButtonName = StringUtils.EMPTY;
private boolean markMnemonic = true;
public UIRadioButton() {
super();
initListener();
@ -58,6 +60,13 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam
initComponent();
}
public UIRadioButton(String text, boolean selected, boolean markMnemonic) {
super(text, selected);
initListener();
initComponent();
this.markMnemonic = markMnemonic;
}
public UIRadioButton(String text, Icon icon) {
super(text, icon);
initListener();
@ -70,6 +79,13 @@ public class UIRadioButton extends JRadioButton implements UIObserver, GlobalNam
initListener();
}
public void setMnemonic(char mnemonic) {
super.setMnemonic(mnemonic);
if (!markMnemonic) {
setDisplayedMnemonicIndex(-1);
}
}
private void initListener() {
if (shouldResponseChangeListener()) {
this.addItemListener(new ItemListener() {

121
designer-base/src/main/java/com/fr/design/gui/ibutton/UIRadioButtonUI.java

@ -5,9 +5,12 @@ import com.fr.design.utils.ThemeUtils;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.plaf.metal.MetalRadioButtonUI;
import java.awt.*;
import java.awt.event.KeyEvent;
import javax.swing.text.View;
import sun.swing.SwingUtilities2;
/**
* Created by IntelliJ IDEA.
@ -84,6 +87,124 @@ public class UIRadioButtonUI extends MetalRadioButtonUI {
return radioButton;
}
// ********************************
// Paint Methods
// ********************************
public synchronized void paint(Graphics g, JComponent c) {
AbstractButton b = (AbstractButton) c;
ButtonModel model = b.getModel();
Dimension size = c.getSize();
int w = size.width;
int h = size.height;
Font f = c.getFont();
g.setFont(f);
FontMetrics fm = SwingUtilities2.getFontMetrics(c, g, f);
Rectangle viewRect = new Rectangle(size);
Rectangle iconRect = new Rectangle();
Rectangle textRect = new Rectangle();
Insets i = c.getInsets();
viewRect.x += i.left;
viewRect.y += i.top;
viewRect.width -= (i.right + viewRect.x);
viewRect.height -= (i.bottom + viewRect.y);
Icon altIcon = b.getIcon();
Icon selectedIcon = null;
Icon disabledIcon = null;
String text = SwingUtilities.layoutCompoundLabel(
c, fm, b.getText(), altIcon != null ? altIcon : getDefaultIcon(),
b.getVerticalAlignment(), b.getHorizontalAlignment(),
b.getVerticalTextPosition(), b.getHorizontalTextPosition(),
viewRect, iconRect, textRect, b.getIconTextGap());
// fill background
if (c.isOpaque()) {
g.setColor(b.getBackground());
g.fillRect(0, 0, size.width, size.height);
}
// Paint the radio button
if (altIcon != null) {
if (!model.isEnabled()) {
if (model.isSelected()) {
altIcon = b.getDisabledSelectedIcon();
} else {
altIcon = b.getDisabledIcon();
}
} else if (model.isPressed() && model.isArmed()) {
altIcon = b.getPressedIcon();
if (altIcon == null) {
// Use selected icon
altIcon = b.getSelectedIcon();
}
} else if (model.isSelected()) {
if (b.isRolloverEnabled() && model.isRollover()) {
altIcon = b.getRolloverSelectedIcon();
if (altIcon == null) {
altIcon = b.getSelectedIcon();
}
} else {
altIcon = b.getSelectedIcon();
}
} else if (b.isRolloverEnabled() && model.isRollover()) {
altIcon = b.getRolloverIcon();
}
if (altIcon == null) {
altIcon = b.getIcon();
}
altIcon.paintIcon(c, g, iconRect.x, iconRect.y);
} else {
getDefaultIcon().paintIcon(c, g, iconRect.x, iconRect.y);
}
// Draw the Text
if (text != null) {
View v = (View) c.getClientProperty(BasicHTML.propertyKey);
if (v != null) {
v.paint(g, textRect);
} else {
int mnemIndex = b.getDisplayedMnemonicIndex();
if (model.isEnabled()) {
// *** paint the text normally
g.setColor(b.getForeground());
} else {
// *** paint the text disabled
g.setColor(getDisabledTextColor());
}
if (markMnemonic(text, mnemIndex)) {
SwingUtilities2.drawStringUnderlineCharAt(c, g, text,
mnemIndex, textRect.x, textRect.y + fm.getAscent());
} else {
SwingUtilities2.drawString(c, g, text, textRect.x, textRect.y + fm.getAscent());
}
}
if (b.hasFocus() && b.isFocusPainted() &&
textRect.width > 0 && textRect.height > 0) {
paintFocus(g, textRect, size);
}
}
}
/**
* @param text
* @param mnemIndex 助记符在text中的索引
* @return true:需要给助记符画一个下划线
*/
private boolean markMnemonic(String text, int mnemIndex) {
return mnemIndex > 0 && text != null && text.length() > 0 && text.length() > mnemIndex;
}
/**
* Paints the focus for the radiobutton

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

@ -34,6 +34,7 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null;
private String checkboxName = "";
private boolean markMnemonic = true;
public UICheckBox(String string) {
super(string);
@ -53,6 +54,13 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
initListener();
}
public UICheckBox(String locText, boolean b, boolean markMnemonic) {
super(locText, b);
setUI(new UICheckBoxUI());
initListener();
this.markMnemonic=markMnemonic;
}
public UICheckBox(String text, Icon icon) {
super(text, icon);
setUI(new UICheckBoxUI());
@ -189,14 +197,18 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
if (v != null) {
v.paint(g, textRect);
} else {
int mnemIndex = b.getDisplayedMnemonicIndex();
if (model.isEnabled()) {
g.setColor(b.getForeground());
} else {
g.setColor(getDisabledTextColor());
}
SwingUtilities2.drawStringUnderlineCharAt(c, g, text,
mnemIndex, textRect.x, textRect.y + fm.getAscent());
if (markMnemonic) {
SwingUtilities2.drawStringUnderlineCharAt(c, g, text,
b.getDisplayedMnemonicIndex(), textRect.x, textRect.y + fm.getAscent());
} else {
SwingUtilities2.drawString(c, g, text, textRect.x, textRect.y + fm.getAscent());
}
}
}
}

52
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java

@ -11,6 +11,10 @@ import com.fr.general.IOUtils;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
@ -22,10 +26,6 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public class UICheckListPopup extends UIPopupMenu {
private List<ActionListener> listeners = new ArrayList<ActionListener>();
@ -36,14 +36,20 @@ public class UICheckListPopup extends UIPopupMenu {
private UIScrollPane jScrollPane;
private Color mouseEnteredColor = UIConstants.CHECKBOX_HOVER_SELECTED;
private int maxDisplayNumber = 8;
private boolean supportSelectAll = true;
public static final String COMMIT_EVENT = "commit";
public static final String SELECT_ALL = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Choose_All");
private static final String SELECT_ALL = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Choose_All");
private static final int CHECKBOX_HEIGHT = 25;
public UICheckListPopup(Object[] value) {
public UICheckListPopup(Object[] values) {
this(values, true);
}
public UICheckListPopup(Object[] value, boolean supportSelectAll) {
super();
values = value;
this.supportSelectAll = supportSelectAll;
initComponent();
}
@ -53,7 +59,7 @@ public class UICheckListPopup extends UIPopupMenu {
public void setMaxDisplayNumber(int maxDisplayNumber) {
this.maxDisplayNumber = maxDisplayNumber;
addCheckboxValues(values);
addCheckboxValues();
}
private void initComponent() {
@ -65,16 +71,23 @@ public class UICheckListPopup extends UIPopupMenu {
this.setLayout(new BorderLayout());
this.add(jScrollPane, BorderLayout.CENTER);
addCheckboxValues(values);
addCheckboxValues();
}
public void refreshCheckboxValues(Object[] values){
this.values = values;
addCheckboxValues();
}
public void addCheckboxValues(Object[] value) {
private void addCheckboxValues() {
checkboxPane.removeAll();
checkBoxList.clear();
//全选加在第一个位置
addOneCheckValue(SELECT_ALL);
for (Object checkValue : value) {
if (supportSelectAll) {
addOneCheckValue(SELECT_ALL);
}
for (Object checkValue : values) {
addOneCheckValue(checkValue);
}
addSelectListener();
@ -146,7 +159,7 @@ public class UICheckListPopup extends UIPopupMenu {
private void addSelectListener() {
for (int i = 0; i < checkBoxList.size(); i++) {
JCheckBox checkBox = checkBoxList.get(i);
if (i == 0) {
if (supportSelectAll && i == 0) {
checkBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
@ -184,7 +197,8 @@ public class UICheckListPopup extends UIPopupMenu {
List<Object> allValue = Arrays.asList(values);
for (Object value : selectedValues.keySet()) {
int index = allValue.indexOf(value);
checkBoxList.get(index + 1).setSelected(selectedValues.get(value));
index = supportSelectAll ? index + 1 : index;
checkBoxList.get(index).setSelected(selectedValues.get(value));
}
}
@ -196,15 +210,19 @@ public class UICheckListPopup extends UIPopupMenu {
public Object[] getSelectedValues() {
List<Object> selectedValues = new ArrayList<Object>();
int selectCount = 0;
for (int i = 1; i < checkBoxList.size(); i++) {
int startIndex = supportSelectAll ? 1 : 0;
for (int i = startIndex; i < checkBoxList.size(); i++) {
if (checkBoxList.get(i).isSelected()) {
selectedValues.add(values[i - 1]);
int valueIndex = supportSelectAll ? i - 1 : i;
selectedValues.add(values[valueIndex]);
selectCount++;
}
}
//全选半选切换
switchSelectIcon(selectCount);
if (supportSelectAll) {
switchSelectIcon(selectCount);
}
return selectedValues.toArray(new Object[selectedValues.size()]);
}

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

@ -17,6 +17,9 @@ import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
@ -29,9 +32,6 @@ import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 设计器下拉复选框组件
@ -59,8 +59,18 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private String multiComboName = StringUtils.EMPTY;
private boolean showOmitText = true;
private boolean supportSelectAll = true;
public UIComboCheckBox(Object[] value) {
this(value, DEFAULT_VALUE_SPERATOR);
this(value, DEFAULT_VALUE_SPERATOR, true);
}
public UIComboCheckBox(Object[] value, boolean supportSelectAll) {
this(value, DEFAULT_VALUE_SPERATOR, supportSelectAll);
}
public UIComboCheckBox(Object[] values, String valueSperator) {
this(values, valueSperator, true);
}
/**
@ -69,8 +79,9 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
* @param value
* @param valueSperator
*/
public UIComboCheckBox(Object[] value, String valueSperator) {
public UIComboCheckBox(Object[] value, String valueSperator, boolean supportSelectAll) {
values = value;
this.supportSelectAll = supportSelectAll;
this.valueSperator = valueSperator;
initComponent();
}
@ -102,7 +113,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private void initComponent() {
this.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
this.popup = new UICheckListPopup(values);
this.popup = new UICheckListPopup(values, supportSelectAll);
this.popup.addActionListener(new PopupAction());
this.editor = createEditor();
this.arrowButton = createArrowButton();
@ -198,7 +209,8 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
*/
public void refreshCombo(Object[] value) {
this.values = value;
this.popup.addCheckboxValues(value);
//CHART-13666 控件之前的刷新有bug,没有刷新popup中values的值,导致数组越界
this.popup.refreshCheckboxValues(value);
}
/**
@ -360,6 +372,14 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
popup.setSelectedValue(map);
}
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
this.popup.setEnabled(enabled);
this.editor.setEnabled(enabled);
this.arrowButton.setEnabled(enabled);
}
/**
* 简单的测试demo
* @param args

103
designer-base/src/main/java/com/fr/design/gui/ifilechooser/AbstractFileChooser.java

@ -0,0 +1,103 @@
package com.fr.design.gui.ifilechooser;
import javax.swing.filechooser.FileFilter;
import java.awt.*;
import java.io.File;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/3/31
*/
public abstract class AbstractFileChooser {
/**
* 返回当前目录
*
*/
public abstract File getCurrentDirectory();
/**
* 返回当前的文件选择过滤器
*
*/
public abstract FileFilter getFileFilter();
/**
* 返回选择的文件
*
*/
public abstract File getSelectedFile();
/**
* 多文件选择模式下 返回选择的多个文件
*
*/
public abstract File[] getSelectedFiles();
/**
* 是否可以选择多个文件
*
*/
public abstract boolean isMultiSelectionEnabled();
/**
* 设置当前选择的目录
*
*/
public abstract void setCurrentDirectory(File dir);
/**
* 设置左上角标题
*
*/
public abstract void setDialogTitle(String title);
/**
* 设置当前的文件过滤器
*
*/
public abstract void setFileFilter(final FileFilter filter);
/**
* 设置文件选择器模式
*
* JFileChooser.FILES_ONLY
* JFileChooser.DIRECTORIES_ONLY
* JFileChooser.FILES_AND_DIRECTORIES
*/
public abstract void setFileSelectionMode(int selectionMode);
/**
* 设置是否允许选择多个文件
*
*/
public abstract void setMultiSelectionEnabled(boolean multiple);
/**
* 设置选择的文件 用于showSaveDialog
*
*/
public abstract void setSelectedFile(File file);
/**
* 弹出文件选择器 打开文件
*
*/
public abstract int showOpenDialog(Component parent);
/**
* 弹出文件选择器 保存文件
*
*/
public abstract int showSaveDialog(Component parent);
/**
* https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4031440
*
* 设置文件名后缀 起到文件过滤的作用 形如 "*.jpg;*.jpeg"
*
*/
public abstract void setExtensionFilter(String file);
}

154
designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java

@ -0,0 +1,154 @@
package com.fr.design.gui.ifilechooser;
import com.fr.design.gui.ifilechooser.AbstractFileChooser;
import com.fr.design.mainframe.DesignerContext;
import com.fr.stable.os.OperatingSystem;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import java.awt.*;
import java.io.File;
import java.io.FilenameFilter;
/**
* 系统原生风格的文件选择器
*
* jdk问题
* https://bugs.openjdk.java.net/browse/JDK-4811090 不支持文件扩展选择
* https://stackoverflow.com/questions/40713398/filter-not-working-in-filedialog windows下 setFilenameFilter不work
*
* @author hades
* @version 10.0
* Created by hades on 2020/3/31
*/
public class UINativeFileChooser extends AbstractFileChooser {
private final FileDialog fileDialog;
private FileFilter fileFilter;
private int selectionMode;
public UINativeFileChooser(File file) {
fileDialog = new FileDialog(DesignerContext.getDesignerFrame());
if (file != null) {
fileDialog.setDirectory(file.getAbsolutePath());
fileDialog.setFile(file.toString());
}
}
public UINativeFileChooser() {
this(null);
}
@Override
public File getCurrentDirectory() {
return new File(fileDialog.getDirectory());
}
@Override
public FileFilter getFileFilter() {
return fileFilter;
}
@Override
public File getSelectedFile() {
return new File(fileDialog.getDirectory() + fileDialog.getFile());
}
@Override
public File[] getSelectedFiles() {
return fileDialog.getFiles();
}
@Override
public boolean isMultiSelectionEnabled() {
return fileDialog.isMultipleMode();
}
@Override
public void setCurrentDirectory(File f) {
fileDialog.setDirectory(f.toString());
}
@Override
public void setDialogTitle(String title) {
fileDialog.setTitle(title);
}
@Override
public void setFileFilter(final FileFilter cff) {
FilenameFilter filter = new FilenameFilter() {
@Override
public boolean accept(File Directory, String fileName) {
return cff.accept(new File(Directory.getAbsolutePath() + fileName));
}
};
fileDialog.setFilenameFilter(filter);
fileFilter = cff;
}
@Override
public void setFileSelectionMode(int selectionMode) {
this.selectionMode = selectionMode;
}
@Override
public void setMultiSelectionEnabled(boolean multiple) {
fileDialog.setMultipleMode(multiple);
}
@Override
public void setSelectedFile(File file) {
fileDialog.setDirectory(file.getAbsolutePath());
fileDialog.setFile(file.getName());
}
@Override
public int showOpenDialog(Component parent) {
boolean appleProperty = OperatingSystem.isMacos() && selectionMode == JFileChooser.DIRECTORIES_ONLY;
if (appleProperty) {
System.setProperty("apple.awt.fileDialogForDirectories", "true");
}
try {
fileDialog.setLocale(JComponent.getDefaultLocale());
fileDialog.setMode(FileDialog.LOAD);
fileDialog.setVisible(true);
return fileDialog.getFile() == null ? JFileChooser.CANCEL_OPTION : JFileChooser.APPROVE_OPTION;
} finally {
if (appleProperty) {
System.setProperty("apple.awt.fileDialogForDirectories", "false");
}
}
}
@Override
public int showSaveDialog(Component parent) {
fileDialog.setLocale(JComponent.getDefaultLocale());
fileDialog.setMode(FileDialog.SAVE);
fileDialog.setVisible(true);
return fileDialog.getFile() == null ? JFileChooser.CANCEL_OPTION : JFileChooser.APPROVE_OPTION;
}
@Override
public void setExtensionFilter(String file) {
fileDialog.setFile(file);
}
/**
* 确认本地文件选择器是否支持选择模式
* @param selectionMode 选择模式
* @return 是否支持选择模式
*/
public static boolean supportsSelectionMode(int selectionMode) {
switch (selectionMode) {
case JFileChooser.FILES_AND_DIRECTORIES:
return false;
case JFileChooser.DIRECTORIES_ONLY:
return OperatingSystem.isMacos();
case JFileChooser.FILES_ONLY:
default:
return true;
}
}
}

10
designer-base/src/main/java/com/fr/design/gui/ilist/TableViewList.java

@ -91,10 +91,10 @@ public class TableViewList extends UIList {
if (refreshList != null) {
refreshList.cancel(true);
}
refreshList = new SwingWorker<Void, Void>() {
refreshList = new SwingWorker<DefaultListModel, Void>() {
@Override
protected Void doInBackground() throws Exception {
protected DefaultListModel doInBackground() throws Exception {
Connection datasource = ConnectionConfig.getInstance().getConnection(databaseName);
boolean status = false;
int count = 3;
@ -106,13 +106,13 @@ public class TableViewList extends UIList {
if (!status) {
throw new Exception(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
}
TableViewList.this.setModel(processDataInAnotherThread(databaseName, searchFilter, typesFilter));
return null;
return processDataInAnotherThread(databaseName, searchFilter, typesFilter);
}
@Override
public void done() {
try {
get();
TableViewList.this.setModel(get());
} catch (Exception e) {
if (!(e instanceof InterruptedException) && !(e instanceof CancellationException)) {
TableViewList.this.setModel(failed);

75
designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItem.java

@ -1,15 +1,11 @@
package com.fr.design.gui.imenu;
import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.basic.BasicMenuItemUI;
import com.fr.design.constants.UIConstants;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import sun.swing.SwingUtilities2;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JMenuItem;
public class UIMenuItem extends JMenuItem{
public UIMenuItem() {
@ -42,66 +38,5 @@ public class UIMenuItem extends JMenuItem{
public String getText() {
return StringUtils.BLANK + super.getText();
}
private class UIMenuItemUI extends BasicMenuItemUI {
@Override
protected void paintBackground(Graphics g, JMenuItem menuItem,Color bgColor) {
if(menuItem.getIcon() == null) {
super.paintBackground(g, menuItem, bgColor);
return;
}
ButtonModel model = menuItem.getModel();
Color oldColor = g.getColor();
int menuWidth = menuItem.getWidth();
int menuHeight = menuItem.getHeight();
g.setColor(UIConstants.NORMAL_BACKGROUND);
g.fillRect(0, 0, menuWidth, menuHeight);
if(menuItem.isOpaque()) {
if (model.isArmed()|| (menuItem instanceof JMenu && model.isSelected())) {
GUIPaintUtils.fillPaint((Graphics2D)g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
} else {
GUIPaintUtils.fillPaint((Graphics2D)g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, menuItem.getBackground(), 7);
}
g.setColor(oldColor);
}
else if (model.isArmed() || (menuItem instanceof JMenu &&
model.isSelected())) {
GUIPaintUtils.fillPaint((Graphics2D)g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
g.setColor(oldColor);
}
}
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) {
ButtonModel model = menuItem.getModel();
FontMetrics fm = SwingUtilities2.getFontMetrics(menuItem, g);
int mnemIndex = menuItem.getDisplayedMnemonicIndex();
if(!model.isEnabled()) {
// *** paint the text disabled
if ( UIManager.get("MenuItem.disabledForeground") instanceof Color ) {
g.setColor( UIManager.getColor("MenuItem.disabledForeground") );
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g,text,
-1, textRect.x, textRect.y + fm.getAscent());
} else {
g.setColor(menuItem.getBackground().brighter());
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text,
-1, textRect.x, textRect.y + fm.getAscent());
g.setColor(menuItem.getBackground().darker());
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g,text,
-1, textRect.x - 1, textRect.y +
fm.getAscent() - 1);
}
} else {
// *** paint the text normally
if (model.isArmed()|| (menuItem instanceof JMenu && model.isSelected())) {
g.setColor(Color.WHITE); // Uses protected field.
}
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g,text,
-1, textRect.x, textRect.y + fm.getAscent());
}
}
}
}

81
designer-base/src/main/java/com/fr/design/gui/imenu/UIMenuItemUI.java

@ -0,0 +1,81 @@
package com.fr.design.gui.imenu;
import com.fr.design.constants.UIConstants;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.Constants;
import sun.swing.SwingUtilities2;
import javax.swing.ButtonModel;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicMenuItemUI;
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
/**
* created by Harrison on 2020/03/22
**/
public class UIMenuItemUI extends BasicMenuItemUI {
@Override
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) {
if (menuItem.getIcon() == null) {
super.paintBackground(g, menuItem, bgColor);
return;
}
ButtonModel model = menuItem.getModel();
Color oldColor = g.getColor();
int menuWidth = menuItem.getWidth();
int menuHeight = menuItem.getHeight();
g.setColor(UIConstants.NORMAL_BACKGROUND);
g.fillRect(0, 0, menuWidth, menuHeight);
if (menuItem.isOpaque()) {
if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) {
GUIPaintUtils.fillPaint((Graphics2D) g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
} else {
GUIPaintUtils.fillPaint((Graphics2D) g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, menuItem.getBackground(), 7);
}
g.setColor(oldColor);
} else if (model.isArmed() || (menuItem instanceof JMenu &&
model.isSelected())) {
GUIPaintUtils.fillPaint((Graphics2D) g, 30, 0, menuWidth - 30, menuHeight, true, Constants.NULL, UIConstants.FLESH_BLUE, 7);
g.setColor(oldColor);
}
}
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) {
ButtonModel model = menuItem.getModel();
FontMetrics fm = SwingUtilities2.getFontMetrics(menuItem, g);
int mnemIndex = menuItem.getDisplayedMnemonicIndex();
if (!model.isEnabled()) {
// *** paint the text disabled
if (UIManager.get("MenuItem.disabledForeground") instanceof Color) {
g.setColor(UIManager.getColor("MenuItem.disabledForeground"));
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text,
-1, textRect.x, textRect.y + fm.getAscent());
} else {
g.setColor(menuItem.getBackground().brighter());
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text,
-1, textRect.x, textRect.y + fm.getAscent());
g.setColor(menuItem.getBackground().darker());
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text,
-1, textRect.x - 1, textRect.y +
fm.getAscent() - 1);
}
} else {
// *** paint the text normally
if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) {
g.setColor(Color.WHITE); // Uses protected field.
}
SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text,
-1, textRect.x, textRect.y + fm.getAscent());
}
}
}

2
designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java

@ -235,7 +235,7 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
public void actionPerformed(ActionEvent e) {
int[] selectedRow = table.getSelectedRows();
if (ismultiSelected()) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Multiple_Select_Warn_Text"));
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Multiple_Select_Warn_Text"));
return;
}
if (table.getCellEditor() != null) {

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

@ -229,6 +229,16 @@ public class BorderPane extends AbstractBasicStylePane implements GlobalNameObse
cellBorderStyle.setVerticalStyle(verticalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
cellBorderStyle.setHorizontalColor(lineColor);
cellBorderStyle.setHorizontalStyle(horizontalToggleButton.isSelected() ? lineStyle : Constants.LINE_NONE);
if (leftToggleButton.isSelected() && bottomToggleButton.isSelected() && rightToggleButton.isSelected() && topToggleButton.isSelected()) {
outerToggleButton.setSelected(true);
} else {
outerToggleButton.setSelected(false);
}
if (verticalToggleButton.isSelected() && horizontalToggleButton.isSelected()) {
innerToggleButton.setSelected(true);
} else {
innerToggleButton.setSelected(false);
}
return cellBorderStyle;
}

39
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.data.core.FormatField;
import com.fr.data.core.FormatField.FormatContents;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.LayoutConstants;
@ -22,6 +23,8 @@ import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
@ -63,6 +66,8 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse
private JPanel contentPane;
private JPanel txtCenterPane;
private JPanel centerPane;
private JPanel optionPane;
private UICheckBox roundingBox;
private JPanel formatFontPane;
private FRFontPane frFontPane;
private boolean isRightFormat;
@ -123,6 +128,22 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse
// centerPane.setBorder(LEFT_BORDER);
frFontPane.setBorder(LEFT_BORDER);
JPanel option = new JPanel(new BorderLayout());
option.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Option"), SwingConstants.LEFT), BorderLayout.WEST);
roundingBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Base_Option_Half_Up"));
roundingBox.setBorder(BorderFactory.createEmptyBorder(0, 40, 0, 0));
roundingBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
}
});
roundingBox.setGlobalName("roundingBox");
option.add(roundingBox, BorderLayout.CENTER);
optionPane = new JPanel(new CardLayout());
optionPane.add(new JPanel(), "hide");
optionPane.setPreferredSize(new Dimension(0, 0));
optionPane.add(option, "show");
Component[][] components = getComponent(fontPane, centerPane, typePane);
this.add(createContentPane(components), BorderLayout.CENTER);
}
@ -142,6 +163,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), typePane},
new Component[]{centerPane, null},
new Component[]{optionPane, null},
new Component[]{fontPane, frFontPane},
};
}
@ -220,6 +242,7 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse
setPatternComboBoxAndList(FormatContents.CURRENCY, pattern);
} else if (pattern.indexOf("%") > 0) {
setPatternComboBoxAndList(FormatContents.PERCENT, pattern);
this.roundingBox.setSelected(((CoreDecimalFormat) format).getRoundingMode().equals(RoundingMode.HALF_UP));
} else if (pattern.indexOf("E") > 0) {
setPatternComboBoxAndList(FormatContents.SCIENTIFIC, pattern);
} else {
@ -286,7 +309,8 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse
}
if (isRightFormat) {
if (StringUtils.isNotEmpty(patternString)) {
return FormatField.getInstance().getFormat(getFormatContents(), patternString);
RoundingMode roundingMode = roundingBox.isSelected() ? RoundingMode.HALF_UP : RoundingMode.HALF_EVEN;
return FormatField.getInstance().getFormat(getFormatContents(), patternString, roundingMode);
}
}
return null;
@ -342,6 +366,15 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse
centerPane.setPreferredSize(new Dimension(270, 65));
cardLayout.show(centerPane, "show");
}
CardLayout optionLayout = ((CardLayout) optionPane.getLayout());
if (getFormatContents() == FormatContents.PERCENT) {
optionPane.setPreferredSize(new Dimension(100, 20));
optionLayout.show(optionPane, "show");
} else {
optionPane.setPreferredSize(new Dimension(0, 0));
optionLayout.show(optionPane, "hide");
roundingBox.setSelected(false);
}
}
}
@ -370,7 +403,9 @@ public class FormatPane extends AbstractBasicStylePane implements GlobalNameObse
* update
*/
public Style update(Style style) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), "textField") || ComparatorUtils.equals(globalNameListener.getGlobalName(), "typeComboBox")) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), "textField")
|| ComparatorUtils.equals(globalNameListener.getGlobalName(), "typeComboBox")
|| ComparatorUtils.equals(globalNameListener.getGlobalName(), "roundingBox")) {
return style.deriveFormat(this.update());
} else {
return style.deriveFRFont(this.frFontPane.update(style.getFRFont()));

13
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java

@ -9,16 +9,7 @@
*/
package com.fr.design.gui.syntax.ui.rsyntaxtextarea;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -604,7 +595,7 @@ private boolean fractionalFontMetricsEnabled;
SecurityManager sm = System.getSecurityManager();
if (sm!=null) {
try {
sm.checkSystemClipboardAccess();
sm.checkPermission(new AWTPermission("accessClipboard"));
} catch (SecurityException se) {
UIManager.getLookAndFeel().provideErrorFeedback(null);
return;

6
designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java

@ -1,5 +1,6 @@
package com.fr.design.i18n;
import com.fr.design.DesignerEnvManager;
import com.fr.general.GeneralContext;
import com.fr.general.log.MessageFormatter;
import com.fr.locale.DesignI18nProvider;
@ -14,6 +15,11 @@ import java.util.Locale;
public class DesignI18nImpl implements DesignI18nProvider {
static {
// GeneralContext上下文 存储本次启动的语言环境 直接使用DesignerEnvManager 会在设置语言环境后 不重启 立即生效 存在问题
GeneralContext.setLocale(DesignerEnvManager.getEnvManager().getLanguage());
}
private static DesignI18nImpl instance = new DesignI18nImpl();
public static DesignI18nImpl getInstance() {

46
designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java

@ -21,6 +21,8 @@ import com.fr.general.IOUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
@ -82,6 +84,20 @@ public class JSContentPane extends BasicPane {
UIScrollPane sp = new UIScrollPane(contentTextArea);
this.add(sp, BorderLayout.CENTER);
contentTextArea.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
// 获得焦点时 安装
installAutoCompletion();
}
@Override
public void focusLost(FocusEvent e) {
// 失去焦点时 卸载
uninstallAutoCompletion();
}
});
UILabel funNameLabel2 = new UILabel();
funNameLabel2.setText("}");
this.add(funNameLabel2, BorderLayout.SOUTH);
@ -91,12 +107,10 @@ public class JSContentPane extends BasicPane {
return KeyStroke.getKeyStroke(ks.replace("+", "pressed"));
}
@Override
protected String title4PopupWindow() {
return "JS";
}
public void populate(String js) {
/**
* 注册安装 自动补全监听
*/
private void installAutoCompletion() {
if (ac == null) {
CompletionProvider provider = createCompletionProvider();
ac = new AutoCompletion(provider);
@ -105,16 +119,28 @@ public class JSContentPane extends BasicPane {
ac.setTriggerKey(convert2KeyStroke(shortCuts));
ac.install(contentTextArea);
}
this.contentTextArea.setText(js);
}
public String update() {
/**
* 卸载移除 自动补全监听
*/
private void uninstallAutoCompletion() {
if (ac != null) {
this.ac.uninstall();
ac.uninstall();
ac = null;
}
}
@Override
protected String title4PopupWindow() {
return "JS";
}
public void populate(String js) {
this.contentTextArea.setText(js);
}
public String update() {
return this.contentTextArea.getText();
}

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

@ -2,6 +2,7 @@ package com.fr.design.javascript;
import com.fr.base.Parameter;
import com.fr.design.data.tabledata.tabledatapane.OneListTableModel;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.frpane.ReportletParameterViewPane;
import com.fr.design.gui.itableeditorpane.ParameterTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditAction;
@ -62,7 +63,7 @@ public class JavaScriptImplPane extends AbstractHyperLinkPane<JavaScriptImpl> {
}
if (tempSet.contains(list.get(i).toString())) {
list.remove(i);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_Duplicate_Name") + "!");
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter_Duplicate_Name") + "!");
parameterChanger(list);
return;
}

83
designer-base/src/main/java/com/fr/design/mainframe/DesignerContext.java

@ -4,6 +4,7 @@
package com.fr.design.mainframe;
import com.fr.base.Style;
import com.fr.design.base.clipboard.DesignerClipboard;
import com.fr.design.designer.TargetComponent;
import com.fr.design.dialog.BasicDialog;
import com.fr.log.FineLoggerFactory;
@ -56,41 +57,53 @@ public class DesignerContext {
public static DesignerBean getDesignerBean(String name) {
return beans.get(name) == null ? DesignerBean.NULL : beans.get(name);
}
public static void setDesignerBean(String name, DesignerBean bean) {
beans.put(name, bean);
}
/**
* Gets the Clipboard.
*/
public static Clipboard getClipboard(JComponent comp) {
if (DesignerContext.clipboard == null) {
try {
Action transferAction = TransferHandler.getCutAction();
Method clipMethod = StableUtils.getDeclaredMethod(transferAction.getClass(), "getClipboard", new Class[]{JComponent.class});
clipMethod.setAccessible(true);
return (Clipboard) clipMethod.invoke(transferAction, new Object[]{comp});
} catch (Exception securityException) {
FineLoggerFactory.getLogger().error(securityException.getMessage(), securityException);
//用反射机制,获得TransferHandler的getClipboard
//这样可以保证和TextField直接的copy paste
try {
//控件的Clipboard.
DesignerContext.clipboard = comp.getToolkit().getSystemClipboard();
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
DesignerContext.clipboard = new Clipboard("FR");
}
}
}
return DesignerContext.clipboard;
}
public static void setFormatState(int setformatState) {
public static void setDesignerBean(String name, DesignerBean bean) {
beans.put(name, bean);
}
/**
* get this custom clipboard
*/
public static Clipboard getClipboard(JComponent comp) {
if (DesignerContext.clipboard == null) {
Clipboard clipboard = getClipboard0(comp);
return new DesignerClipboard(clipboard);
}
return DesignerContext.clipboard;
}
/**
* Gets the system Clipboard.
*/
private static Clipboard getClipboard0(JComponent comp) {
Clipboard clipboard = null;
try {
Action transferAction = TransferHandler.getCutAction();
Method clipMethod = StableUtils.getDeclaredMethod(transferAction.getClass(), "getClipboard", new Class[]{JComponent.class});
clipMethod.setAccessible(true);
return (Clipboard) clipMethod.invoke(transferAction, new Object[]{comp});
} catch (Exception securityException) {
FineLoggerFactory.getLogger().error(securityException.getMessage(), securityException);
//用反射机制,获得TransferHandler的getClipboard
//这样可以保证和TextField直接的copy paste
try {
//控件的Clipboard.
clipboard = comp.getToolkit().getSystemClipboard();
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
clipboard = new Clipboard("FR");
}
}
return clipboard;
}
public static void setFormatState(int setformatState) {
formatState = setformatState;
}

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

@ -509,7 +509,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
if (OperatingSystem.isMacos()) {
Class clazz = Class.forName("com.apple.eawt.Application");
BufferedImage icon = image.isEmpty() ? IOUtils.readImage("/com/fr/base/images/oem/logo.png") : image.get(image.size() - 1);
Reflect.on(Reflect.on(clazz).call("getApplication").get()).call("setDockIconImage", icon);
Object application = Reflect.on(clazz).call("getApplication").get();
Reflect.on(application).call("setDockIconImage", icon);
} else {
this.setIconImages(image);
}
@ -1105,7 +1106,17 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
int index = HistoryTemplateListCache.getInstance().contains(tplFile);
if (index != -1) {
JTemplate jt = HistoryTemplateListCache.getInstance().getHistoryList().get(index);
if (!(jt instanceof JVirtualTemplate)) {
if (jt instanceof JVirtualTemplate) {
// 如果是JVirtualTemplate 创建真实JTemplate
JTemplate realJTemplate = JTemplateFactory.createJTemplate(tplFile);
if (realJTemplate == null) {
return;
}
// 由JVirtualTemplate激活真实JTemplate 本质在historyList中进行替换
// 同时 realJTemplate被管理起来 不需要主动释放 关闭时会自动释放
jt.activeJTemplate(index, realJTemplate);
return;
} else {
jt.activeOldJTemplate();
return;
}

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

@ -3,21 +3,50 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.constants.UIConstants;
import com.fr.design.fun.PropertyItemPaneProvider;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.icontainer.UIEastResizableContainer;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.general.FRFont;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@ -26,6 +55,7 @@ import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -101,9 +131,112 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
defaultAuthorityPane = getDefaultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Not_Support_Authority_Edit"));
switchMode(PropertyMode.REPORT);
setContainerWidth(CONTAINER_WIDTH);
initPluginPane();
listenPlugin();
}
private void listenPlugin() {
PluginFilter filter = new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PropertyItemPaneProvider.XML_TAG);
}
};
PluginListenerRegistration.getInstance().listen(
PluginEventType.AfterRun,
new PluginEventListener(PropertyItemPaneProvider.FIRST) {
@Override
public void on(PluginEvent event) {
PluginContext context = event.getContext();
PluginRuntime runtime = context.getRuntime();
final Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG);
// UI相关的逻辑 用UI线程执行 不走FinePluginController线程 走FinePluginController线程有几率出问题
// 容易导致FinePluginController持有Swing内部的java.awt.Component$AWTTreeLock 这个锁不能被UI线程之外的线程持有 否则容易造成UI线程被Blocked住
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
for (PropertyItemPaneProvider provider : providers) {
addPropertyItem(provider);
}
updateAllPropertyPane();
}
}); }
}, filter);
PluginListenerRegistration.getInstance().listen(
PluginEventType.BeforeStop,
new PluginEventListener(PropertyItemPaneProvider.FIRST) {
@Override
public void on(PluginEvent event) {
PluginContext context = event.getContext();
PluginRuntime runtime = context.getRuntime();
final Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG);
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
for (PropertyItemPaneProvider provider : providers) {
removePropertyItem(provider);
}
updateAllPropertyPane();
}
});
}
}, filter);
}
private void removePropertyItem(PropertyItemPaneProvider provider) {
propertyItemMap.remove(provider.key());
String replaceKey = provider.replaceKey();
if (replaceKey == null) {
return;
}
PropertyItem replaceItem = propertyItemMap.get(replaceKey);
if (replaceItem != null) {
replaceItem.setReplace(false);
}
}
private void initPluginPane() {
ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<PropertyItemPaneProvider> providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
addPropertyItem(provider);
}
}
private void addPropertyItem(PropertyItemPaneProvider provider) {
String key = provider.key();
PropertyItemBean itemBean = provider.getItem();
PropertyItem propertyItem = new PropertyItem(itemBean.getName(),
itemBean.getTitle(),
itemBean.getBtnIconName(),
itemBean.getBtnIconBaseDir(),
itemBean.getVisibleModes(),
itemBean.getEnableModes());
UIButton button = propertyItem.getButton();
List<ActionListener> buttonListeners = itemBean.getButtonListeners();
for (ActionListener buttonListener : buttonListeners) {
button.addActionListener(buttonListener);
}
propertyItemMap.put(key, propertyItem);
String replaceKey = provider.replaceKey();
if (replaceKey == null) {
return;
}
PropertyItem replaceItem = propertyItemMap.get(replaceKey);
if (replaceItem != null) {
replaceItem.setReplace(true);
}
}
private void initPropertyItemList() {
propertyItemMap = new LinkedHashMap<>(); // 有序map
// 单元格元素
PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Element"),
@ -118,7 +251,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
"floatelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT});
// 控件设置
PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Settings"),
PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings"),
"widgetsettings", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART});
// 条件属性
@ -352,19 +485,30 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public void replaceAuthorityEditionPane(JComponent pane) {
propertyItemMap.get(KEY_AUTHORITY_EDITION).replaceContentPane(pane);
}
public JComponent getAuthorityEditionPane() {
return propertyItemMap.get(KEY_AUTHORITY_EDITION).getContentPane();
}
public void replaceConfiguredRolesPane(JComponent pane) {
propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane);
}
public void replaceKeyPane(final String key, final JComponent pane) {
//需要放到 ui 线程中处理
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
propertyItemMap.get(key).replaceContentPane(pane);
}
});
}
public JComponent getConfiguredRolesPane() {
return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane();
}
public void addParameterPane(JComponent paraPane) {
propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceHeaderPane(paraPane);
}
@ -511,6 +655,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private PopupDialog popupDialog; // 弹出框
private boolean isPoppedOut = false; // 是否弹出
private boolean isVisible = true; // 是否可见
private boolean replace = false; // 是否被替代
private boolean isEnabled = true; // 是否可用
private Set<PropertyMode> visibleModes;
private Set<PropertyMode> enableModes;
@ -521,14 +666,21 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private static final String ICON_SUFFIX_DISABLED = "_disabled.png";
private static final String ICON_SUFFIX_SELECTED = "_selected.png";
private String btnIconName;
private String iconBaseDir;
private String iconSuffix = ICON_SUFFIX_NORMAL; // normal, diabled, selected, 三者之一
private final Color selectedBtnBackground = new Color(0xF5F5F7);
private Color originBtnBackground;
public PropertyItem(String name, String title, String btnIconName, PropertyMode[] visibleModes, PropertyMode[] enableModes) {
this(name, title, btnIconName, ICON_BASE_DIR, visibleModes, enableModes);
}
public PropertyItem(String name, String title, String btnIconName, String iconBaseDir, PropertyMode[] visibleModes, PropertyMode[] enableModes) {
this.name = name;
this.title = title;
this.btnIconName = btnIconName;
this.iconBaseDir = iconBaseDir;
initButton();
initPropertyPanel();
initModes(visibleModes, enableModes);
@ -563,13 +715,19 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
public boolean isVisible() {
return isVisible;
// 取决于可见且未替代
return isVisible && !replace;
}
public void setVisible(boolean isVisible) {
this.isVisible = isVisible;
}
public void setReplace(boolean replace) {
this.replace = replace;
}
public boolean isEnabled() {
return isEnabled;
}
@ -580,6 +738,15 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
button.setEnabled(isEnabled);
}
public void setIconBaseDir(String iconBaseDir) {
this.iconBaseDir = iconBaseDir;
}
private String getIconBaseDir() {
return StringUtils.isEmpty(iconBaseDir) ? ICON_BASE_DIR : iconBaseDir;
}
private void initPropertyPanel() {
propertyPanel = new JPanel();
propertyPanel.setBackground(Color.pink);
@ -660,7 +827,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
}
private String getBtnIconUrl() {
return ICON_BASE_DIR + btnIconName + iconSuffix;
return getIconBaseDir() + btnIconName + iconSuffix;
}
public void resetButtonIcon() {

7
designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java

@ -88,6 +88,8 @@ public class JFormSliderPane extends JPanel {
private UIRadioButton customButton;
//拖动条处理和button、直接输入不一样
private boolean isButtonOrIsTxt = true;
//是否选中指定的几个缩放等级,避免触发不必要的事件
private boolean selectSpecified = false;
private FormPopupPane dialog;
private int upButtonX;
private JPanel dialogContentPanel;
@ -288,6 +290,9 @@ public class JFormSliderPane extends JPanel {
refreshBottun(val);
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.setCaretPosition(showValSpinner.getValue().toString().length());
if (!selectSpecified) {
customButton.setSelected(true);
}
}
};
@ -317,7 +322,9 @@ public class JFormSliderPane extends JPanel {
public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource();
if (temp.isSelected()) {
selectSpecified = true;
showValSpinner.setValue(Integer.valueOf(temp.getText().substring(0, temp.getText().indexOf("%"))));
selectSpecified = false;
}
}
};

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

@ -28,6 +28,7 @@ import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerFrameUpButtonProvider;
import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.PreviewProvider;
import com.fr.design.fun.PropertyItemPaneProvider;
import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
@ -55,6 +56,14 @@ import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage;
import com.fr.stable.ArrayUtils;
@ -97,10 +106,13 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
private static short currentIndex = 0;// 此变量用于多次新建模板时,让名字不重复
private DesignModelAdapter<T, ?> designModel;
private PreviewProvider previewType;
private TimeConsumeTimer consumeTimer = new TimeConsumeTimer();
protected TimeConsumeTimer consumeTimer = new TimeConsumeTimer();
public int resolution = ScreenResolution.getScreenResolution();
private PluginEventListener pluginListener;
public JTemplate() {
initAndStartPlugin();
}
public JTemplate(T t, String defaultFileName) {
@ -129,8 +141,50 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
designModel = createDesignModel();
consumeTimer.setEnabled(shouldInitForCollectInfo(isNewFile));
initAndStartPlugin();
}
private void initAndStartPlugin() {
initPluginPane();
startListenPlugin();
}
private void startListenPlugin() {
PluginFilter filter = new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PropertyItemPaneProvider.XML_TAG);
}
};
this.pluginListener = new PluginEventListener(PropertyItemPaneProvider.LAST) {
@Override
public void on(PluginEvent event) {
PluginContext context = event.getContext();
PluginRuntime runtime = context.getRuntime();
Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
addPane(provider);
}
}
};
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginListener, filter);
}
private void initPluginPane() {
ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<PropertyItemPaneProvider> providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
addPane(provider);
}
}
protected <R> void addPane(PropertyItemPaneProvider provider) {
// do nothing
}
void onGetFocus() {
consumeTimer.start();
}
@ -251,7 +305,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* 模板关闭时
*/
public void whenClose() {
// do nothing
// stop的时候 pluginListener 和 PluginFilter 都会移除
PluginListenerRegistration.getInstance().stopListen(this.pluginListener);
}
/**
@ -266,7 +321,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
try {
this.template = JTemplateFactory.asIOFile(this.editingFILE);
setTarget(this.template);
// 先移除旧的。
removeCenterPane();
// 加入新的
@ -275,19 +330,19 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
private void addCenterPane() {
this.centerPane = createCenterPane();
this.add(centerPane, BorderLayout.CENTER);
}
private void removeCenterPane() {
JComponent centerPane = this.centerPane;
this.remove(centerPane);
}
/**
* 刷新容器
*/

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

@ -211,6 +211,8 @@ public class JVirtualTemplate extends JTemplate {
List<JTemplate<?, ?>> historyList = HistoryTemplateListPane.getInstance().getHistoryList();
historyList.set(index, jt);
DesignerContext.getDesignerFrame().addAndActivateJTemplate(jt);
// 虚拟模板JVirtualTemplate被激活后 由真实的JTemplate替换 此时调用whenClose 防止JVirtualTemplate无法释放
this.whenClose();
}
@Override

17
designer-base/src/main/java/com/fr/design/mainframe/PaneHolder.java

@ -0,0 +1,17 @@
package com.fr.design.mainframe;
import javax.swing.JPanel;
/**
* created by Harrison on 2020/03/23
**/
public interface PaneHolder<T> {
/**
* 得到 Pane
*
* @param arg 参数
* @return 面板
*/
JPanel getInstance(T arg);
}

78
designer-base/src/main/java/com/fr/design/mainframe/PropertyItemBean.java

@ -0,0 +1,78 @@
package com.fr.design.mainframe;
import java.awt.event.ActionListener;
import java.util.List;
/**
* created by Harrison on 2020/03/23
**/
public class PropertyItemBean {
private String name;
private String title;
private String btnIconName;
private String btnIconBaseDir;
private EastRegionContainerPane.PropertyMode[] visibleModes;
private EastRegionContainerPane.PropertyMode[] enableModes;
private List<ActionListener> buttonListeners;
public PropertyItemBean() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getBtnIconName() {
return btnIconName;
}
public void setBtnIconName(String btnIconName) {
this.btnIconName = btnIconName;
}
public String getBtnIconBaseDir() {
return btnIconBaseDir;
}
public void setBtnIconBaseDir(String btnIconBaseDir) {
this.btnIconBaseDir = btnIconBaseDir;
}
public EastRegionContainerPane.PropertyMode[] getVisibleModes() {
return visibleModes;
}
public void setVisibleModes(EastRegionContainerPane.PropertyMode[] visibleModes) {
this.visibleModes = visibleModes;
}
public EastRegionContainerPane.PropertyMode[] getEnableModes() {
return enableModes;
}
public void setEnableModes(EastRegionContainerPane.PropertyMode[] enableModes) {
this.enableModes = enableModes;
}
public List<ActionListener> getButtonListeners() {
return buttonListeners;
}
public void setButtonListeners(List<ActionListener> buttonListeners) {
this.buttonListeners = buttonListeners;
}
}

17
designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointCollector.java

@ -5,6 +5,8 @@ import com.fr.base.io.XMLReadHelper;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.template.info.SendHelper;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLableReader;
@ -121,10 +123,23 @@ public abstract class AbstractPointCollector<T extends AbstractPointInfo> implem
}
}
private File getInfoFile() {
File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), getInfoFilePath()));
try {
if (!file.exists()) {
StableUtils.makesureFileExist(file);
}
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
return file;
}
/**
* 获取缓存文件存放路径
*/
protected abstract File getInfoFile();
protected abstract String getInfoFilePath();
protected abstract void addIdleDayCount();
}

9
designer-base/src/main/java/com/fr/design/mainframe/burying/point/AbstractPointInfo.java

@ -11,6 +11,9 @@ public abstract class AbstractPointInfo implements BasePointInfo {
protected int idleDayCount; // 到现在为止,埋点闲置的天数
//是否是测试模板
protected boolean testTemplate;
@Override
public void resetIdleDayCount() {
this.idleDayCount = 0;
@ -38,10 +41,14 @@ public abstract class AbstractPointInfo implements BasePointInfo {
}
}
public void setTestTemplate(boolean testTemplate) {
this.testTemplate = testTemplate;
}
/**
* 是否为测试模板
*/
protected abstract boolean isTestTemplate();
public abstract boolean isTestTemplate();
/**
* 是否已经制作完成

88
designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfo.java

@ -1,6 +1,10 @@
package com.fr.design.mainframe.chart.info;
import com.fr.base.io.BaseBook;
import com.fr.chartx.attr.ChartProvider;
import com.fr.chartx.config.info.AbstractConfig;
import com.fr.chartx.config.info.ChartConfigInfo;
import com.fr.chartx.config.info.constant.ConfigType;
import com.fr.config.MarketConfig;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager;
@ -26,10 +30,11 @@ import java.util.Map;
public class ChartInfo extends AbstractPointInfo {
public static final String XML_TAG = "ChartInfo";
private static final String CHART_CONSUMING_URL = CloudCenter.getInstance().acquireUrlByKind("chartinfo.consuming") + "/single";
private static final String CHART_FUNCTION_URL = CloudCenter.getInstance().acquireUrlByKind("chart.info.function") + "/single";
private static final String XML_CHART_CONSUMING_MAP = "chartConsumingMap";
private static final String ATTR_TEST_TEMPLATE = "testTemplate";
private static final String ATTR_TEST_CHART = "testChart";
private static final String ATTR_DAY_COUNT = "day_count";
private static final String ATTR_USERNAME = "username";
private static final String ATTR_UUID = "uuid";
@ -44,6 +49,11 @@ public class ChartInfo extends AbstractPointInfo {
private static final String ATTR_CHART_PROPERTY_END_TIME = "chartPropertyEndTime";
private static final String ATTR_JAR_TIME = "jarTime";
private static final String ATTR_VERSION = "version";
private static final String ATTR_USER_ID = "userId";
private static final String ATTR_FIRST_CHART_TYPE = "firstChartType";
private static final String ATTR_OVER_CHART_TYPE_COUNT = "overChartTypeCount";
private static final String ATTR_IS_NEW = "isNew";
private static final String ATTR_IS_REUSE = "isReuse";
private static final int COMPLETE_DAY_COUNT = 3; // 判断图表是否可以上传的天数
@ -53,9 +63,12 @@ public class ChartInfo extends AbstractPointInfo {
private Map<String, String> chartConsumingMap = new HashMap<>();
private ChartConfigInfo chartConfigInfo = new ChartConfigInfo();
private BaseBook book;
private boolean testTemplate;
private boolean testChart;
private ChartInfo() {
}
@ -64,6 +77,7 @@ public class ChartInfo extends AbstractPointInfo {
this.chartId = chartId;
this.templateId = templateId;
this.book = book;
this.testChart = true;
}
public String getChartId() {
@ -84,36 +98,42 @@ public class ChartInfo extends AbstractPointInfo {
this.chartConsumingMap.put(ATTR_TEMPLATE_ID, templateId);
}
public BaseBook getBook() {
return book;
}
@Override
public boolean isTestTemplate() {
return testTemplate;
return testTemplate || testChart;
}
public void setTestTemplate(boolean testTemplate) {
this.testTemplate = testTemplate;
}
public void setTestChart(boolean testChart) {
this.testChart = testChart;
}
static ChartInfo newInstanceByRead(XMLableReader reader) {
ChartInfo chartInfo = new ChartInfo();
reader.readXMLObject(chartInfo);
return chartInfo;
}
public static ChartInfo newInstance(String chartId, String chartType) {
return newInstance(chartId, chartType, null);
public static ChartInfo newInstance(ChartProvider chartProvider) {
return newInstance(chartProvider, null, false, false);
}
public static ChartInfo newInstance(String chartId, String chartType, String createTime) {
public static ChartInfo newInstance(ChartProvider chartProvider, String createTime, boolean isNew, boolean isReuse) {
HashMap<String, String> chartConsumingMap = new HashMap<>();
String username = MarketConfig.getInstance().getBbsUsername();
String userId = String.valueOf(MarketConfig.getInstance().getBbsUid());
String uuid = DesignerEnvManager.getEnvManager().getUUID();
String activityKey = DesignerEnvManager.getEnvManager().getActivationKey();
String chartId = chartProvider.getChartUuid();
String chartType = chartProvider.getID();
BaseBook book = DesignModelAdapter.getCurrentModelAdapter().getBook();
String templateId = book.getTemplateID();
@ -138,9 +158,15 @@ public class ChartInfo extends AbstractPointInfo {
chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, "");
chartConsumingMap.put(ATTR_JAR_TIME, jarTime);
chartConsumingMap.put(ATTR_VERSION, version);
chartConsumingMap.put(ATTR_USER_ID, userId);
chartConsumingMap.put(ATTR_FIRST_CHART_TYPE, chartType);
chartConsumingMap.put(ATTR_OVER_CHART_TYPE_COUNT, "0");
chartConsumingMap.put(ATTR_IS_NEW, String.valueOf(isNew));
chartConsumingMap.put(ATTR_IS_REUSE, String.valueOf(isReuse));
ChartInfo chartInfo = new ChartInfo(chartId, templateId, book);
chartInfo.chartConsumingMap = chartConsumingMap;
chartProvider.initChartConfigInfo(chartInfo.chartConfigInfo);
return chartInfo;
}
@ -158,6 +184,7 @@ public class ChartInfo extends AbstractPointInfo {
writer.attr(ATTR_DAY_COUNT, this.idleDayCount);
}
writer.attr(ATTR_TEST_TEMPLATE, this.testTemplate);
writer.attr(ATTR_TEST_CHART, this.testChart);
writer.startTAG(XML_CHART_CONSUMING_MAP);
writer.attr(ATTR_USERNAME, chartConsumingMap.get(ATTR_USERNAME));
writer.attr(ATTR_UUID, chartConsumingMap.get(ATTR_UUID));
@ -170,7 +197,14 @@ public class ChartInfo extends AbstractPointInfo {
writer.attr(ATTR_CHART_PROPERTY_END_TIME, chartConsumingMap.get(ATTR_CHART_PROPERTY_END_TIME));
writer.attr(ATTR_JAR_TIME, chartConsumingMap.get(ATTR_JAR_TIME));
writer.attr(ATTR_VERSION, chartConsumingMap.get(ATTR_VERSION));
writer.attr(ATTR_USER_ID, chartConsumingMap.get(ATTR_USER_ID));
writer.attr(ATTR_FIRST_CHART_TYPE, chartConsumingMap.get(ATTR_FIRST_CHART_TYPE));
writer.attr(ATTR_OVER_CHART_TYPE_COUNT, chartConsumingMap.get(ATTR_OVER_CHART_TYPE_COUNT));
writer.attr(ATTR_IS_NEW, chartConsumingMap.get(ATTR_IS_NEW));
writer.attr(ATTR_IS_REUSE, chartConsumingMap.get(ATTR_IS_REUSE));
writer.end();
chartConfigInfo.writeXML(writer);
writer.end();
}
@ -182,6 +216,7 @@ public class ChartInfo extends AbstractPointInfo {
chartId = reader.getAttrAsString(ATTR_CHART_ID, StringUtils.EMPTY);
templateId = reader.getAttrAsString(ATTR_TEMPLATE_ID, StringUtils.EMPTY);
testTemplate = reader.getAttrAsBoolean(ATTR_TEST_TEMPLATE, true);
testChart = reader.getAttrAsBoolean(ATTR_TEST_CHART, false);
} else {
String name = reader.getTagName();
if (XML_CHART_CONSUMING_MAP.equals(name)) {
@ -198,6 +233,14 @@ public class ChartInfo extends AbstractPointInfo {
chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, reader.getAttrAsString(ATTR_CHART_PROPERTY_END_TIME, StringUtils.EMPTY));
chartConsumingMap.put(ATTR_JAR_TIME, reader.getAttrAsString(ATTR_JAR_TIME, StringUtils.EMPTY));
chartConsumingMap.put(ATTR_VERSION, reader.getAttrAsString(ATTR_VERSION, "8.0"));
chartConsumingMap.put(ATTR_USER_ID, reader.getAttrAsString(ATTR_USER_ID, StringUtils.EMPTY));
chartConsumingMap.put(ATTR_FIRST_CHART_TYPE, reader.getAttrAsString(ATTR_FIRST_CHART_TYPE, StringUtils.EMPTY));
chartConsumingMap.put(ATTR_OVER_CHART_TYPE_COUNT, reader.getAttrAsString(ATTR_OVER_CHART_TYPE_COUNT, "0"));
chartConsumingMap.put(ATTR_IS_NEW, reader.getAttrAsString(ATTR_IS_NEW, StringUtils.EMPTY));
chartConsumingMap.put(ATTR_IS_REUSE, reader.getAttrAsString(ATTR_IS_REUSE, StringUtils.EMPTY));
}
if (ChartConfigInfo.XML_TAG.equals(name)) {
this.chartConfigInfo = (ChartConfigInfo) reader.readXMLObject(new ChartConfigInfo());
}
}
}
@ -212,9 +255,17 @@ public class ChartInfo extends AbstractPointInfo {
public Map<String, String> getSendInfo() {
Map<String, String> sendMap = new HashMap<>();
sendMap.put(CHART_CONSUMING_URL, new JSONObject(chartConsumingMap).toString());
sendMap.put(CHART_FUNCTION_URL, getFunctionJson());
return sendMap;
}
private String getFunctionJson() {
JSONObject jsonObject = JSONObject.create();
jsonObject.put("chartID", this.chartId);
chartConfigInfo.toJSONObject(jsonObject);
return jsonObject.toString();
}
public void updatePropertyTime() {
String propertyTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss");
@ -224,13 +275,31 @@ public class ChartInfo extends AbstractPointInfo {
chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, propertyTime);
}
public void updateChartType(String chartType) {
public void updateChartType(ChartProvider chartProvider) {
String typeTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss");
chartConsumingMap.put(ATTR_CHART_TYPE_TIME, typeTime);
chartConsumingMap.put(ATTR_CHART_TYPE, chartType);
chartConsumingMap.put(ATTR_CHART_TYPE, chartProvider.getID());
chartConsumingMap.put(ATTR_CHART_PROPERTY_FIRST_TIME, "");
chartConsumingMap.put(ATTR_CHART_PROPERTY_END_TIME, "");
String count = chartConsumingMap.get(ATTR_OVER_CHART_TYPE_COUNT);
count = StringUtils.isEmpty(count) ? "1" : String.valueOf(Integer.parseInt(count) + 1);
chartConsumingMap.put(ATTR_OVER_CHART_TYPE_COUNT, count);
resetChartConfigInfo(chartProvider);
}
public void resetChartConfigInfo(ChartProvider chartProvider) {
chartConfigInfo.reset();
chartProvider.initChartConfigInfo(chartConfigInfo);
}
public void updateFirstType(String chartType) {
chartConsumingMap.put(ATTR_FIRST_CHART_TYPE, chartType);
}
public void updateChartConfig(ConfigType configType, AbstractConfig config) {
chartConfigInfo.updateChartConfig(configType, config);
}
@Override
@ -245,6 +314,7 @@ public class ChartInfo extends AbstractPointInfo {
chartConsumingMap.put(entry.getKey(), entry.getValue());
}
chartInfo.chartConsumingMap = chartConsumingMap;
chartInfo.chartConfigInfo = chartConfigInfo.clone();
return chartInfo;
}
}

108
designer-base/src/main/java/com/fr/design/mainframe/chart/info/ChartInfoCollector.java

@ -2,20 +2,16 @@ package com.fr.design.mainframe.chart.info;
import com.fr.base.io.BaseBook;
import com.fr.chartx.attr.ChartProvider;
import com.fr.chartx.config.info.AbstractConfig;
import com.fr.chartx.config.info.constant.ConfigType;
import com.fr.design.mainframe.burying.point.AbstractPointCollector;
import com.fr.design.mainframe.template.info.TemplateInfo;
import com.fr.design.mainframe.template.info.TemplateProcessInfo;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.vanchart.VanChart;
import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.third.joda.time.DateTime;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
@ -53,72 +49,92 @@ public class ChartInfoCollector extends AbstractPointCollector<ChartInfo> {
}
public void collection(ChartProvider chartProvider, String createTime) {
if (chartProvider instanceof VanChart) {
VanChart vanChart = (VanChart) chartProvider;
collection(vanChart.getUuid(), vanChart.getID(), createTime);
}
collection(chartProvider, createTime, false);
}
/**
* 新建图表保存状态
*/
public void collection(String chartId, String chartType, String createTime) {
if (!shouldCollectInfo()) {
public void collection(ChartProvider chartProvider, String createTime, boolean isReuse) {
String chartId = chartProvider.getChartUuid();
if (!shouldCollectInfo() || StringUtils.isEmpty(chartId)) {
return;
}
ChartInfo chartInfo = ChartInfo.newInstance(chartId, chartType, createTime);
ChartInfo chartInfo = ChartInfo.newInstance(chartProvider, createTime, true, isReuse);
chartInfoCacheMap.put(chartId, chartInfo);
}
/**
* 图表编辑更新编辑时间
*/
public void updateChartPropertyTime(ChartProvider chartProvider) {
if (chartProvider instanceof VanChart) {
VanChart vanChart = (VanChart) chartProvider;
updateChartPropertyTime(vanChart.getUuid(), vanChart.getID());
if (!shouldCollectInfo() || StringUtils.isEmpty(chartProvider.getChartUuid())) {
return;
}
ChartInfo chartInfo = getOrCreateChartInfo(chartProvider);
//更新编辑时间
chartInfo.updatePropertyTime();
//重置计数
chartInfo.resetIdleDayCount();
}
/**
* 图表编辑更新编辑时间
*/
public void updateChartPropertyTime(String chartId, String chartType) {
if (!shouldCollectInfo()) {
public void updateChartConfig(ChartProvider chartProvider, ConfigType configType, AbstractConfig config) {
if (!shouldCollectInfo() || StringUtils.isEmpty(chartProvider.getChartUuid())) {
return;
}
ChartInfo chartInfo = getOrCreateChartInfo(chartId, chartType);
ChartInfo chartInfo = getOrCreateChartInfo(chartProvider);
//更新编辑时间
chartInfo.updatePropertyTime();
//更新对应的配置
chartInfo.updateChartConfig(configType, config);
//重置计数
chartInfo.resetIdleDayCount();
}
public void updateChartTypeTime(ChartProvider chartProvider) {
if (chartProvider instanceof VanChart) {
VanChart vanChart = (VanChart) chartProvider;
updateChartTypeTime(vanChart.getUuid(), vanChart.getID());
/**
* 图表子类型更新
*/
public void updateChartMiniType(ChartProvider chartProvider) {
if (!shouldCollectInfo() || StringUtils.isEmpty(chartProvider.getChartUuid())) {
return;
}
ChartInfo chartInfo = getOrCreateChartInfo(chartProvider);
//图表子类型更新
chartInfo.resetChartConfigInfo(chartProvider);
//重置计数
chartInfo.resetIdleDayCount();
}
/**
* 图表类型变化更新类型和类型确认时间
*/
public void updateChartTypeTime(String chartId, String chartType) {
if (!shouldCollectInfo()) {
public void updateChartTypeTime(ChartProvider chartProvider, String oldType) {
if (!shouldCollectInfo() || StringUtils.isEmpty(chartProvider.getChartUuid())) {
return;
}
ChartInfo chartInfo = getOrCreateChartInfo(chartId, chartType);
ChartInfo chartInfo = getOrCreateChartInfo(chartProvider, oldType);
//更新类型确认时间和类型
chartInfo.updateChartType(chartType);
chartInfo.updateChartType(chartProvider);
//重置计数
chartInfo.resetIdleDayCount();
}
private ChartInfo getOrCreateChartInfo(String chartId, String chartType) {
private ChartInfo getOrCreateChartInfo(ChartProvider chartProvider) {
return getOrCreateChartInfo(chartProvider, null);
}
private ChartInfo getOrCreateChartInfo(ChartProvider chartProvider, String oldType) {
String chartId = chartProvider.getChartUuid();
//缓存中有从缓存中拿
if (chartInfoCacheMap.containsKey(chartId)) {
return chartInfoCacheMap.get(chartId);
@ -129,12 +145,26 @@ public class ChartInfoCollector extends AbstractPointCollector<ChartInfo> {
chartInfoCacheMap.put(chartId, chartInfo);
return chartInfo;
}
//都有的话创建一个并加入到缓存中
ChartInfo chartInfo = ChartInfo.newInstance(chartId, chartType);
//都没有的话创建一个并加入到缓存中
ChartInfo chartInfo = ChartInfo.newInstance(chartProvider);
if (StringUtils.isNotEmpty(oldType)) {
chartInfo.updateFirstType(oldType);
}
chartInfoCacheMap.put(chartId, chartInfo);
return chartInfo;
}
public void checkTestChart(ChartProvider chartProvider) {
if (!shouldCollectInfo()) {
return;
}
ChartInfo chartInfo = chartInfoCacheMap.get(chartProvider.getChartUuid());
if (chartInfo != null) {
boolean testChart = chartProvider.isTestChart();
chartInfo.setTestChart(testChart);
}
}
/**
* 保存模板的时候将该模板中的图表埋点信息保存
*/
@ -200,16 +230,8 @@ public class ChartInfoCollector extends AbstractPointCollector<ChartInfo> {
* 获取缓存文件存放路径
*/
@Override
protected File getInfoFile() {
File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), XML_FILE_NAME));
try {
if (!file.exists()) {
file.createNewFile();
}
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
return file;
protected String getInfoFilePath() {
return XML_FILE_NAME;
}
@Override

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

@ -45,7 +45,7 @@ public class DesignerLogHandler {
private final SimpleDateFormat LOG_SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static final int GAP_X = -150;
private static final int GAP_X = -75;
private static final int INFO_GAP_Y = -60;

327
designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogHandlerBar.java

@ -2,183 +2,170 @@ package com.fr.design.mainframe.loghandler;
import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.ui.util.UIUtil;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.concurrent.atomic.AtomicBoolean;
public class LogHandlerBar extends JPanel implements ItemSelectable {
private static final long serialVersionUID = 1L;
private ItemListener listeners;
private UIButton clear;
private UIButton selectedall;
private UIButton set;
private String text;
private int INFONUM = 0;
private int ERRORNUM = 0;
private int SERVERNUM = 0;
private boolean isWithSerious;
public LogHandlerBar() {
this(null);
}
public LogHandlerBar(String text) {
this.setLayout(new CaptionLayout());
this.setUI(new LogHandlerBarUI());
this.text = text;
clear = new UIButton(BaseUtils.readIcon("com/fr/design/images/log/clear.png"));
clear.setMargin(null);
clear.setOpaque(false);
clear.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
clear.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Clear_All"));
selectedall = new UIButton(BaseUtils.readIcon("com/fr/design/images/log/selectedall.png"));
selectedall.setMargin(null);
selectedall.setOpaque(false);
selectedall.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
selectedall.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Select_All"));
set = new UIButton(BaseUtils.readIcon("com/fr/design/images/log/setting.png"));
set.setMargin(null);
set.setOpaque(false);
set.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
set.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"));
this.add(clear);
this.add(selectedall);
this.add(set);
}
public void clearMessage() {
INFONUM = ERRORNUM = SERVERNUM = 0;
repaint();
}
public boolean IsWithSerious() {
return isWithSerious;
}
public void setWithSerious(boolean b) {
this.isWithSerious = b;
}
public void infoAdd() {
INFONUM++;
repaint();
}
public void errorAdd() {
ERRORNUM++;
timerPaint();
}
public void serverAdd() {
SERVERNUM++;
timerPaint();
}
private AtomicBoolean painting = new AtomicBoolean(false);
public void timerPaint() {
if(!painting.get()) {
painting.set(true);
repaint();
painting.set(false);
}
}
public int getInfo() {
return INFONUM;
}
public int getError() {
return ERRORNUM;
}
public int getServer() {
return SERVERNUM;
}
public void addItemListener(ItemListener l) {
listeners = l;
}
public void removeItemListener(ItemListener l) {
listeners = null;
}
protected void fireItemStateChanged(ItemEvent e) {
listeners.itemStateChanged(e);
}
public Object[] getSelectedObjects() {
return new Object[] { text };
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
repaint();
}
public void addClearListener(ActionListener l) {
clear.addActionListener(l);
}
public void addSelectedListener(ActionListener l) {
selectedall.addActionListener(l);
}
public void addSetListener(ActionListener l) {
set.addActionListener(l);
}
private class CaptionLayout implements LayoutManager {
@Override
public void addLayoutComponent(String name, Component comp) {
}
@Override
public void removeLayoutComponent(Component comp) {
}
@Override
public Dimension preferredLayoutSize(Container parent) {
return new Dimension(120, 24);
}
import static com.fr.design.i18n.Toolkit.i18nText;
@Override
public Dimension minimumLayoutSize(Container parent) {
return new Dimension(0, 0);
}
@Override
public void layoutContainer(Container target) {
Insets insets = target.getInsets();
int top = insets.top;
int right = target.getWidth() - insets.right;
clear.setBounds(right - CLEAR_OFFSET, top + TOP_OFFSET, clear.getPreferredSize().width, clear.getPreferredSize().height);
selectedall.setBounds(right - SELECT_OFFSET, top + TOP_OFFSET, selectedall.getPreferredSize().width, selectedall.getPreferredSize().height);
set.setBounds(right - SET_OFFSET, top + TOP_OFFSET, set.getPreferredSize().width, set.getPreferredSize().height);
}
private static final int CLEAR_OFFSET = 130;
private static final int TOP_OFFSET = 4;
private static final int SELECT_OFFSET = 100;
private static final int SET_OFFSET = 70;
}
public class LogHandlerBar extends JPanel implements ItemSelectable {
// 可以作为常量 提前初始化 不用每次都去实时频繁的读取
private static final String NORMAL_MARK = i18nText("Fine-Design_Basic_NNormal");
private static final String ALERT_MARK = i18nText("Fine-Design_Basic_Alert");
private static final String SERIOUSLY_MARK = i18nText("Fine-Design_Basic_Seriously");
private static final long serialVersionUID = 1L;
private ItemListener listeners;
private UIButton clear;
private UIButton selectedall;
private UIButton set;
private UILabel normalLabel;
private UILabel alertLabel;
private UILabel seriouslyLabel;
private String text;
private int INFONUM = 0;
private int ERRORNUM = 0;
private int SERVERNUM = 0;
private static final int FLOW_LAYOUT_HGAP = 10;
private static final int FLOW_LAYOUT_VGAP = 5;
private boolean isWithSerious;
public LogHandlerBar() {
this(null);
}
public LogHandlerBar(String text) {
this.setLayout(new FlowLayout(FlowLayout.RIGHT, FLOW_LAYOUT_HGAP, FLOW_LAYOUT_VGAP));
this.setUI(new LogHandlerBarUI());
this.text = text;
clear = new UIButton(BaseUtils.readIcon("com/fr/design/images/log/clear.png"));
clear.setMargin(null);
clear.setOpaque(false);
clear.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
clear.setToolTipText(i18nText("Fine-Design_Basic_Clear_All"));
selectedall = new UIButton(BaseUtils.readIcon("com/fr/design/images/log/selectedall.png"));
selectedall.setMargin(null);
selectedall.setOpaque(false);
selectedall.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
selectedall.setToolTipText(i18nText("Fine-Design_Basic_Select_All"));
set = new UIButton(BaseUtils.readIcon("com/fr/design/images/log/setting.png"));
set.setMargin(null);
set.setOpaque(false);
set.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
set.setToolTipText(i18nText("Fine-Design_Report_Set"));
normalLabel = new UILabel(i18nText("Fine-Design_Basic_NNormal") + "(0)");
alertLabel = new UILabel(i18nText("Fine-Design_Basic_Alert") + "(0)");
seriouslyLabel = new UILabel(i18nText("Fine-Design_Basic_Seriously") + "(0)");
this.add(normalLabel);
this.add(alertLabel);
this.add(seriouslyLabel);
this.add(clear);
this.add(selectedall);
this.add(set);
}
/**
* 更新日志数量统计标签
*/
private void changeLabel() {
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
// 这块逻辑执行地很频繁
// 容易造成 AWT 与 FinePluginController 发生死锁
// in18Text每次读取 资源的时候 都会走下插件引擎逻辑去读取下插件的资源
// 应该避免每次都去读取 可以作为常量提前初始化好 避免与FinePluginController的竞争
normalLabel.setText(NORMAL_MARK + '(' + getInfo() + ')');
alertLabel.setText(ALERT_MARK + '(' + getError() + ')');
seriouslyLabel.setText(SERIOUSLY_MARK + '(' + getServer() + ')');
}
});
}
public void clearMessage() {
INFONUM = ERRORNUM = SERVERNUM = 0;
changeLabel();
}
public boolean IsWithSerious() {
return isWithSerious;
}
public void setWithSerious(boolean b) {
this.isWithSerious = b;
}
public void infoAdd() {
INFONUM++;
changeLabel();
}
public void errorAdd() {
ERRORNUM++;
changeLabel();
}
public void serverAdd() {
SERVERNUM++;
changeLabel();
}
public int getInfo() {
return INFONUM;
}
public int getError() {
return ERRORNUM;
}
public int getServer() {
return SERVERNUM;
}
public void addItemListener(ItemListener l) {
listeners = l;
}
public void removeItemListener(ItemListener l) {
listeners = null;
}
protected void fireItemStateChanged(ItemEvent e) {
listeners.itemStateChanged(e);
}
public Object[] getSelectedObjects() {
return new Object[]{text};
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
repaint();
}
public void addClearListener(ActionListener l) {
clear.addActionListener(l);
}
public void addSelectedListener(ActionListener l) {
selectedall.addActionListener(l);
}
public void addSetListener(ActionListener l) {
set.addActionListener(l);
}
}

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

@ -1,5 +1,7 @@
package com.fr.design.mainframe.loghandler;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.FontMetrics;
@ -11,9 +13,6 @@ import java.awt.event.FocusListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
public class LogHandlerBarUI extends ComponentUI implements MouseListener, FocusListener {
@ -99,10 +98,6 @@ public class LogHandlerBarUI extends ComponentUI implements MouseListener, Focus
if (button.getText() != null) {
g.drawString(button.getText(), textLeadingGap, y);
}
g.drawString(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_NNormal") + '(' + button.getInfo() + ')', button.getWidth() - 310, y);
g.drawString(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert") + '(' + button.getError() + ')', button.getWidth() - 250, y);
g.drawString(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Seriously") + '(' + button.getServer() + ')', button.getWidth() - 190, y);
}
/**

5
designer-base/src/main/java/com/fr/design/mainframe/loghandler/LogMessageBar.java

@ -12,6 +12,9 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class LogMessageBar extends JPanel {
private static final String LOG_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Log");
private UILabel messageLabel;
private int width = 600;
private static volatile LogMessageBar THIS;
@ -56,7 +59,7 @@ public class LogMessageBar extends JPanel {
if (message == null) {
return;
}
messageLabel.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Log") + " | " + message);
messageLabel.setText(LOG_MARK + " | " + message);
repaint();
}

50
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java

@ -6,13 +6,12 @@ import com.fr.design.gui.itextfield.UIIntNumberField;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.UITitleSplitLine;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.mobile.MobileCollapsedStyle;
import com.fr.form.ui.mobile.MobileFormCollapsedStyle;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.*;
import java.awt.*;
/**
* @author hades
@ -21,34 +20,45 @@ import java.awt.Dimension;
*/
public class MobileCollapsedStyleExpandPane extends MobileCollapsedStylePane {
private static final Dimension DEFAULT_SPINNER_SIZE = new Dimension(60, 24);
private UISpinner rowSpinner;
public MobileCollapsedStyleExpandPane() {
}
@Override
protected JPanel createLinePane() {
UITitleSplitLine splitLine = new UITitleSplitLine(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Line_Number"), 520);
splitLine.setPreferredSize(new Dimension(520, 20));
protected void createConfigPanes(JPanel settingPane) {
JPanel lineNumberConfigPane = this.createLineNumberConfigPane();
settingPane.add(lineNumberConfigPane);
super.createConfigPanes(settingPane);
}
protected JPanel createLineNumberConfigPane() {
JPanel configPane = super.createTitleConfigPane(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Line_Number"));
UILabel collapseLocationLabel = createLabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button"));
this.rowSpinner = new UISpinner(1, Integer.MAX_VALUE, 1, 1) {
@Override
protected UINumberField initNumberField(){
return new UIIntNumberField();
}
};
rowSpinner.setPreferredSize(DEFAULT_SPINNER_SIZE);
JPanel panel = new JPanel();
panel.setLayout(FRGUIPaneFactory.createBoxFlowLayout());
panel.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Start_From")));
panel.add(rowSpinner);
panel.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Row_To_Fold")));
JPanel linePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
linePane.add(splitLine, BorderLayout.NORTH);
linePane.add(panel, BorderLayout.CENTER);
return linePane;
this.rowSpinner.setPreferredSize(new Dimension(62, COMPONENT_HEIGHT));
JPanel defaultCollapsedStatePanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
defaultCollapsedStatePanel.add(createLabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Start_From") + " "));
defaultCollapsedStatePanel.add(rowSpinner);
defaultCollapsedStatePanel.add(createLabel(" " + Toolkit.i18nText("Fine-Design_Mobile_Collapse_Row_To_Fold")));
double[] rowSize = {COMPONENT_HEIGHT};
double[] columnSize = {LABEL_WIDTH, COMPONENT_WIDTH};
double[] verticalGaps = {0};
JPanel navButtonSettingsPanel = TableLayoutHelper.createDiffVGapTableLayoutPane(new JComponent[][]{
{collapseLocationLabel, defaultCollapsedStatePanel},
}, rowSize, columnSize, 5, verticalGaps);
navButtonSettingsPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 15, 0));
configPane.add(navButtonSettingsPanel);
return configPane;
}
@Override

153
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java

@ -1,8 +1,6 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ibutton.ModeButtonGroup;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox;
@ -10,9 +8,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.widget.UITitleSplitLine;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils;
@ -21,13 +17,7 @@ import com.fr.form.ui.mobile.MobileChartCollapsedStyle;
import com.fr.form.ui.mobile.MobileCollapsedStyle;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.*;
/**
* @author hades
@ -36,6 +26,13 @@ import java.awt.FlowLayout;
*/
public class MobileCollapsedStylePane extends BasicBeanPane<MobileCollapsedStyle> {
public final static Color THEME_COLOR = Color.decode("#2F8EF1");
public final static Font TEXT_FONT = new Font("Default", Font.PLAIN, 12);
public final static Color TEXT_FONT_COLOR = Color.decode("#333334");
public final static int LABEL_WIDTH = 96;
public final static int COMPONENT_HEIGHT = 20;
public final static int COMPONENT_WIDTH = 160;
private UICheckBox showButtonCheck;
private NewColorSelectBox buttonColorBox;
private UITextField foldedTextFiled;
@ -44,74 +41,94 @@ public class MobileCollapsedStylePane extends BasicBeanPane<MobileCollapsedStyle
public MobileCollapsedStylePane() {
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"), null);
VerticalFlowLayout layout = new VerticalFlowLayout(FlowLayout.LEADING, 0, 10);
layout.setAlignLeft(true);
this.setBorder(titledBorder);
this.setLayout(layout);
this.add(createLinePane());
this.add(createSettingPane());
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setBorder(BorderFactory.createEmptyBorder( 10, 5, 0, 5));
JPanel settingPane = this.createSettingPane();
this.createConfigPanes(settingPane);
this.add(settingPane);
}
private JPanel createSettingPane() {
JPanel settingPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 0);
UITitleSplitLine splitLine = new UITitleSplitLine(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Button"), 520);
splitLine.setPreferredSize(new Dimension(520, 20));
UILabel showButtonLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button"));
showButtonCheck = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button_On_Right"));
showButtonCheck.setPreferredSize(new Dimension(140, 24));
UILabel buttonColorLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Button_Color"));
buttonColorBox = new NewColorSelectBox(137);
UILabel foldedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Folded_Hint"));
JPanel settingPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
settingPane.setBorder(GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Report_Set"), THEME_COLOR));
return settingPane;
}
protected UILabel createLabel(String text) {
UILabel label = new UILabel(text, SwingConstants.RIGHT);
label.setForeground(TEXT_FONT_COLOR);
label.setFont(TEXT_FONT);
return label;
}
protected void createConfigPanes(JPanel settingPane) {
JPanel collapsedButtonConfigPane = this.createCollapsedButtonConfigPane();
settingPane.add(collapsedButtonConfigPane);
}
protected JPanel createTitleConfigPane(String title) {
JPanel configPane = new JPanel();
configPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
configPane.setLayout(new BoxLayout(configPane, BoxLayout.Y_AXIS));
Dimension titleLineDim = new Dimension(610, 20);
UITitleSplitLine splitLine = new UITitleSplitLine(title, titleLineDim.width);
splitLine.setPreferredSize(titleLineDim);
configPane.add(splitLine);
return configPane;
}
private JPanel createCollapsedButtonConfigPane() {
JPanel configPane = this.createTitleConfigPane(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Button"));
UILabel showButtonLabel = this.createLabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button"));
showButtonCheck = new UICheckBox(Toolkit.i18nText(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button_On_Right")));
showButtonCheck.setForeground(TEXT_FONT_COLOR);
showButtonCheck.setFont(TEXT_FONT);
UILabel buttonColorLabel = this.createLabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Button_Color"));
buttonColorBox = new NewColorSelectBox(COMPONENT_WIDTH);
UILabel foldedLabel = this.createLabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Folded_Hint"));
foldedTextFiled = new UITextField();
UILabel unfoldedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_UnFolded_Hint"));
UILabel unfoldedLabel = this.createLabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_UnFolded_Hint"));
unfoldedTextFiled = new UITextField();
UILabel defaultStateLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Default_State"));
buttonGroup = new ModeButtonGroup<>();
UILabel defaultCollapsedStateLabel = this.createLabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Default_State"));
JPanel defaultCollapsedStatePanel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
UIRadioButton foldedButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Fold"));
foldedButton.setSelected(true);
foldedButton.setPreferredSize(new Dimension(COMPONENT_WIDTH / 2, COMPONENT_HEIGHT));
foldedButton.setForeground(TEXT_FONT_COLOR);
foldedButton.setFont(TEXT_FONT);
UIRadioButton unfoldedButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Unfold"));
unfoldedButton.setPreferredSize(new Dimension(COMPONENT_WIDTH / 2, COMPONENT_HEIGHT));
unfoldedButton.setForeground(TEXT_FONT_COLOR);
unfoldedButton.setFont(TEXT_FONT);
defaultCollapsedStatePanel.add(foldedButton);
defaultCollapsedStatePanel.add(unfoldedButton);
buttonGroup = new ModeButtonGroup<>();
buttonGroup.put(CollapseState.FOLDED, foldedButton);
buttonGroup.put(CollapseState.UNFOLDED, unfoldedButton);
JPanel flowLeftPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
flowLeftPane.add(foldedButton);
flowLeftPane.add(unfoldedButton);
Component[][] northComponents = new Component[][] {
new Component[] {showButtonLabel, showButtonCheck}
};
Component[][] southComponents = new Component[][] {
new Component[] {defaultStateLabel, flowLeftPane}
};
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p};
double[] colSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
Component[][] centerComponents = new Component[][] {
new Component[] {buttonColorLabel, buttonColorBox},
new Component[] {foldedLabel, foldedTextFiled},
new Component[] {unfoldedLabel, unfoldedTextFiled},
};
JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(northComponents, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W2, IntervalConstants.INTERVAL_L1);
JPanel southPane = TableLayoutHelper.createGapTableLayoutPane(southComponents, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
final JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(centerComponents, rowSize, colSize, rowCount, LayoutConstants.HGAP_LARGE, LayoutConstants.VGAP_SMALL);
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.add(northPane, BorderLayout.NORTH);
panel.add(centerPane, BorderLayout.CENTER);
panel.add(southPane, BorderLayout.SOUTH);
settingPane.add(splitLine);
settingPane.add(panel);
showButtonCheck.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
centerPane.setVisible(showButtonCheck.isSelected());
}
});
return settingPane;
}
protected JPanel createLinePane() {
return FRGUIPaneFactory.createBorderLayout_S_Pane();
double[] rowSize = {COMPONENT_HEIGHT, COMPONENT_HEIGHT, COMPONENT_HEIGHT, COMPONENT_HEIGHT, COMPONENT_HEIGHT};
double[] columnSize = {LABEL_WIDTH, COMPONENT_WIDTH};
double[] verticalGaps = {10, 10, 10, 10, 10};
JPanel contentPane = TableLayoutHelper.createDiffVGapTableLayoutPane(new JComponent[][]{
{showButtonLabel, showButtonCheck},
{buttonColorLabel, buttonColorBox},
{foldedLabel, foldedTextFiled},
{unfoldedLabel, unfoldedTextFiled},
{defaultCollapsedStateLabel, defaultCollapsedStatePanel}
}, rowSize, columnSize, 5, verticalGaps);
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 15, 0));
configPane.add(contentPane);
return configPane;
}
@Override

5
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java

@ -9,8 +9,8 @@ import com.fr.design.i18n.Toolkit;
import com.fr.form.ui.mobile.MobileCollapsedStyle;
import com.fr.general.ComparatorUtils;
import javax.swing.SwingUtilities;
import java.awt.Dimension;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -33,6 +33,7 @@ public class MobileComboBoxDialogEditor extends BasicPane {
private ActionListener listener;
public MobileComboBoxDialogEditor(MobileCollapsedStylePane stylePane) {
this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
this.stylePane = stylePane;
this.comboBox = new UIComboBox(new Object[] {NONE, CUSTOM});
this.comboBox.setPreferredSize(COMBOX_DIMENSION);

140
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java

@ -2,29 +2,57 @@ package com.fr.design.mainframe.mobile.ui;
import com.fr.base.background.ColorBackground;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.Widget;
import com.fr.form.ui.mobile.MobileStyle;
import com.fr.general.FRFont;
import com.fr.invoke.Reflect;
import com.fr.stable.Constants;
import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
private final static int[] BORDER_LINE_STYLE_ARRAY = new int[]{
Constants.LINE_NONE,
Constants.LINE_THIN, //1px
Constants.LINE_MEDIUM, //2px
Constants.LINE_THICK, //3px
};
private static final int NORMAL_COMBO_WIDTH = 152;
private Widget widget;
private MobileStyleCustomDefinePane customBeanPane;
private Class<? extends MobileStyle> mobileStyleClazz;
private UIComboBox customCombo;
private JPanel settingPane;
private ColorSelectBox colorSelectBox;
private Color titleColor = new Color(47, 142, 241);
private JPanel commomPane;
private LineComboBox borderType;
private NewColorSelectBox borderColor;
private UISpinner borderRadius;
private NewColorSelectBox iconColor;
private MobileStyleFontConfigPane fontConfigPane;
MobileStyleDefinePane(Widget widget, Class<? extends MobileStyleCustomDefinePane> customBeanPaneClass,
Class<? extends MobileStyle> mobileStyleClazz) {
@ -37,8 +65,21 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
@Override
public void populateBean(MobileStyle ob) {
this.customBeanPane.populateBean(ob);
if(ob.getBackground() != null) {
colorSelectBox.setSelectObject(((ColorBackground)ob.getBackground()).getColor());
customCombo.setSelectedIndex(ob.isCommonCustom() ? 1 : 0);
if(ob.getCommonBackground() != null) {
colorSelectBox.setSelectObject(((ColorBackground)ob.getCommonBackground()).getColor());
}
borderType.setSelectedLineStyle(ob.getCommonBorderType());
if (ob.getCommonBorderColor() != null) {
borderColor.setSelectObject(ob.getCommonBorderColor());
}
borderRadius.setValue(ob.getCommonBorderRadius());
if (ob.getCommonIconColor() != null) {
iconColor.setSelectObject(ob.getCommonIconColor());
}
if (ob.getCommonFont() != null) {
fontConfigPane.populateBean(ob.getCommonFont());
}
}
@ -47,7 +88,13 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
MobileStyle mobileStyle = Reflect.on(mobileStyleClazz).create().get();
this.widget.setMobileStyle(mobileStyle);
this.customBeanPane.updateBean();
mobileStyle.setBackground(ColorBackground.getInstance(colorSelectBox.getSelectObject()));
mobileStyle.setCommonCustom(customCombo.getSelectedIndex() == 1);
mobileStyle.setCommonBackground(ColorBackground.getInstance(colorSelectBox.getSelectObject()));
mobileStyle.setCommonBorderType(borderType.getSelectedLineStyle());
mobileStyle.setCommonBorderColor(borderColor.getSelectObject());
mobileStyle.setCommonBorderRadius(borderRadius.getValue());
mobileStyle.setCommonIconColor(iconColor.getSelectObject());
mobileStyle.setCommonFont(fontConfigPane.updateBean());
return mobileStyle;
}
@ -64,7 +111,7 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
private void createGeneralPane() {
createPreviewPane();
createBackgroundPane();
createCommonPane();
}
private void createPreviewPane() {
@ -79,29 +126,63 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
}
}
private void createBackgroundPane() {
JPanel backgroundPane = new JPanel();
backgroundPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 5));
backgroundPane.setPreferredSize(new Dimension(500, 65));
private void createCommonPane() {
TitledBorder titledBorder = createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_Common_Attribute"));
backgroundPane.setBorder(titledBorder);
commomPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10);
commomPane.setBorder(titledBorder);
this.add(commomPane, BorderLayout.NORTH);
UILabel colorSelectLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Widget_Background"), UILabel.RIGHT);
colorSelectLabel.setPreferredSize(new Dimension(65, 20));
colorSelectBox = new ColorSelectBox(152);
colorSelectBox.addSelectChangeListener(new ChangeListener() {
customCombo = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Mobile_Default"), Toolkit.i18nText("Fine-Design_Mobile_Custom")});
customCombo.setSelectedIndex(0);
customCombo.setPreferredSize(new Dimension(NORMAL_COMBO_WIDTH + 15, 20));
customCombo.addItemListener(new ItemListener() {
@Override
public void stateChanged(ChangeEvent e) {
public void itemStateChanged(ItemEvent e) {
boolean custom = customCombo.getSelectedIndex() == 1;
settingPane.setVisible(custom);
}
});
commomPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Attribute_Settings")), customCombo));
backgroundPane.add(colorSelectLabel);
backgroundPane.add(colorSelectBox);
settingPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10);
settingPane.setVisible(false);
commomPane.add(settingPane);
this.add(backgroundPane, BorderLayout.NORTH);
createBackgroundPane();
createBorderPane();
createIconSettingPane();
createFontPane();
}
private void createBackgroundPane() {
colorSelectBox = new ColorSelectBox(NORMAL_COMBO_WIDTH);
JPanel backgroundPane = createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Background")), colorSelectBox);
settingPane.add(backgroundPane);
}
private void createBorderPane() {
borderType = new LineComboBox(BORDER_LINE_STYLE_ARRAY);
borderType.setSelectedLineStyle(Constants.LINE_THIN);
borderType.setPreferredSize(new Dimension(NORMAL_COMBO_WIDTH + 15, 20));
borderColor = new NewColorSelectBox(NORMAL_COMBO_WIDTH);
borderRadius = new UISpinner(0, Integer.MAX_VALUE, 1, 2);
borderRadius.setPreferredSize(new Dimension(NORMAL_COMBO_WIDTH + 20, 20));
settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderType")), borderType));
settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderColor")), borderColor));
settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_BorderRadius")), borderRadius));
}
private void createIconSettingPane() {
iconColor = new NewColorSelectBox(NORMAL_COMBO_WIDTH);
iconColor.setSelectObject(new Color(31,173,229));
settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Icon_Color")), iconColor));
}
private void createFontPane() {
fontConfigPane = new MobileStyleFontConfigPane();
settingPane.add(createLeftRightComponentsPane(createConfigLabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Font")), fontConfigPane));
}
private void createCustomPane() {
@ -109,6 +190,7 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
TitledBorder titledBorder = createTitledBorder(Toolkit.i18nText("Fine-Design_Report_Set"));
configPane.setBorder(titledBorder);
JPanel container = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10);
configPane.add(this.customBeanPane, BorderLayout.CENTER);
this.add(configPane, BorderLayout.CENTER);
@ -119,4 +201,14 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 12));
return titledBorder;
}
private UILabel createConfigLabel(String title) {
UILabel label = new UILabel(title + ":", UILabel.RIGHT);
label.setPreferredSize(new Dimension(75, 20));
return label;
}
private JPanel createLeftRightComponentsPane(Component... components) {
return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{components}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
}
}

122
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleFontConfigPane.java

@ -0,0 +1,122 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.base.BaseUtils;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.util.Vector;
public class MobileStyleFontConfigPane extends JPanel {
public static final int FONT_NONE = 0;
private static final int MAX_FONT_SIZE = 18;
private static final int MIN_FONT_SIZE = 12;
private static final Dimension BUTTON_SIZE = new Dimension(20, 18);
public static Vector<Integer> getFontSizes() {
Vector<Integer> FONT_SIZES = new Vector<Integer>();
for (int i = MIN_FONT_SIZE; i <= MAX_FONT_SIZE; i++) {
FONT_SIZES.add(i);
}
return FONT_SIZES;
}
private UIComboBox fontSizeComboBox;
private UIColorButton color;
private UIToggleButton italic;
private UIToggleButton bold;
public MobileStyleFontConfigPane() {
this.initComponent();
}
private void initComponent() {
fontSizeComboBox = new UIComboBox();
fontSizeComboBox.setModel(new DefaultComboBoxModel(getFontSizes()));
fontSizeComboBox.setSelectedItem(16);
fontSizeComboBox.setPreferredSize(new Dimension(60, 20));
fontSizeComboBox.setRenderer(new LineCellRenderer());
color = new UIColorButton();
italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"));
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
this.setButtonsTips();
this.setButtonsSize(BUTTON_SIZE);
Component[] components_font = new Component[]{
fontSizeComboBox, color, italic, bold
};
JPanel buttonPane = new JPanel(new BorderLayout());
buttonPane.add(GUICoreUtils.createFlowPane(components_font, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE));
this.setLayout(new BorderLayout(0,0));
this.add(buttonPane, BorderLayout.CENTER);
}
private void setButtonsTips() {
color.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Foreground"));
italic.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Italic"));
bold.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bold"));
}
private void setButtonsSize(Dimension size) {
color.setPreferredSize(size);
italic.setPreferredSize(size);
bold.setPreferredSize(size);
}
public void populateBean(FRFont frFont) {
fontSizeComboBox.setSelectedItem(frFont.getSize());
color.setColor(frFont.getForeground());
bold.setSelected(frFont.isBold());
italic.setSelected(frFont.isItalic());
}
public FRFont updateBean() {
int style = Font.PLAIN;
style += this.bold.isSelected() ? Font.BOLD : Font.PLAIN;
style += this.italic.isSelected() ? Font.ITALIC : Font.PLAIN;
return FRFont.getInstance(
FRFont.DEFAULT_FONTNAME,
style,
Float.parseFloat(fontSizeComboBox.getSelectedItem().toString()),
color.getColor(),
Constants.LINE_NONE
);
}
private class LineCellRenderer extends UIComboBoxRenderer {
public LineCellRenderer() {
super();
}
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel renderer =(JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
int currentValue = ((Integer) value).intValue();
if (currentValue == MobileStyleFontConfigPane.FONT_NONE) {
renderer.setText(StringUtils.BLANK + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None"));
}
return renderer;
}
}
}

76
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java

@ -63,14 +63,16 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
protected void init() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
previewPane = createPreviewPane();
previewPane.setPreferredSize(new Dimension(500, 60));
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"), null);
titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 9, Color.BLUE));
northPane.setBorder(titledBorder);
northPane.setPreferredSize(new Dimension(500, 83));
northPane.add(previewPane, BorderLayout.CENTER);
this.add(northPane, BorderLayout.NORTH);
if (previewPane != null) {
previewPane.setPreferredSize(new Dimension(500, 60));
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"), null);
titledBorder.setTitleFont(FRFont.getInstance("PingFangSC-Regular", Font.PLAIN, 9, Color.BLUE));
northPane.setBorder(titledBorder);
northPane.setPreferredSize(new Dimension(500, 83));
northPane.add(previewPane, BorderLayout.CENTER);
this.add(northPane, BorderLayout.NORTH);
}
createConfigPane();
}
@ -107,22 +109,11 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
UILabel tabStyleLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Style"));
tabStyleLabel.setPreferredSize(new Dimension(55, 20));
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tabStyleLabel, custom}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
jPanel.setPreferredSize(new Dimension(200, 20));
jPanel.setPreferredSize(new Dimension(212, 20));
outPanel.add(jPanel);
scrollPanel.add(outPanel, BorderLayout.NORTH);
UITitleSplitLine backgroundSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 520);
backgroundSplit.setPreferredSize(new Dimension(520, 20));
centerPane.add(backgroundSplit);
centerPane.add(createBackgroundConfPane());
UITitleSplitLine fontSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Char"), 520);
fontSplit.setPreferredSize(new Dimension(520, 20));
centerPane.add(fontSplit);
centerPane.add(createFontConfPane());
createBuiltinConfPane(centerPane);
createExtraConfPane(centerPane);
scrollPanel.add(centerPane, BorderLayout.CENTER);
@ -169,6 +160,19 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
return jPanel3;
}
protected void createBuiltinConfPane(JPanel centerPane) {
UITitleSplitLine backgroundSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background"), 520);
backgroundSplit.setPreferredSize(new Dimension(520, 20));
centerPane.add(backgroundSplit);
centerPane.add(createBackgroundConfPane());
UITitleSplitLine fontSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Char"), 520);
fontSplit.setPreferredSize(new Dimension(520, 20));
centerPane.add(fontSplit);
centerPane.add(createFontConfPane());
}
protected void createExtraConfPane(JPanel centerPane) {
@ -184,8 +188,12 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
populateSubStyle(ob);
custom.setSelectedItem(!ob.isCustom() ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default") :
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom"));
initialColorBox.setSelectObject(ob.getInitialColor());
fontConfPane.populate(ob.getTabFontConfig().getFont());
if (initialColorBox != null) {
initialColorBox.setSelectObject(ob.getInitialColor());
}
if (fontConfPane != null) {
fontConfPane.populate(ob.getTabFontConfig().getFont());
}
updatePreviewPane();
}
@ -207,20 +215,26 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
}
MobileTemplateStyle ob = updateSubStyle();
ob.setCustom(custom.getSelectedIndex() == 1);
ob.setInitialColor(initialColorBox.getSelectObject());
TabFontConfig config = new TabFontConfig();
config.setSelectColor(ob.getTabFontConfig().getSelectColor());
config.setFont(fontConfPane.update());
ob.setTabFontConfig(config);
if (initialColorBox != null) {
ob.setInitialColor(initialColorBox.getSelectObject());
}
if (fontConfPane != null) {
TabFontConfig config = new TabFontConfig();
config.setSelectColor(ob.getTabFontConfig().getSelectColor());
config.setFont(fontConfPane.update());
ob.setTabFontConfig(config);
}
return ob;
}
protected abstract MobileTemplateStyle getDefaultTemplateStyle();
public void updatePreviewPane() {
previewPane.populateConfig(updateConfig());
previewPane.setBackground(previewPane.getInitialColor());
previewPane.repaint();
if (previewPane != null) {
previewPane.populateConfig(updateConfig());
previewPane.setBackground(previewPane.getInitialColor());
previewPane.repaint();
}
}
public abstract void populateSubStyle(MobileTemplateStyle ob);

57
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe.mobile.ui;
import com.fr.base.BaseUtils;
import com.fr.base.Utils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.AttrScrollPane;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.LineComboBox;
@ -34,6 +35,7 @@ import java.awt.*;
public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<MobileBookMarkStyle> {
private static final long serialVersionUID = 1L;
private static final int COLUMN_HEIGHT = 20;
private static final int COLUMN_WIDTH = 160;
private UnsignedIntUISpinner buttonWidthSpinner;
@ -73,9 +75,20 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
this.add(this.createNavButtonStylePanel());
this.add(this.createNormalStateStylePanel());
this.add(this.createSelectedStateStylePanel());
final JPanel contentPanel = FRGUIPaneFactory.createYBoxEmptyBorderPane();
contentPanel.add(this.createNavButtonStylePanel());
contentPanel.add(this.createNormalStateStylePanel());
contentPanel.add(this.createSelectedStateStylePanel());
JPanel scrollPanel = new AttrScrollPane() {
@Override
protected JPanel createContentPane() {
return contentPanel;
}
};
scrollPanel.setPreferredSize(new Dimension(-2, -2));
this.add(scrollPanel, BorderLayout.CENTER);
}
private JPanel createNavButtonStylePanel() {
@ -87,11 +100,11 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
UILabel sizeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Size") + ":",
SwingConstants.RIGHT);
JPanel sizePane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0);
JPanel sizePane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 4, 0);
sizePane.add(buttonWidthSpinner);
sizePane.add(buttonHeightSpinner);
JPanel sizeTipsPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0);
JPanel sizeTipsPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 4, 0);
sizeTipsPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Width"),
SwingConstants.CENTER));
sizeTipsPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Height"),
@ -103,7 +116,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
SwingConstants.RIGHT);
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p};
double[] rowSize = {COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT};
double[] columnSize = {p, COLUMN_WIDTH};
double[] verticalGaps = {0, 10, 10};
@ -145,7 +158,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
}
});
normalBorderWidthComBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
normalBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getBorderWidth());
normalBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getBorderLineStyle());
normalBorderColorBox = new ColorSelectBox(COLUMN_WIDTH);
normalBorderColorBox.setSelectObject(DEFAULT_STYLE.getBorderColor());
normalFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
@ -167,12 +180,12 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
JPanel fontExtraPane = TableLayoutHelper.createGapTableLayoutPane(
new JComponent[][]{{normalFontSizeComboBox, normalFontColorButton, normalFontItalicButton, normalFontBoldButton}},
new double[]{p},
new double[]{COLUMN_HEIGHT},
new double[]{p, p, p, p},
0, 5
7, 0
);
double[] rowSize = {p, p, p, p, p};
double[] rowSize = {COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT};
double[] columnSize = {p, COLUMN_WIDTH, p};
JPanel normalStateStyleSettingsPanel = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{
@ -232,7 +245,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
}
});
selectedBorderWidthComBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
selectedBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getSelectedBorderWidth());
selectedBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getSelectedBorderLineStyle());
selectedBorderColorBox = new ColorSelectBox(COLUMN_WIDTH);
selectedBorderColorBox.setSelectObject(DEFAULT_STYLE.getSelectedBorderColor());
selectedFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
@ -254,12 +267,12 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
JPanel fontExtraPane = TableLayoutHelper.createGapTableLayoutPane(
new JComponent[][]{{selectedFontSizeComboBox, selectedFontColorButton, selectedFontItalicButton, selectedFontBoldButton}},
new double[]{p},
new double[]{COLUMN_HEIGHT},
new double[]{p, p, p, p},
0, 5
7, 0
);
double[] rowSize = {p, p, p, p, p};
double[] rowSize = {COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT};
double[] columnSize = {p, COLUMN_WIDTH, p};
JPanel selectedStateStyleSettingsPanel = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{
@ -316,7 +329,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
normalBackgroundColorBox.setSelectObject(style.getBackgroundColor());
normalOpacityDragBar.setValue(style.getOpacity());
normalOpacitySpinner.setValue(style.getOpacity());
normalBorderWidthComBox.setSelectedLineStyle(style.getBorderWidth());
normalBorderWidthComBox.setSelectedLineStyle(style.getBorderLineStyle());
normalBorderColorBox.setSelectObject(style.getBorderColor());
normalFontNameComboBox.setSelectedItem(style.getFontFamily());
normalFontSizeComboBox.setSelectedItem(style.getFontSize());
@ -327,7 +340,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
selectedBackgroundColorBox.setSelectObject(style.getSelectedBackgroundColor());
selectedOpacityDragBar.setValue(style.getSelectedOpacity());
selectedOpacitySpinner.setValue(style.getSelectedOpacity());
selectedBorderWidthComBox.setSelectedLineStyle(style.getSelectedBorderWidth());
selectedBorderWidthComBox.setSelectedLineStyle(style.getSelectedBorderLineStyle());
selectedBorderColorBox.setSelectObject(style.getSelectedBorderColor());
selectedFontNameComboBox.setSelectedItem(style.getSelectedFontFamily());
selectedFontSizeComboBox.setSelectedItem(style.getSelectedFontSize());
@ -345,11 +358,9 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
style.setGap((int) buttonGapSpinner.getValue());
style.setBorderRadius((int) buttonBorderRadiusSpinner.getValue());
if (normalBackgroundColorBox.getSelectObject() != null) {
style.setBackgroundColor(normalBackgroundColorBox.getSelectObject());
}
style.setBackgroundColor(normalBackgroundColorBox.getSelectObject());
style.setOpacity((int) normalOpacitySpinner.getValue());
style.setBorderWidth(normalBorderWidthComBox.getSelectedLineStyle());
style.setBorderLineStyle(normalBorderWidthComBox.getSelectedLineStyle());
style.setBorderColor(normalBorderColorBox.getSelectObject());
if (normalFontNameComboBox.getSelectedItem() != null) {
style.setFontFamily((String) normalFontNameComboBox.getSelectedItem());
@ -361,11 +372,9 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
style.setFontItalic(normalFontItalicButton.isSelected());
style.setFontBold(normalFontBoldButton.isSelected());
if (selectedBackgroundColorBox.getSelectObject() != null) {
style.setSelectedBackgroundColor(selectedBackgroundColorBox.getSelectObject());
}
style.setSelectedBackgroundColor(selectedBackgroundColorBox.getSelectObject());
style.setSelectedOpacity((int) selectedOpacitySpinner.getValue());
style.setSelectedBorderWidth(selectedBorderWidthComBox.getSelectedLineStyle());
style.setSelectedBorderLineStyle(selectedBorderWidthComBox.getSelectedLineStyle());
style.setSelectedBorderColor(selectedBorderColorBox.getSelectObject());
if (selectedFontNameComboBox.getSelectedItem() != null) {
style.setSelectedFontFamily((String) selectedFontNameComboBox.getSelectedItem());

2
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java

@ -7,6 +7,7 @@ import com.fr.general.cardtag.mobile.DownMenuStyle;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.SliderStyle;
import com.fr.general.cardtag.mobile.UpMenuStyle;
import com.fr.general.cardtag.mobile.UniteStyle;
import com.fr.invoke.Reflect;
import com.fr.log.FineLoggerFactory;
import java.util.HashMap;
@ -20,6 +21,7 @@ public class TemplateStyleDefinePaneFactory {
defineMap.put(UpMenuStyle.STYLE_NAME, new StyleDefinePaneUI(UpMenuStyleDefinePane.class));
defineMap.put(DownMenuStyle.STYLE_NAME, new StyleDefinePaneUI(DownMenuStyleDefinePane.class));
defineMap.put(SliderStyle.STYLE_NAME, new StyleDefinePaneUI(SliderStyleDefinePane.class));
defineMap.put(UniteStyle.STYLE_NAME, new StyleDefinePaneUI(UniteStyleDefinePane.class));
}
public static BasicBeanPane<MobileTemplateStyle> createDefinePane(String style, WCardTagLayout tagLayout) {

251
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java

@ -0,0 +1,251 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UnsignedIntUISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.MobileTabFontConfPane;
import com.fr.design.mainframe.widget.UITitleSplitLine;
import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.TabFontConfig;
import com.fr.general.cardtag.mobile.UniteStyle;
import com.fr.stable.CoreConstants;
import javax.swing.*;
import java.awt.*;
public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane {
private static final int SPLIT_LINE_WIDTH = 520;
private static final int SPLIT_LINE_HEIGHT = 20;
private static final int TOGGLE_BUTTON_WIDTH = 20;
private static final int LABEL_WIDTH = 75;
private static final int LINE_COMPONENT_WIDTH = 157;
private static final int LINE_COMPONENT_HEIGHT = 20;
private UnsignedIntUISpinner paddingLeftSpinner;
private UnsignedIntUISpinner paddingRightSpinner;
private UnsignedIntUISpinner paddingTopSpinner;
private UnsignedIntUISpinner paddingBottomSpinner;
private NewColorSelectBox initialBackgroundColorBox;
private NewColorSelectBox selectedBackgroundColorBox;
private LineComboBox borderWidthComboBox;
private ColorSelectBox borderColorBox;
private UnsignedIntUISpinner borderRadiusSpinner;
private MobileTabFontConfPane tabFontConfPane;
private UIColorButton selectedFontColorButton;
public UniteStyleDefinePane(WCardTagLayout tagLayout) {
super(tagLayout);
}
@Override
protected void createBuiltinConfPane(JPanel centerPane) {
// ignore builtin conf pane
}
@Override
protected void createExtraConfPane(JPanel centerPane) {
UITitleSplitLine paddingSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Button_Padding"), SPLIT_LINE_WIDTH);
paddingSplit.setPreferredSize(new Dimension(SPLIT_LINE_WIDTH, SPLIT_LINE_HEIGHT));
centerPane.add(paddingSplit);
centerPane.add(this.createPaddingConfPane());
UITitleSplitLine backgroundSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Button_Background"), SPLIT_LINE_WIDTH);
backgroundSplit.setPreferredSize(new Dimension(SPLIT_LINE_WIDTH, SPLIT_LINE_HEIGHT));
centerPane.add(backgroundSplit);
centerPane.add(this.createBackgroundColorConfPanel());
UITitleSplitLine borderSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Border"), SPLIT_LINE_WIDTH);
borderSplit.setPreferredSize(new Dimension(SPLIT_LINE_WIDTH, SPLIT_LINE_HEIGHT));
centerPane.add(borderSplit);
centerPane.add(this.createBorderConfPanel());
UITitleSplitLine fontSplit = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Char"), SPLIT_LINE_WIDTH);
fontSplit.setPreferredSize(new Dimension(SPLIT_LINE_WIDTH, SPLIT_LINE_HEIGHT));
centerPane.add(fontSplit);
centerPane.add(this.createFontConfPanel());
}
private JPanel createPaddingConfPane() {
this.paddingTopSpinner = new UnsignedIntUISpinner(0, 30, 1, UniteStyle.DEFAULT_PADDING_TOP);
this.paddingTopSpinner.setPreferredSize(new Dimension(62, LINE_COMPONENT_HEIGHT));
this.paddingBottomSpinner = new UnsignedIntUISpinner(0, 30, 1, UniteStyle.DEFAULT_PADDING_BOTTOM);
this.paddingBottomSpinner.setPreferredSize(new Dimension(62, LINE_COMPONENT_HEIGHT));
UILabel paddingTopLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Base_Top") + ":", SwingConstants.RIGHT);
paddingTopLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel paddingBottomLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Base_Bottom") + ":", SwingConstants.RIGHT);
paddingBottomLabel.setPreferredSize(new Dimension(LABEL_WIDTH / 2, LINE_COMPONENT_HEIGHT));
this.paddingLeftSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, UniteStyle.DEFAULT_PADDING_LEFT);
this.paddingLeftSpinner.setPreferredSize(new Dimension(62, LINE_COMPONENT_HEIGHT));
this.paddingRightSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, UniteStyle.DEFAULT_PADDING_RIGHT);
this.paddingRightSpinner.setPreferredSize(new Dimension(62, LINE_COMPONENT_HEIGHT));
UILabel paddingLeftLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Left") + ":", SwingConstants.RIGHT);
paddingLeftLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel paddingRightLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Right") + ":", SwingConstants.RIGHT);
paddingLeftLabel.setPreferredSize(new Dimension(LABEL_WIDTH / 2, LINE_COMPONENT_HEIGHT));
JPanel paddingPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{ paddingTopLabel, paddingTopSpinner, paddingBottomLabel, paddingBottomSpinner},
new Component[]{ paddingLeftLabel, paddingLeftSpinner, paddingRightLabel,paddingRightSpinner}
}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
paddingPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 20));
return paddingPanel;
}
private JPanel createBackgroundColorConfPanel() {
this.initialBackgroundColorBox = new NewColorSelectBox(LINE_COMPONENT_WIDTH);
this.initialBackgroundColorBox.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT));
this.selectedBackgroundColorBox = new NewColorSelectBox(LINE_COMPONENT_WIDTH);
this.selectedBackgroundColorBox.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel initialBackgroundColorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Init_Fill") + ":", SwingConstants.RIGHT);
initialBackgroundColorLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel selectedBackgroundColorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Select_Fill") + ":", SwingConstants.RIGHT);
selectedBackgroundColorLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
JPanel backgroundColorPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{ initialBackgroundColorLabel, initialBackgroundColorBox },
new Component[]{ selectedBackgroundColorLabel, selectedBackgroundColorBox }
}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
backgroundColorPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 20));
return backgroundColorPanel;
}
private JPanel createBorderConfPanel() {
this.borderWidthComboBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY);
this.borderWidthComboBox.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT));
this.borderColorBox = new ColorSelectBox(LINE_COMPONENT_WIDTH);
this.borderColorBox.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT));
this.borderRadiusSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, UniteStyle.DEFAULT_BORDER_RADIUS);
this.borderRadiusSpinner.setPreferredSize(new Dimension(LINE_COMPONENT_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel borderSizeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Line_Style") + ":", SwingConstants.RIGHT);
borderSizeLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel borderColorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Colors") + ":", SwingConstants.RIGHT);
borderColorLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel borderRadiusLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius") + ":", SwingConstants.RIGHT);
borderRadiusLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
JPanel borderPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{ borderSizeLabel, borderWidthComboBox},
new Component[]{ borderColorLabel, borderColorBox },
new Component[]{ borderRadiusLabel, borderRadiusSpinner }
}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
borderPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 20));
return borderPanel;
}
private JPanel createFontConfPanel() {
this.tabFontConfPane = new MobileTabFontConfPane();
this.selectedFontColorButton = new UIColorButton();
this.selectedFontColorButton.setPreferredSize(new Dimension(TOGGLE_BUTTON_WIDTH, LINE_COMPONENT_HEIGHT));
JPanel selectedFontColorPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
selectedFontColorPanel.add(this.selectedFontColorButton);
UILabel initialFontLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Init_Char") + ":", SwingConstants.RIGHT);
initialFontLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel selectedFontLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Select_Char") + ":", SwingConstants.RIGHT);
selectedFontLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
JPanel fontPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{ initialFontLabel, tabFontConfPane },
new Component[]{ selectedFontLabel, selectedFontColorPanel }
}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
fontPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 20));
return fontPanel;
}
@Override
protected void initDefaultConfig() {
this.paddingTopSpinner.setValue(UniteStyle.DEFAULT_PADDING_TOP);
this.paddingBottomSpinner.setValue(UniteStyle.DEFAULT_PADDING_BOTTOM);
this.paddingLeftSpinner.setValue(UniteStyle.DEFAULT_PADDING_LEFT);
this.paddingRightSpinner.setValue(UniteStyle.DEFAULT_PADDING_RIGHT);
this.initialBackgroundColorBox.setSelectObject(UniteStyle.DEFAULT_INITIAL_BACKGROUND_COLOR);
this.selectedBackgroundColorBox.setSelectObject(UniteStyle.DEFAULT_SELECTED_BACKGROUND_COLOR);
this.borderWidthComboBox.setSelectedLineStyle(UniteStyle.DEFAULT_BORDER_LINE.getLineStyle());
this.borderColorBox.setSelectObject(UniteStyle.DEFAULT_BORDER_LINE.getColor());
this.borderRadiusSpinner.setValue(UniteStyle.DEFAULT_BORDER_RADIUS);
this.tabFontConfPane.populate(UniteStyle.DEFAULT_TAB_FONT.getFont());
this.selectedFontColorButton.setColor(UniteStyle.DEFAULT_TAB_FONT.getSelectColor());
}
@Override
protected MobileTemplatePreviewPane createPreviewPane() {
return null;
}
@Override
protected MobileTemplateStyle getDefaultTemplateStyle() {
return new UniteStyle();
}
@Override
public void populateSubStyle(MobileTemplateStyle ob) {
UniteStyle style = (UniteStyle) ob;
this.paddingTopSpinner.setValue(style.getPaddingTop());
this.paddingBottomSpinner.setValue(style.getPaddingBottom());
this.paddingLeftSpinner.setValue(style.getPaddingLeft());
this.paddingRightSpinner.setValue(style.getPaddingRight());
this.initialBackgroundColorBox.setSelectObject(style.getInitialColor());
this.selectedBackgroundColorBox.setSelectObject(style.getSelectColor());
this.borderWidthComboBox.setSelectedLineStyle(style.getBorderLineStyle());
this.borderColorBox.setSelectObject(style.getBorderColor());
this.borderRadiusSpinner.setValue(style.getBorderRadius());
this.tabFontConfPane.populate(style.getTabFontConfig().getFont());
this.selectedFontColorButton.setColor(style.getTabFontConfig().getSelectColor());
}
@Override
public MobileTemplateStyle updateSubStyle() {
UniteStyle style = new UniteStyle();
style.setPaddingTop((int) this.paddingTopSpinner.getValue());
style.setPaddingBottom((int) this.paddingBottomSpinner.getValue());
style.setPaddingLeft((int) this.paddingLeftSpinner.getValue());
style.setPaddingRight((int) this.paddingRightSpinner.getValue());
style.setInitialColor(this.initialBackgroundColorBox.getSelectObject());
style.setSelectColor(this.selectedBackgroundColorBox.getSelectObject());
style.setBorderLineStyle(this.borderWidthComboBox.getSelectedLineStyle());
style.setBorderColor(this.borderColorBox.getSelectObject());
style.setBorderRadius((int) this.borderRadiusSpinner.getValue());
TabFontConfig config = new TabFontConfig();
config.setFont(this.tabFontConfPane.update());
config.setSelectColor(this.selectedFontColorButton.getColor());
style.setTabFontConfig(config);
return style;
}
@Override
protected String title4PopupWindow() {
return null;
}
}

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

Loading…
Cancel
Save