Browse Source

Merge branch 'final/10.0' into persist/10.0

# Conflicts:
#	designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
persist/10.0
jeo 4 years ago
parent
commit
ca541bcfea
  1. 8
      .gitignore
  2. 82
      build.gradle
  3. 54
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  4. 37
      designer-base/src/main/java/com/fr/design/ExtraDesignClassManager.java
  5. 7
      designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java
  6. 3
      designer-base/src/main/java/com/fr/design/bridge/exec/JSExecutor.java
  7. 32
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  8. 31
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  9. 4
      designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java
  10. 12
      designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java
  11. 7
      designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java
  12. 234
      designer-base/src/main/java/com/fr/design/extra/QQLoginWebPane.java
  13. 18
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  14. 7
      designer-base/src/main/java/com/fr/design/fun/CellExpandAttrPanelProvider.java
  15. 14
      designer-base/src/main/java/com/fr/design/fun/ChartWidgetOptionProvider.java
  16. 9
      designer-base/src/main/java/com/fr/design/fun/FormAdaptiveConfigUIProcessor.java
  17. 7
      designer-base/src/main/java/com/fr/design/fun/FormWidgetOptionProvider.java
  18. 4
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractCellExpandAttrPanelProvider.java
  19. 29
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractChartWidgetOptionProvider.java
  20. 5
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractFormWidgetOptionProvider.java
  21. 6
      designer-base/src/main/java/com/fr/design/gui/frpane/EditingStringListPane.java
  22. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java
  23. 48
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java
  24. 26
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java
  25. 1
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/UINativeFileChooser.java
  26. 13
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/RSyntaxTextArea.java
  27. 46
      designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java
  28. 3
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  29. 7
      designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java
  30. 57
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  31. 2
      designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java
  32. 33
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileStyleDefinePane.java
  33. 2
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java
  34. 26
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java
  35. 28
      designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java
  36. 20
      designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java
  37. 17
      designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java
  38. 10
      designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java
  39. 2
      designer-base/src/main/java/com/fr/design/upm/UpmFinder.java
  40. 200
      designer-base/src/main/java/com/fr/design/utils/AWTUtilities.java
  41. 68
      designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java
  42. 28
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  43. 3
      designer-base/src/main/java/com/fr/start/SplashWindow.java
  44. BIN
      designer-base/src/main/resources/com/fr/design/images/m_insert/auto_chart.png
  45. 47
      designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java
  46. 3
      designer-base/src/test/java/com/fr/design/env/RemoteWorkspaceTest.java
  47. 41
      designer-base/src/test/java/com/fr/design/gui/icombocheckbox/UICheckListPopupTest.java
  48. 39
      designer-base/src/test/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePaneTest.java
  49. 3
      designer-chart/build.gradle
  50. 13
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  51. 79
      designer-chart/src/main/java/com/fr/design/chart/AutoChartDialog.java
  52. 104
      designer-chart/src/main/java/com/fr/design/chart/AutoChartIcon.java
  53. 199
      designer-chart/src/main/java/com/fr/design/chart/AutoChartTypePane.java
  54. 1
      designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java
  55. 46
      designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java
  56. 3
      designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java
  57. 9
      designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java
  58. 43
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java
  59. 49
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java
  60. 106
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java
  61. 5
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java
  62. 92
      designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java
  63. 7
      designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java
  64. 4
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnConditionPane.java
  65. 21
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java
  66. 3
      designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java
  67. 27
      designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java
  68. 71
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java
  69. 113
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPaneWithGradientBar.java
  70. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java
  71. 25
      designer-chart/src/main/java/com/fr/van/chart/designer/data/OneDimensionalPlotReportDataContentPane.java
  72. 153
      designer-chart/src/main/java/com/fr/van/chart/designer/other/condition/item/VanChartColumnSeriesColorConditionPane.java
  73. 16
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java
  74. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java
  75. 10
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java
  76. 33
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java
  77. 24
      designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java
  78. 43
      designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java
  79. 13
      designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java
  80. 1
      designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java
  81. 9
      designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarSeriesPane.java
  82. 2
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java
  83. BIN
      designer-chart/src/main/resources/com/fr/design/images/form/toolbar/auto_chart.png
  84. BIN
      designer-chart/src/main/resources/com/fr/design/images/us_emptydata.png
  85. BIN
      designer-chart/src/main/resources/com/fr/design/images/zh_emptydata.png
  86. 3
      designer-form/build.gradle
  87. 18
      designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java
  88. 58
      designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java
  89. 26
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  90. 7
      designer-form/src/main/java/com/fr/design/designer/creator/DedicateLayoutContainer.java
  91. 121
      designer-form/src/main/java/com/fr/design/designer/creator/XAutoChartCreator.java
  92. 19
      designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java
  93. 7
      designer-form/src/main/java/com/fr/design/designer/creator/XCheckBoxGroup.java
  94. 24
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  95. 1
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  96. 7
      designer-form/src/main/java/com/fr/design/designer/creator/XRadioGroup.java
  97. 3
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  98. 32
      designer-form/src/main/java/com/fr/design/designer/properties/mobile/ButtonGroupPropertyUI.java
  99. 37
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  100. 12
      designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.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'
}
}

54
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) {
@ -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
@ -409,7 +407,7 @@ public class EnvChangeEntrance {
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() {
@ -418,6 +416,8 @@ public class EnvChangeEntrance {
FineProcessContext.getParentPipe().fire(new CarryMessageEvent(ReportState.ACTIVE.getValue()));
if (!envListOkAction(envListPane, PopTipStrategy.NOW)) {
DesignerExiter.getInstance().execute();
} else {
updateNotRememberPwdEnv();
}
}
@ -429,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);

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

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

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

@ -4,6 +4,7 @@ import com.fr.base.TableData;
import com.fr.data.core.DataCoreUtils;
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.DBTableData;
import com.fr.data.operator.DataOperator;
@ -37,11 +38,7 @@ import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.connection.DBConnectAuth;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.SwingWorker;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.PopupMenuEvent;
@ -52,9 +49,7 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.*;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent;
@ -469,6 +464,15 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
* @return 数据集数据
*/
public TableData createSelectTableData() {
return createSelectTableData(new SelectSqlProcessor() {
@Override
public String createSelectSql(String schema, String tableName, Dialect dialect) {
return DataCoreUtils.createSelectSQL(schema, tableName, dialect);
}
});
}
public TableData createSelectTableData(SelectSqlProcessor sqlProcessor) {
DataBaseItems paras = this.updateBean();
boolean connect = false;
com.fr.data.impl.Connection database = DBUtils.checkDBConnection(paras.getDatabaseName());
@ -491,11 +495,11 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
TableData tableData = null;
if (WorkContext.getCurrent().isLocal()) {
tableData = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(),
tableData = new DBTableData(database, sqlProcessor.createSelectSql(paras.getSchemaName(), paras.getTableName(),
DialectFactory.getDialectByName(paras.getDatabaseName())));
} else {
try {
TableData tableDataLocal = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName())));
TableData tableDataLocal = new DBTableData(database, sqlProcessor.createSelectSql(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName())));
tableData = DataOperator.getInstance().previewTableData(tableDataLocal, java.util.Collections.EMPTY_MAP,
DesignerEnvManager.getEnvManager().getMaxNumberOrPreviewRow());
} catch (Exception e) {
@ -605,6 +609,13 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
});
}
/**
* 数据集选择面板里的生成sql语句的接口
*/
public interface SelectSqlProcessor {
String createSelectSql(String schema, String tableName, Dialect dialect);
}
protected class StringUIComboBox extends UIComboBox {
private boolean refreshingModel = false;

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授权窗口
*/

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

18
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;
/**
@ -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,

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

@ -18,4 +18,11 @@ public interface CellExpandAttrPanelProvider extends Mutable {
* @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();
}

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

@ -25,13 +25,10 @@ public interface FormAdaptiveConfigUIProcessor extends Immutable {
ShortCut getConfigShortCut(JTemplate jTemplate);
/**
* 绘制自适应下报表块在表单界面中显示图片
* @param size 绘制尺寸
* @param elementCasePane 报表块内容对象
* @return 自适应下报表块在表单界面中显示的图片
* 是否开启表单滑块缩放功能
* @return 是否开启表单滑块缩放
*/
BufferedImage paintFormElementCaseImage(Dimension size, JComponent elementCasePane);
boolean openFormSliderZoom();
/**
* 获取新自适应下字体显示的dpi

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

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

@ -36,4 +36,8 @@ public class AbstractCellExpandAttrPanelProvider implements CellExpandAttrPanelP
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;
}
}

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

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;

48
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();
//全选加在第一个位置
if (supportSelectAll) {
addOneCheckValue(SELECT_ALL);
for (Object checkValue : value) {
}
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++;
}
}
//全选半选切换
if (supportSelectAll) {
switchSelectIcon(selectCount);
}
return selectedValues.toArray(new Object[selectedValues.size()]);
}

26
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);
}
/**

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

@ -1,5 +1,6 @@
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;

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;

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

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

57
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;
@ -100,7 +109,10 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
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);
}
/**

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

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

@ -67,19 +67,19 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
this.customBeanPane.populateBean(ob);
customCombo.setSelectedIndex(ob.isCommonCustom() ? 1 : 0);
if(ob.getBackground() != null) {
colorSelectBox.setSelectObject(((ColorBackground)ob.getBackground()).getColor());
if(ob.getCommonBackground() != null) {
colorSelectBox.setSelectObject(((ColorBackground)ob.getCommonBackground()).getColor());
}
borderType.setSelectedLineStyle(ob.getBorderType());
if (ob.getBorderColor() != null) {
borderColor.setSelectObject(ob.getBorderColor());
borderType.setSelectedLineStyle(ob.getCommonBorderType());
if (ob.getCommonBorderColor() != null) {
borderColor.setSelectObject(ob.getCommonBorderColor());
}
borderRadius.setValue(ob.getBorderRadius());
if (ob.getIconColor() != null) {
iconColor.setSelectObject(ob.getIconColor());
borderRadius.setValue(ob.getCommonBorderRadius());
if (ob.getCommonIconColor() != null) {
iconColor.setSelectObject(ob.getCommonIconColor());
}
if (ob.getFont() != null) {
fontConfigPane.populateBean(ob.getFont());
if (ob.getCommonFont() != null) {
fontConfigPane.populateBean(ob.getCommonFont());
}
}
@ -89,12 +89,12 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
this.widget.setMobileStyle(mobileStyle);
this.customBeanPane.updateBean();
mobileStyle.setCommonCustom(customCombo.getSelectedIndex() == 1);
mobileStyle.setBackground(ColorBackground.getInstance(colorSelectBox.getSelectObject()));
mobileStyle.setBorderType(borderType.getSelectedLineStyle());
mobileStyle.setBorderColor(borderColor.getSelectObject());
mobileStyle.setBorderRadius(borderRadius.getValue());
mobileStyle.setIconColor(iconColor.getSelectObject());
mobileStyle.setFont(fontConfigPane.updateBean());
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;
}
@ -132,6 +132,7 @@ public class MobileStyleDefinePane extends BasicBeanPane<MobileStyle> {
commomPane.setBorder(titledBorder);
this.add(commomPane, BorderLayout.NORTH);
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));

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

@ -109,7 +109,7 @@ 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);

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

@ -33,6 +33,8 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane {
private UnsignedIntUISpinner paddingLeftSpinner;
private UnsignedIntUISpinner paddingRightSpinner;
private UnsignedIntUISpinner paddingTopSpinner;
private UnsignedIntUISpinner paddingBottomSpinner;
private NewColorSelectBox initialBackgroundColorBox;
private NewColorSelectBox selectedBackgroundColorBox;
@ -77,6 +79,15 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane {
}
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));
@ -86,11 +97,12 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane {
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, LINE_COMPONENT_HEIGHT));
paddingLeftLabel.setPreferredSize(new Dimension(LABEL_WIDTH / 2, LINE_COMPONENT_HEIGHT));
JPanel paddingPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{
paddingLeftLabel, paddingLeftSpinner, paddingRightLabel,paddingRightSpinner
}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
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;
@ -164,6 +176,8 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane {
@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);
@ -191,6 +205,8 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane {
@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());
@ -208,6 +224,8 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane {
@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());

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

@ -19,11 +19,10 @@ import com.fr.plugin.solution.sandbox.collection.PluginSandboxCollections;
import com.fr.stable.StableUtils;
import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Constructor;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Window;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
/**
* Created by IntelliJ IDEA.
@ -45,6 +44,7 @@ public class DesignModuleFactory {
private Class<Widget> chartEditorClass;
private Class<MiddleChartComponent> chartComponentClass;
private Class<MiddleChartDialog> chartDialogClass;
private Class<MiddleChartDialog> autoChartDialogClass;
private Class<? extends BaseChartPropertyPane> chartPropertyPaneClass;
private Class newFormAction;
private Class formParaDesigner;
@ -100,6 +100,10 @@ public class DesignModuleFactory {
instance.chartDialogClass = cd;
}
public static void registerAutoChartDialogClass(Class autoChartDialogClass) {
instance.autoChartDialogClass = autoChartDialogClass;
}
public static void registerChartPropertyPaneClass(Class<? extends BaseChartPropertyPane> p) {
instance.chartPropertyPaneClass = p;
}
@ -205,6 +209,26 @@ public class DesignModuleFactory {
return null;
}
/**
* 初始化图表向导对话框, 调用静态方法showWindow, 参数window.
*
* @return 返回调出的图表自动推荐AutoChartDialog
*/
public static MiddleChartDialog getAutoChartDialog(Window window) {
try {
Constructor<MiddleChartDialog> c;
if (window instanceof Frame) {
c = instance.autoChartDialogClass.getConstructor(Frame.class);
} else {
c = instance.autoChartDialogClass.getConstructor(Dialog.class);
}
return c.newInstance(window);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return null;
}
/**
* kunsnat: 获取图表属性界面
*

20
designer-base/src/main/java/com/fr/design/os/impl/MacOsAddListenerAction.java

@ -9,11 +9,16 @@ import com.fr.invoke.Reflect;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.os.support.OSBasedAction;
import java.awt.*;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
/**
* com.apple.eawt.Application属于jdk1.8及以下mac jdk特有的api
* 在jdk9中被移除由Desktop.getDesktop().setQuitHandler等jdk9.0引入的新api替代
* 参见 https://stackoverflow.com/questions/38381824/how-can-i-use-apple-com-apple-eawt-functionality-on-java-8
*
* @author hades
* @version 10.0
* Created by hades on 2020/3/13
@ -28,10 +33,21 @@ public class MacOsAddListenerAction implements OSBasedAction {
Object quitInstance = getProxy(quitHandler, "handleQuitRequestWith", new QuitAction());
Class aboutHandler = Class.forName("com.apple.eawt.AboutHandler");
Object aboutInstance = getProxy(aboutHandler, "handleAbout", new AboutAction());
Reflect.on(Reflect.on(app).call("getApplication").get()).call("setQuitHandler", quitInstance)
Object application = Reflect.on(app).call("getApplication").get();
Reflect.on(application).call("setQuitHandler", quitInstance)
.call("setAboutHandler", aboutInstance);
} catch (ClassNotFoundException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
// 上面的不能移除,同时要保证再jdk1.8下面能运行
// 抛出异常时 说明使用>=jdk9运行行设计器,但由于编译使用1.8构建,使用反射运行
try {
Class quitHandler = Class.forName("java.awt.desktop.QuitHandler");
Object quitInstance = getProxy(quitHandler, "handleQuitRequestWith", new QuitAction());
Class aboutHandler = Class.forName("java.awt.desktop.AboutHandler");
Object aboutInstance = getProxy(aboutHandler, "handleAbout", new AboutAction());
Reflect.on(Desktop.getDesktop()).call("setQuitHandler", quitInstance).call("setAboutHandler", aboutInstance);
} catch (ClassNotFoundException ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
}
}

17
designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java

@ -106,12 +106,8 @@ public class ParameterInputPane extends BasicPane {
contentPane.add(flowTableLayoutHelper.createLabelFlowPane(parameterDisplayName + ":", editPane));
//add editor to parameter hashtable.
textF.getCurrentEditor().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified();
}
});
initTextListener(textF);
this.editorNameMap.put(textF, parameter.getName());
nameAddedList.add(parameter.getName());
}
@ -120,6 +116,15 @@ public class ParameterInputPane extends BasicPane {
flowTableLayoutHelper.adjustLabelWidth();
}
protected void initTextListener(ValueEditorPane textF) {
textF.getCurrentEditor().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified();
}
});
}
private Editor[] makeEditorByValue(Object pv) {
Editor[] editors = {null};
if (pv instanceof Integer) {

10
designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java

@ -2,7 +2,9 @@ package com.fr.design.present.dict;
import com.fr.base.BaseFormula;
import com.fr.base.TableData;
import com.fr.data.core.DataCoreUtils;
import com.fr.data.core.db.DBUtils;
import com.fr.data.core.db.dialect.Dialect;
import com.fr.data.impl.DatabaseDictionary;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.design.beans.FurtherBasicBeanPane;
@ -23,7 +25,6 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -215,7 +216,12 @@ public class DatabaseDictPane extends FurtherBasicBeanPane<DatabaseDictionary> i
*
*/
public void dbChange() {
TableData tableData = this.chooseTable.createSelectTableData();
TableData tableData = this.chooseTable.createSelectTableData(new ChoosePane.SelectSqlProcessor() {
@Override
public String createSelectSql(String schema, String tableName, Dialect dialect) {
return DataCoreUtils.createColumnSelectSQL(schema, tableName, dialect);
}
});
String[] columnNames = DesignTableDataManager.getColumnNamesByTableData(tableData).toArray(new String[0]);
ColumnNameEditor columnNameEditor1 = new ColumnNameEditor(columnNames);
columnNameEditor1.addItemListener(itemListener);

2
designer-base/src/main/java/com/fr/design/upm/UpmFinder.java

@ -88,7 +88,7 @@ public class UpmFinder {
dialog.setVisible(true);
}
} else {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message"));
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Update_Info_Plugin_Message"));
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.setAutoUpdateAfterInit();
dialog.showDialog();

200
designer-base/src/main/java/com/fr/design/utils/AWTUtilities.java

@ -0,0 +1,200 @@
package com.fr.design.utils;
import sun.awt.SunToolkit;
import java.awt.*;
/**
* 适配jdk10之后被移除的 com.sun.awt.AWTUtilities
* 参照 https://github.com/frohoff/jdk8u-dev-jdk/blob/master/src/share/classes/com/sun/awt/AWTUtilities.java中实现
*
* @author hades
* @version 10.0
* Created by hades on 2020/5/29
*/
public class AWTUtilities {
/**
* @param window the window to set the shape to
* @param shape the shape to set to the window
*
*/
public static void setWindowShape(Window window, Shape shape) {
if (window == null) {
throw new NullPointerException("The window argument should not be null.");
}
window.setShape(shape);
}
/**
*
*
* @param window the window to set the shape to
* @param opaque whether the window must be opaque (true),
* or translucent (false)
*
*/
public static void setWindowOpaque(Window window, boolean opaque) {
if (window == null) {
throw new NullPointerException("The window argument should not be null.");
}
if (!opaque && !isTranslucencySupported(Translucency.PERPIXEL_TRANSLUCENT)) {
throw new UnsupportedOperationException("The PERPIXEL_TRANSLUCENT translucency kind is not supported");
}
Color color = window.getBackground();
if (color == null) {
color = new Color(0, 0, 0, 0);
}
window.setBackground(new Color(color.getRed(), color.getGreen(), color.getBlue(), opaque ? 255 : 0));
}
public static enum Translucency {
/**
* Represents support in the underlying system for windows each pixel
* of which is guaranteed to be either completely opaque, with
* an alpha value of 1.0, or completely transparent, with an alpha
* value of 0.0.
*/
PERPIXEL_TRANSPARENT,
/**
* Represents support in the underlying system for windows all of
* the pixels of which have the same alpha value between or including
* 0.0 and 1.0.
*/
TRANSLUCENT,
/**
* Represents support in the underlying system for windows that
* contain or might contain pixels with arbitrary alpha values
* between and including 0.0 and 1.0.
*/
PERPIXEL_TRANSLUCENT;
}
/**
* Returns whether the given level of translucency is supported by
* the underlying system.
*
* Note that this method may sometimes return the value
* indicating that the particular level is supported, but
* the native windowing system may still not support the
* given level of translucency (due to the bugs in
* the windowing system).
*
* @param translucencyKind a kind of translucency support
* (either PERPIXEL_TRANSPARENT,
* TRANSLUCENT, or PERPIXEL_TRANSLUCENT)
* @return whether the given translucency kind is supported
*/
private static boolean isTranslucencySupported(Translucency translucencyKind) {
switch (translucencyKind) {
case PERPIXEL_TRANSPARENT:
return isWindowShapingSupported();
case TRANSLUCENT:
return isWindowOpacitySupported();
case PERPIXEL_TRANSLUCENT:
return isWindowTranslucencySupported();
}
return false;
}
/**
* Returns whether the windowing system supports changing the opacity
* value of top-level windows.
* Note that this method may sometimes return true, but the native
* windowing system may still not support the concept of
* translucency (due to the bugs in the windowing system).
*/
private static boolean isWindowOpacitySupported() {
Toolkit curToolkit = Toolkit.getDefaultToolkit();
if (!(curToolkit instanceof SunToolkit)) {
return false;
}
return ((SunToolkit)curToolkit).isWindowOpacitySupported();
}
/**
* Returns whether the windowing system supports changing the shape
* of top-level windows.
* Note that this method may sometimes return true, but the native
* windowing system may still not support the concept of
* shaping (due to the bugs in the windowing system).
*/
private static boolean isWindowShapingSupported() {
Toolkit curToolkit = Toolkit.getDefaultToolkit();
if (!(curToolkit instanceof SunToolkit)) {
return false;
}
return ((SunToolkit)curToolkit).isWindowShapingSupported();
}
private static boolean isWindowTranslucencySupported() {
/*
* Per-pixel alpha is supported if all the conditions are TRUE:
* 1. The toolkit is a sort of SunToolkit
* 2. The toolkit supports translucency in general
* (isWindowTranslucencySupported())
* 3. There's at least one translucency-capable
* GraphicsConfiguration
*/
Toolkit curToolkit = Toolkit.getDefaultToolkit();
if (!(curToolkit instanceof SunToolkit)) {
return false;
}
if (!((SunToolkit)curToolkit).isWindowTranslucencySupported()) {
return false;
}
GraphicsEnvironment env =
GraphicsEnvironment.getLocalGraphicsEnvironment();
// If the default GC supports translucency return true.
// It is important to optimize the verification this way,
// see CR 6661196 for more details.
if (isTranslucencyCapable(env.getDefaultScreenDevice()
.getDefaultConfiguration()))
{
return true;
}
// ... otherwise iterate through all the GCs.
GraphicsDevice[] devices = env.getScreenDevices();
for (int i = 0; i < devices.length; i++) {
GraphicsConfiguration[] configs = devices[i].getConfigurations();
for (int j = 0; j < configs.length; j++) {
if (isTranslucencyCapable(configs[j])) {
return true;
}
}
}
return false;
}
private static boolean isTranslucencyCapable(GraphicsConfiguration gc) {
if (gc == null) {
throw new NullPointerException("The gc argument should not be null");
}
/*
return gc.isTranslucencyCapable();
*/
Toolkit curToolkit = Toolkit.getDefaultToolkit();
if (!(curToolkit instanceof SunToolkit)) {
return false;
}
return ((SunToolkit)curToolkit).isTranslucencyCapable(gc);
}
}

68
designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java

@ -36,6 +36,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.DateUtils;
import com.fr.general.data.Condition;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ColumnRow;
import com.fr.stable.ColumnRowGroup;
import com.fr.write.DBManipulation;
@ -47,14 +48,31 @@ import com.fr.write.config.InsertConfig;
import com.fr.write.config.IntelliDMLConfig;
import com.fr.write.config.UpdateConfig;
import javax.swing.*;
import javax.swing.AbstractCellEditor;
import javax.swing.BorderFactory;
import javax.swing.DefaultCellEditor;
import javax.swing.DefaultComboBoxModel;
import javax.swing.Icon;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTree;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableColumn;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
@ -911,6 +929,11 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
return ComparatorUtils.equals(this.name, ((ColumnName)obj).name);
}
@Override
protected ColumnName clone() throws CloneNotSupportedException {
return new ColumnName(name);
}
}
public static class ColumnValue {
@ -931,6 +954,11 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
return ComparatorUtils.equals(this.obj, ((ColumnValue)obj).obj);
}
@Override
protected ColumnValue clone() throws CloneNotSupportedException {
return new ColumnValue(obj);
}
}
protected static class KeyColumnNameValueTable extends JTable {
@ -941,7 +969,14 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
public KeyColumnTableModel getTableModel4SmartAddCell() {
return new KeyColumnValueTableModel((KeyColumnTableModel)this.getModel());
KeyColumnTableModel clonedTableModel = null;
try {
//智能添加的时候修改clone的配置,不修改原配置,点击确认后覆盖原配置
clonedTableModel = ((KeyColumnValueTableModel) this.getModel()).clone();
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return new KeyColumnValueTableModel(clonedTableModel);
}
}
@ -953,7 +988,7 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
public static final String[] COLUMN_NAMES = new String[]{RAW_KEY, COLUMN, VALUE};
protected java.util.List<KeyColumnNameValue> keyColumnNameValueList = new ArrayList<KeyColumnNameValue>();
protected List<KeyColumnNameValue> keyColumnNameValueList = new ArrayList<>();
public KeyColumnTableModel(KeyColumnTableModel model) {
if (model != null) {
@ -988,9 +1023,16 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
public void removeAllKeyColumnNameValue() {
this.keyColumnNameValueList.clear();
}
public void refreshNameValueList(KeyColumnTableModel model) {
if (model != null) {
this.keyColumnNameValueList.clear();
this.keyColumnNameValueList.addAll(model.keyColumnNameValueList);
}
}
}
protected static class KeyColumnValueTableModel extends KeyColumnTableModel {
protected static class KeyColumnValueTableModel extends KeyColumnTableModel implements Cloneable{
public KeyColumnValueTableModel(KeyColumnTableModel model) {
super(model);
@ -1037,6 +1079,16 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
public boolean isCellEditable(int row, int col) {
return true;
}
@Override
protected KeyColumnValueTableModel clone() throws CloneNotSupportedException {
KeyColumnValueTableModel cloned = (KeyColumnValueTableModel) super.clone();
cloned.keyColumnNameValueList = new ArrayList<>();
for (KeyColumnNameValue keyColumnNameValue : keyColumnNameValueList) {
cloned.keyColumnNameValueList.add(keyColumnNameValue.clone());
}
return cloned;
}
}
@ -1054,11 +1106,17 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
/**
* 字符串
*
* @return 字符串z
*/
public String toString() {
return (isKey ? "* " : "") + cn + ":" + cv;
}
@Override
protected KeyColumnNameValue clone() throws CloneNotSupportedException {
return new KeyColumnNameValue(isKey, cn.clone(), cv.clone(), false);
}
}
/*

28
designer-base/src/main/java/com/fr/env/RemoteEnvPane.java vendored

@ -96,6 +96,10 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
* 密码
*/
private UIPassWordField passwordInput = new UIPassWordField();
/**
* 是否记住密码
*/
private UICheckBox rememberPwdCheckbox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Remote_Env_Remember_Password"));
/**
* https证书路径
*/
@ -212,7 +216,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
updateHttpsConfigPanel();
remoteWorkspaceURL.setHttps(isHttps);
// reset下url,将勾选状态是否htpps加到url里
// reset下url,将勾选状态是否https加到url里
remoteWorkspaceURL.resetUrl();
fillRemoteEnvURLField();
@ -286,6 +290,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
contentPanel.add(configPanel, BorderLayout.NORTH);
contentPanel.add(accountPanel, BorderLayout.CENTER);
contentPanel.add(packRememberPwdConfigPanel(), BorderLayout.SOUTH);
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.add(contentPanel, BorderLayout.NORTH);
panel.add(testPanel, BorderLayout.CENTER);
@ -306,15 +311,18 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
String pwd = fromNullable(connection.getPassword()).or(StringUtils.EMPTY);
String certPath = fromNullable(connection.getCertPath()).or(StringUtils.EMPTY);
String certSecretKey = fromNullable(connection.getCertSecretKey()).or(StringUtils.EMPTY);
boolean rememberPwd = fromNullable(connection.isRememberPwd()).or(true);
this.usernameInput.setText(username);
this.passwordInput.setText(pwd);
this.certPathInput.setText(certPath);
this.certSecretKeyInput.setText(certSecretKey);
this.rememberPwdCheckbox.setSelected(rememberPwd);
} else {
this.remoteWorkspaceURL = RemoteWorkspaceURL.createDefaultURL();
this.usernameInput.setText(StringUtils.EMPTY);
this.passwordInput.setText(StringUtils.EMPTY);
this.rememberPwdCheckbox.setSelected(true);
}
fillRemoteEnvURLField();
@ -333,6 +341,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
String url = this.remoteWorkspaceURL.getURL();
String username = this.usernameInput.getText();
String password = new String(this.passwordInput.getPassword());
boolean rememberPwd = this.rememberPwdCheckbox.isSelected();
DesignerEnvProcessor envProcessor = ExtraDesignClassManager.getInstance().getSingle(DesignerEnvProcessor.XML_TAG);
if (envProcessor != null) {
url = envProcessor.changeEnvPathBeforeConnect(username, password, url);
@ -342,7 +351,8 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
username,
password,
this.certPathInput.getText(),
new String(this.certSecretKeyInput.getPassword()));
new String(this.certSecretKeyInput.getPassword()),
rememberPwd);
return RemoteDesignerWorkspaceInfo.create(connection);
}
@ -522,6 +532,20 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
accountPanel.add(content, BorderLayout.CENTER);
}
private JPanel packRememberPwdConfigPanel() {
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{
new Component[]{rememberPwdCheckbox}
},
new double[]{PREFERRED},
new double[]{PREFERRED},
5,
10
);
TableLayoutHelper.modifyTableLayoutIndexHGap(panel, 0, 50);
return panel;
}
private JPanel createHttpsCertFileInputPanel() {
JPanel inputPanel = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();

3
designer-base/src/main/java/com/fr/start/SplashWindow.java

@ -2,9 +2,9 @@ package com.fr.start;
import com.fr.base.BaseUtils;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.utils.AWTUtilities;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.OperatingSystem;
import com.sun.awt.AWTUtilities;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
@ -41,7 +41,6 @@ public class SplashWindow extends JFrame {
this.setAlwaysOnTop(false);
this.setUndecorated(true);
AWTUtilities.setWindowOpaque(this, false);
//使窗体背景透明
if (OperatingSystem.isWindows()) {
this.setBackground(new Color(0, 0, 0, 0));

BIN
designer-base/src/main/resources/com/fr/design/images/m_insert/auto_chart.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 B

47
designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java

@ -2,7 +2,10 @@ package com.fr.design;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.LocalDesignerWorkspaceInfo;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.env.CheckServiceDialog;
import com.fr.invoke.Reflect;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.engine.channel.http.FunctionalHttpRequest;
import org.easymock.EasyMock;
@ -19,7 +22,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
* @Description:
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({FunctionalHttpRequest.class,EnvChangeEntrance.class,CheckServiceDialog.class})
@PrepareForTest({FunctionalHttpRequest.class,EnvChangeEntrance.class,CheckServiceDialog.class, DesignerEnvManager.class})
public class EnvChangeEntranceTest {
@Test
@ -55,4 +58,46 @@ public class EnvChangeEntranceTest {
}
}
@Test
public void testUpdateNotRememberPwdEnv() {
DesignerEnvManager manager = new DesignerEnvManager();
PowerMock.mockStatic(DesignerEnvManager.class);
EasyMock.expect(DesignerEnvManager.getEnvManager()).andReturn(manager).anyTimes();
PowerMock.replayAll();
EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
manager.putEnv("test1", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)));
manager.putEnv("test2", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", false)));
manager.putEnv("test3", LocalDesignerWorkspaceInfo.create("name", "path"));
Reflect.on(entrance).call("updateNotRememberPwdEnv");
Assert.assertEquals(manager.getWorkspaceInfo("test1").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)).getConnection());
Assert.assertEquals(manager.getWorkspaceInfo("test2").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "", "", "", false)).getConnection());
Assert.assertEquals(manager.getWorkspaceInfo("test3").getName(), "name");
Assert.assertEquals(manager.getWorkspaceInfo("test3").getPath(), "path");
PowerMock.verifyAll();
}
@Test
public void testIsNotRememberPwd() {
EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
DesignerWorkspaceInfo info1 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true));
DesignerWorkspaceInfo info2 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "111", "", "", false));
DesignerWorkspaceInfo info3 = LocalDesignerWorkspaceInfo.create("name", "path");
DesignerWorkspaceInfo info4 = null;
Assert.assertFalse((boolean) Reflect.on(entrance).call("isNotRememberPwd", info1).get());
Assert.assertTrue((boolean) Reflect.on(entrance).call("isNotRememberPwd", info2).get());
Assert.assertFalse((boolean) Reflect.on(entrance).call("isNotRememberPwd", info3).get());
Assert.assertFalse((boolean) Reflect.on(entrance).call("isNotRememberPwd", info4).get());
}
}

3
designer-base/src/test/java/com/fr/design/env/RemoteWorkspaceTest.java vendored

@ -38,7 +38,7 @@ public class RemoteWorkspaceTest {
EasyMock.replay(workspace, operator);
PowerMock.replayAll();
WorkspaceConnectionInfo info = new WorkspaceConnectionInfo("url", "username", "password", "certPath", "certSecretKey");
WorkspaceConnectionInfo info = new WorkspaceConnectionInfo("url", "username", "password", "certPath", "certSecretKey", true);
RemoteWorkspace remoteWorkspace= new RemoteWorkspace(null, info);
@ -51,4 +51,5 @@ public class RemoteWorkspaceTest {
}
}

41
designer-base/src/test/java/com/fr/design/gui/icombocheckbox/UICheckListPopupTest.java

@ -0,0 +1,41 @@
package com.fr.design.gui.icombocheckbox;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/4/3
*/
public class UICheckListPopupTest extends TestCase {
@Test
public void testGetSelectedValues() {
Object[] values = new Object[]{"a", "b", "c"};
Map<Object, Boolean> map = new TreeMap<>();
map.put("a", true);
map.put("b", false);
map.put("c", true);
List<Object> list = new ArrayList<>();
for (Map.Entry<Object, Boolean> entry : map.entrySet()) {
if (entry.getValue()) {
list.add(entry.getKey());
}
}
Object[] selectValues = list.toArray();
UICheckListPopup uiCheckListPopup1 = new UICheckListPopup(values);
uiCheckListPopup1.setSelectedValue(map);
Assert.assertArrayEquals(selectValues, uiCheckListPopup1.getSelectedValues());
UICheckListPopup uiCheckListPopup2 = new UICheckListPopup(values, false);
uiCheckListPopup2.setSelectedValue(map);
Assert.assertArrayEquals(selectValues, uiCheckListPopup2.getSelectedValues());
}
}

39
designer-base/src/test/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePaneTest.java

@ -0,0 +1,39 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.UniteStyle;
import com.fr.invoke.Reflect;
import junit.framework.TestCase;
import org.junit.Test;
import java.awt.*;
public class UniteStyleDefinePaneTest extends TestCase {
@Test
public void testDefaultConfig() {
UniteStyleDefinePane definePane = new UniteStyleDefinePane(new WCardTagLayout());
Reflect.on(definePane).call("initDefaultConfig");
double paddingTop = Reflect.on(definePane).field("paddingTopSpinner").call("getValue").get();
assertEquals((int)paddingTop, UniteStyle.DEFAULT_PADDING_TOP);
double paddingBottom = Reflect.on(definePane).field("paddingBottomSpinner").call("getValue").get();
assertEquals((int)paddingBottom, UniteStyle.DEFAULT_PADDING_BOTTOM);
double paddingLeft = Reflect.on(definePane).field("paddingLeftSpinner").call("getValue").get();
assertEquals((int)paddingLeft, UniteStyle.DEFAULT_PADDING_LEFT);
double paddingRight = Reflect.on(definePane).field("paddingRightSpinner").call("getValue").get();
assertEquals((int)paddingRight, UniteStyle.DEFAULT_PADDING_RIGHT);
Color initialBackgroundColor = Reflect.on(definePane).field("initialBackgroundColorBox").call("getSelectObject").get();
assertEquals(initialBackgroundColor, UniteStyle.DEFAULT_INITIAL_BACKGROUND_COLOR);
Color selectedBackgroundColor = Reflect.on(definePane).field("selectedBackgroundColorBox").call("getSelectObject").get();
assertEquals(selectedBackgroundColor, UniteStyle.DEFAULT_SELECTED_BACKGROUND_COLOR);
int lineStyle = Reflect.on(definePane).field("borderWidthComboBox").call("getSelectedLineStyle").get();
assertEquals(lineStyle, UniteStyle.DEFAULT_BORDER_LINE.lineStyle);
Color borderColor = Reflect.on(definePane).field("borderColorBox").call("getSelectObject").get();
assertEquals(borderColor, UniteStyle.DEFAULT_BORDER_LINE.color);
double borderRadius = Reflect.on(definePane).field("borderRadiusSpinner").call("getValue").get();
assertEquals((int)borderRadius, UniteStyle.DEFAULT_BORDER_RADIUS);
}
}

3
designer-chart/build.gradle

@ -0,0 +1,3 @@
dependencies {
compile project(':designer-base')
}

13
designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java

@ -104,6 +104,7 @@ import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.awt.event.ActionListener;
import static com.fr.chart.charttypes.ChartTypeManager.DEFAULT_PRIORITY;
import static com.fr.chart.charttypes.ChartTypeManager.DEPRECATED_CHART_PRIORITY;
@ -164,6 +165,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
String[] chartIDs = ChartTypeManager.getInstance().getAllChartIDs();
ChartWidgetOption[] child = new ChartWidgetOption[chartIDs.length];
int index = 0;
for (String chartID : chartIDs) {
ChartProvider[] rowChart = ChartTypeManager.getInstance().getCharts(chartID);
if (ArrayUtils.isEmpty(rowChart) && !ChartTypeManager.innerChart(chartID)) {
@ -258,17 +260,21 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
*
* @param paneList pane容器
*/
public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends ChartProvider>> paneList, Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane) {
public void addPlotTypePaneList(List<FurtherBasicBeanPane<? extends ChartProvider>> paneList,
Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane,
ActionListener autoButtonListener) {
List<Integer> priorityList = getPriorityInOrder();
for (Integer aPriorityList : priorityList) {
String priority = String.valueOf(aPriorityList);
addPlotTypePaneList(priority, paneList, allChartTypePane);
addPlotTypePaneList(priority, paneList, allChartTypePane, autoButtonListener);
}
}
public void addPlotTypePaneList(String priority, List<FurtherBasicBeanPane<? extends ChartProvider>> paneList, Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane) {
public void addPlotTypePaneList(String priority, List<FurtherBasicBeanPane<? extends ChartProvider>> paneList,
Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane,
ActionListener autoButtonListener) {
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(priority)) {
@ -285,6 +291,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
continue;
}
pane.reLayout(plotID);
pane.registerButtonListener(autoButtonListener);
paneList.add(pane);
if (allChartTypePane.get(priority) == null) {

79
designer-chart/src/main/java/com/fr/design/chart/AutoChartDialog.java

@ -0,0 +1,79 @@
package com.fr.design.chart;
import com.fr.base.chart.BaseChartCollection;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.TwoTuple;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.vanchart.VanChart;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-05-28
*/
public class AutoChartDialog extends ChartDialog {
private AutoChartTypePane autoChartTypePane;
public AutoChartDialog(Frame owner) {
super(owner);
}
public AutoChartDialog(Dialog owner) {
super(owner);
}
protected Component initCenterPane() {
autoChartTypePane = new AutoChartTypePane();
return autoChartTypePane;
}
protected ActionListener getActionListener() {
return new ActionListener() {
public void actionPerformed(ActionEvent e) {
ChartCollection chartCollection = (ChartCollection) getChartCollection();
autoChartTypePane.update(chartCollection);
if (chartCollection.getChartCount() > 0) {
doOK();
} else {
doCancel();
}
}
};
}
protected String getDialogTitle() {
return Toolkit.i18nText("Fine-Design_Chart_Auto_Recommended_Chart");
}
/**
* 更新新建的图表 ChartCollection
*/
public void populate(BaseChartCollection cc) {
super.populate(cc);
ChartCollection chartCollection = (ChartCollection) getChartCollection();
VanChart vanChart = chartCollection.getSelectedChartProvider(VanChart.class);
if (vanChart == null) {
return;
}
TopDefinitionProvider filterDefinition = vanChart.getFilterDefinition();
if (filterDefinition == null) {
return;
}
TwoTuple<String, String[]> tableNameAndDataFields = filterDefinition.getTableNameAndDataFields();
if (tableNameAndDataFields == null) {
return;
}
String tableName = tableNameAndDataFields.getFirst();
String[] dataFields = tableNameAndDataFields.getSecond();
autoChartTypePane.populate(tableName, dataFields);
}
}

104
designer-chart/src/main/java/com/fr/design/chart/AutoChartIcon.java

@ -0,0 +1,104 @@
package com.fr.design.chart;
import com.fr.base.chart.BaseChartPainter;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.base.chart.result.WebChartIDInfo;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.script.Calculator;
import javax.swing.Icon;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-05-29
*/
public class AutoChartIcon implements Icon {
private static final int WIDTH = 500;
private static final int HEIGHT = 281;
private ChartCollection chartCollection;
private CallbackEvent callbackEvent;
private String chartName;
public AutoChartIcon(ChartCollection chartCollection) {
this.chartCollection = chartCollection;
initChartName();
}
public ChartCollection getChartCollection() {
return chartCollection;
}
public String getChartName() {
return chartName;
}
private void initChartName() {
Chart chart = chartCollection.getSelectedChart(Chart.class);
String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(chart.getPlot().getPlotID());
chartName = subName[0];
}
public void registerCallBackEvent(CallbackEvent callbackEvent) {
this.callbackEvent = callbackEvent;
}
/**
* 画出缩略图Icon
*
* @param g 图形的上下文
* @param c 所在的Component
* @param x 缩略图的起始坐标x
* @param y 缩略图的起始坐标y
*/
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
BaseChartPainter painter = chartCollection.createResultChartPainterWithOutDealFormula(Calculator.createCalculator(),
WebChartIDInfo.createEmptyDesignerInfo(), getIconWidth(), getIconHeight());
int resolution = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getJTemplateResolution();
Graphics2D g2d = (Graphics2D) g;
Paint oldPaint = g2d.getPaint();
g.translate(x, y);
g2d.setPaint(Color.white);
g2d.fillRect(0, 0, getIconWidth(), getIconHeight());
painter.paint(g2d, getIconWidth(), getIconHeight(), resolution, null, callbackEvent);
g.translate(-x, -y);
g2d.setPaint(oldPaint);
}
/**
* 返回缩略图的宽度
*
* @return int 缩略图宽度
*/
@Override
public int getIconWidth() {
return WIDTH;
}
/**
* 返回缩略图的高度
*
* @return int 缩略图高度
*/
@Override
public int getIconHeight() {
return HEIGHT;
}
}

199
designer-chart/src/main/java/com/fr/design/chart/AutoChartTypePane.java

@ -0,0 +1,199 @@
package com.fr.design.chart;
import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataComboBox;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombocheckbox.UIComboCheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.ListCellRenderer;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-05-29
*/
public class AutoChartTypePane extends ChartWizardPane implements CallbackEvent {
private JList chartViewList;
private DefaultListModel chartResultModel;
private UIButton refreshButton;
private TableDataComboBox tableNameComboBox;
private UIComboCheckBox dataFieldBox;
public AutoChartTypePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
initButtonGroup();
initRefreshLabel();
initDataFiledBox();
JPanel contentPane = createContentPane();
chartViewList = new JList();
chartResultModel = new DefaultListModel();
chartViewList.setModel(chartResultModel);
chartViewList.setVisibleRowCount(0);
chartViewList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
chartViewList.setCellRenderer(iconCellRenderer);
JScrollPane subListPane = new JScrollPane(chartViewList);
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, contentPane, subListPane);
splitPane.setDividerLocation(60);
splitPane.setBorder(BorderFactory.createTitledBorder(Toolkit.i18nText("Fine-Design_Chart_M_Popup_Auto_Chart_Type")));
this.add(splitPane);
}
ListCellRenderer iconCellRenderer = new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
this.setText("");
AutoChartIcon chartIcon = (AutoChartIcon) value;
this.setIcon(chartIcon);
setHorizontalAlignment(UILabel.CENTER);
if (isSelected) {
// 深蓝色.
this.setBackground(new Color(57, 107, 181));
this.setBorder(GUICoreUtils.createTitledBorder(chartIcon.getChartName(), Color.WHITE));
} else {
this.setBorder(GUICoreUtils.createTitledBorder(chartIcon.getChartName()));
}
return this;
}
};
private JPanel createContentPane() {
JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
JPanel tableDataPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
panel.add(tableDataPane);
tableDataPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Chart_Table_Data") + ":"));
tableNameComboBox.setPreferredSize(new Dimension(96, 20));
tableDataPane.add(tableNameComboBox);
JPanel areaNamePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
panel.add(areaNamePane);
areaNamePane.add(new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Field") + ":"));
areaNamePane.add(dataFieldBox);
panel.add(refreshButton);
return panel;
}
private void initButtonGroup() {
dataFieldBox = new UIComboCheckBox(new Object[0]);
dataFieldBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkButtonState();
}
});
}
private void initDataFiledBox() {
tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource());
tableNameComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
refreshBox();
checkButtonState();
}
}
});
}
private void checkButtonState() {
if (tableNameComboBox.getSelectedItem() != null && dataFieldBox.getSelectedValues().length > 0) {
refreshButton.setEnabled(true);
} else {
refreshButton.setEnabled(false);
}
}
private void refreshBox() {
TableDataWrapper dataWrap = tableNameComboBox.getSelectedItem();
if (dataWrap == null) {
return;
}
dataFieldBox.clearText();
List<String> columnNameList = dataWrap.calculateColumnNameList();
dataFieldBox.refreshCombo(columnNameList.toArray());
}
private void initRefreshLabel() {
refreshButton = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Recommend"));
refreshButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
calculateAutoChart();
}
});
refreshButton.setEnabled(false);
}
private void calculateAutoChart() {
chartResultModel.clear();
}
@Override
public void populate(ChartCollection cc) {
}
@Override
public void update(ChartCollection cc) {
if (chartViewList.getSelectedIndex() < 0) {
return;
}
AutoChartIcon chartIcon = (AutoChartIcon) chartViewList.getSelectedValue();
ChartProvider chartProvider = chartIcon.getChartCollection().getSelectedChartProvider(ChartProvider.class);
if (cc.getChartCount() > 0) {
cc.setSelectChart(chartProvider);
} else {
cc.addChart(chartProvider);
}
}
public void populate(String tableName, String[] dataFields) {
tableNameComboBox.setSelectedTableDataByName(tableName);
Map<Object, Boolean> map = new HashMap();
for (String dataField : dataFields) {
map.put(dataField, true);
}
dataFieldBox.setSelectedValues(map);
}
@Override
public void callback() {
this.repaint();
}
}

1
designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java

@ -39,6 +39,7 @@ public class ChartDesignerActivator extends Activator implements Prepare {
DesignModuleFactory.registerChartComponentClass(ChartComponent.class);
DesignModuleFactory.registerChartDialogClass(ChartDialog.class);
DesignModuleFactory.registerAutoChartDialogClass(AutoChartDialog.class);
DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);

46
designer-chart/src/main/java/com/fr/design/chart/ChartDialog.java

@ -5,11 +5,13 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.gui.chart.MiddleChartDialog;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.third.joda.time.DateTime;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.FlowLayout;
import java.awt.Frame;
@ -18,6 +20,7 @@ import java.awt.event.ActionListener;
/**
* 封装一层 图表新建的对话框, 配合属性表确定: 先单独只要一种图表类型的对话框.
*
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2013-1-7 下午07:29:15
*/
@ -27,6 +30,8 @@ public class ChartDialog extends MiddleChartDialog {
private UIButton ok;
private UIButton cancel;
private ChartTypePane chartTypePane;
private String createTime;
public ChartDialog(Frame owner) {
super(owner);
@ -39,45 +44,54 @@ public class ChartDialog extends MiddleChartDialog {
}
private void initComponent() {
final String createTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss");
createTime = DateTime.now().toString("yyyy-MM-dd HH:mm:ss");
this.setModal(true);
this.setLayout(new BorderLayout());
final ChartTypePane chartTypePane = new ChartTypePane();
setTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_M_Popup_Chart_Type"));
setTitle(getDialogTitle());
this.applyClosingAction();
this.applyEscapeAction();
this.setBasicDialogSize(BasicDialog.DEFAULT);
this.add(chartTypePane, BorderLayout.CENTER);
this.add(initCenterPane(), BorderLayout.CENTER);
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
this.add(buttonPane, BorderLayout.SOUTH);
ok = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK"));
cancel = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cancel"));
buttonPane.add(ok);
buttonPane.add(cancel);
ok.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
chartTypePane.update((ChartCollection)cc, createTime);
doOK();
}
});
ok.addActionListener(getActionListener());
cancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doCancel();
}
});
buttonPane.add(ok);
buttonPane.add(cancel);
GUICoreUtils.setWindowCenter(getOwner(), this);
}
protected String getDialogTitle() {
return Toolkit.i18nText("Fine-Design_Chart_M_Popup_Chart_Type");
}
protected Component initCenterPane() {
chartTypePane = new ChartTypePane();
return chartTypePane;
}
protected ActionListener getActionListener() {
return new ActionListener() {
public void actionPerformed(ActionEvent e) {
chartTypePane.update((ChartCollection) cc, createTime);
doOK();
}
};
}
/**
* 不处理
*/

3
designer-chart/src/main/java/com/fr/design/chart/gui/ChartComponent.java

@ -140,6 +140,9 @@ public class ChartComponent extends MiddleChartComponent implements MouseListene
public void paintComponent(Graphics g) { //
super.paintComponent(g);
if(chartCollection4Design.getChartCount() == 0) {
return;
}
Graphics2D g2d = (Graphics2D) g;

9
designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java

@ -2,6 +2,8 @@ package com.fr.design.chartx.component.combobox;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.cert.token.lang.Collections;
import com.fr.chart.base.ChartConstants;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.i18n.Toolkit;
@ -60,6 +62,7 @@ public class ColorSchemeComboBox extends UIComboBox {
//添加默认的方案和第一个方案
String defaultName = config.getCurrentStyle();
ChartColorMatching defaultStyle = (ChartColorMatching) config.getPreStyle(defaultName);
if (names.hasNext()) {
Object firstName = names.next();
ChartColorMatching firstStyle = (ChartColorMatching) config.getPreStyle(firstName);
if (defaultStyle == null) {
@ -67,6 +70,12 @@ public class ColorSchemeComboBox extends UIComboBox {
}
colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorMatchingToColorInfo(defaultStyle));
colorSchemes.put(firstStyle.getId(), colorMatchingToColorInfo(firstStyle));
} else {
ColorInfo colorInfo = new ColorInfo();
colorInfo.setGradient(false);
colorInfo.setColors(Collections.arrayToList(ChartConstants.CHART_COLOR_ARRAY));
colorSchemes.put(Toolkit.i18nText("Fine-Design_Report_Default"), colorInfo);
}
//添加其他的配色方案
while (names.hasNext()) {

43
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -6,31 +6,38 @@ import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.chart.MiddleChartDialog;
import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.item.FlexibleComboBox;
import com.fr.design.mainframe.chart.gui.item.ItemEventType;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.design.module.DesignModuleFactory;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* 图表 属性表, 类型选择 界面.
*
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-26 上午10:56:51
*/
@ -39,9 +46,11 @@ public class ChartTypePane extends AbstractChartAttrPane{
private ChartTypeButtonPane buttonPane;
private ChartEditPane editPane;
private ChartCollection editingCollection;
private ActionListener autoButtonListener;
@Override
protected JPanel createContentPane() {
initButtonListener();
JPanel content = new JPanel(new BorderLayout());
buttonPane = new ChartTypeButtonPane(this);
@ -91,12 +100,30 @@ public class ChartTypePane extends AbstractChartAttrPane{
/**
* 界面标题
*
* @return 界面标题
*/
public String title4PopupWindow() {
return PaneTitleConstants.CHART_TYPE_TITLE;
}
public void initButtonListener() {
autoButtonListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final MiddleChartDialog autoChartDialog = DesignModuleFactory.getAutoChartDialog(DesignerContext.getDesignerFrame());
autoChartDialog.populate(editingCollection);
autoChartDialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
populate(editingCollection);
}
});
autoChartDialog.setVisible(true);
}
};
}
class ComboBoxPane extends UIComboBoxPane<ChartProvider> {
private Map<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>> allChartTypePane;
@ -104,7 +131,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
protected List<FurtherBasicBeanPane<? extends ChartProvider>> initPaneList() {
List<FurtherBasicBeanPane<? extends ChartProvider>> paneList = new ArrayList<FurtherBasicBeanPane<? extends ChartProvider>>();
allChartTypePane = new LinkedHashMap<String, Map<String, FurtherBasicBeanPane<? extends ChartProvider>>>();
ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList, allChartTypePane);
ChartTypeInterfaceManager.getInstance().addPlotTypePaneList(paneList, allChartTypePane, autoButtonListener);
return paneList;
}
@ -117,6 +144,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
* 不同图表切换分同一个selected的不同图表切换和不同selected的不同图表切换
* 如果是切换图表的某个图表发生变化则collection的选择下标不会变
* 如果是切换图表的不同图表之间切换则collection的选择下标会改变
*
* @param chart
*/
public void updateBean(ChartProvider chart) {
@ -290,6 +318,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
/**
* 面板重构
*
* @param lastPlotID
* @param collection
*/
@ -340,6 +369,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
/**
* 所有图表的类型界面
*
* @return 类型界面
*/
public FurtherBasicBeanPane[] getPaneList() {
@ -348,6 +378,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
/**
* 当前选中的图表的index
*
* @return 当前选中的图表的index
*/
public int getSelectedIndex() {
@ -356,6 +387,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
/**
* 返回选中的图表的index
*
* @return 选中的图标的序号
*/
public int getSelectedChartIndex() {
@ -364,6 +396,7 @@ public class ChartTypePane extends AbstractChartAttrPane{
/**
* 设置下编辑的面板
*
* @param currentEditPane 设置下编辑的面板
*/
public void registerChartEditPane(ChartEditPane currentEditPane) {

49
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java

@ -6,11 +6,11 @@ import com.fr.chart.chartattr.MeterPlot;
import com.fr.chart.chartdata.MeterReportDefinition;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
@ -20,16 +20,19 @@ import java.awt.Component;
/**
* 仪表盘 属性表 单元格数据界面
*
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-21 下午02:47:57
*/
public class MeterPlotReportDataContentPane extends AbstractReportDataContentPane {
private static final String CATENAME = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Name");
private static final String NVALUE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Pointer_Value");
private static final String CATENAME = Toolkit.i18nText("Fine-Design_Chart_Category_Name");
private static final String NVALUE = Toolkit.i18nText("Fine-Design_Chart_Value_Pointer");
private static final String TARGET_VALUE = Toolkit.i18nText("Fine-Design_Chart_Target_Value");
private TinyFormulaPane singCatePane;
private TinyFormulaPane singValuePane;
public TinyFormulaPane singValuePane;
private TinyFormulaPane customPane;
private ChartDataFilterPane filterPane;
public MeterPlotReportDataContentPane(ChartDataPane parent) {
@ -45,16 +48,12 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = { p, p, p};
double[] rowSize = getRowSize();
Component[][] components = new Component[][]{
new Component[]{new UILabel(getCateNameString()), getSingCatePane()},
new Component[]{new UILabel(getNValueString()), singValuePane = new TinyFormulaPane()},
new Component[]{null, null}
};
Component[][] components = getShowComponents();
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 24, 6);
panel.setBorder(BorderFactory.createEmptyBorder(0,24,0,15));
panel.setBorder(BorderFactory.createEmptyBorder(0, 24, 5, 8));
this.setLayout(new BorderLayout());
this.add(panel, BorderLayout.NORTH);
@ -66,6 +65,19 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
this.add(pane, BorderLayout.CENTER);
}
protected double[] getRowSize() {
double p = TableLayout.PREFERRED;
return new double[]{p, p, p};
}
protected Component[][] getShowComponents() {
return new Component[][]{
new Component[]{new UILabel(getCateNameString()), getSingCatePane()},
new Component[]{new UILabel(getNValueString()), singValuePane = new TinyFormulaPane()},
new Component[]{new UILabel(TARGET_VALUE), customPane = new TinyFormulaPane()}
};
}
protected String getCateNameString() {
return CATENAME;
}
@ -85,11 +97,18 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
if (meterDefinition.getValue() != null) {
singValuePane.getUITextField().setText(meterDefinition.getValue().toString());
}
if (meterDefinition.getTarget() != null) {
populateCustomPane(meterDefinition.getTarget().toString());
}
}
filterPane.populateBean(collection);
}
protected void populateCustomPane(String target) {
customPane.getUITextField().setText(target);
}
protected void populateSingCatePane(String name) {
singCatePane.getUITextField().setText(name);
}
@ -103,12 +122,20 @@ public class MeterPlotReportDataContentPane extends AbstractReportDataContentPan
meterDefinition.setValue(canBeFormula(singValuePane.getUITextField().getText()));
updateCustomPane(meterDefinition);
collection.getSelectedChart().setFilterDefinition(meterDefinition);
filterPane.updateBean(collection);
}
}
protected void updateCustomPane(MeterReportDefinition meterDefinition) {
meterDefinition.setTarget(canBeFormula(customPane.getUITextField().getText()));
}
protected void updateSingCatePane(MeterReportDefinition meterDefinition) {
meterDefinition.setName(canBeFormula(singCatePane.getUITextField().getText()));

106
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java

@ -4,73 +4,121 @@ import com.fr.base.Utils;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.MeterPlot;
import com.fr.chart.chartdata.MeterTableDefinition;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.extended.chart.StringFormula;
import com.fr.extended.chart.UIComboBoxWithNone;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.List;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* 仪表盘, 属性表, 数据集数据界面.
*
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-21 下午04:51:50
*/
public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane {
private static final String METER_NAME = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name");
private static final String METER_VALUE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Pointer_Value");
private static final String METER_NAME = Toolkit.i18nText("Fine-Design_Chart_Category_Name");
private static final String METER_VALUE = Toolkit.i18nText("Fine-Design_Chart_Value_Pointer");
private static final String TARGET_VALUE = Toolkit.i18nText("Fine-Design_Chart_Target_Value");
private static final int COMBOBOX_WIDTH = 115;
private static final int COMBOBOX_HEIGHT = 20;
private static final int LABEL_WIDTH = 85;
private UIComboBox nameBox;
private UIComboBox valueBox;
private UIComboBox targetBox;
private TinyFormulaPane custom;
private ChartDataFilterPane filterPane;
private JPanel boxPane;
public MeterPlotTableDataContentPane(ChartDataPane parent) {
this.setLayout(new BorderLayout());
nameBox = new UIComboBox();
nameBox = new UIComboBoxWithNone();
valueBox = new UIComboBox();
targetBox = new UIComboBox();
custom = new TinyFormulaPane();
filterPane = new ChartDataFilterPane(new MeterPlot(), parent);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f, COMPONENT_WIDTH};
double[] rowSize = {p, p};
boxPane = new JPanel();
boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS));
JPanel namePane = createPaneWithLabel(Toolkit.i18nText(METER_NAME), getNameComponent());
boxPane.add(namePane);
JPanel valuePane = createPaneWithLabel(Toolkit.i18nText(METER_VALUE), valueBox);
boxPane.add(valuePane);
JPanel targetPane = createPaneWithLabel(Toolkit.i18nText(TARGET_VALUE), targetBox);
boxPane.add(targetPane);
Component[][] components = createComponents();
final JPanel customPane = createPaneWithLabel(StringUtils.EMPTY, custom);
boxPane.add(customPane);
customPane.setVisible(false);
initTargetBoxValue();
targetBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (targetBox.getSelectedIndex() == targetBox.getItemCount() - 1) {
customPane.setVisible(true);
} else {
customPane.setVisible(false);
}
}
});
JPanel jPanel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), filterPane);
JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize);
filterPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
panel.setBorder(BorderFactory.createEmptyBorder(10,24,10,15));
boxPane.setBorder(BorderFactory.createEmptyBorder(7, 24, 7, 15));
jPanel.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 5));
this.add(getJSeparator(), BorderLayout.NORTH);
this.add(panel,BorderLayout.CENTER);
this.add(boxPane, BorderLayout.CENTER);
this.add(jPanel, BorderLayout.SOUTH);
nameBox.addItemListener(tooltipListener);
valueBox.addItemListener(tooltipListener);
targetBox.addItemListener(tooltipListener);
}
private Component[][] createComponents() {
return new Component[][]{
new Component[]{new BoldFontTextLabel(METER_NAME), getNameComponent()},
new Component[]{new BoldFontTextLabel(METER_VALUE), valueBox},
};
private JPanel createPaneWithLabel(String labelName, Component component) {
component.setPreferredSize(new Dimension(COMBOBOX_WIDTH, COMBOBOX_HEIGHT));
UILabel label = new BoldFontTextLabel(labelName);
label.setPreferredSize(new Dimension(LABEL_WIDTH, COMBOBOX_HEIGHT));
JPanel paneWithLabel = GUICoreUtils.createBorderLayoutPane(new Component[]{component, null, null, label, null});
paneWithLabel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0));
return paneWithLabel;
}
protected void refreshBoxListWithSelectTableData(List list) {
refreshBoxItems(nameBox, list);
refreshBoxItems(valueBox, list);
refreshBoxItems(targetBox, list);
initTargetBoxValue();
}
/**
@ -81,6 +129,11 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
clearBoxItems(valueBox);
}
private void initTargetBoxValue() {
targetBox.addItem(Toolkit.i18nText("Fine-Design_Chart_Custom"));
targetBox.setSelectedItem(null);
}
/**
* 更新仪表盘数据界面
*/
@ -91,6 +144,12 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
populateNameComponent(meter);
valueBox.setSelectedItem(meter.getValue());
custom.getUITextField().setText(meter.getCustomTarget().getContent());
if (meter.isCustom()) {
targetBox.setSelectedIndex(targetBox.getItemCount() - 1);
} else {
targetBox.setSelectedItem(meter.getTargetValue());
}
filterPane.populateBean(ob);
}
}
@ -110,6 +169,13 @@ public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane
updateNameComponent(meter);
meter.setValue(Utils.objectToString(valueBox.getSelectedItem()));
if (targetBox.getSelectedIndex() == targetBox.getItemCount() - 1) {
meter.setCustom(true);
meter.setCustomTarget(new StringFormula(custom.getUITextField().getText()));
} else {
meter.setCustom(false);
meter.setTargetValue(GeneralUtils.objectToString(targetBox.getSelectedItem()));
}
filterPane.updateBean(ob);
}
}

5
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AbstractChartTypePane.java

@ -22,6 +22,7 @@ import java.util.List;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionListener;
public abstract class AbstractChartTypePane<T extends ChartProvider> extends FurtherBasicBeanPane<T> {
@ -240,4 +241,8 @@ public abstract class AbstractChartTypePane<T extends ChartProvider> extends Fur
public ChartProvider getDefaultChart() {
return BarIndependentChart.barChartTypes[0];
}
public void registerButtonListener(ActionListener autoButtonListener) {
}
}

92
designer-chart/src/main/java/com/fr/design/module/ChartEmptyDataStylePane.java

@ -2,11 +2,13 @@ package com.fr.design.module;
import com.fr.base.BaseUtils;
import com.fr.base.ChartEmptyDataStyleConf;
import com.fr.base.Style;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.background.image.ImageFileChooser;
import com.fr.design.style.background.image.ImagePreviewPane;
@ -14,7 +16,7 @@ import com.fr.design.utils.ImageUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.stable.Constants;
import com.fr.stable.CoreGraphHelper;
import com.fr.stable.StringUtils;
@ -24,6 +26,7 @@ import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingWorker;
import java.io.File;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
@ -32,7 +35,6 @@ import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
/**
* Created by mengao on 2017/11/23.
@ -47,8 +49,10 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
private UIButtonGroup emptyData;
private UILabel imageContent;
private UIButtonGroup imageData;
private UIRadioButton defaultRadioButton;
private UIRadioButton customRadioButton;
private UIRadioButton adjustRadioButton;
private UIButton selectPictureButton;
private ImagePreviewPane previewPane;
@ -72,7 +76,7 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
}
private JPanel creatNorthPane() {
emptyData = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")});
emptyData = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")});
emptyData.setSelectedIndex(0);
emptyData.setPreferredSize(new Dimension(WIDTH, HEIGHT));
emptyData.addActionListener(new ActionListener() {
@ -83,8 +87,24 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
}
});
UILabel promptContent = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Tip_Content"));
JPanel northPane = GUICoreUtils.createFlowPane(new Component[]{promptContent, emptyData}, FlowLayout.LEFT, TEN, 0);
imageData = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Mode_Auto"), Toolkit.i18nText("Fine-Design_Chart_Mode_Custom")});
imageData.setSelectedIndex(0);
imageData.setPreferredSize(new Dimension(WIDTH, HEIGHT));
imageData.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
emptyDataImage = null;
checkIsCustom();
repaintPreviewPane();
}
});
UILabel promptContent = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Tip_Content"));
imageContent = new UILabel(Toolkit.i18nText("Fine-Design_Report_Image"));
JPanel emptyPane = GUICoreUtils.createFlowPane(new Component[]{promptContent, emptyData}, FlowLayout.LEFT, TEN, 0);
JPanel imagePane = GUICoreUtils.createFlowPane(new Component[]{imageContent, imageData}, FlowLayout.LEFT, TEN, 0);
imagePane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
JPanel northPane = GUICoreUtils.createFlowPane(new Component[]{emptyPane, imagePane}, FlowLayout.LEFT, 0, 0);
northPane.setBorder(BorderFactory.createEmptyBorder(0, FIVE, 0, 0));
return northPane;
}
@ -96,7 +116,7 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
JPanel previewContainerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
centerPane.add(previewContainerPane, BorderLayout.CENTER);
JPanel previewOwnerPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"));
JPanel previewOwnerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Preview"));
previewOwnerPane.setLayout(new BorderLayout());
previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER);
previewContainerPane.add(initSelectFilePane(), BorderLayout.EAST);
@ -116,25 +136,27 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
selectFilePane.setBorder(BorderFactory.createEmptyBorder(TEN, FIVE, 0, THIRTY));
defaultRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"));
customRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Custom"));
defaultRadioButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Report_Default"));
adjustRadioButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Report_Image_Adjust"));
ButtonGroup buttonGroup = new ButtonGroup();
defaultRadioButton.setSelected(true);
buttonGroup.add(defaultRadioButton);
buttonGroup.add(customRadioButton);
buttonGroup.add(adjustRadioButton);
defaultRadioButton.setEnabled(false);
adjustRadioButton.setEnabled(false);
defaultRadioButton.addActionListener(getLayoutActionListener());
customRadioButton.addActionListener(getLayoutActionListener());
JPanel jp = new JPanel(new GridLayout(3, 1, 0, TEN));
jp.add(defaultRadioButton);
jp.add(customRadioButton);
adjustRadioButton.addActionListener(getLayoutActionListener());
selectPictureButton = new UIButton(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Image_Select"));
Toolkit.i18nText("Fine-Design_Basic_Background_Image_Select"));
selectPictureButton.setEnabled(false);
selectPictureButton.addActionListener(getSelectPictureActionListener());
jp.add(selectPictureButton);
JPanel jp = new JPanel(new GridLayout(3, 1, 0, TEN));
jp.add(selectPictureButton);
jp.add(defaultRadioButton);
jp.add(adjustRadioButton);
selectFilePane.add(jp, BorderLayout.NORTH);
return selectFilePane;
@ -142,10 +164,8 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
private ActionListener getLayoutActionListener() {
return new ActionListener() {
public void actionPerformed(ActionEvent evt) {
emptyDataImage = null;
checkCustomImage();
setImageStyle();
repaintPreviewPane();
}
};
@ -188,17 +208,30 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
private void checkEmptyDataStyle() {
boolean b = emptyData.getSelectedIndex() == 0;
defaultRadioButton.setVisible(b);
adjustRadioButton.setVisible(b);
selectPictureButton.setVisible(b);
imageContent.setVisible(b);
imageData.setVisible(b);
}
private void checkIsCustom() {
boolean b = imageData.getSelectedIndex() == 1;
defaultRadioButton.setEnabled(b);
customRadioButton.setEnabled(b);
adjustRadioButton.setEnabled(b);
selectPictureButton.setEnabled(b);
}
private void checkCustomImage() {
selectPictureButton.setVisible(customRadioButton.isSelected());
private void setImageStyle() {
if (adjustRadioButton.isSelected()) {
previewPane.setImageStyle(Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST));
} else {
previewPane.setImageStyle(Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER));
}
}
private void repaintPreviewPane() {
emptyDataImage = customRadioButton.isSelected() ? emptyDataImage : DEFAULT_EMPTY_DATA_IMAGE;
emptyDataImage = imageData.getSelectedIndex() == 1 ? emptyDataImage : DEFAULT_EMPTY_DATA_IMAGE;
previewPane.setImage(emptyData.getSelectedIndex() == 0 ? emptyDataImage : null);
previewPane.repaint();
}
@ -215,12 +248,14 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
public void populateBean() {
ChartEmptyDataStyleConf manager = ChartEmptyDataStyleConf.getInstance();
emptyData.setSelectedIndex(manager.isOpenEmptyDataStyle() == true ? 0 : 1);
customRadioButton.setSelected(manager.isCustomEmptyDataStyle());
emptyData.setSelectedIndex(manager.isOpenEmptyDataStyle() ? 0 : 1);
imageData.setSelectedIndex(manager.isCustomEmptyDataStyle() ? 1 : 0);
adjustRadioButton.setSelected(manager.isAdjust());
emptyDataImage = manager.getEmptyDataImage();
checkEmptyDataStyle();
checkCustomImage();
checkIsCustom();
setImageStyle();
repaintPreviewPane();
}
@ -228,7 +263,8 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
ChartEmptyDataStyleConf manager = ChartEmptyDataStyleConf.getInstance();
manager.setOpenEmptyDataStyle(emptyData.getSelectedIndex() == 0);
manager.setCustomEmptyDataStyle(customRadioButton.isSelected());
manager.setCustomEmptyDataStyle(imageData.getSelectedIndex() == 1);
manager.setAdjust(adjustRadioButton.isSelected());
manager.setEmptyDataImage(emptyDataImage);
}
}

7
designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java

@ -2,6 +2,7 @@ package com.fr.van.chart.bubble;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.design.i18n.Toolkit;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -53,7 +54,7 @@ public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane {
//设置色彩面板内容
@Override
protected void setColorPaneContent(JPanel panel) {
panel.add(createAlphaPane(), BorderLayout.CENTER);
panel.add(createAlphaPane(), BorderLayout.SOUTH);
}
@Override
@ -67,7 +68,7 @@ public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane {
@Override
public String getPaneTitle() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Axis");
return Toolkit.i18nText("Fine-Design_Chart_Custom_Axis");
}
};
stackAndAxisEditExpandablePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(stackAndAxisEditPane.getPaneTitle(), stackAndAxisEditPane);
@ -76,7 +77,7 @@ public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane {
private JPanel createBubblePane() {
bubblePane = new VanChartBubblePane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Bubble"), bubblePane);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Bubble"), bubblePane);
}
protected void populateCondition(ConditionAttr defaultAttr) {

4
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnConditionPane.java

@ -17,11 +17,11 @@ import com.fr.plugin.chart.base.AttrTooltip;
import com.fr.plugin.chart.base.VanChartAttrTrendLine;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.type.ConditionKeyType;
import com.fr.van.chart.designer.other.condition.item.VanChartColumnSeriesColorConditionPane;
import com.fr.van.chart.designer.other.condition.item.VanChartDataSheetContentPane;
import com.fr.van.chart.designer.other.condition.item.VanChartEffectConditionPane;
import com.fr.van.chart.designer.other.condition.item.VanChartFloatColorConditionPane;
import com.fr.van.chart.designer.other.condition.item.VanChartLabelConditionPane;
import com.fr.van.chart.designer.other.condition.item.VanChartSeriesColorConditionPane;
import com.fr.van.chart.designer.other.condition.item.VanChartSeriesImageBackgroundConditionPane;
import com.fr.van.chart.designer.other.condition.item.VanChartTooltipConditionPane;
import com.fr.van.chart.designer.other.condition.item.VanChartTrendLineConditionPane;
@ -46,7 +46,7 @@ public class VanChartColumnConditionPane extends DataSeriesConditionPane{
@Override
protected void addBasicAction() {
classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this));
classPaneMap.put(AttrBackground.class, new VanChartColumnSeriesColorConditionPane(this));
classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this));
classPaneMap.put(AttrBorder.class, new VanChartColumnLabelBorderPane(this));
classPaneMap.put(AttrLabel.class, new VanChartLabelConditionPane(this, plot));

21
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnSeriesPane.java

@ -3,6 +3,7 @@ package com.fr.van.chart.column;
import com.fr.base.background.ImageBackground;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.design.i18n.Toolkit;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
@ -17,6 +18,8 @@ import com.fr.plugin.chart.base.AttrSeriesImageBackground;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.stable.Constants;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.component.VanChartBeautyPaneWithGradientBar;
import com.fr.van.chart.designer.component.border.VanChartBorderPane;
import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
@ -70,28 +73,28 @@ public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane {
}
private JPanel createSeriesStylePane(double[] row, double[] col) {
isFixedWidth = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_YES"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_NO")});
isFixedWidth = new UIButtonGroup<Integer>(new String[]{Toolkit.i18nText("Fine-Design_Chart_YES"), Toolkit.i18nText("Fine-Design_Chart_NO")});
columnWidth = new UISpinner(0,1000,1,0);
columnWidth.setBorder(BorderFactory.createEmptyBorder(0, (int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL,0,0));
seriesGap = new UINumberDragPane(-100, 100);
categoryGap = new UINumberDragPane(0, 100);
isFillWithImage = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_YES"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_NO")});
isFillWithImage = new UIButtonGroup<Integer>(new String[]{Toolkit.i18nText("Fine-Design_Chart_YES"), Toolkit.i18nText("Fine-Design_Chart_NO")});
imagePane = new ImageBackgroundQuickPane(false);
imagePane.setBorder(BorderFactory.createEmptyBorder(0,(int)TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL,0,0));
JPanel panel1 = new JPanel(new BorderLayout());
JPanel isFixedWidthPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fixed_Column_Width"),isFixedWidth);
JPanel isFixedWidthPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Fixed_Column_Width"),isFixedWidth);
isFixedWidthPane.setBorder(BorderFactory.createEmptyBorder(0,0,6,0));
panel1.add(isFixedWidthPane, BorderLayout.NORTH);
panel1.add(columnWidth, BorderLayout.CENTER);
Component[][] components2 = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gap_Series")),seriesGap},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gap_Category")),categoryGap},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Gap_Series")),seriesGap},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Gap_Category")),categoryGap},
};
JPanel panel2 = TableLayout4VanChartHelper.createGapTableLayoutPane(components2, row, col);
UILabel fillImageLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Filled_With_Image"));
UILabel fillImageLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Filled_With_Image"));
Component[][] components3 = new Component[][]{
new Component[]{fillImageLabel, UIComponentUtils.wrapWithBorderLayoutPane(isFillWithImage)},
};
@ -117,7 +120,7 @@ public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane {
checkImagePane();
}
});
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), borderPane);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), borderPane);
}
private void checkAll() {
@ -131,6 +134,10 @@ public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane {
seriesGap.setEnabled(!b);
}
protected VanChartBeautyPane createStylePane() {
return new VanChartBeautyPaneWithGradientBar();
}
private void checkImagePane() {
imagePane.setVisible(isFillWithImage.getSelectedIndex() == 0);
}

3
designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotPane.java

@ -61,7 +61,8 @@ public class VanChartCustomPlotPane extends AbstractVanChartTypePane {
return new Component[][]{
new Component[]{typePane},
new Component[]{stylePane},
new Component[]{contentPane}
new Component[]{contentPane},
new Component[]{buttonPane},
};
}

27
designer-chart/src/main/java/com/fr/van/chart/custom/style/VanChartCustomSeriesPane.java

@ -7,9 +7,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.component.VanChartFillStylePane;
import javax.swing.BorderFactory;
@ -26,9 +24,6 @@ public class VanChartCustomSeriesPane extends ChartSeriesPane {
private JPanel seriesPane;
protected VanChartCustomPlotSeriesTabPane plotSeriesPane;
private VanChartFillStylePane fillStylePane;//配色
private VanChartBeautyPane stylePane;//风格
public VanChartCustomSeriesPane(ChartStylePane parent) {
super(parent);
@ -69,16 +64,13 @@ public class VanChartCustomSeriesPane extends ChartSeriesPane {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] row = {p,p};
double[] row = {p};
double[] col = {f};
fillStylePane = new VanChartFillStylePane();
stylePane = new VanChartBeautyPane();
Component[][] components = new Component[][]{
new Component[]{fillStylePane}, //配色
new Component[]{stylePane},//风格
new Component[]{fillStylePane} //配色
};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col);
@ -101,16 +93,6 @@ public class VanChartCustomSeriesPane extends ChartSeriesPane {
if (fillStylePane != null){
plot.setPlotFillStyle(fillStylePane.updateBean());
}
if(stylePane != null) {
plot.setPlotStyle(stylePane.updateBean());
//风格属性传递
for (int i = 0; i < plot.getCustomPlotList().size(); i++){
VanChartPlot vanChartPlot = plot.getCustomPlotList().get(i);
vanChartPlot.setPlotStyle(plot.getPlotStyle());
}
}
if (seriesPane != null){
plotSeriesPane.updateBean(plot);
}
@ -135,14 +117,9 @@ public class VanChartCustomSeriesPane extends ChartSeriesPane {
if(plot == null) {
return;
}
if(fillStylePane != null) {//配色
fillStylePane.populateBean(plot.getPlotFillStyle());
}
if(stylePane != null){//风格
stylePane.populateBean(plot.getPlotStyle());
}
//更新不同点的系列界面
plotSeriesPane.populateBean(plot);

71
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPane.java

@ -1,12 +1,13 @@
package com.fr.van.chart.designer.component;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.GradientStyle;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.plugin.chart.type.GradientType;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
@ -17,56 +18,68 @@ import java.awt.Component;
* Created by Mitisky on 15/9/8.
*/
//系列-风格
public class VanChartBeautyPane extends BasicBeanPane<Integer> {
private UIButtonGroup styleBox;
public class VanChartBeautyPane extends BasicBeanPane<GradientStyle> {
private UIButtonGroup gradientTypeBox;
public UIButtonGroup getGradientTypeBox() {
return gradientTypeBox;
}
public VanChartBeautyPane() {
styleBox = new UIButtonGroup(getNameArray());
this.setLayout(new BorderLayout());
this.add(initGradientTypePane(), BorderLayout.CENTER);
}
private JPanel initGradientTypePane() {
String[] names = getNameArray();
gradientTypeBox = new UIButtonGroup(names);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Gradient_Style")), styleBox},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Gradient_Style")), gradientTypeBox},
};
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER);
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
}
protected String[] getNameArray() {
return new String[]{Toolkit.i18nText("Fine-Design_Chart_On"),
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_On"),
Toolkit.i18nText("Fine-Design_Chart_Off")
};
}
@Override
public void populateBean(Integer ob) {
int finalIndex;
switch (ob){
case ChartConstants.STYLE_NONE: finalIndex = 1; break;
case ChartConstants.STYLE_SHADE: finalIndex = 0; break;
default: finalIndex = 1;
}
styleBox.setSelectedIndex(finalIndex);
public void populateBean(GradientStyle gradientStyle) {
gradientTypeBox.setSelectedIndex(this.convertGradientTypeToIndex(gradientStyle.getGradientType()));
}
@Override
public Integer updateBean() {
int index = styleBox.getSelectedIndex();
int style;
switch (index){
case 0: style = ChartConstants.STYLE_SHADE; break;
case 1: style = ChartConstants.STYLE_NONE; break;
default: style = ChartConstants.STYLE_NONE;
public GradientStyle updateBean() {
GradientStyle gradientStyle = new GradientStyle();
gradientStyle.setGradientType(this.convertIndexToGradientType(this.gradientTypeBox.getSelectedIndex()));
return gradientStyle;
}
return style;
protected int convertGradientTypeToIndex(GradientType gradientType) {
return gradientType == GradientType.NONE ? 1 : 0;
}
protected GradientType convertIndexToGradientType(int index) {
return index == 1 ? GradientType.NONE : GradientType.AUTO;
}
@Override
protected String title4PopupWindow() {
return "";
return StringUtils.EMPTY;
}
}

113
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartBeautyPaneWithGradientBar.java

@ -0,0 +1,113 @@
package com.fr.van.chart.designer.component;
import com.fr.chart.base.GradientStyle;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.plugin.chart.type.GradientType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class VanChartBeautyPaneWithGradientBar extends VanChartBeautyPane {
private FixedGradientBar colorGradient;
private JPanel gradientBarPane;
public VanChartBeautyPaneWithGradientBar() {
super();
this.add(initGradientBarPane(), BorderLayout.SOUTH);
initListener();
}
private JPanel initGradientBarPane() {
colorGradient = new FixedGradientBar(4, 140);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{null, colorGradient},
};
gradientBarPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
return gradientBarPane;
}
private void initListener() {
getGradientTypeBox().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkGradientBarVisible();
}
});
}
private void checkGradientBarVisible() {
if (colorGradient != null && gradientBarPane != null) {
gradientBarPane.setVisible(getGradientTypeBox().getSelectedIndex() == 1);
}
}
protected String[] getNameArray() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_Auto"),
Toolkit.i18nText("Fine-Design_Chart_Custom"),
Toolkit.i18nText("Fine-Design_Chart_Off")
};
}
public void populateBean(GradientStyle gradientStyle) {
super.populateBean(gradientStyle);
if (colorGradient != null) {
colorGradient.updateColor(gradientStyle.getStartColor(), gradientStyle.getEndColor());
}
checkGradientBarVisible();
}
@Override
public GradientStyle updateBean() {
GradientStyle gradientStyle = super.updateBean();
if (this.colorGradient != null && this.gradientBarPane != null) {
gradientStyle.setStartColor(colorGradient.getSelectColorPointBtnP1().getColorInner());
gradientStyle.setEndColor(colorGradient.getSelectColorPointBtnP2().getColorInner());
}
return gradientStyle;
}
protected int convertGradientTypeToIndex(GradientType gradientType) {
switch (gradientType) {
case CUSTOM:
return 1;
case NONE:
return 2;
default:
return 0;
}
}
protected GradientType convertIndexToGradientType(int index) {
switch (index) {
case 1:
return GradientType.CUSTOM;
case 2:
return GradientType.NONE;
default:
return GradientType.AUTO;
}
}
}

3
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFillStylePane.java

@ -144,8 +144,9 @@ public class VanChartFillStylePane extends BasicBeanPane<AttrFillStyle> implemen
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p};
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Match_Color_Scheme")), styleSelectBox},
new Component[]{null, customPane},

25
designer-chart/src/main/java/com/fr/van/chart/designer/data/OneDimensionalPlotReportDataContentPane.java

@ -1,8 +1,13 @@
package com.fr.van.chart.designer.data;
import com.fr.chart.chartdata.MeterReportDefinition;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.report.MeterPlotReportDataContentPane;
import java.awt.Component;
/**
@ -23,4 +28,24 @@ public class OneDimensionalPlotReportDataContentPane extends MeterPlotReportData
protected String getNValueString() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Value");
}
@Override
protected double[] getRowSize() {
double p = TableLayout.PREFERRED;
return new double[]{p, p, p};
}
@Override
protected Component[][] getShowComponents() {
return new Component[][]{
new Component[]{new UILabel(getCateNameString()), getSingCatePane()},
new Component[]{new UILabel(getNValueString()), singValuePane = new TinyFormulaPane()},
};
}
protected void populateCustomPane(String target) {
}
protected void updateCustomPane(MeterReportDefinition meterDefinition) {
}
}

153
designer-chart/src/main/java/com/fr/van/chart/designer/other/condition/item/VanChartColumnSeriesColorConditionPane.java

@ -0,0 +1,153 @@
package com.fr.van.chart.designer.other.condition.item;
import com.fr.base.background.ColorBackground;
import com.fr.chart.base.AttrBackground;
import com.fr.chart.base.DataSeriesCondition;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.style.background.gradient.FixedGradientBar;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.plugin.chart.type.GradientType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class VanChartColumnSeriesColorConditionPane extends AbstractNormalMultiLineConditionPane {
private UIButtonGroup matchColorTypeBox;
private ColorSelectBox colorSelectionBox;
private FixedGradientBar colorGradient;
private JPanel colorSelectPane;
private JPanel colorGradientPane;
public VanChartColumnSeriesColorConditionPane(ConditionAttributesPane conditionAttributesPane) {
super(conditionAttributesPane, null);
}
protected String getItemLabelString() {
return nameForPopupMenuItem();
}
protected JPanel initContentPane() {
colorSelectionBox = new ColorSelectBox(80);
colorGradient = new FixedGradientBar(4, 150);
colorSelectPane = createJPanelWithComponent(colorSelectionBox);
colorGradientPane = createJPanelWithComponent(colorGradient);
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add(initColorButtonPane(), BorderLayout.NORTH);
panel.add(colorSelectPane, BorderLayout.CENTER);
panel.add(colorGradientPane, BorderLayout.SOUTH);
initListener();
return panel;
}
private JPanel initColorButtonPane() {
String[] names = new String[]{
Toolkit.i18nText("Fine-Design_Chart_Solid_Color"),
Toolkit.i18nText("Fine-Design_Chart_Style_TopDownShade")
};
matchColorTypeBox = new UIButtonGroup(names);
double p = TableLayout.PREFERRED;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
Component[][] components = new Component[][]{new Component[]{matchColorTypeBox}};
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p}, new double[]{e});
}
private void initListener() {
matchColorTypeBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkColorPaneVisible();
}
});
}
private void checkColorPaneVisible() {
if (colorSelectPane != null) {
colorSelectPane.setVisible(matchColorTypeBox.getSelectedIndex() == 0);
}
if (colorGradientPane != null) {
colorGradientPane.setVisible(matchColorTypeBox.getSelectedIndex() == 1);
}
}
public String nameForPopupMenuItem() {
return Toolkit.i18nText("Fine-Design_Chart_Match_Color");
}
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Chart_Match_Color");
}
public void populate(DataSeriesCondition condition) {
if (condition instanceof AttrBackground) {
AttrBackground matchColor = (AttrBackground) condition;
if (matchColor.getGradient() == GradientType.NONE) {
this.matchColorTypeBox.setSelectedIndex(0);
} else {
this.matchColorTypeBox.setSelectedIndex(1);
}
ColorBackground seriesColor = (ColorBackground) matchColor.getSeriesBackground();
if (seriesColor != null) {
this.colorSelectionBox.setSelectObject(seriesColor.getColor());
}
this.colorGradient.updateColor(matchColor.getGradientStartColor(), matchColor.getGradientEndColor());
}
checkColorPaneVisible();
}
public DataSeriesCondition update() {
AttrBackground matchColor = new AttrBackground();
if (this.matchColorTypeBox.getSelectedIndex() == 0) {
matchColor.setGradient(GradientType.NONE);
} else {
matchColor.setGradient(GradientType.CUSTOM);
}
matchColor.setSeriesBackground(ColorBackground.getInstance(this.colorSelectionBox.getSelectObject()));
matchColor.setGradientStartColor(this.colorGradient.getSelectColorPointBtnP1().getColorInner());
matchColor.setGradientEndColor(this.colorGradient.getSelectColorPointBtnP2().getColorInner());
return matchColor;
}
public void setDefault() {
this.populate(new AttrBackground());
}
private JPanel createJPanelWithComponent(Component component) {
double p = TableLayout.PREFERRED;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
Component[][] components = new Component[][]{
new Component[]{null},
new Component[]{component}
};
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{e});
}
}

16
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java

@ -254,21 +254,13 @@ public class VanChartPlotLegendPane extends BasicPane {
customFloatPositionButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if(!customFloatPositionButton.isSelected()){
public void mouseReleased(MouseEvent e) {
super.mouseReleased(e);
location.setSelectedIndex(-1);
customFloatPositionButton.setSelected(true);
checkLayoutPaneVisible();
checkDisplayStrategyUse();
}
}
@Override
public void mousePressed(MouseEvent e) {
location.setSelectedIndex(-1);
}
@Override
public void mouseReleased(MouseEvent e) {
super.mouseReleased(e);
if(customFloatPositionPane == null) {
customFloatPositionPane = new VanChartFloatPositionPane();

17
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java

@ -214,23 +214,14 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
});
customFloatPositionButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (!customFloatPositionButton.isSelected()) {
customFloatPositionButton.setSelected(true);
checkDisplayStrategyUse();
}
}
@Override
public void mousePressed(MouseEvent e) {
alignmentPane.setSelectedIndex(-1);
}
@Override
public void mouseReleased(MouseEvent e) {
super.mouseReleased(e);
alignmentPane.setSelectedIndex(-1);
customFloatPositionButton.setSelected(true);
checkDisplayStrategyUse();
if (customFloatPositionPane == null) {
customFloatPositionPane = new VanChartFloatPositionPane();
}

10
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartAxisScrollPaneWithTypeSelect.java

@ -1,11 +1,11 @@
package com.fr.van.chart.designer.style.axis;
import com.fr.chart.chartattr.Axis;
import com.fr.design.i18n.Toolkit;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartTimeAxis;
import com.fr.plugin.chart.attr.axis.VanChartValueAxis;
@ -57,7 +57,7 @@ public class VanChartAxisScrollPaneWithTypeSelect extends AbstractVanChartScroll
protected void initLayout() {
this.setLayout(new BorderLayout(0,6));
JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Type"),jcb);
JPanel northPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Type"), jcb);
northPane.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER);
@ -102,21 +102,21 @@ public class VanChartAxisScrollPaneWithTypeSelect extends AbstractVanChartScroll
if(ComparatorUtils.equals(axis.getAxisType(), AxisType.AXIS_CATEGORY)){
textAxisPane.updateBean(axis);
} else {
axis = new VanChartAxis(axis.getAxisName(), axis.getPosition());
axis = new VanChartAxis(axis.getAxisName(), axis.getPosition(), axis.getGridLineType(), axis.getMainGridColor());
textAxisPane.updateBean(axis);
}
} else if(ComparatorUtils.equals(index, AxisType.AXIS_TIME.ordinal())){
if(ComparatorUtils.equals(axis.getAxisType(), AxisType.AXIS_TIME)){
timeAxisPane.updateBean(axis);
} else {
axis = new VanChartTimeAxis(axis.getAxisName(), axis.getPosition());
axis = new VanChartTimeAxis(axis.getAxisName(), axis.getPosition(), axis.getGridLineType(), axis.getMainGridColor());
timeAxisPane.updateBean(axis);
}
} else if(ComparatorUtils.equals(index, AxisType.AXIS_VALUE.ordinal())){
if(ComparatorUtils.equals(axis.getAxisType(), AxisType.AXIS_VALUE)){
valueAxisPane.updateBean(axis);
} else {
axis = new VanChartValueAxis(axis.getAxisName(), axis.getPosition());
axis = new VanChartValueAxis(axis.getAxisName(), axis.getPosition(), axis.getGridLineType(), axis.getMainGridColor());
valueAxisPane.updateBean(axis);
}
}

33
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/gauge/VanChartGaugeDetailAxisPane.java

@ -9,7 +9,6 @@ import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPaneWithAuto;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.axis.VanChartGaugeAxis;
import com.fr.plugin.chart.gauge.VanChartGaugePlot;
@ -18,7 +17,6 @@ import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.axis.VanChartValueAxisPane;
import com.fr.van.chart.designer.style.axis.component.MinMaxValuePaneWithOutTick;
import com.fr.van.chart.designer.style.axis.component.VanChartMinMaxValuePane;
import javax.swing.BorderFactory;
@ -112,7 +110,36 @@ public class VanChartGaugeDetailAxisPane extends VanChartValueAxisPane {
switch (gaugeStyle) {
case RING:
case SLOT:
minMaxValuePane = new MinMaxValuePaneWithOutTick();
minMaxValuePane = new VanChartMinMaxValuePane() {
@Override
protected double[] getRowSize(double p) {
return new double[]{p};
}
@Override
protected Component[][] getShowComponents(JPanel minPaneWithCheckBox, JPanel maxPaneWithCheckBox, JPanel mainPaneWithCheckBox, JPanel secPaneWithCheckBox) {
return new Component[][]{
{minPaneWithCheckBox},
};
}
};
break;
case THERMOMETER:
minMaxValuePane = new VanChartMinMaxValuePane() {
@Override
protected double[] getRowSize(double p) {
return new double[]{p, p, p};
}
@Override
protected Component[][] getShowComponents(JPanel minPaneWithCheckBox, JPanel maxPaneWithCheckBox, JPanel mainPaneWithCheckBox, JPanel secPaneWithCheckBox) {
return new Component[][]{
{minPaneWithCheckBox},
{mainPaneWithCheckBox},
{secPaneWithCheckBox},
};
}
};
break;
default:
minMaxValuePane = new VanChartMinMaxValuePane();

24
designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java

@ -6,6 +6,7 @@ import com.fr.base.chart.chartdata.model.NormalDataModel;
import com.fr.chart.base.AttrAlpha;
import com.fr.chart.base.AttrBorder;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.GradientStyle;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.design.gui.frpane.UINumberDragPane;
@ -22,6 +23,7 @@ import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.VanChartAttrLine;
import com.fr.plugin.chart.base.VanChartAttrMarker;
import com.fr.plugin.chart.base.VanChartAttrTrendLine;
import com.fr.plugin.chart.type.GradientType;
import com.fr.van.chart.custom.style.VanChartCustomStylePane;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartAreaSeriesFillColorPane;
@ -105,7 +107,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
//风格
protected VanChartBeautyPane createStylePane() {
return parentPane instanceof VanChartCustomStylePane ? null : new VanChartBeautyPane();
return new VanChartBeautyPane();
}
//获取颜色面板
@ -114,7 +116,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
stylePane = createStylePane();
vanChartFillStylePane = getVanChartFillStylePane();
if (vanChartFillStylePane != null) {
panel.add(vanChartFillStylePane, BorderLayout.NORTH);
panel.add(vanChartFillStylePane, BorderLayout.CENTER);
}
setColorPaneContent(panel);
JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel);
@ -122,10 +124,16 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
return panel.getComponentCount() == 0 ? null : colorPane;
}
//设置色彩面板内容
//设置色彩面板内容: 风格居上,配色居中,不透明度居下
protected void setColorPaneContent(JPanel panel) {
if (stylePane != null) {
panel.add(stylePane, BorderLayout.CENTER);
panel.add(stylePane, BorderLayout.NORTH);
}
}
private void checkFillStylePane(GradientStyle gradientStyle) {
if (vanChartFillStylePane != null) {
vanChartFillStylePane.setVisible(gradientStyle.getGradientType() != GradientType.CUSTOM);
}
}
@ -276,7 +284,9 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
}
if (stylePane != null) {//风格
stylePane.populateBean(plot.getPlotStyle());
GradientStyle gradientStyle = ((VanChartPlot) plot).getGradientStyle();
stylePane.populateBean(gradientStyle);
checkFillStylePane(gradientStyle);
}
//大数据模式 恢复用注释。下面3行删除。
@ -335,7 +345,9 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
}
if (stylePane != null) {//风格
plot.setPlotStyle(stylePane.updateBean());
GradientStyle gradientStyle = stylePane.updateBean();
((VanChartPlot) plot).setGradientStyle(gradientStyle);
checkFillStylePane(gradientStyle);
}
//大数据模式 恢复用注释。下面3行删除。

43
designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractVanChartTypePane.java

@ -1,5 +1,6 @@
package com.fr.van.chart.designer.type;
import com.fr.base.BaseUtils;
import com.fr.chart.base.AttrFillStyle;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Legend;
@ -7,13 +8,16 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chart.chartglyph.ConditionCollection;
import com.fr.chart.chartglyph.DataSheet;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.MultilineLabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
import com.fr.design.mainframe.chart.info.ChartInfoCollector;
@ -25,21 +29,53 @@ import com.fr.plugin.chart.base.VanChartTools;
import com.fr.plugin.chart.base.VanChartZoom;
import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionListener;
public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Chart> {
private static final long serialVersionUID = 7743244512351499265L;
private UICheckBox largeModelCheckBox;
protected JPanel buttonPane;
protected UIButton autoButton;
private boolean samePlot;
protected boolean isSamePlot() {
return samePlot;
}
public AbstractVanChartTypePane() {
buttonPane = new JPanel();
buttonPane.setLayout(new BorderLayout());
if (ChartTypeManager.AUTO_CHART) {
autoButton = new UIButton(Toolkit.i18nText("Fine-Design_Chart_Auto_Recommended_Chart"),
BaseUtils.readIcon("/com/fr/design/images/m_insert/auto_chart.png")) {
@Override
public Dimension getPreferredSize() {
return new Dimension((int) super.getPreferredSize().getWidth(), 25);
}
};
buttonPane.setBorder((BorderFactory.createEmptyBorder(5, 0, 0, 0)));
buttonPane.add(autoButton);
}
}
@Override
protected Component[][] getPaneComponents(JPanel typePane) {
return new Component[][]{
new Component[]{typePane},
new Component[]{buttonPane},
new Component[]{stylePane},
};
}
//新图表暂时还没有平面3d,渐变高光等布局。
@Override
protected String[] getTypeLayoutPath() {
@ -237,4 +273,11 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha
newPlot.setConditionCollection((ConditionCollection) oldPlot.getConditionCollection().clone());
}
}
@Override
public void registerButtonListener(ActionListener autoButtonListener) {
if (autoButton != null) {
autoButton.addActionListener(autoButtonListener);
}
}
}

13
designer-chart/src/main/java/com/fr/van/chart/funnel/designer/style/VanChartFunnelSeriesPane.java

@ -1,6 +1,7 @@
package com.fr.van.chart.funnel.designer.style;
import com.fr.chart.chartattr.Plot;
import com.fr.design.i18n.Toolkit;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
@ -43,14 +44,14 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane {
//设置色彩面板内容
protected void setColorPaneContent (JPanel panel) {
if (stylePane != null) {
panel.add(stylePane, BorderLayout.CENTER);
panel.add(stylePane, BorderLayout.NORTH);
}
panel.add(createAlphaPane(), BorderLayout.SOUTH);
}
private JPanel createFunnelStylePane() {
useSameSlantAngle = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Same_Slant_Angle"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Diff_Slant_Angle")});
sort = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Auto_Sort"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Origin")});
useSameSlantAngle = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Same_Slant_Angle"), Toolkit.i18nText("Fine-Design_Chart_Use_Diff_Slant_Angle")});
sort = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Auto_Sort"), Toolkit.i18nText("Fine-Design_Chart_Origin")});
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
@ -59,13 +60,13 @@ public class VanChartFunnelSeriesPane extends VanChartAbstractPlotSeriesPane {
double[] rowSize = {p,p,p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Continuity")), useSameSlantAngle},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Sort")), sort},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Continuity")), useSameSlantAngle},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Sort")), sort},
};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Name"), panel);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Style_Name"), panel);
}
public void populateBean(Plot plot) {

1
designer-chart/src/main/java/com/fr/van/chart/map/designer/type/VanChartMapPlotPane.java

@ -42,6 +42,7 @@ public class VanChartMapPlotPane extends AbstractVanChartTypePane {
}
return new Component[][]{
new Component[]{typePane},
new Component[]{buttonPane},
new Component[]{sourceChoosePane}
};
}

9
designer-chart/src/main/java/com/fr/van/chart/radar/VanChartRadarSeriesPane.java

@ -1,6 +1,7 @@
package com.fr.van.chart.radar;
import com.fr.chart.chartattr.Plot;
import com.fr.design.i18n.Toolkit;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -59,15 +60,15 @@ public class VanChartRadarSeriesPane extends VanChartAbstractPlotSeriesPane {
//设置色彩面板内容
protected void setColorPaneContent (JPanel panel) {
if(plot instanceof VanChartRadarPlot && ((VanChartRadarPlot)plot).isStackChart()) {
panel.add(createAlphaPane(), BorderLayout.CENTER);
panel.add(createAlphaPane(), BorderLayout.SOUTH);
}
}
private JPanel createRadarTypePane() {
radarType = new UIButtonGroup<String>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Circle"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Polygonal")},
radarType = new UIButtonGroup<String>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Circle"), Toolkit.i18nText("Fine-Design_Chart_Polygonal")},
new String[]{RadarType.CIRCLE.getType(), RadarType.POLYGON.getType()});
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Shape"), radarType);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Present"), panel);
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Shape"), radarType);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Style_Present"), panel);
}
protected VanChartLineTypePane getLineTypePane() {

2
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java

@ -54,7 +54,7 @@ public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane {
//设置色彩面板内容
protected void setColorPaneContent(JPanel panel) {
panel.add(createAlphaPane(), BorderLayout.CENTER);
panel.add(createAlphaPane(), BorderLayout.SOUTH);
}
@Override

BIN
designer-chart/src/main/resources/com/fr/design/images/form/toolbar/auto_chart.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

BIN
designer-chart/src/main/resources/com/fr/design/images/us_emptydata.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 21 KiB

BIN
designer-chart/src/main/resources/com/fr/design/images/zh_emptydata.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 25 KiB

3
designer-form/build.gradle

@ -0,0 +1,3 @@
dependencies {
compile project(':designer-base')
}

18
designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java

@ -1,18 +1,18 @@
package com.fr.design.designer.beans.models;
import java.awt.Rectangle;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.adapters.component.CompositeComponentAdapter;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.utils.ComponentUtils;
import com.fr.general.ComparatorUtils;
import java.awt.Rectangle;
/**
* 添加状态下的model
*/
@ -26,9 +26,8 @@ public class AddingModel {
private boolean added;
public AddingModel(FormDesigner designer, XCreator xCreator) {
String creatorName = getXCreatorName(designer, xCreator);
this.creator = xCreator;
instantiateCreator(designer, creatorName);
instantiateCreator(designer);
// 初始的时候隐藏该组件的图标
currentY = -this.creator.getWidth();
currentX = -this.creator.getHeight();
@ -38,10 +37,10 @@ public class AddingModel {
* 待说明
*
* @param designer 设计器
* @param creatorName 组件名
*/
public void instantiateCreator(FormDesigner designer, String creatorName) {
creator.toData().setWidgetName(creatorName);
public void instantiateCreator(FormDesigner designer) {
ModelUtil.renameWidgetName(designer.getTarget(), creator);
ComponentAdapter adapter = new CompositeComponentAdapter(designer, creator);
adapter.initialize();
creator.addNotify();
@ -77,6 +76,7 @@ public class AddingModel {
return def + i;
}
public int getCurrentX() {
return currentX;
}

58
designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java

@ -0,0 +1,58 @@
package com.fr.design.designer.beans.models;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.form.main.Form;
import com.fr.form.ui.Widget;
import com.fr.stable.StringUtils;
import java.util.HashSet;
import java.util.Set;
/**
* created by Harrison on 2020/06/05
**/
abstract class ModelUtil {
public static void renameWidgetName(Form form, XCreator xCreator) {
Set<String> duplicated = new HashSet<>();
recursiveRenameWidgetName(form, xCreator, duplicated);
}
private static void recursiveRenameWidgetName(Form form, XCreator xCreator, Set<String> duplicated) {
Set<XCreator> nameRelatedCreators = new HashSet<>();
//直接遍历出来目标值,然后按需处理
xCreator.traversalNameRelatedXCreators(nameRelatedCreators);
for (XCreator target : nameRelatedCreators) {
String uniqueName = uniqueName(form, target, duplicated);
target.resetCreatorName(uniqueName);
}
}
private static String uniqueName(Form form, XCreator xCreator, Set<String> duplicated) {
if (xCreator.acceptType(XWParameterLayout.class)) {
return xCreator.createDefaultName();
}
Widget widget = xCreator.toData();
String widgetName = widget.getWidgetName();
if (StringUtils.isEmpty(widgetName)) {
widgetName = xCreator.createDefaultName();
}
//先保存默认名字
String raw = widgetName;
int i = 0;
//先初始化加上索引。
widgetName = widgetName + i;
while (form.isNameExist(widgetName) || duplicated.contains(widgetName)) {
i++;
widgetName = raw + i;
}
//将名字加入重复集合中
duplicated.add(widgetName);
return widgetName;
}
}

26
designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

@ -1,6 +1,7 @@
package com.fr.design.designer.beans.models;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.base.clipboard.ClipboardFilter;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.LayoutAdapter;
@ -19,11 +20,13 @@ import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelection;
import com.fr.design.mainframe.FormSelectionUtils;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils;
import java.awt.LayoutManager;
@ -31,6 +34,7 @@ import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Set;
/**
* 该model保存当前选择的组件和剪切版信息
@ -43,6 +47,7 @@ public class SelectionModel {
private FormDesigner designer;
private FormSelection selection;
private Rectangle hotspotBounds;
private FormWidgetOptionProvider provider;
public SelectionModel(FormDesigner designer) {
this.designer = designer;
@ -256,9 +261,30 @@ public class SelectionModel {
//绝对布局
Rectangle rec = selection.getSelctionBounds();
FormSelectionUtils.paste2Container(designer, container, clipboard, rec.x + DELTA_X_Y, rec.y + DELTA_X_Y);
} else if (isExtraContainer(container)) {
provider.paste2Container(selection);
}
}
/**
* 扩展的容器布局
* @param container
* @return
*/
private boolean isExtraContainer(XLayoutContainer container) {
if (container != null) {
Set<FormWidgetOptionProvider> set = ExtraDesignClassManager.getInstance().getArray(FormWidgetOptionProvider.XML_TAG);
for (FormWidgetOptionProvider provider : set) {
if (provider.isContainer() && ComparatorUtils.equals(provider.appearanceForWidget(), selection.getSelectedCreator().getParent().getClass())) {
this.provider = provider;
return true;
}
}
}
return false;
}
/**
* 删除当前所有选择的组件
*/

7
designer-form/src/main/java/com/fr/design/designer/creator/DedicateLayoutContainer.java

@ -9,6 +9,7 @@ import java.awt.Component;
import java.awt.Dimension;
import java.beans.IntrospectionException;
import java.util.List;
import java.util.Set;
/**
* 一些控件专属的容器如标题容器sclae容器
@ -70,8 +71,14 @@ public abstract class DedicateLayoutContainer extends XLayoutContainer {
child.toData().setWidgetName(name);
}
@Override
public void traversalNameRelatedXCreators(Set<XCreator> xCreators) {
xCreators.add(this);
}
/**
* 重置组件的可见性
*
* @param visible 可见性
*/
@Override

121
designer-form/src/main/java/com/fr/design/designer/creator/XAutoChartCreator.java

@ -0,0 +1,121 @@
package com.fr.design.designer.creator;
import com.fr.base.GraphHelper;
import com.fr.base.chart.BaseChartCollection;
import com.fr.common.annotations.Open;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.gui.chart.MiddleChartDialog;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.module.DesignModuleFactory;
import com.fr.form.ui.ChartAutoEditor;
import com.fr.general.IOUtils;
import com.fr.stable.Constants;
import com.fr.stable.bridge.StableFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-05-26
*/
@Open
public class XAutoChartCreator extends XChartEditor {
private MiddleChartDialog autoChartDialog;
private EditingMouseListener editingMouseListener;
public XAutoChartCreator(ChartAutoEditor editor, Dimension size) {
super(editor, size);
}
/**
* 返回组件默认名
*
* @return 组件类名(小写)
*/
public String createDefaultName() {
return "auto_chart";
}
@Override
public ChartAutoEditor toData() {
return (ChartAutoEditor) data;
}
/**
* 点击选中的时候, 刷新界面
* 右键 reset之后, 触发事件 populate此方法
*
* @param jform 表单
* @param formDesigner 表单设计器
* @return 控件.
*/
public JComponent createToolPane(final BaseJForm jform, final FormDesigner formDesigner) {
if (toData().isChartSelect()) {
return super.createToolPane(jform, formDesigner);
}
if (isEditing) {
if (autoChartDialog != null && autoChartDialog.isVisible()) {
return new JPanel();
}
final BaseChartCollection chartCollection = (BaseChartCollection) StableFactory.createXmlObject(BaseChartCollection.XML_TAG);
autoChartDialog = DesignModuleFactory.getAutoChartDialog(DesignerContext.getDesignerFrame());
autoChartDialog.populate(chartCollection);
autoChartDialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
initChart(autoChartDialog.getChartCollection());
formDesigner.fireTargetModified();
}
@Override
public void doCancel() {
editingMouseListener.stopEditing();
}
});
autoChartDialog.setVisible(true);
}
return toData().isChartSelect() ? super.createToolPane(jform, formDesigner) : new JPanel();
}
/**
* 响应点击事件
*
* @param editingMouseListener 鼠标点击位置处理器
* @param e 鼠标点击事件
*/
public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e) {
this.editingMouseListener = editingMouseListener;
super.respondClick(editingMouseListener, e);
}
public void paint(Graphics g) {
BufferedImage bufferedImage = IOUtils.readImage("com/fr/design/form/images/auto_chart_preview.png");
GraphHelper.paintImage(
g, this.getWidth(), this.getHeight(), bufferedImage,
Constants.IMAGE_ADJUST,
0,
0, -1, -1
);
super.paint(g);
}
private void initChart(BaseChartCollection chartCollection) {
((MiddleChartComponent) getDesignerEditor().getEditorTarget()).populate(chartCollection);
this.toData().resetChangeChartCollection(chartCollection);
this.toData().setChartSelect(true);
}
}

19
designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java

@ -28,13 +28,13 @@ import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.beans.IntrospectionException;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.beans.IntrospectionException;
/**
* form中的图表按钮弹出的控件, 创建初始化图表内容.
@ -52,7 +52,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
//marro:无奈的属性,暂时想不出好办法
private boolean isRefreshing = false;
private boolean isEditing = false;
protected boolean isEditing = false;
private boolean isHovering = false;
private static final Color OUTER_BORDER_COLOR = new Color(65, 155, 249, 30);
@ -79,6 +79,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
/**
* 返回组件默认名
*
* @return 组件类名(小写)
*/
public String createDefaultName() {
@ -87,6 +88,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
/**
* 是否支持设置标题
*
* @return 是返回true
*/
public boolean hasTitleStyle() {
@ -98,8 +100,10 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
isEditing = false;
}
/**
* 得到属性名
*
* @return 属性名
* @throws java.beans.IntrospectionException
*/
@ -111,7 +115,8 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
@Override
public void propertyChange() {
makeVisible(toData().isVisible());}
makeVisible(toData().isVisible());
}
}),
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
WLayoutBorderStyleEditor.class).setI18NName(
@ -128,6 +133,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
/**
* 该组件是否可以拖入参数面板
*
* @return 是则返回true
*/
public boolean canEnterIntoParaPane() {
@ -137,7 +143,6 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
/**
* 编辑状态的时候需要重新绘制下边框
*
*/
@Override
public void paintBorder(Graphics g, Rectangle bounds) {
@ -206,8 +211,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
}
});
return (JComponent) propertyPane;
}
else{
} else {
return (JComponent) DesignModuleFactory.getWidgetPropertyPane(formDesigner);
}
}
@ -305,6 +309,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
/**
* 是否展现覆盖的pane
*
* @param display 是否
*/
public void displayCoverPane(boolean display) {
@ -329,7 +334,6 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
/**
* data属性改变触发其他操作
*
*/
public void firePropertyChange() {
initStyle();
@ -342,6 +346,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
/**
* 是否支持共享-现只支持报表块图表tab块绝对布局
*
* @return
*/
public boolean isSupportShared() {

7
designer-form/src/main/java/com/fr/design/designer/creator/XCheckBoxGroup.java

@ -3,7 +3,9 @@
*/
package com.fr.design.designer.creator;
import com.fr.design.designer.properties.mobile.ButtonGroupPropertyUI;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.editors.DictionaryEditor;
@ -87,4 +89,9 @@ public class XCheckBoxGroup extends XFieldEditor {
protected String getIconName() {
return "checkbox_group_16.png";
}
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[] {new ButtonGroupPropertyUI(this)};
}
}

24
designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java

@ -41,6 +41,7 @@ import java.awt.event.MouseEvent;
import java.beans.IntrospectionException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* @author richer
@ -410,6 +411,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
/**
* 重置组件的名称
*
* @param name 名称
*/
@Override
@ -417,8 +419,30 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
toData().setWidgetName(name);
}
/**
* 遍历所有命名相关的组件到集合中
*
* @param xCreators 集合
*/
public void traversalNameRelatedXCreators(Set<XCreator> xCreators) {
xCreators.add(this);
int componentCount = getComponentCount();
for (int i = 0; i < componentCount; i++) {
Component component = getComponent(i);
if (component instanceof XCreator) {
XCreator xCreator = (XCreator) component;
//获取真实的 creator
XCreator realCreator = xCreator.getXCreator();
realCreator.traversalNameRelatedXCreators(xCreators);
}
}
}
/**
* 重置组件的可见性
*
* @param visible 可见性
*/
public void resetVisible(boolean visible) {

1
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -169,6 +169,7 @@ public class XCreatorUtils {
extraObjectMap.clear();
extraObjectMap.putAll(ExtraDesignClassManager.getInstance().getParameterWidgetOptionsMap());
extraObjectMap.putAll(ExtraDesignClassManager.getInstance().getFormWidgetOptionsMap());
extraObjectMap.putAll(ExtraDesignClassManager.getInstance().getChartWidgetOptionsMap());
}
private static void putExtraEditor() {

7
designer-form/src/main/java/com/fr/design/designer/creator/XRadioGroup.java

@ -12,6 +12,8 @@ import javax.swing.ButtonGroup;
import javax.swing.JComponent;
import javax.swing.JRadioButton;
import com.fr.design.designer.properties.mobile.ButtonGroupPropertyUI;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.editors.DictionaryEditor;
import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor;
@ -83,4 +85,9 @@ public class XRadioGroup extends XFieldEditor {
protected String getIconName() {
return "button_group_16.png";
}
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[] {new ButtonGroupPropertyUI(this)};
}
}

3
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java

@ -433,6 +433,8 @@ public class XWCardLayout extends XLayoutContainer {
//修改相关SwitchButton所绑定的cardLayout控件名
private void changeRelateSwitchCardName(String cardLayoutName) {
XWCardMainBorderLayout borderLayout = (XWCardMainBorderLayout) this.getBackupParent();
//可能为空
if (borderLayout != null) {
WCardMainBorderLayout border = borderLayout.toData();
WCardTitleLayout titleLayout = border.getTitlePart();
titleLayout.setCardName(cardLayoutName);
@ -442,6 +444,7 @@ public class XWCardLayout extends XLayoutContainer {
button.setCardLayoutName(cardLayoutName);
}
}
}
/**
* 删除相关组件

32
designer-form/src/main/java/com/fr/design/designer/properties/mobile/ButtonGroupPropertyUI.java

@ -0,0 +1,32 @@
package com.fr.design.designer.properties.mobile;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XFieldEditor;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.widget.ui.designer.mobile.ButtonGroupDefinePane;
public class ButtonGroupPropertyUI extends AbstractWidgetPropertyUIProvider {
private XCreator xCreator;
public ButtonGroupPropertyUI(XFieldEditor xButtonGroupEditor) {
this.xCreator = xButtonGroupEditor;
}
@Override
public AbstractPropertyTable createWidgetAttrTable() {
return null;
}
@Override
public BasicPane createWidgetAttrPane() {
return new ButtonGroupDefinePane(xCreator);
}
@Override
public String tableTitle() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr");
}
}

37
designer-form/src/main/java/com/fr/design/mainframe/FormArea.java

@ -2,12 +2,14 @@ package com.fr.design.mainframe;
import com.fr.base.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.FormAdaptiveConfigUIProcessor;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UINumberField;
@ -49,7 +51,6 @@ import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
public class FormArea extends JComponent implements ScrollRulerComponent {
private static final double SLIDER_FLOAT = 400.0;
private static final double SLIDER_MIN = 10.0;
public static final double DEFAULT_SLIDER = 100.0;
@ -76,6 +77,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
private int resolution = ScreenResolution.getScreenResolution();
private double screenValue;
public FormScrollBar getHorScrollBar() {
return horScrollBar;
}
@ -113,6 +115,13 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener);
}
private boolean openSliderZoom(){
FormAdaptiveConfigUIProcessor adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING);
if (adaptiveConfigUI != null) {
return adaptiveConfigUI.openFormSliderZoom();
}
return false;
}
public void onMobileAttrModified() {
FormMobileAttr formMobileAttr = designer.getTarget().getFormMobileAttr();
if (formMobileAttr.isMobileOnly()) {
@ -142,7 +151,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {f};
double[] columnSize = {p, f, p, p, p, p, p, f, p};
double[] columnSize = {p, f, p, p, p, p, p, p};
UILabel tipsPane = new UILabel("form");
tipsPane.setPreferredSize(new Dimension(200, 0));
widthPane = new UINumberField();
@ -150,18 +159,24 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
heightPane = new UINumberField();
heightPane.setPreferredSize(new Dimension(60, 0));
// slidePane = new UINumberSlidePane(SLIDER_MIN, SLIDER_FLOAT);
// slidePane.setPreferredSize(new Dimension(260,20));
slidePane = JFormSliderPane.getInstance();
slidePane.setPreferredSize(new Dimension(200, 20));
JPanel resizePane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{{ tipsPane, new UILabel(), widthPane, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel")), new UILabel("x"), heightPane, new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel")), new UILabel(), slidePane }}, rowSize, columnSize, RESIZE_PANE_GAP);
slidePane.setPreferredSize(new Dimension(375, 20));
JPanel resizePane = TableLayoutHelper.createCommonTableLayoutPane(
new JComponent[][]{{tipsPane, new UILabel(), widthPane,
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel")),
new UILabel("x"), heightPane,
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel")),
slidePane}}, rowSize, columnSize, RESIZE_PANE_GAP);
this.add(FormRulerLayout.BOTTOM, resizePane);
setWidgetsConfig();
boolean needOpenSliderZoom = openSliderZoom();
// 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小
slidePane.setEnabled(false);
slidePane.setVisible(false);
// initTransparent();
slidePane.setEnabled(needOpenSliderZoom);
slidePane.setVisible(needOpenSliderZoom);
if (needOpenSliderZoom) {
initTransparent();
}
initCalculateSize();
}
@ -770,7 +785,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
int scrollMax = orientation == 1 ? verticalMax : horicalMax;
//防止滚动条到达低端还可以继续点击移动(滚动条最大范围不变时,newValue要在范围之内)
if (oldmax == scrollMax + visi && newValue > scrollMax) {
return new Point(oldValue, oldmax);
return new Point(scrollMax, oldmax);
}
return new Point(newValue, max);
}

12
designer-form/src/main/java/com/fr/design/mainframe/FormParaWidgetPane.java

@ -34,6 +34,10 @@ import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.SwingConstants;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
@ -42,10 +46,6 @@ import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* @author null
@ -440,7 +440,9 @@ public class FormParaWidgetPane extends JPanel {
private WidgetOption[] loadChartOptions() {
if (chartOptions == null) {
chartOptions = DesignModuleFactory.getExtraWidgetOptions();
ExtraDesignClassManager instance = ExtraDesignClassManager.getInstance();
WidgetOption[] widgetOptions = ArrayUtils.addAll(instance.getBeforeChartWidgetOptions(), DesignModuleFactory.getExtraWidgetOptions());
chartOptions = ArrayUtils.addAll(widgetOptions, instance.getAfterChartWidgetOptions());
}
return chartOptions;
}

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

Loading…
Cancel
Save