Browse Source

Merge remote-tracking branch 'origin/release/10.0' into release/10.0

feature/big-screen
Yvan 4 years ago
parent
commit
57ce575c1e
  1. 2
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 5
      designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java
  3. 33
      designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java
  4. 7
      designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
  5. 7
      designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java
  6. 18
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTableModel.java
  7. 8
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  8. 108
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MultiTDTableDataPane.java
  9. 30
      designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java
  10. 9
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  11. 73
      designer-base/src/main/java/com/fr/design/formula/FormulaTextField.java
  12. 25
      designer-base/src/main/java/com/fr/design/formula/SortFormulaPane.java
  13. 554
      designer-base/src/main/java/com/fr/design/gui/frpane/UIBubbleFloatPane.java
  14. 7
      designer-base/src/main/java/com/fr/design/gui/itableeditorpane/UITableModelAdapter.java
  15. 45
      designer-base/src/main/java/com/fr/design/gui/itextfield/DictionaryTextField.java
  16. 2
      designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java
  17. 3
      designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java
  18. 128
      designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java
  19. 1032
      designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java
  20. 8
      designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java
  21. 4
      designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java
  22. 7
      designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java
  23. 5
      designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java
  24. 2
      designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateDialog.java
  25. 33
      designer-base/src/main/java/com/fr/design/update/push/DesignerUpdateInfo.java
  26. 8
      designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java
  27. 61
      designer-base/src/main/java/com/fr/design/utils/ParameterUtils.java
  28. 7
      designer-base/src/main/java/com/fr/env/CheckServiceDialog.java
  29. 38
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  30. 2
      designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.css
  31. 12
      designer-base/src/test/java/com/fr/design/mainframe/JFormSliderPaneTest.java
  32. 38
      designer-base/src/test/java/com/fr/design/utils/ParameterUtilsTest.java
  33. 7
      designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java
  34. 6
      designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java
  35. 10
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  36. 31
      designer-chart/src/main/java/com/fr/design/chart/auto/AutoTypeCalculate.java
  37. 121
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java
  38. 12
      designer-chart/src/main/java/com/fr/design/chartx/component/SeriesValueFieldComboBoxPane.java
  39. 69
      designer-chart/src/main/java/com/fr/design/chartx/data/DataLayoutHelper.java
  40. 15
      designer-chart/src/main/java/com/fr/design/chartx/data/map/AbstractAreaLngLatPane.java
  41. 1
      designer-chart/src/main/java/com/fr/design/chartx/data/map/MapChartDataPane.java
  42. 15
      designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java
  43. 15
      designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractDataSetFieldsPane.java
  44. 7
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java
  45. 2
      designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java
  46. 30
      designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java
  47. 22
      designer-chart/src/main/java/com/fr/design/chartx/single/SingleDataPane.java
  48. 8
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java
  49. 18
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java
  50. 20
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java
  51. 12
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java
  52. 15
      designer-chart/src/main/java/com/fr/van/chart/box/BoxIndependentVanChartInterface.java
  53. 4
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxPlotTooltipPane.java
  54. 93
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java
  55. 12
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipPane.java
  56. 4
      designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java
  57. 2
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java
  58. 16
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableResultDataSeriesPane.java
  59. 7
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableSeriesNameUseFieldValuePane.java
  60. 99
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableSeriesTypeUsePane.java
  61. 6
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/UIComboBoxWithEditLabel.java
  62. 16
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  63. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java
  64. 4
      designer-chart/src/main/java/com/fr/van/chart/designer/other/condition/item/VanChartLineMapTooltipConditionPane.java
  65. 89
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java
  66. 75
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java
  67. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java
  68. 16
      designer-chart/src/main/java/com/fr/van/chart/designer/style/datasheet/VanchartDataSheetNoCheckPane.java
  69. 12
      designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartTooltipPane.java
  70. 4
      designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java
  71. 2
      designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java
  72. 17
      designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java
  73. 3
      designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartBubblePointMapConditionPane.java
  74. 3
      designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartCommonPointMapConditionPane.java
  75. 3
      designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartDefaultPointMapConditionPane.java
  76. 3
      designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartImagePointMapConditionPane.java
  77. 2
      designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartLineMapConditionPane.java
  78. 2
      designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartMapConditionPane.java
  79. 36
      designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapPlotTooltipNoCheckPane.java
  80. 159
      designer-chart/src/main/java/com/fr/van/chart/range/component/LegendGradientBar.java
  81. 12
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/data/StructurePlotReportDataContentPane.java
  82. 16
      designer-chart/src/main/java/com/fr/van/chart/structure/desinger/data/StructurePlotTableDataContentPane.java
  83. BIN
      designer-chart/src/main/resources/com/fr/design/images/form/toolbar/box.png
  84. BIN
      designer-chart/src/main/resources/com/fr/van/chart/box.images/box.png
  85. 5
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
  86. 17
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java
  87. 15
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  88. 28
      designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java
  89. 4
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  90. 23
      designer-form/src/main/java/com/fr/design/designer/creator/XButton.java
  91. 9
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  92. 6
      designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java
  93. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XNumberEditor.java
  94. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java
  95. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XTextEditor.java
  96. 16
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  97. 56
      designer-form/src/main/java/com/fr/design/designer/creator/XWBorderLayout.java
  98. 94
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  99. 40
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardAddButton.java
  100. 32
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  101. Some files were not shown because too many files have changed in this diff Show More

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

@ -236,7 +236,7 @@ public class EnvChangeEntrance {
//说明版本一致,仅做日志记录 //说明版本一致,仅做日志记录
FineLoggerFactory.getLogger().info("Remote Designer version consistency"); FineLoggerFactory.getLogger().info("Remote Designer version consistency");
} else { } else {
localBranch = formatBranch(localBranch); localBranch = GeneralUtils.getVersion();
remoteBranch = formatBranch(remoteBranch); remoteBranch = formatBranch(remoteBranch);
Set<Class> noExistServiceSet = getNoExistServiceSet(connectionInfo); Set<Class> noExistServiceSet = getNoExistServiceSet(connectionInfo);
StringBuilder textBuilder = new StringBuilder(); StringBuilder textBuilder = new StringBuilder();

5
designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java

@ -15,6 +15,7 @@ import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
/* /*
@ -51,6 +52,10 @@ public class TableDataSourceAction extends TemplateComponentAction<JTemplate<?,
reportTableDataDialog.setDoOKSucceed(false); reportTableDataDialog.setDoOKSucceed(false);
return; return;
} }
Iterator<String> iterator = tds.getTableDataNameIterator();
while (iterator.hasNext()) {
DesignTableDataManager.removeSelectedColumnNames(iterator.next());
}
DesignModelAdapter.getCurrentModelAdapter().renameTableData(tableDataPane.getDsNameChangedMap()); DesignModelAdapter.getCurrentModelAdapter().renameTableData(tableDataPane.getDsNameChangedMap());
tableDataPane.update(tds); tableDataPane.update(tds);
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());

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

@ -11,8 +11,10 @@ import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.locale.InterProviderFactory;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
@ -36,14 +38,16 @@ public class AboutPane extends JPanel {
private static final String BUILD_PREFIX = " "; private static final String BUILD_PREFIX = " ";
private static final String COMPANY_TELEPHONE = CloudCenter.getInstance().acquireUrlByKind("help.compNo"); private static final String COMPANY_TELEPHONE = CloudCenter.getInstance().acquireUrlByKind("help.compNo");
private static final String PRESIDENT_PHONE = CloudCenter.getInstance().acquireUrlByKind("help.PNo"); private static final String PRESIDENT_PHONE = CloudCenter.getInstance().acquireUrlByKind("help.PNo");
private static final String LEFT_BRACKET = "(";
private static final String RIGHT_BRACKET = ")";
private int maxWidth; private int maxWidth;
public AboutPane() { public AboutPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.maxWidth = GraphHelper.getWidth(getBuildTitle() + GeneralUtils.readFullBuildNO() + this.maxWidth = GraphHelper.getWidth(getBuildTitle() + getVersionBuildNO() +
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy_Build_NO") + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy_Build_NO") +
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy_Build_NO_OK")); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy_Build_NO_OK"));
//center panel //center panel
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
@ -51,9 +55,10 @@ public class AboutPane extends JPanel {
JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel contentPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
centerPane.add(contentPane, BorderLayout.NORTH); centerPane.add(contentPane, BorderLayout.NORTH);
contentPane.add(new BoxCenterAligmentPane(getBuildTitle()));
BoxCenterAlignmentCopyablePane buildCopyPane = new BoxCenterAlignmentCopyablePane( BoxCenterAlignmentCopyablePane buildCopyPane = new BoxCenterAlignmentCopyablePane(
getBuildTitle(), StringUtils.EMPTY,
GeneralUtils.readFullBuildNO(), getVersionBuildNO(),
new String[]{ new String[]{
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy_Build_NO"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy_Build_NO"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy_Build_NO_OK") com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Copy_Build_NO_OK")
@ -95,6 +100,15 @@ public class AboutPane extends JPanel {
} }
} }
public String getVersionBuildNO() {
String version = GeneralUtils.getVersion();
String build = GeneralUtils.readFullBuildNO();
String notInstalledVersion = InterProviderFactory.getProvider().getLocText("Fine-Core_Basic_About_No_Build");
if (ComparatorUtils.equals(notInstalledVersion, build))
return notInstalledVersion;
return version + LEFT_BRACKET + build + RIGHT_BRACKET;
}
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(this.maxWidth, super.getPreferredSize().height); return new Dimension(this.maxWidth, super.getPreferredSize().height);
@ -191,7 +205,7 @@ public class AboutPane extends JPanel {
private String getBuildTitle() { private String getBuildTitle() {
return append(ProductConstants.APP_NAME, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_About_Version"), return append(ProductConstants.APP_NAME, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_About_Version"),
StringUtils.BLANK, ProductConstants.RELEASE_VERSION, BUILD_PREFIX); StringUtils.BLANK, ProductConstants.VERSION, BUILD_PREFIX);
} }
private JPanel getEmailActionPane(final String desc, final String mailTo) { private JPanel getEmailActionPane(final String desc, final String mailTo) {
@ -289,12 +303,13 @@ public class AboutPane extends JPanel {
public BoxCenterAlignmentCopyablePane(String title, String copyText, final String[] descriptions) { public BoxCenterAlignmentCopyablePane(String title, String copyText, final String[] descriptions) {
setLayout(FRGUIPaneFactory.createBorderLayout()); setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
this.label = new UILabel(title); if (StringUtils.isNotEmpty(title)) {
this.label = new UILabel(title);
centerPane.add(label);
}
this.textField = new UILabel(copyText); this.textField = new UILabel(copyText);
textField.setBackground(null); textField.setBackground(null);
textField.setBorder(null); textField.setBorder(null);
centerPane.add(label);
centerPane.add(textField); centerPane.add(textField);
textField.addMouseListener(new MouseAdapter() { textField.addMouseListener(new MouseAdapter() {
@Override @Override

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

@ -5,7 +5,6 @@ package com.fr.design.actions.server;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.config.Configuration;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
@ -18,12 +17,10 @@ import com.fr.design.gui.NameInspector;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.file.ProcedureConfig;
import com.fr.file.TableDataConfig; import com.fr.file.TableDataConfig;
import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker;
import com.fr.transaction.WorkerFacade; import com.fr.transaction.WorkerFacade;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
@ -95,6 +92,10 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
} }
DesignTableDataManager.clearGlobalDs(); DesignTableDataManager.clearGlobalDs();
// 保存时 移除服务器数据集列名缓存
for (String name : tableDataConfig.getTableDatas().keySet()) {
DesignTableDataManager.removeSelectedColumnNames(name);
}
Configurations.modify(new WorkerFacade(TableDataConfig.class) { Configurations.modify(new WorkerFacade(TableDataConfig.class) {
@Override @Override

7
designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java

@ -15,8 +15,9 @@ import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import java.awt.Dimension; import java.awt.Dimension;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map;
import java.util.LinkedHashMap;
@Open @Open
public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> { public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> {
@ -27,7 +28,7 @@ public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> {
protected LiteConditionPane liteConditionPane; protected LiteConditionPane liteConditionPane;
protected java.util.Map<Class, ConditionAttrSingleConditionPane> classPaneMap = new HashMap<Class, ConditionAttrSingleConditionPane>(); protected Map<Class, ConditionAttrSingleConditionPane> classPaneMap = new LinkedHashMap<>();
//可用的Actions. //可用的Actions.
protected java.util.List<UpdateAction> useAbleActionList = new java.util.ArrayList<UpdateAction>(); protected java.util.List<UpdateAction> useAbleActionList = new java.util.ArrayList<UpdateAction>();
@ -70,7 +71,7 @@ public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> {
selectedItemScrollPane.setMinimumSize(new Dimension((int) selectedItemScrollPane.getPreferredSize().getWidth(), MIN_HEIGHT)); selectedItemScrollPane.setMinimumSize(new Dimension((int) selectedItemScrollPane.getPreferredSize().getWidth(), MIN_HEIGHT));
propertyChangePane.add(selectedItemScrollPane); propertyChangePane.add(selectedItemScrollPane);
} }
public void updateBean(T ob) { public void updateBean(T ob) {
updateMenuDef(); updateMenuDef();
} }

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

@ -17,6 +17,10 @@ import javax.swing.table.AbstractTableModel;
* 这个TableModel主要是预览数据的. 字段TableData必须转化为内置的 * 这个TableModel主要是预览数据的. 字段TableData必须转化为内置的
*/ */
public class PreviewTableModel extends AbstractTableModel { public class PreviewTableModel extends AbstractTableModel {
private static final int LEN_LIMIT = 1000;
private static final String THREE_DOT = "...";
private DataModel dataModel; private DataModel dataModel;
private String erroMessage = null; private String erroMessage = null;
@ -127,11 +131,21 @@ public class PreviewTableModel extends AbstractTableModel {
public Object getValueAt(int row, int column) { public Object getValueAt(int row, int column) {
try { try {
return dataModel.getValueAt(row, column); Object value = dataModel.getValueAt(row, column);
if (value != null) {
String strValue = value.toString();
// 字符长度过长 swing会卡住一会
// 同时设计器内预览展示也不需要展示太长的字符
if (strValue.length() > LEN_LIMIT) {
strValue = strValue.substring(0, LEN_LIMIT) + THREE_DOT;
return strValue;
}
}
return value;
} catch (TableDataException e) { } catch (TableDataException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
DesignUtils.errorMessage(e.getMessage()); DesignUtils.errorMessage(e.getMessage());
return ""; return StringUtils.EMPTY;
} }
} }

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

@ -29,10 +29,10 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane; import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.ParameterUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.sql.SqlUtils; import com.fr.general.sql.SqlUtils;
@ -219,8 +219,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
paramTexts[1] = SqlUtils.tryPureSqlText(pageQuery); paramTexts[1] = SqlUtils.tryPureSqlText(pageQuery);
List<ParameterProvider> existParameterList = editorPane.update(); List<ParameterProvider> existParameterList = editorPane.update();
Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[existParameterList.size()]); Parameter[] ps = existParameterList == null ? new Parameter[0] : existParameterList.toArray(new Parameter[existParameterList.size()]);
editorPane.populate(ParameterUtils.analyzeAndUnionParameters(paramTexts, ps));
editorPane.populate(ParameterHelper.analyzeAndUnionSameParameters(paramTexts, ps));
} }
private JToolBar createToolBar() { private JToolBar createToolBar() {
@ -316,7 +315,8 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
// com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + "."); // com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") + ".");
} }
} }
// 保存前 刷新下参数列表 保证获取到最新的参数
refresh();
List<ParameterProvider> parameterList = editorPane.update(); List<ParameterProvider> parameterList = editorPane.update();
Parameter[] parameters = parameterList.toArray(new Parameter[parameterList.size()]); Parameter[] parameters = parameterList.toArray(new Parameter[parameterList.size()]);

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

@ -19,6 +19,7 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -95,9 +96,8 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
centerPanel.setLayout(new GridLayout(len < MIN_BAR_NUMBER ? MIN_BAR_NUMBER : len + 1, 1)); centerPanel.setLayout(new GridLayout(len < MIN_BAR_NUMBER ? MIN_BAR_NUMBER : len + 1, 1));
centerPanel.add(headLabel); centerPanel.add(headLabel);
Iterator<Entry<String, TableDataWrapper>> entryIt = resMap.entrySet().iterator(); for (Entry<String, TableDataWrapper> stringTableDataWrapperEntry : resMap.entrySet()) {
while (entryIt.hasNext()) { TableDataWrapper tableDataWrappe = stringTableDataWrapperEntry.getValue();
TableDataWrapper tableDataWrappe = entryIt.next().getValue();
String tmp = tableDataWrappe.getTableDataName(); String tmp = tableDataWrappe.getTableDataName();
if (!ComparatorUtils.equals(tableDataWrappe.getTableDataName(), multiName)) { if (!ComparatorUtils.equals(tableDataWrappe.getTableDataName(), multiName)) {
centerPanel.add(new BarPanel(tmp, tableDataWrappe.getIcon())); centerPanel.add(new BarPanel(tmp, tableDataWrappe.getIcon()));
@ -111,13 +111,10 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
} }
private ActionListener getPreviewActionListener() { private ActionListener getPreviewActionListener() {
return new ActionListener() { return e -> {
MultiTDTableData td = MultiTDTableDataPane.this.updateBean();
public void actionPerformed(ActionEvent e) { td.setTableDataSource(DesignTableDataManager.getEditingTableDataSource());
MultiTDTableData td = MultiTDTableDataPane.this.updateBean(); new TemplateTableDataWrapper(td).previewData();
td.setTableDataSource(DesignTableDataManager.getEditingTableDataSource());
new TemplateTableDataWrapper(td).previewData();
}
}; };
} }
@ -126,12 +123,12 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
jpanel.setPreferredSize(new Dimension(-1, 150)); jpanel.setPreferredSize(new Dimension(-1, 150));
jpanel.setLayout(new BorderLayout()); jpanel.setLayout(new BorderLayout());
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel() { editorPane = new UITableEditorPane<>(new ParameterTableModel() {
@Override @Override
public UITableEditAction[] createAction() { public UITableEditAction[] createAction() {
return new UITableEditAction[]{new RefreshAction()}; return new UITableEditAction[]{new RefreshAction()};
} }
}, " " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Default_Parameter")); }, StringUtils.BLANK + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Default_Parameter"));
jpanel.add(editorPane, BorderLayout.CENTER); jpanel.add(editorPane, BorderLayout.CENTER);
@ -162,29 +159,32 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
paramTexts[i] = (String) object[i]; paramTexts[i] = (String) object[i];
} }
List<ParameterProvider> existParameterList = new ArrayList<ParameterProvider>(); List<ParameterProvider> existParameterList = new ArrayList<>();
Iterator<Entry<String, String>> dataItera = choosenTableData.entrySet().iterator(); List<String> parameterName = new ArrayList<>();
List<String> parameterName = new ArrayList<String>(); for (Entry<String, String> entry : choosenTableData.entrySet()) {
while (dataItera.hasNext()) { TableData td = resMap.get(entry.getKey()).getTableData();
Entry<String, String> entry = dataItera.next(); ParameterProvider[] currentParameters = td.getParameters(Calculator.createCalculator());
TableData td = resMap.get(entry.getKey()).getTableData(); for (ParameterProvider currentParameter : currentParameters) {
ParameterProvider[] currentparameters = td.getParameters(Calculator.createCalculator()); if (parameterName.contains(currentParameter.getName())) {
for (int i=0; i<currentparameters.length; i++){ continue;
if (parameterName.contains(currentparameters[i].getName())){ }
continue; parameterName.add(currentParameter.getName());
} try {
parameterName.add(currentparameters[i].getName()); //采用给新的界面刷新参数时,clone一个值过去,不然会出现联动修改
existParameterList.add(currentparameters[i]); existParameterList.add((ParameterProvider) currentParameter.clone());
} } catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
} }
ParameterProvider[] texts = ParameterHelper.analyze4Parameters(paramTexts, true); ParameterProvider[] texts = ParameterHelper.analyze4Parameters(paramTexts, true);
for (int i=0; i<texts.length; i++) { for (ParameterProvider text : texts) {
if (parameterName.contains(texts[i].getName())){ if (parameterName.contains(text.getName())) {
continue; continue;
} }
existParameterList.add(texts[i]); existParameterList.add(text);
} }
Parameter[] ps = existParameterList.toArray(new Parameter[existParameterList.size()]); ParameterProvider[] ps = existParameterList.toArray(new ParameterProvider[0]);
editorPane.populate(ps); editorPane.populate(ps);
existParameterList.clear(); existParameterList.clear();
parameterName.clear(); parameterName.clear();
@ -217,7 +217,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
String name; String name;
for (int i = 0; i < ob.getTableDataCount(); i++) { for (int i = 0; i < ob.getTableDataCount(); i++) {
name = ob.getTableDataName(i); name = ob.getTableDataName(i);
choosenTableData.put(name, ""); choosenTableData.put(name, StringUtils.EMPTY);
} }
} }
} }
@ -236,15 +236,13 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
@Override @Override
public MultiTDTableData updateBean() { public MultiTDTableData updateBean() {
ConditionTableData td = new ConditionTableData(); ConditionTableData td = new ConditionTableData();
Iterator<Entry<String, String>> it = choosenTableData.entrySet().iterator(); for (Entry<String, String> entry : choosenTableData.entrySet()) {
while (it.hasNext()) {
Entry<String, String> entry = it.next();
td.addTableData(entry.getKey(), entry.getValue()); td.addTableData(entry.getKey(), entry.getValue());
} }
List<ParameterProvider> paramList = editorPane.update(); List<ParameterProvider> paramList = editorPane.update();
if (paramList != null) { if (paramList != null) {
td.setDefineParameters(paramList.toArray(new Parameter[paramList.size()])); td.setDefineParameters(paramList.toArray(new Parameter[0]));
} }
return td; return td;
@ -348,9 +346,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
chekbox.setSelected(false); chekbox.setSelected(false);
formulaContentTextField.setEnabled(false); formulaContentTextField.setEnabled(false);
formulaButton.setEnabled(false); formulaButton.setEnabled(false);
if (choosenTableData.containsKey(name)) { choosenTableData.remove(name);
choosenTableData.remove(name);
}
} else { } else {
formulaButton.setEnabled(true); formulaButton.setEnabled(true);
formulaContentTextField.setEnabled(true); formulaContentTextField.setEnabled(true);
@ -372,9 +368,7 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
} else { } else {
formulaButton.setEnabled(false); formulaButton.setEnabled(false);
formulaContentTextField.setEnabled(false); formulaContentTextField.setEnabled(false);
if (choosenTableData.containsKey(name)) { choosenTableData.remove(name);
choosenTableData.remove(name);
}
} }
} }
@ -388,22 +382,20 @@ public class MultiTDTableDataPane extends AbstractTableDataPane<MultiTDTableData
} }
private ActionListener getFormulaActionListener() { private ActionListener getFormulaActionListener() {
return new ActionListener() { return e -> {
public void actionPerformed(ActionEvent e) { final UIFormula formulaPane = FormulaFactory.createFormulaPane();
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); formulaPane.populate(BaseFormula.createFormulaBuilder().build(formulaContentTextField.getText()));
formulaPane.populate(BaseFormula.createFormulaBuilder().build(formulaContentTextField.getText())); formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(MultiTDTableDataPane.this), new DialogActionAdapter() {
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(MultiTDTableDataPane.this), new DialogActionAdapter() { public void doOk() {
public void doOk() { BaseFormula formula = formulaPane.update();
BaseFormula formula = formulaPane.update(); if (formula == null) {
if (formula == null) { formulaContentTextField.setText(StringUtils.EMPTY);
formulaContentTextField.setText(""); } else {
} else { formulaContentTextField.setText(formula.getContent().substring(1));
formulaContentTextField.setText(formula.getContent().substring(1));
}
MultiTDTableDataPane.this.refresh();
} }
}).setVisible(true); MultiTDTableDataPane.this.refresh();
} }
}).setVisible(true);
}; };
} }
} }

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

@ -24,11 +24,11 @@ public class RemoteWorkspace implements Workspace {
private final WorkspaceClient client; private final WorkspaceClient client;
private final String address; private final String address;
private final WorkspaceConnectionInfo connection; private final WorkspaceConnectionInfo connection;
private volatile Boolean isRoot = null; private volatile Boolean isRoot = null;
RemoteWorkspace(WorkspaceClient client, WorkspaceConnectionInfo connection) { RemoteWorkspace(WorkspaceClient client, WorkspaceConnectionInfo connection) {
this.client = client; this.client = client;
@ -41,13 +41,13 @@ public class RemoteWorkspace implements Workspace {
return address; return address;
} }
@Override @Override
public String getDescription() { public String getDescription() {
return Toolkit.i18nText("Fine-Design_Basic_Remote_Env"); return Toolkit.i18nText("Fine-Design_Basic_Remote_Env");
} }
@Override @Override
public boolean isWarDeploy() { public boolean isWarDeploy() {
return WorkContext.getCurrent().get(CommonOperator.class, new ExceptionHandler<Boolean>() { return WorkContext.getCurrent().get(CommonOperator.class, new ExceptionHandler<Boolean>() {
@ -66,7 +66,7 @@ public class RemoteWorkspace implements Workspace {
@Override @Override
public boolean isRoot() { public boolean isRoot() {
if (isRoot == null) { if (isRoot == null) {
synchronized (this) { synchronized (this) {
if (isRoot == null) { if (isRoot == null) {
@ -89,10 +89,10 @@ public class RemoteWorkspace implements Workspace {
@Override @Override
public WorkspaceConnection getConnection() { public WorkspaceConnection getConnection() {
return client.getConnection(); return client.getConnection();
} }
@Override @Override
public <T> T get(Class<T> type) { public <T> T get(Class<T> type) {
@ -111,22 +111,22 @@ public class RemoteWorkspace implements Workspace {
} }
return client.getPool().get(type); return client.getPool().get(type);
} }
@Override @Override
public void close() { public void close() {
client.close(); client.close();
} }
@Override @Override
public int hashCode() { public int hashCode() {
return connection.hashCode(); return connection.hashCode();
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return obj instanceof RemoteWorkspace && AssistUtils.equals(((RemoteWorkspace) obj).connection, this.connection); return obj instanceof RemoteWorkspace && AssistUtils.equals(((RemoteWorkspace) obj).connection, this.connection);
} }

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

@ -370,6 +370,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
*/ */
public void load() { public void load() {
FineLoggerFactory.getLogger().info("Env Change Template Loading..."); FineLoggerFactory.getLogger().info("Env Change Template Loading...");
JTemplate currentTemplate = null;
if (stashFILEMap != null && stashFILEMap.size() != 0) { if (stashFILEMap != null && stashFILEMap.size() != 0) {
int size = historyList.size(); int size = historyList.size();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
@ -385,20 +386,24 @@ public class HistoryTemplateListCache implements CallbackEvent {
historyList.set(i, template); historyList.set(i, template);
// 替换当前正在编辑的模板,使用添加并激活的方式,以便使用统一的入口来处理监听事件 // 替换当前正在编辑的模板,使用添加并激活的方式,以便使用统一的入口来处理监听事件
if (isCurrentEditingFile(template.getPath())) { if (isCurrentEditingFile(template.getPath())) {
loadCurrentTemplate(template); currentTemplate = template;
} }
} else { } else {
// 当模板为空时 说明是一个新建的未保存模板 但是内存中保存了该模板 可以从中获取 // 当模板为空时 说明是一个新建的未保存模板 但是内存中保存了该模板 可以从中获取
JTemplate jt = historyList.get(i); JTemplate jt = historyList.get(i);
// 另外如果该模板是正在编辑的模板,需要要激活 // 另外如果该模板是正在编辑的模板,需要要激活
if (jt != null && isCurrentEditingFile(jt.getPath())) { if (jt != null && isCurrentEditingFile(jt.getPath())) {
loadCurrentTemplate(jt); currentTemplate = jt;
} }
} }
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
// 最后加载当前正在编辑的模板 以保证数据集刷新正常
if (currentTemplate != null) {
loadCurrentTemplate(currentTemplate);
}
stashFILEMap.clear(); stashFILEMap.clear();
MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList); MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList);
MutilTempalteTabPane.getInstance().repaint(); MutilTempalteTabPane.getInstance().repaint();

73
designer-base/src/main/java/com/fr/design/formula/FormulaTextField.java

@ -1,73 +0,0 @@
package com.fr.design.formula;
import com.fr.base.BaseFormula;
import com.fr.design.gui.itextfield.DictionaryTextField;
import com.fr.stable.StringUtils;
import javax.swing.text.Document;
/**
* 公式展示时使用
* 展示 String.
* 但实际保存的是 BaseFormula
* 从而保留公式的形态
*
* created by Harrison on 2020/08/03
**/
public class FormulaTextField extends DictionaryTextField<BaseFormula> {
private static final BaseFormula EMPTY_FORMULA = BaseFormula.createFormulaBuilder().build("=");
public FormulaTextField() {
}
public FormulaTextField(int columns) {
super(columns);
}
public FormulaTextField(String text, int columns, BaseFormula value) {
super(text, columns, value);
}
public FormulaTextField(String text, BaseFormula value) {
super(text, value);
}
public FormulaTextField(Document doc, String text, int columns, BaseFormula value) {
super(doc, text, columns, value);
}
@Override
public BaseFormula getValue() {
if (this.value == null) {
this.value = createDefault();
}
return this.value;
}
/**
* 设置值时会将展示的公式值一同设置进去
*
* @param value 公式值
*/
@Override
public void setValue(BaseFormula value) {
this.value = value;
if (this.value == null) {
this.value = createDefault();
}
setText(this.value.getPureContent());
}
private BaseFormula createDefault() {
String text = getText();
if (StringUtils.isNotEmpty(text)) {
return BaseFormula.createFormulaBuilder().build(text);
} else {
return EMPTY_FORMULA;
}
}
}

25
designer-base/src/main/java/com/fr/design/formula/SortFormulaPane.java

@ -7,13 +7,12 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.SortOrderComboBox; import com.fr.design.gui.icombobox.SortOrderComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.*;
import javax.swing.SwingUtilities; import java.awt.*;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -21,7 +20,7 @@ public abstract class SortFormulaPane extends JPanel {
protected static final String InsetText = " "; protected static final String InsetText = " ";
protected SortOrderComboBox sortOrderComboBox; protected SortOrderComboBox sortOrderComboBox;
protected FormulaTextField sortFormulaTextField; protected UITextField sortFormulaTextField;
// 屏蔽掉“自定义比较规则”和“选择”按钮,只显示公式输入文本和公式按钮 // 屏蔽掉“自定义比较规则”和“选择”按钮,只显示公式输入文本和公式按钮
protected UIButton sortFormulaTextFieldButton; protected UIButton sortFormulaTextFieldButton;
@ -36,7 +35,7 @@ public abstract class SortFormulaPane extends JPanel {
} }
}); });
sortFormulaTextField = new FormulaTextField(16); sortFormulaTextField = new UITextField(16);
//Lance:添加一公式编辑器按钮 //Lance:添加一公式编辑器按钮
sortFormulaTextFieldButton = new UIButton("..."); sortFormulaTextFieldButton = new UIButton("...");
sortFormulaTextFieldButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula") + "..."); sortFormulaTextFieldButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula") + "...");
@ -56,15 +55,17 @@ public abstract class SortFormulaPane extends JPanel {
public abstract void formulaAction(); public abstract void formulaAction();
public void showFormulaDialog(String[] displayNames) { public void showFormulaDialog(String[] displayNames) {
BaseFormula value = sortFormulaTextField.getValue(); String text = sortFormulaTextField.getText();
final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula();
formulaPane.populate(value, new CustomVariableResolver(displayNames, true)); formulaPane.populate(BaseFormula.createFormulaBuilder().build(text), new CustomVariableResolver(displayNames, true));
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(SortFormulaPane.this), formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(SortFormulaPane.this),
new DialogActionAdapter() { new DialogActionAdapter() {
public void doOk() { public void doOk() {
BaseFormula fm = formulaPane.update(); BaseFormula fm = formulaPane.update();
if (fm != null) { if (fm.getContent().length() <= 1) {
sortFormulaTextField.setValue(fm); sortFormulaTextField.setText("");
} else {
sortFormulaTextField.setText(fm.getContent().substring(1));
} }
} }
}).setVisible(true); }).setVisible(true);

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

@ -9,14 +9,17 @@ import com.fr.stable.Constants;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import java.awt.AWTEvent; import java.awt.AWTEvent;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component;
import java.awt.Dialog; import java.awt.Dialog;
import java.awt.Frame; import java.awt.Frame;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Point; import java.awt.Point;
import java.awt.Polygon; import java.awt.Polygon;
import java.awt.Rectangle; import java.awt.Rectangle;
@ -29,303 +32,312 @@ import java.awt.event.MouseEvent;
/** /**
* @author Jerry * @author Jerry
* 非模态悬浮对话框气泡形状 * 非模态悬浮对话框气泡形状
*/ */
public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> { public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> {
private static final long serialVersionUID = -6386018511442190959L; private static final long serialVersionUID = -6386018511442190959L;
private static int OFF_LEFT = 10; private static int OFF_LEFT = 10;
private static final int ARROR_PARALLEL = 30; private static final int ARROR_PARALLEL = 30;
private static final int ARROR_VERTICAL = 20; private static final int ARROR_VERTICAL = 20;
private static final int TITLE_HEIGHT = 60; private static final int TITLE_HEIGHT = 60;
private static final double TIME_DEFAULT = 0.5; private static final double TIME_DEFAULT = 0.5;
private static final double TIME_GAP = 0.1; private static final double TIME_GAP = 0.1;
private BasicBeanPane<T> contentPane; private BasicBeanPane<T> contentPane;
private Rectangle bounds; private Rectangle bounds;
private int arrowPosition; private int arrowPosition;
private double time = 0.5; private double time = 0.5;
private UIDialog showDialog; private UIDialog showDialog;
/** /**
* @param arrowPosition 箭头的位置上下左右暂时只处理了左边后面用到了再说 TODO * @param arrowPosition 箭头的位置上下左右暂时只处理了左边后面用到了再说 TODO
* @param arrowPoint 箭头的坐标点 * @param arrowPoint 箭头的坐标点
* @param contentPane 对话框中的Panel * @param contentPane 对话框中的Panel
*/ */
public UIBubbleFloatPane(int arrowPosition, Point arrowPoint, BasicBeanPane<T> contentPane) { public UIBubbleFloatPane(int arrowPosition, Point arrowPoint, BasicBeanPane<T> contentPane) {
this(arrowPosition, arrowPoint, contentPane, contentPane.getPreferredSize().width, contentPane.getPreferredSize().height); this(arrowPosition, arrowPoint, contentPane, contentPane.getPreferredSize().width, contentPane.getPreferredSize().height);
} }
/** /**
* 这个方法主要用于那些宽度和高度有变化的面板因为显然外面的气泡要固定大小不然忽大忽小体验太差了 * 这个方法主要用于那些宽度和高度有变化的面板因为显然外面的气泡要固定大小不然忽大忽小体验太差了
* *
* @param arrowPosition 箭头的位置上下左右暂时只处理了左边后面用到了再说 TODO * @param arrowPosition 箭头的位置上下左右暂时只处理了左边后面用到了再说 TODO
* @param arrowPoint 箭头的坐标点 * @param arrowPoint 箭头的坐标点
* @param contentPane 对话框中的Panel * @param contentPane 对话框中的Panel
* @param width 对话框中的Panel的宽度写死了 * @param width 对话框中的Panel的宽度写死了
* @param height 对话框中的Panel的高度写死了 * @param height 对话框中的Panel的高度写死了
*/ */
public UIBubbleFloatPane(int arrowPosition, Point arrowPoint, BasicBeanPane<T> contentPane, int width, int height) { public UIBubbleFloatPane(int arrowPosition, Point arrowPoint, BasicBeanPane<T> contentPane, int width, int height) {
this.contentPane = contentPane; this.contentPane = contentPane;
this.arrowPosition = arrowPosition; this.arrowPosition = arrowPosition;
this.time = initBoundsTime(arrowPosition, arrowPoint, width, height); this.time = initBoundsTime(arrowPosition, arrowPoint, width, height);
if (arrowPosition == Constants.LEFT) { if (arrowPosition == Constants.LEFT) {
this.bounds = new Rectangle(arrowPoint.x - width, (int) (arrowPoint.y - height * time), width, height); this.bounds = new Rectangle(arrowPoint.x - width, (int) (arrowPoint.y - height * time), width, height);
} else if (arrowPosition == Constants.TOP) { } else if (arrowPosition == Constants.TOP) {
this.bounds = new Rectangle((int) (arrowPoint.x - width * time), arrowPoint.y , width, height); this.bounds = new Rectangle((int) (arrowPoint.x - width * time), arrowPoint.y, width, height);
} else if (arrowPosition == Constants.RIGHT) { } else if (arrowPosition == Constants.RIGHT) {
this.bounds = new Rectangle(arrowPoint.x - OFF_LEFT * 2 - width, (int) (arrowPoint.y - height * time), width, height); this.bounds = new Rectangle(arrowPoint.x - OFF_LEFT * 2 - width, (int) (arrowPoint.y - height * time), width, height);
} }
initComponents(); initComponents();
} }
/** /**
* show对话框 * show对话框
*
* @param fatherPane 上一层界面 parentPane * @param fatherPane 上一层界面 parentPane
* @param ob 传入的内容在show之前populate * @param ob 传入的内容在show之前populate
*/ */
public void show(JComponent fatherPane, T ob) { public void show(JComponent fatherPane, T ob) {
populateBean(ob); populateBean(ob);
UIDialog dialog = showUnsizedWindow(SwingUtilities.getWindowAncestor(fatherPane)); if (showDialog == null) {
showDialog = dialog; showDialog = showUnsizedWindow(SwingUtilities.getWindowAncestor(fatherPane));
Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); }
dialog.setVisible(true); Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK);
} showDialog.setVisible(true);
}
/**
* 数据展现 /**
*/ * 数据展现
public void populateBean(T ob) { */
contentPane.populateBean(ob); public void populateBean(T ob) {
} contentPane.populateBean(ob);
}
/**
* 停止编辑, 更新至最新的面板到属性保存 /**
*/ * 停止编辑, 更新至最新的面板到属性保存
public T updateBean() { */
updateContentPane(); public T updateBean() {
return contentPane.updateBean(); updateContentPane();
} return contentPane.updateBean();
}
/**
* 需要实现更新内容将updateBean传值给对象即可在窗口消失的时候会被调用 /**
*/ * 需要实现更新内容将updateBean传值给对象即可在窗口消失的时候会被调用
protected abstract void updateContentPane(); */
protected abstract void updateContentPane();
/**
* 以对话框的形式弹出 /**
* * 以对话框的形式弹出
* @param window 窗口 *
* @return 对话框 * @param window 窗口
*/ * @return 对话框
public UIDialog showUnsizedWindow(Window window) { */
CustomShapedDialog dg = null; public UIDialog showUnsizedWindow(Window window) {
if (window instanceof Frame) { CustomShapedDialog dg = null;
dg = new CustomShapedDialog((Frame) window); if (window instanceof Frame) {
} else { dg = new CustomShapedDialog((Frame) window);
dg = new CustomShapedDialog((Dialog) window); } else {
} dg = new CustomShapedDialog((Dialog) window);
if (arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) { }
dg.setSize(bounds.width + ARROR_PARALLEL, bounds.height + ARROR_VERTICAL); if (arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) {
} else { dg.setSize(bounds.width + ARROR_PARALLEL, bounds.height + ARROR_VERTICAL);
dg.setSize(bounds.width + ARROR_VERTICAL, bounds.height + ARROR_PARALLEL); } else {
} dg.setSize(bounds.width + ARROR_VERTICAL, bounds.height + ARROR_PARALLEL);
}
dg.setLocation(bounds.x, bounds.y);
dg.setBackground(Color.blue); dg.setLocation(bounds.x, bounds.y);
dg.setResizable(false); dg.setBackground(Color.blue);
return dg; dg.setResizable(false);
} return dg;
}
@Override
protected String title4PopupWindow() { @Override
return null; protected String title4PopupWindow() {
} return null;
}
private double initBoundsTime(int arrowPosition, Point arrowPoint, int width, int height) {
int x = arrowPoint.x; private double initBoundsTime(int arrowPosition, Point arrowPoint, int width, int height) {
int y = arrowPoint.y; int x = arrowPoint.x;
int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width; int y = arrowPoint.y;
int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height - TITLE_HEIGHT; int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width;
double time = TIME_DEFAULT; int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height - TITLE_HEIGHT;
double time = TIME_DEFAULT;
if (arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) {
while (y + time * height > screenHeight && time > 0) { if (arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) {
time -= TIME_GAP; while (y + time * height > screenHeight && time > 0) {
} time -= TIME_GAP;
}
while (y - (1 - time) * height < 0 && time < 1) {
time += TIME_GAP; while (y - (1 - time) * height < 0 && time < 1) {
} time += TIME_GAP;
} else if (arrowPosition == Constants.TOP) { }
while (x + time * width > screenWidth && time > 0) { } else if (arrowPosition == Constants.TOP) {
time -= TIME_GAP; while (x + time * width > screenWidth && time > 0) {
} time -= TIME_GAP;
}
while (x - (1 - time) * width < 0 && time < 1) {
time += TIME_GAP; while (x - (1 - time) * width < 0 && time < 1) {
} time += TIME_GAP;
} }
return 1 - time; }
} return 1 - time;
}
private AWTEventListener awt = new AWTEventListener() {
public void eventDispatched(AWTEvent event) { private AWTEventListener awt = new AWTEventListener() {
doSomeInAll(event); public void eventDispatched(AWTEvent event) {
} doSomeInAll(event);
}; }
};
private void doSomeInAll(AWTEvent event) {
if (event instanceof MouseEvent) { private void doSomeInAll(AWTEvent event) {
MouseEvent mv = (MouseEvent) event; if (event instanceof MouseEvent) {
if (mv.getClickCount() > 0) { MouseEvent mv = (MouseEvent) event;
Point point = new Point((int) (mv.getLocationOnScreen().getX()) - 2 * OFF_LEFT, (int) mv.getLocationOnScreen().getY()); if (mv.getClickCount() > 0) {
// 判断鼠标点击是否在边界内 Point point = new Point((int) (mv.getLocationOnScreen().getX()) - 2 * OFF_LEFT, (int) mv.getLocationOnScreen().getY());
if (!containsPoint(point) && showDialog != null) { // 判断鼠标点击是否在边界内
updateContentPane(); if (!containsPoint(point) && showDialog != null) {
showDialog.setVisible(false); updateContentPane();
Toolkit.getDefaultToolkit().removeAWTEventListener(awt); showDialog.setVisible(false);
} Toolkit.getDefaultToolkit().removeAWTEventListener(awt);
} }
} }
} }
}
private boolean containsPoint(Point point) { private boolean containsPoint(Point point) {
if(arrowPosition == Constants.TOP){ if (arrowPosition == Constants.TOP) {
//箭头和按钮也算在pane内 //箭头和按钮也算在pane内
Rectangle judgedBounds = new Rectangle(bounds.x, bounds.y - OFF_LEFT * 2, bounds.width, bounds.height + OFF_LEFT * 2 + OFF_LEFT); Rectangle judgedBounds = new Rectangle(bounds.x, bounds.y - OFF_LEFT * 2, bounds.width, bounds.height + OFF_LEFT * 2 + OFF_LEFT);
return judgedBounds.contains(point); return judgedBounds.contains(point);
} }
return bounds.contains(point); return bounds.contains(point);
} }
private void initComponents() { private void initComponents() {
if(arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) { if (arrowPosition == Constants.LEFT || arrowPosition == Constants.RIGHT) {
this.setBounds(20, 10, bounds.width, bounds.height); this.setBounds(20, 10, bounds.width, bounds.height);
} else { } else {
this.setBounds(10, 10, bounds.width, bounds.height); this.setBounds(10, 10, bounds.width, bounds.height);
} }
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(contentPane, BorderLayout.CENTER); this.add(contentPane, BorderLayout.CENTER);
} }
private class CustomShapedDialog extends UIDialog { private class CustomShapedDialog extends UIDialog {
private static final int GAP_SMALL = 10; private static final int GAP_SMALL = 10;
private static final int GAP = 20; private static final int GAP = 20;
private static final int GAP_BIG = 30; private static final int GAP_BIG = 30;
public CustomShapedDialog(Frame parent) { public CustomShapedDialog(Frame parent) {
super(parent); super(parent);
this.initComponents(); this.initComponents();
} }
public CustomShapedDialog(Dialog parent) { public CustomShapedDialog(Dialog parent) {
super(parent); super(parent);
this.initComponents(); this.initComponents();
} }
private Shape getCustomShap() { private Shape getCustomShap() {
Polygon polygon = new Polygon(); Polygon polygon = new Polygon();
if (arrowPosition == Constants.LEFT) { if (arrowPosition == Constants.LEFT) {
polygon.addPoint(GAP_SMALL, 0); polygon.addPoint(GAP_SMALL, 0);
polygon.addPoint(bounds.width + GAP_BIG, 0); polygon.addPoint(bounds.width + GAP_BIG, 0);
polygon.addPoint(bounds.width + GAP_BIG, bounds.height + GAP); polygon.addPoint(bounds.width + GAP_BIG, bounds.height + GAP);
polygon.addPoint(GAP_SMALL, bounds.height + GAP); polygon.addPoint(GAP_SMALL, bounds.height + GAP);
polygon.addPoint(GAP_SMALL, (int) ((bounds.height + GAP) * time) - GAP_SMALL); polygon.addPoint(GAP_SMALL, (int) ((bounds.height + GAP) * time) - GAP_SMALL);
polygon.addPoint(0, (int) ((bounds.height + GAP) * time - GAP)); polygon.addPoint(0, (int) ((bounds.height + GAP) * time - GAP));
polygon.addPoint(GAP_SMALL, (int) ((bounds.height + GAP) * time - GAP_BIG)); polygon.addPoint(GAP_SMALL, (int) ((bounds.height + GAP) * time - GAP_BIG));
polygon.addPoint(GAP_SMALL, 0); polygon.addPoint(GAP_SMALL, 0);
} else if (arrowPosition == Constants.TOP) { } else if (arrowPosition == Constants.TOP) {
polygon.addPoint(0, GAP_SMALL); polygon.addPoint(0, GAP_SMALL - 2);
polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL); polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL - 2);
polygon.addPoint((int) (bounds.width * time + GAP), 0); polygon.addPoint((int) (bounds.width * time + GAP), 0);
polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL); polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL - 2);
polygon.addPoint(bounds.width + GAP, GAP_SMALL); polygon.addPoint(bounds.width + GAP, GAP_SMALL - 2);
polygon.addPoint(bounds.width + GAP, bounds.height + GAP_BIG); polygon.addPoint(bounds.width + GAP, bounds.height + GAP_BIG);
polygon.addPoint(0, bounds.height + GAP_BIG); polygon.addPoint(0, bounds.height + GAP_BIG);
polygon.addPoint(0, GAP_SMALL); polygon.addPoint(0, GAP_SMALL - 2);
} else if (arrowPosition == Constants.RIGHT) { } else if (arrowPosition == Constants.RIGHT) {
polygon.addPoint(0, 0); polygon.addPoint(0, 0);
polygon.addPoint(bounds.width + GAP, 0); polygon.addPoint(bounds.width + GAP, 0);
polygon.addPoint(bounds.width + GAP, (int) ((bounds.height + GAP) * time) - GAP_BIG); polygon.addPoint(bounds.width + GAP, (int) ((bounds.height + GAP) * time) - GAP_BIG);
polygon.addPoint(bounds.width + GAP_BIG, (int) ((bounds.height + GAP) * time) - GAP); polygon.addPoint(bounds.width + GAP_BIG, (int) ((bounds.height + GAP) * time) - GAP);
polygon.addPoint(bounds.width + GAP, (int) ((bounds.height + GAP) * time) - GAP_SMALL); polygon.addPoint(bounds.width + GAP, (int) ((bounds.height + GAP) * time) - GAP_SMALL);
polygon.addPoint(bounds.width + GAP, bounds.height + GAP); polygon.addPoint(bounds.width + GAP, bounds.height + GAP);
polygon.addPoint(0, bounds.height + GAP); polygon.addPoint(0, bounds.height + GAP);
polygon.addPoint(0, 0); polygon.addPoint(0, 0);
} }
return polygon; return polygon;
} }
private Shape getShape4Board() { private Shape getShape4Board() {
Polygon polygon = new Polygon(); Polygon polygon = new Polygon();
if (arrowPosition == Constants.LEFT) { if (arrowPosition == Constants.LEFT) {
polygon.addPoint(GAP_SMALL, 1); polygon.addPoint(GAP_SMALL, 1);
polygon.addPoint(bounds.width + GAP_BIG - 1, 1); polygon.addPoint(bounds.width + GAP_BIG - 1, 1);
polygon.addPoint(bounds.width + GAP_BIG - 1, bounds.height + GAP - 1); polygon.addPoint(bounds.width + GAP_BIG - 1, bounds.height + GAP - 1);
polygon.addPoint(GAP_SMALL + 1, bounds.height + GAP - 1); polygon.addPoint(GAP_SMALL + 1, bounds.height + GAP - 1);
polygon.addPoint(GAP_SMALL + 1, (int) ((bounds.height + GAP) * time) - GAP_SMALL); polygon.addPoint(GAP_SMALL + 1, (int) ((bounds.height + GAP) * time) - GAP_SMALL);
polygon.addPoint(1, (int) ((bounds.height + GAP) * time - GAP)); polygon.addPoint(1, (int) ((bounds.height + GAP) * time - GAP));
polygon.addPoint(GAP_SMALL + 1, (int) ((bounds.height + GAP) * time - GAP_BIG)); polygon.addPoint(GAP_SMALL + 1, (int) ((bounds.height + GAP) * time - GAP_BIG));
polygon.addPoint(GAP_SMALL + 1, 1); polygon.addPoint(GAP_SMALL + 1, 1);
} else if (arrowPosition == Constants.TOP) { } else if (arrowPosition == Constants.TOP) {
polygon.addPoint(1, GAP_SMALL + 1); polygon.addPoint(1, GAP_SMALL - 1);
polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL + 1); polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL - 1);
polygon.addPoint((int) (bounds.width * time + GAP), 1); polygon.addPoint((int) (bounds.width * time + GAP), 1);
polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL + 1); polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL - 1);
polygon.addPoint(bounds.width + GAP - 1, GAP_SMALL + 1); polygon.addPoint(bounds.width + GAP - 1, GAP_SMALL - 1);
polygon.addPoint(bounds.width + GAP - 1, bounds.height + GAP_BIG - 1); polygon.addPoint(bounds.width + GAP - 1, bounds.height + GAP_BIG - 1);
polygon.addPoint(1, bounds.height + GAP_BIG - 1); polygon.addPoint(1, bounds.height + GAP_BIG - 1);
polygon.addPoint(1, GAP_SMALL + 1); polygon.addPoint(1, GAP_SMALL - 1);
} else if(arrowPosition == Constants.RIGHT) { } else if (arrowPosition == Constants.RIGHT) {
polygon.addPoint(1, 1); polygon.addPoint(1, 1);
polygon.addPoint(bounds.width + GAP - 1, 1); polygon.addPoint(bounds.width + GAP - 1, 1);
polygon.addPoint(bounds.width + GAP - 1, (int) ((bounds.height + GAP) * time) - GAP_BIG); polygon.addPoint(bounds.width + GAP - 1, (int) ((bounds.height + GAP) * time) - GAP_BIG);
polygon.addPoint(bounds.width + GAP_BIG - 1, (int) ((bounds.height + GAP) * time) - GAP); polygon.addPoint(bounds.width + GAP_BIG - 1, (int) ((bounds.height + GAP) * time) - GAP);
polygon.addPoint(bounds.width + GAP - 1, (int) ((bounds.height + GAP) * time) - GAP_SMALL); polygon.addPoint(bounds.width + GAP - 1, (int) ((bounds.height + GAP) * time) - GAP_SMALL);
polygon.addPoint(bounds.width + GAP - 1, bounds.height + GAP - 1); polygon.addPoint(bounds.width + GAP - 1, bounds.height + GAP - 1);
polygon.addPoint(1, bounds.height + GAP - 1); polygon.addPoint(1, bounds.height + GAP - 1);
polygon.addPoint(1, 0); polygon.addPoint(1, 0);
} }
return polygon; return polygon;
} }
/** protected void initComponents() {
* 画出界面的样式, 边框等. setUndecorated(true);
*/ try {
public void paint(Graphics g) { AWTUtilities.setWindowShape(CustomShapedDialog.this, this.getCustomShap());
super.paint(g); } catch (UnsupportedOperationException e) {
Graphics2D g2d = (Graphics2D) g;
Stroke oldStroke = g2d.getStroke();
g2d.setStroke(new BasicStroke(2, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
g2d.setColor(new Color(51, 51, 51));
g2d.drawPolygon((Polygon) getShape4Board());
g2d.setStroke(oldStroke);
}
protected void initComponents() {
setUndecorated(true);
try {
AWTUtilities.setWindowShape(CustomShapedDialog.this, this.getCustomShap());
} catch (UnsupportedOperationException e) {
FineLoggerFactory.getLogger().info("Not support"); FineLoggerFactory.getLogger().info("Not support");
} }
final JPanel contentPane = (JPanel) this.getContentPane(); final JPanel contentPane = (JPanel) this.getContentPane();
this.setLayout(null); this.setLayout(null);
contentPane.add(UIBubbleFloatPane.this); contentPane.add(UIBubbleFloatPane.this);
setVisible(true); contentPane.setBorder(new Border() {
} @Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
/** Graphics2D g2d = (Graphics2D) g;
* 检查 Stroke oldStroke = g2d.getStroke();
*/ g2d.setStroke(new BasicStroke(2, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
public void checkValid() throws Exception { g2d.setColor(new Color(51, 51, 51));
g2d.drawPolygon((Polygon) getShape4Board());
} g2d.setStroke(oldStroke);
} }
@Override
public Insets getBorderInsets(Component c) {
return null;
}
@Override
public boolean isBorderOpaque() {
return false;
}
});
}
/**
* 检查
*/
public void checkValid() throws Exception {
}
}
} }

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

@ -23,7 +23,7 @@ import java.util.List;
* @editor zhou * @editor zhou
* @since 2012-3-28下午3:07:44 * @since 2012-3-28下午3:07:44
*/ */
public abstract class UITableModelAdapter<T extends Object> extends AbstractTableModel implements UITableEditorLoader { public abstract class UITableModelAdapter<T> extends AbstractTableModel implements UITableEditorLoader {
/** /**
* *
@ -37,7 +37,6 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
// list里放的是一行数据 // list里放的是一行数据
private List<T> list = new ArrayList<T>(); private List<T> list = new ArrayList<T>();
@SuppressWarnings({ "unchecked", "rawtypes" })
protected UITableModelAdapter(String[] columnNames) { protected UITableModelAdapter(String[] columnNames) {
this.columnNames = columnNames; this.columnNames = columnNames;
table = new JTable(this); table = new JTable(this);
@ -101,8 +100,8 @@ public abstract class UITableModelAdapter<T extends Object> extends AbstractTabl
} }
} }
public void setRowAt(T value, int rowIndwx) { public void setRowAt(T value, int rowIndex) {
this.list.set(rowIndwx, value); this.list.set(rowIndex, value);
} }
/** /**

45
designer-base/src/main/java/com/fr/design/gui/itextfield/DictionaryTextField.java

@ -1,45 +0,0 @@
package com.fr.design.gui.itextfield;
import javax.swing.text.Document;
/**
* 文字 ui.
* 保存实际值展示值
* 允许实际值和展示值不同
*
* created by Harrison on 2020/08/03
**/
public class DictionaryTextField<T> extends UITextField {
protected T value;
public DictionaryTextField() {
}
public DictionaryTextField(int columns) {
super(columns);
}
public DictionaryTextField(String text, int columns, T value) {
super(text, columns);
this.value = value;
}
public DictionaryTextField(String text, T value) {
super(text);
this.value = value;
}
public DictionaryTextField(Document doc, String text, int columns, T value) {
super(doc, text, columns);
this.value = value;
}
public T getValue() {
return value;
}
public void setValue(T value) {
this.value = value;
}
}

2
designer-base/src/main/java/com/fr/design/gui/syntax/ui/rtextarea/RTextAreaBase.java

@ -25,6 +25,7 @@ import javax.swing.JTextArea;
import javax.swing.event.CaretEvent; import javax.swing.event.CaretEvent;
import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.TextUI; import javax.swing.plaf.TextUI;
import javax.swing.plaf.basic.BasicBorders;
import javax.swing.text.AbstractDocument; import javax.swing.text.AbstractDocument;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.Caret; import javax.swing.text.Caret;
@ -645,6 +646,7 @@ int currentCaretY; // Used to know when to rehighlight current line.
setTabsEmulated(false); setTabsEmulated(false);
// Stuff needed by the caret listener below. // Stuff needed by the caret listener below.
setBorder(new BasicBorders.MarginBorder());
previousCaretY = currentCaretY = getInsets().top; previousCaretY = currentCaretY = getInsets().top;
// Stuff to highlight the current line. // Stuff to highlight the current line.

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

@ -31,6 +31,7 @@ public class JSContentPane extends BasicPane {
private RSyntaxTextArea contentTextArea; private RSyntaxTextArea contentTextArea;
private UILabel funNameLabel; private UILabel funNameLabel;
private AutoCompletion ac; private AutoCompletion ac;
private static final Dimension FUNCTION_NAME_LABEL_SIZE = new Dimension(300, 80);
private int titleWidth = 180; private int titleWidth = 180;
@ -68,7 +69,7 @@ public class JSContentPane extends BasicPane {
JPanel jsParaPane = new JPanel(new BorderLayout(4, 4)); JPanel jsParaPane = new JPanel(new BorderLayout(4, 4));
jsParaPane.setPreferredSize(new Dimension(300, 80)); jsParaPane.setPreferredSize(new Dimension(300, 80));
UIScrollPane scrollPane = new UIScrollPane(funNameLabel); UIScrollPane scrollPane = new UIScrollPane(funNameLabel);
scrollPane.setPreferredSize(new Dimension(400, 80)); scrollPane.setPreferredSize(FUNCTION_NAME_LABEL_SIZE);
scrollPane.setBorder(new UIRoundedBorder(UIConstants.TITLED_BORDER_COLOR, 1, UIConstants.ARC)); scrollPane.setBorder(new UIRoundedBorder(UIConstants.TITLED_BORDER_COLOR, 1, UIConstants.ARC));
jsParaPane.add(scrollPane, BorderLayout.WEST); jsParaPane.add(scrollPane, BorderLayout.WEST);
jsParaPane.add(label, BorderLayout.EAST); jsParaPane.add(label, BorderLayout.EAST);

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

@ -2,24 +2,31 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.islider.UISlider; import com.fr.design.gui.islider.UISlider;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.text.AttributeSet; import javax.swing.plaf.basic.BasicSliderUI;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.EventQueue; import java.awt.EventQueue;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.KeyListener; import java.awt.event.KeyListener;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@ -29,6 +36,7 @@ import java.math.BigDecimal;
* Created by MoMeak on 2017/7/13. * Created by MoMeak on 2017/7/13.
*/ */
public class JFormSliderPane extends JPanel { public class JFormSliderPane extends JPanel {
public static final Image APPFIT_V0 = BaseUtils.readImage("com/fr/design/images/control/icon_thumb_normal.png");
private static final double ONEPOINTEIGHT = 1.8; private static final double ONEPOINTEIGHT = 1.8;
private static final int SIX = 6; private static final int SIX = 6;
@ -37,14 +45,13 @@ public class JFormSliderPane extends JPanel {
private static final int HUNDRED = 100; private static final int HUNDRED = 100;
private static final int TWO_HUNDRED = 200; private static final int TWO_HUNDRED = 200;
private static final int FOUR_HUNDRED = 400; private static final int FOUR_HUNDRED = 400;
private static final int SHOWVALBUTTON_WIDTH = 40; private static final int SHOWVALBUTTON_WIDTH = 35;
private static final int SHOWVALBUTTON_HEIGHTH = 20; private static final int SHOWVALBUTTON_HEIGHTH = 20;
private static final String SUFFIX = "%"; private static final String SUFFIX = "%";
private static final String REGEX = "[\\d%]*";
private static final int TOOLTIP_Y = 30; private static final int TOOLTIP_Y = 30;
private static final Color BACK_COLOR = new Color(245, 245, 247); private static final Color BACK_COLOR = new Color(245, 245, 247);
public int showValue = 100; public int showValue = 100;
private UITextField showValField; private UINumberField showValField;
private UISlider slider; private UISlider slider;
private int times; private int times;
private int sliderValue; private int sliderValue;
@ -64,6 +71,9 @@ public class JFormSliderPane extends JPanel {
panel.add(slider); panel.add(slider);
panel.add(upButton); panel.add(upButton);
panel.add(showValField); panel.add(showValField);
UILabel uiLabel = new UILabel(SUFFIX);
uiLabel.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4));
panel.add(uiLabel);
panel.setBackground(BACK_COLOR); panel.setBackground(BACK_COLOR);
this.add(panel, BorderLayout.NORTH); this.add(panel, BorderLayout.NORTH);
} }
@ -112,8 +122,8 @@ public class JFormSliderPane extends JPanel {
} }
private void initShowValField() { private void initShowValField() {
showValField = new UITextField(showValue + SUFFIX); showValField = new UINumberField();
showValField.setBorderPainted(false); showValField.setValue(showValue);
showValField.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH)); showValField.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH));
showValField.addKeyListener(new KeyListener() { showValField.addKeyListener(new KeyListener() {
@Override @Override
@ -131,27 +141,28 @@ public class JFormSliderPane extends JPanel {
int code = evt.getKeyCode(); int code = evt.getKeyCode();
if (code == KeyEvent.VK_ENTER) { if (code == KeyEvent.VK_ENTER) {
showValue = parseInputValue(showValField.getText()); showValFieldChange((int) showValField.getValue());
showValField.setText(showValue + SUFFIX);
showValFieldChange();
} }
} }
}); });
showValField.setDocument(new PlainDocument() { showValField.addFocusListener(new FocusListener() {
@Override @Override
public void insertString(int offset, String s, AttributeSet a) throws BadLocationException { public void focusGained(FocusEvent e) {
if (!s.matches(REGEX)) {
return;
}
super.insertString(offset, s, a);
} }
});
@Override
public void focusLost(FocusEvent e) {
showValFieldChange((int) showValField.getValue());
}
});
} }
private void showValFieldChange() {
private void showValFieldChange(int value) {
isButtonOrIsTxt = true; isButtonOrIsTxt = true;
showValue = getPreferredValue(showValue); showValue = getPreferredValue(value);
refreshShowValueFieldText(); refreshShowValueFieldText();
refreshSlider(); refreshSlider();
} }
@ -167,22 +178,10 @@ public class JFormSliderPane extends JPanel {
} }
private void refreshShowValueFieldText(){ private void refreshShowValueFieldText(){
showValField.setText(showValue + SUFFIX); showValField.setValue(showValue);
} setAdjustButtonStatus();
private int parseInputValue(String text){
if (text.endsWith(SUFFIX)){
text = text.substring(0, text.length() -1);
}
try{
return Integer.parseInt(text);
}catch (NumberFormatException e){
return HUNDRED;
}
} }
//定义一个监听器,用于监听所有滑动条 //定义一个监听器,用于监听所有滑动条
private ChangeListener listener = new ChangeListener() { private ChangeListener listener = new ChangeListener() {
public void stateChanged(ChangeEvent event) { public void stateChanged(ChangeEvent event) {
@ -207,6 +206,11 @@ public class JFormSliderPane extends JPanel {
slider.setValue(calSliderValue(showValue)); slider.setValue(calSliderValue(showValue));
} }
private void setAdjustButtonStatus(){
this.downButton.setEnabled(this.showValue > TEN);
this.upButton.setEnabled(this.showValue < FOUR_HUNDRED);
}
private int calSliderValue(int value) { private int calSliderValue(int value) {
int result; int result;
if (value > HUNDRED) { if (value > HUNDRED) {
@ -245,7 +249,7 @@ public class JFormSliderPane extends JPanel {
if (newUpVal <= FOUR_HUNDRED) { if (newUpVal <= FOUR_HUNDRED) {
showValue = newUpVal; showValue = newUpVal;
} else { } else {
showValue = TEN; showValue = FOUR_HUNDRED;
} }
refreshShowValueFieldText(); refreshShowValueFieldText();
refreshSlider(); refreshSlider();
@ -271,8 +275,7 @@ public class JFormSliderPane extends JPanel {
} }
public void setShowValue(int value) { public void setShowValue(int value) {
showValue = value; showValFieldChange(value);
showValFieldChange();
} }
@ -280,6 +283,55 @@ public class JFormSliderPane extends JPanel {
this.slider.addChangeListener(changeListener); this.slider.addChangeListener(changeListener);
} }
class JSliderPaneUI extends BasicSliderUI {
private static final int THUMB_XOFFSET = 8;
private static final int THUMB_YOFFSET = 3;
private static final int FOUR = 4;
private static final int FIVE = 5;
private static final int SIX = 6;
private static final int MID_X_SHIFT = 2; // 中点标记的水平位置偏移
public JSliderPaneUI(UISlider b) {
super(b);
}
/**
* 绘制指示物
*/
public void paintThumb(Graphics g) {
Rectangle knobBounds = thumbRect;
Graphics2D g2d = (Graphics2D) g;
g2d.drawImage(APPFIT_V0, knobBounds.x - THUMB_XOFFSET, knobBounds.y + THUMB_YOFFSET, null);
g2d.dispose();
}
/**
* 绘制刻度轨迹
*/
public void paintTrack(Graphics g) {
int cy, cw;
Rectangle trackBounds = trackRect;
if (slider.getOrientation() == UISlider.HORIZONTAL) {
Graphics2D g2 = (Graphics2D) g;
cy = (trackBounds.height / 2);
cw = trackBounds.width;
g2.setPaint(BACK_COLOR);
g2.fillRect(0, -cy, cw + 10, cy * 4);
g.setColor(new Color(216, 216, 216));
g.drawLine(0, cy, cw + 3, cy);
g.drawLine(MID_X_SHIFT + cw / 2, cy - FOUR, MID_X_SHIFT + cw / 2, cy + FOUR);
} else {
super.paintTrack(g);
}
}
public void setThumbLocation(int x, int y) {
super.setThumbLocation(x, y);
slider.repaint();
}
}
public static void main(String[] args) { public static void main(String[] args) {
JFrame jf = new JFrame("test"); JFrame jf = new JFrame("test");

1032
designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java

File diff suppressed because it is too large Load Diff

8
designer-base/src/main/java/com/fr/design/mainframe/WestRegionContainerPane.java

@ -39,8 +39,12 @@ public class WestRegionContainerPane extends UIResizableContainer {
@Override @Override
public void on(PluginEvent event) { public void on(PluginEvent event) {
setDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); if (getDownPane() != null) {
replaceDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
} else {
setDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
}
} }
}, new PluginFilter() { }, new PluginFilter() {

4
designer-base/src/main/java/com/fr/design/os/impl/PMDialogAction.java

@ -17,11 +17,11 @@ public class PMDialogAction implements OSBasedAction {
private static String PLUGIN_MANAGER_ROUTE = "#management/plugin"; private static String PLUGIN_MANAGER_ROUTE = "#management/plugin";
@Override @Override
public void execute(Object... objects) { public void execute(Object... objects) {
if(Arch.getArch() == Arch.ARM){ if(Arch.getArch() == Arch.ARM || OperatingSystem.isLinux()){
DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null); DesignUtils.visitEnvServerByParameters( PLUGIN_MANAGER_ROUTE,null,null);
return; return;
} }
if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM() && !OperatingSystem.isLinux()) { if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM()) {
UpmFinder.showUPMDialog(); UpmFinder.showUPMDialog();
} else { } else {
WebViewDlgHelper.createPluginDialog(); WebViewDlgHelper.createPluginDialog();

7
designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java

@ -117,6 +117,13 @@ public enum SupportOSImpl implements SupportOS {
public boolean support() { public boolean support() {
return OperatingSystem.isWindows(); return OperatingSystem.isWindows();
} }
},
KOREAN_INPUT {
@Override
public boolean support() {
return OperatingSystem.isWindows();
}
} }
} }

5
designer-base/src/main/java/com/fr/design/update/actions/RecoverForDesigner.java

@ -24,6 +24,8 @@ public class RecoverForDesigner implements Recover {
private final String installHome = StableUtils.getInstallHome(); private final String installHome = StableUtils.getInstallHome();
private static final String HYPHEN = "-";
@Override @Override
public boolean recover() { public boolean recover() {
try{ try{
@ -41,7 +43,8 @@ public class RecoverForDesigner implements Recover {
@Override @Override
public boolean backup() { public boolean backup() {
//jar包备份文件的目录为"backup/"+jar包当前版本号 //jar包备份文件的目录为"backup/"+jar包当前版本号
String todayBackupDir = StableUtils.pathJoin(installHome, UpdateConstants.DESIGNER_BACKUP_DIR, (GeneralUtils.readBuildNO())); String versionBuildNo = GeneralUtils.getVersion() + HYPHEN + GeneralUtils.readBuildNO();
String todayBackupDir = StableUtils.pathJoin(installHome, UpdateConstants.DESIGNER_BACKUP_DIR, versionBuildNo);
String envHome = ProjectLibrary.getInstance().getLibHome(); String envHome = ProjectLibrary.getInstance().getLibHome();
backupFilesFromInstallEnv(envHome, todayBackupDir); backupFilesFromInstallEnv(envHome, todayBackupDir);
backupFilesFromInstallLib(installHome, todayBackupDir); backupFilesFromInstallLib(installHome, todayBackupDir);

2
designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateDialog.java

@ -79,7 +79,7 @@ class DesignerPushUpdateDialog extends UIDialog {
private Model createModel(DesignerUpdateInfo updateInfo) { private Model createModel(DesignerUpdateInfo updateInfo) {
Model model = new Model(); Model model = new Model();
model.setVersion(updateInfo.getLatestVersion()); model.setVersion(updateInfo.getLatestFullVersion());
model.setContent(updateInfo.getPushContent()); model.setContent(updateInfo.getPushContent());
model.setMoreInfoUrl(updateInfo.getMoreInfoUrl()); model.setMoreInfoUrl(updateInfo.getMoreInfoUrl());
model.setBackgroundUrl(updateInfo.getBackgroundUrl()); model.setBackgroundUrl(updateInfo.getBackgroundUrl());

33
designer-base/src/main/java/com/fr/design/update/push/DesignerUpdateInfo.java

@ -1,7 +1,12 @@
package com.fr.design.update.push; package com.fr.design.update.push;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSON;
import com.fr.json.JSONFactory;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.security.InvalidParameterException; import java.security.InvalidParameterException;
@ -14,9 +19,12 @@ class DesignerUpdateInfo {
private static final String KEY_CONTENT = "content"; private static final String KEY_CONTENT = "content";
private static final String KEY_BACKGROUND_URL = "background"; private static final String KEY_BACKGROUND_URL = "background";
private static final String KEY_MORE_INFO_URL = "more"; private static final String KEY_MORE_INFO_URL = "more";
private static final String SPLIT_CHAR = "-";
private final String currentVersion; // 当前版本 private final String currentVersion; // 当前版本
private final String latestVersion; // 最新版本 private final String latestVersion; // 最新版本
private final String latestFullVersion; // 最新版本的完整信息
private final String lastIgnoredVersion; // 最近一次跳过的版本 private final String lastIgnoredVersion; // 最近一次跳过的版本
private final String pushVersion; // 推送版本 private final String pushVersion; // 推送版本
@ -27,6 +35,7 @@ class DesignerUpdateInfo {
DesignerUpdateInfo(String currentVersion, String latestVersion, String lastIgnoredVersion, JSONObject pushData) { DesignerUpdateInfo(String currentVersion, String latestVersion, String lastIgnoredVersion, JSONObject pushData) {
this.currentVersion = currentVersion; this.currentVersion = currentVersion;
this.latestVersion = latestVersion; this.latestVersion = latestVersion;
this.latestFullVersion = initLatestFullVersion();
this.lastIgnoredVersion = lastIgnoredVersion; this.lastIgnoredVersion = lastIgnoredVersion;
this.pushVersion = pushData.optString(KEY_VERSION); this.pushVersion = pushData.optString(KEY_VERSION);
@ -58,6 +67,30 @@ class DesignerUpdateInfo {
return latestVersion; return latestVersion;
} }
String initLatestFullVersion() {
try {
String url = CloudCenter.getInstance().acquireUrlByKind("jar10.new.update");
if (StringUtils.isBlank(url)) {
return StringUtils.EMPTY;
}
String res = HttpToolbox.get(url);
if (StringUtils.isBlank(res)) {
return StringUtils.EMPTY;
}
JSONObject jsonObject = JSONFactory.createJSON(JSON.OBJECT, res);
String version = jsonObject.getString("version");
String build = jsonObject.getString("build");
return version + SPLIT_CHAR + build;
} catch (Throwable e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return StringUtils.EMPTY;
}
String getLatestFullVersion() {
return latestFullVersion;
}
String getLastIgnoredVersion() { String getLastIgnoredVersion() {
return lastIgnoredVersion; return lastIgnoredVersion;
} }

8
designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java

@ -29,6 +29,7 @@ import com.fr.general.*;
import com.fr.general.http.HttpToolbox; import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.process.engine.core.FineProcessContext; import com.fr.process.engine.core.FineProcessContext;
import com.fr.process.engine.core.FineProcessEngineEvent; import com.fr.process.engine.core.FineProcessEngineEvent;
@ -80,6 +81,8 @@ public class UpdateMainDialog extends UIDialog {
private static final String UPDATE_CACHE_STATE_FAIL = "fail"; private static final String UPDATE_CACHE_STATE_FAIL = "fail";
private static final String UPDATE_CACHE_STATE_SUCCESS = "success"; private static final String UPDATE_CACHE_STATE_SUCCESS = "success";
private static final String HYPHEN = "-";
private final SimpleDateFormat CHANGELOG_FORMAT = new SimpleDateFormat("M/d/y, h:m:s a", Locale.ENGLISH); private final SimpleDateFormat CHANGELOG_FORMAT = new SimpleDateFormat("M/d/y, h:m:s a", Locale.ENGLISH);
private final SimpleDateFormat UPDATE_INFO_TABLE_FORMAT = new SimpleDateFormat("yyyy.MM.dd"); private final SimpleDateFormat UPDATE_INFO_TABLE_FORMAT = new SimpleDateFormat("yyyy.MM.dd");
@ -303,8 +306,9 @@ public class UpdateMainDialog extends UIDialog {
new UILabel(UpdateConstants.DEFAULT_APP_NAME + StringUtils.BLANK + ProductConstants.VERSION) new UILabel(UpdateConstants.DEFAULT_APP_NAME + StringUtils.BLANK + ProductConstants.VERSION)
); );
String notInstallVersion = InterProviderFactory.getProvider().getLocText("Fine-Core_Basic_About_No_Build");
jarCurrentLabel = new UILabel(StringUtils.isEmpty(GeneralUtils.readBuildNO()) ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_Not_Install_Version") : GeneralUtils.readBuildNO(), SwingConstants.CENTER); String versionBuildNo = GeneralUtils.getVersion() + HYPHEN + GeneralUtils.readBuildNO();
jarCurrentLabel = new UILabel(ComparatorUtils.equals(notInstallVersion, GeneralUtils.readBuildNO()) ? notInstallVersion : versionBuildNo, SwingConstants.CENTER);
UILabel noJarPreviousRevision = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_No_Previous_Version")); UILabel noJarPreviousRevision = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_No_Previous_Version"));
UpdateActionLabel jarRestorePreviousRevision = new UpdateActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_Restore"), false); UpdateActionLabel jarRestorePreviousRevision = new UpdateActionLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Updater_Restore"), false);
jarRestorePreviousRevision.setForeground(new Color(RESTORE_LABEL_COLOR)); jarRestorePreviousRevision.setForeground(new Color(RESTORE_LABEL_COLOR));

61
designer-base/src/main/java/com/fr/design/utils/ParameterUtils.java

@ -0,0 +1,61 @@
package com.fr.design.utils;
import com.fr.base.Parameter;
import com.fr.base.ParameterHelper;
import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
/**
* @Author: Yuan.Wang
* @Date: 2020/8/11
*/
public class ParameterUtils {
/**
* 获得新的参数集合,返回的集合中的参数的顺序为新增参数全部放在后面以保证原有参数的相对顺序
*
* @param paramTexts sql语句
* @param oldParameters 旧的参数集合
* @return 新参数集合
*/
public static Parameter[] analyzeAndUnionParameters(String[] paramTexts, Parameter[] oldParameters) {
Parameter[] newParameters = ParameterHelper.analyze4Parameters(paramTexts, false);
return unionParametersInRelativeOrder(oldParameters, newParameters);
}
/**
* 合并新旧参数集合新增参数全部放在后面以保证原有参数的相对顺序
*
* @param oldParameters 旧的参数集合
* @param newParameters 新的参数集合
* @return 新参数集合
*/
private static Parameter[] unionParametersInRelativeOrder(Parameter[] oldParameters, Parameter[] newParameters) {
if (ArrayUtils.isEmpty(newParameters) || ArrayUtils.isEmpty(oldParameters)) {
return newParameters;
}
Parameter[] result = new Parameter[newParameters.length];
List<Parameter> newParameterList = new ArrayList<>(Arrays.asList(newParameters));
int i = 0;
//遍历旧参数数组中的参数,如果新参数list中存在同名参数,将该参数加入到result里,同时删除list中的同名参数
for (Parameter oldParameter : oldParameters) {
Iterator<Parameter> iterator = newParameterList.listIterator();
while (iterator.hasNext()) {
Parameter newParameter = iterator.next();
if (ComparatorUtils.equals(oldParameter.getName(), newParameter.getName())) {
result[i++] = oldParameter;
iterator.remove();
break;
}
}
}
//将新参数list中的剩余参数添加到result中
System.arraycopy(newParameterList.toArray(new Parameter[0]), 0, result, i, newParameterList.size());
return result;
}
}

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

@ -59,10 +59,13 @@ public class CheckServiceDialog extends JDialog implements ActionListener {
label.setPreferredSize(new Dimension(650,30)); label.setPreferredSize(new Dimension(650,30));
String text = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer") + localBranch String text = Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer") + localBranch
+ Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") + remoteBranch; + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") +
Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old") +
localBranch;
String delimiter = DisplayUtils.getDisplayLength(text) > 70? "<br>":"/"; String delimiter = DisplayUtils.getDisplayLength(text) > 70? "<br>":"/";
JLabel label2 = new JLabel("<html>"+Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer") JLabel label2 = new JLabel("<html>"+Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Local_Designer")
+ localBranch + delimiter + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") + remoteBranch+"</html>"); + localBranch + delimiter + Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Remote_Server") +
Toolkit.i18nText("Fine-Design_Basic_Remote_Design_Branch_Is_Old")+ localBranch +"</html>");
label2.setPreferredSize(new Dimension(600,30)); label2.setPreferredSize(new Dimension(600,30));
JTextPane tipsPane = new JTextPane(); JTextPane tipsPane = new JTextPane();

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

@ -44,6 +44,7 @@ import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.io.File; import java.io.File;
import java.util.function.Supplier;
import static com.fr.design.layout.TableLayout.FILL; import static com.fr.design.layout.TableLayout.FILL;
import static com.fr.design.layout.TableLayout.PREFERRED; import static com.fr.design.layout.TableLayout.PREFERRED;
@ -439,20 +440,29 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
* 设置 app servlet 默认值 * 设置 app servlet 默认值
*/ */
private void setDefaultAppAndServlet() { private void setDefaultAppAndServlet() {
String appName; setWrap(webAppNameInput, () -> FRContext.getCommonOperator().getAppName(), RemoteWorkspaceURL.DEFAULT_WEB_APP_NAME);
String servletName; setWrap(servletNameInput, () -> ServerConfig.getInstance().getServletName(), RemoteWorkspaceURL.DEFAULT_SERVLET_NAME);
try { }
appName = FRContext.getCommonOperator().getAppName();
} catch (Exception ignored) { private void setWrap(final UITextField textField, final Supplier<String> supplier, final String defaultName) {
appName = RemoteWorkspaceURL.DEFAULT_WEB_APP_NAME; new SwingWorker<String, Void>() {
}
try { @Override
servletName = ServerConfig.getInstance().getServletName(); protected String doInBackground() throws Exception {
} catch (Exception ignored) { return supplier.get();
servletName = RemoteWorkspaceURL.DEFAULT_SERVLET_NAME; }
}
webAppNameInput.setText(appName); @Override
servletNameInput.setText(servletName); protected void done() {
String name = defaultName;
try {
name = get();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage() , e);
}
textField.setText(name);
}
}.execute();
} }

2
designer-base/src/main/resources/com/fr/design/ui/update/push/pushUpdate.css

@ -1,6 +1,6 @@
body { body {
padding-left: 30px; padding-left: 30px;
padding-top: 30px; padding-top: 25px;
color: white; color: white;
background-size: 100% 100% !important; background-size: 100% 100% !important;
-moz-background-size: 100% 100% !important; -moz-background-size: 100% 100% !important;

12
designer-base/src/test/java/com/fr/design/mainframe/JFormSliderPaneTest.java

@ -9,18 +9,6 @@ import org.junit.Test;
*/ */
public class JFormSliderPaneTest { public class JFormSliderPaneTest {
@Test
public void testParseInputValue() {
JFormSliderPane sliderPane = new JFormSliderPane();
int result = Reflect.on(sliderPane).call("parseInputValue", "100%").get();
Assert.assertEquals(100, result);
result = Reflect.on(sliderPane).call("parseInputValue", "50%").get();
Assert.assertEquals(50, result);
result = Reflect.on(sliderPane).call("parseInputValue", "50").get();
Assert.assertEquals(50, result);
result = Reflect.on(sliderPane).call("parseInputValue", "50abc").get();
Assert.assertEquals(100, result);
}
@Test @Test
public void testGetPreferredValue() { public void testGetPreferredValue() {

38
designer-base/src/test/java/com/fr/design/utils/ParameterUtilsTest.java

@ -0,0 +1,38 @@
package com.fr.design.utils;
import com.fr.base.Parameter;
import junit.framework.TestCase;
/**
* @Author: Yuan.Wang
* @Date: 2020/8/11
*/
public class ParameterUtilsTest extends TestCase {
public void testAnalyzeAndUnionParameters() {
String[] paramTexts = {"${a}${b}${d}", ""};
Parameter[] oldParameters = new Parameter[]{new Parameter("c"), new Parameter("b"), new Parameter("a")};
Parameter[] rightResult = new Parameter[]{new Parameter("b"), new Parameter("a"), new Parameter("d")};
Parameter[] result = ParameterUtils.analyzeAndUnionParameters(paramTexts, oldParameters);
assertEquals(result.length, rightResult.length);
for (int i = 0; i < rightResult.length; i++) {
assertEquals(rightResult[i].getName(), result[i].getName());
}
paramTexts = new String[]{"${a}${b}${d}", ""};
oldParameters = new Parameter[]{};
rightResult = new Parameter[]{new Parameter("a"), new Parameter("b"), new Parameter("d")};
result = ParameterUtils.analyzeAndUnionParameters(paramTexts, oldParameters);
assertEquals(result.length,rightResult.length);
paramTexts = new String[]{"${b}", ""};
oldParameters = new Parameter[]{new Parameter("b"), new Parameter("a"), new Parameter("d")};
rightResult = new Parameter[]{new Parameter("b")};
result = ParameterUtils.analyzeAndUnionParameters(paramTexts, oldParameters);
assertEquals(result.length,rightResult.length);
assertEquals(result.length, rightResult.length);
for (int i = 0; i < rightResult.length; i++) {
assertEquals(rightResult[i].getName(), result[i].getName());
}
}
}

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

@ -6,9 +6,7 @@ import com.fr.design.actions.core.ActionFactory;
import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.ChartPropertyPane; import com.fr.design.mainframe.ChartPropertyPane;
import com.fr.design.module.ChartEmptyDataStyleAction;
import com.fr.design.module.ChartHyperlinkGroup; import com.fr.design.module.ChartHyperlinkGroup;
import com.fr.design.module.ChartPreStyleAction;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.form.ui.ChartEditor; import com.fr.form.ui.ChartEditor;
import com.fr.locale.InterMutableKey; import com.fr.locale.InterMutableKey;
@ -20,7 +18,6 @@ import com.fr.plugin.chart.vanchart.export.ImagePainter;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider;
import com.fr.van.chart.DownloadOnlineSourcesHelper; import com.fr.van.chart.DownloadOnlineSourcesHelper;
import com.fr.van.chart.map.server.ChartMapEditorAction;
/** /**
* Created by juhaoyu on 2018/6/27. * Created by juhaoyu on 2018/6/27.
@ -43,10 +40,6 @@ public class ChartDesignerActivator extends Activator implements Prepare {
DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);
ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction());
ActionFactory.registerChartEmptyDataStyleAction(new ChartEmptyDataStyleAction());
ActionFactory.registerChartMapEditorAction(new ChartMapEditorAction());
ActionFactory.registerChartCollection(ChartCollection.class); ActionFactory.registerChartCollection(ChartCollection.class);
DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption()); DesignModuleFactory.registerExtraWidgetOptions(ChartTypeInterfaceManager.initWidgetOption());

6
designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java

@ -3,8 +3,8 @@ package com.fr.design.chart;
import com.fr.base.chart.BaseChartPainter; import com.fr.base.chart.BaseChartPainter;
import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.base.chart.result.WebChartIDInfo; import com.fr.base.chart.result.WebChartIDInfo;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.script.Calculator; import com.fr.script.Calculator;
@ -57,8 +57,8 @@ public class ChartIcon implements Icon, XMLable {
} }
private void initChartName() { private void initChartName() {
Chart chart = chartCollection.getSelectedChart(Chart.class); ChartProvider chart = chartCollection.getSelectedChartProvider(ChartProvider.class);
String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(chart.getPlot().getPlotID()); String[] subName = ChartTypeInterfaceManager.getInstance().getSubName(chart.getID());
chartName = subName[0]; chartName = subName[0];
} }

10
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -23,6 +23,8 @@ import javax.swing.JSplitPane;
import javax.swing.ListCellRenderer; import javax.swing.ListCellRenderer;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -35,6 +37,8 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven
private JList iconViewList = null; private JList iconViewList = null;
private DefaultListModel iconListModel = null; private DefaultListModel iconListModel = null;
private static Map<ChartProvider, ChartProvider> map = new ConcurrentHashMap();
public ChartTypePane() { public ChartTypePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
DefaultListModel defaultListModel = new DefaultListModel(); DefaultListModel defaultListModel = new DefaultListModel();
@ -102,7 +106,11 @@ public class ChartTypePane extends ChartCommonWizardPane implements CallbackEven
ChartTypePane.this.iconListModel.clear(); ChartTypePane.this.iconListModel.clear();
for (int i = 0, len = charts.length; i < len; i++) { for (int i = 0, len = charts.length; i < len; i++) {
ChartProvider chart = charts[i]; ChartProvider chart = charts[i];
ChartCollection chartCollection = new ChartCollection(chart); if (map.get(chart) == null) {
ChartProvider chartProvider = chart.transformProperties();
map.put(chart, chartProvider);
}
ChartCollection chartCollection = new ChartCollection(map.get(chart));
ChartIcon chartIcon = new ChartIcon(chartCollection); ChartIcon chartIcon = new ChartIcon(chartCollection);
chartIcon.setChartName(subName[i]); chartIcon.setChartName(subName[i]);
chartIcon.registerCallBackEvent(ChartTypePane.this); chartIcon.registerCallBackEvent(ChartTypePane.this);

31
designer-chart/src/main/java/com/fr/design/chart/auto/AutoTypeCalculate.java

@ -22,6 +22,8 @@ import com.fr.stable.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* @author Bjorn * @author Bjorn
@ -30,6 +32,15 @@ import java.util.List;
*/ */
public class AutoTypeCalculate { public class AutoTypeCalculate {
public static Pattern[] dataPatterns;
static {
Pattern pattern1 = Pattern.compile("^(19|20)\\d{2}$");
Pattern pattern2 = Pattern.compile("^\\d{4}(0?[1-9]|1[012])$");
Pattern pattern3 = Pattern.compile("^\\d{4}(0?[1-9]|1[012])(0?[1-9]|[12]\\d|3[01])$");
dataPatterns = new Pattern[]{pattern1, pattern2, pattern3};
}
public static List<VanChart> calculateType(String tableName, List<String> columns) { public static List<VanChart> calculateType(String tableName, List<String> columns) {
List<ColumnInfo> columnValue = calculateField(tableName, columns); List<ColumnInfo> columnValue = calculateField(tableName, columns);
if (columnValue.isEmpty()) { if (columnValue.isEmpty()) {
@ -86,9 +97,29 @@ public class AutoTypeCalculate {
return false; return false;
} }
} }
//不是日期型数字才是指标
return !isNumberData(values);
}
private static boolean isNumberData(List<String> values) {
for (String value : values) {
if (!isNumberData(value)) {
return false;
}
}
return true; return true;
} }
private static boolean isNumberData(String value) {
for (Pattern pattern : dataPatterns) {
Matcher matcher = pattern.matcher(value);
if (matcher.matches()) {
return true;
}
}
return false;
}
private static List<ColumnInfo> calculateField(String tableName, List<String> columns) { private static List<ColumnInfo> calculateField(String tableName, List<String> columns) {
NameTableData nameTableData = new NameTableData(tableName); NameTableData nameTableData = new NameTableData(tableName);
TableDataSource dataSource = TableDataSourceTailor.extractTableData(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget()); TableDataSource dataSource = TableDataSourceTailor.extractTableData(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getTarget());

121
designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java

@ -1,19 +1,18 @@
package com.fr.design.chartx.component; package com.fr.design.chartx.component;
import com.fr.data.util.function.AbstractDataFunction; import com.fr.data.util.function.AbstractDataFunction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.component.correlation.AbstractCorrelationPane; import com.fr.design.chartx.component.correlation.AbstractCorrelationPane;
import com.fr.design.chartx.component.correlation.CalculateComboBoxEditorComponent; import com.fr.design.chartx.component.correlation.CalculateComboBoxEditorComponent;
import com.fr.design.chartx.component.correlation.FieldEditorComponentWrapper; import com.fr.design.chartx.component.correlation.FieldEditorComponentWrapper;
import com.fr.design.chartx.component.correlation.UIComboBoxEditorComponent; import com.fr.design.chartx.component.correlation.UIComboBoxEditorComponent;
import com.fr.design.chartx.component.correlation.UITextFieldEditorComponent; import com.fr.design.chartx.component.correlation.UITextFieldEditorComponent;
import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; 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.CalculateComboBox; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper; import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.extended.chart.UIComboBoxWithNone; import com.fr.extended.chart.UIComboBoxWithNone;
@ -22,19 +21,25 @@ import com.fr.stable.StringUtils;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.util.ArrayList; import javax.swing.event.ChangeEvent;
import java.util.List; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/** /**
* Created by shine on 2018/9/12. * Created by shine on 2018/9/12.
* 系列名使用字段名or字段值的抽象的pane 支持多种属性结构的存取 * 系列名使用字段名or字段值的抽象的pane 支持多种属性结构的存取
*/ */
public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<T> { public abstract class AbstractCustomFieldComboBoxPane<T> extends BasicBeanPane<T> {
private UIButtonGroup<Boolean> nameOrValue;
private JPanel cardPane;
private CardLayout cardLayout;
private AbstractUseFieldValuePane useFieldValuePane; private AbstractUseFieldValuePane useFieldValuePane;
@ -42,73 +47,43 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
private List<String> fieldList = new ArrayList<String>(); private List<String> fieldList = new ArrayList<String>();
@Override public AbstractCustomFieldComboBoxPane() {
protected void initLayout() {
this.setLayout(new BorderLayout(0, 6));
JPanel northPane = new JPanel(new BorderLayout());
northPane.add(jcb, BorderLayout.CENTER);
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, 20));
northPane.add(label, BorderLayout.WEST);
this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER);
}
@Override
protected List<FurtherBasicBeanPane<? extends T>> initPaneList() {
useFieldValuePane = createUseFieldValuePane(); useFieldValuePane = createUseFieldValuePane();
customFieldNamePane = createCustomFieldNamePane(); customFieldNamePane = createCustomFieldNamePane();
List<FurtherBasicBeanPane<? extends T>> list = new ArrayList<FurtherBasicBeanPane<? extends T>>();
list.add(useFieldValuePane);
list.add(paneWrapper());
return list;
}
private FurtherBasicBeanPane<? extends T> paneWrapper() { nameOrValue = new UIButtonGroup<Boolean>(
FurtherBasicBeanPane pane = new FurtherBasicBeanPane() { new String[]{useFieldValuePane.title4PopupWindow(), customFieldNamePane.title4PopupWindow()},
new Boolean[]{false, true});
nameOrValue.setSelectedItem(false);
nameOrValue.addChangeListener(new ChangeListener() {
@Override @Override
public String title4PopupWindow() { public void stateChanged(ChangeEvent e) {
return Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Name"); checkCardPane();
} }
});
JPanel northPane = DataLayoutHelper.createDataLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"), nameOrValue);
@Override cardLayout = new CardLayout();
public boolean accept(Object ob) { cardPane = new JPanel(cardLayout);
return false; cardPane.add(useFieldValuePane, useFieldValuePane.title4PopupWindow());
} cardPane.add(customFieldNamePane, customFieldNamePane.title4PopupWindow());
@Override
public void reset() {
}
@Override this.setLayout(new BorderLayout(0, 6));
public void populateBean(Object ob) { this.add(northPane, BorderLayout.NORTH);
} this.add(cardPane, BorderLayout.CENTER);
@Override
public Object updateBean() {
return null;
}
};
pane.setLayout(new BorderLayout(0, 6));
pane.add(customFieldNamePane, BorderLayout.CENTER);
return pane;
} }
protected abstract AbstractUseFieldValuePane createUseFieldValuePane(); protected abstract AbstractUseFieldValuePane createUseFieldValuePane();
protected abstract AbstractCustomFieldNamePane createCustomFieldNamePane(); protected abstract AbstractCustomFieldNamePane createCustomFieldNamePane();
@Override
protected String title4PopupWindow() {
return StringUtils.EMPTY;
}
protected boolean valueComboBoxHasNone() { protected boolean valueComboBoxHasNone() {
return false; return false;
} }
public void checkBoxUse(boolean hasUse) { public void checkBoxUse(boolean hasUse) {
jcb.setEnabled(hasUse); nameOrValue.setEnabled(hasUse);
useFieldValuePane.checkBoxUse(hasUse); useFieldValuePane.checkBoxUse(hasUse);
} }
@ -122,6 +97,19 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
fieldList = columnNameList; fieldList = columnNameList;
} }
private void checkCardPane() {
cardLayout.show(cardPane, nameOrValue.getSelectedItem() ? customFieldNamePane.title4PopupWindow() : useFieldValuePane.title4PopupWindow());
}
protected void populateNameOrValue(boolean b) {
nameOrValue.setSelectedItem(b);
checkCardPane();
}
protected boolean updateNameOrValue() {
return nameOrValue.getSelectedItem();
}
protected void populateCustomFieldNamePane(T t) { protected void populateCustomFieldNamePane(T t) {
customFieldNamePane.populateBean(t); customFieldNamePane.populateBean(t);
} }
@ -138,6 +126,16 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
useFieldValuePane.updateBean(t); useFieldValuePane.updateBean(t);
} }
@Override
public T updateBean() {
return null;
}
@Override
protected String title4PopupWindow() {
return null;
}
protected abstract class AbstractUseFieldValuePane extends FurtherBasicBeanPane<T> { protected abstract class AbstractUseFieldValuePane extends FurtherBasicBeanPane<T> {
private UIComboBox series; private UIComboBox series;
private UIComboBox value; private UIComboBox value;
@ -169,11 +167,7 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), function}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), function},
}; };
double p = TableLayout.PREFERRED; JPanel panel = DataLayoutHelper.createDataLayoutPane(components);
double[] columnSize = {78, 122};
double[] rowSize = {p, p, p};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout(0, 6)); this.setLayout(new BorderLayout(0, 6));
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
@ -258,5 +252,10 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
protected Object[] createLine() { protected Object[] createLine() {
return new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Use_None")}; return new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Use_None")};
} }
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Name");
}
} }
} }

12
designer-chart/src/main/java/com/fr/design/chartx/component/SeriesValueFieldComboBoxPane.java

@ -27,23 +27,21 @@ public class SeriesValueFieldComboBoxPane extends AbstractCustomFieldComboBoxPan
@Override @Override
public void populateBean(SeriesValueCorrelationDefinition ob) { public void populateBean(SeriesValueCorrelationDefinition ob) {
populateNameOrValue(ob.isCustomFieldValue());
if (ob.isCustomFieldValue()) { if (ob.isCustomFieldValue()) {
populateCustomFieldNamePane(ob); populateCustomFieldNamePane(ob);
jcb.setSelectedIndex(1);
} else { } else {
populateUseFieldValuePane(ob); populateUseFieldValuePane(ob);
jcb.setSelectedIndex(0);
} }
} }
@Override @Override
public void updateBean(SeriesValueCorrelationDefinition ob) { public void updateBean(SeriesValueCorrelationDefinition ob) {
if (jcb.getSelectedIndex() == 0) { ob.setCustomFieldValue(updateNameOrValue());
ob.setCustomFieldValue(false); if (ob.isCustomFieldValue()) {
updateUseFieldValuePane(ob);
} else {
ob.setCustomFieldValue(true);
updateCustomFieldNamePane(ob); updateCustomFieldNamePane(ob);
} else {
updateUseFieldValuePane(ob);
} }
} }

69
designer-chart/src/main/java/com/fr/design/chartx/data/DataLayoutHelper.java

@ -0,0 +1,69 @@
package com.fr.design.chartx.data;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.Component;
import java.util.Arrays;
/**
* @author shine
* @version 10.0
* Created by shine on 2020/7/22
*/
public class DataLayoutHelper {
public static int WIDTH = 150;
public static int LABEL_HEIGHT = 20;
public static int LABEL_WIDTH = 65;
public static int LEFT_GAP = 15;
public static int RIGHT_GAP = 10;
public static void setWIDTH(int WIDTH) {
DataLayoutHelper.WIDTH = WIDTH;
}
public static void setLabelHeight(int labelHeight) {
LABEL_HEIGHT = labelHeight;
}
public static void setLabelWidth(int labelWidth) {
LABEL_WIDTH = labelWidth;
}
public static void setLeftGap(int leftGap) {
LEFT_GAP = leftGap;
}
public static void setRightGap(int rightGap) {
RIGHT_GAP = rightGap;
}
public static JPanel createDataLayoutPane(Component[][] components) {
int len = components.length;
double p = TableLayout.PREFERRED;
double[] columnSize = {DataLayoutHelper.LABEL_WIDTH, DataLayoutHelper.WIDTH};
double[] rowSize = new double[len];
Arrays.fill(rowSize, p);
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
public static JPanel createDataLayoutPane(String label, Component component) {
Component[][] components = new Component[][]{
new Component[]{new UILabel(label, SwingConstants.LEFT), component}
};
return createDataLayoutPane(components);
}
public static void addNormalBorder(JComponent component) {
component.setBorder(BorderFactory.createEmptyBorder(0, DataLayoutHelper.LEFT_GAP, 0, DataLayoutHelper.RIGHT_GAP));
}
}

15
designer-chart/src/main/java/com/fr/design/chartx/data/map/AbstractAreaLngLatPane.java

@ -1,18 +1,15 @@
package com.fr.design.chartx.data.map; package com.fr.design.chartx.data.map;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; 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 javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.util.Arrays;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
@ -67,8 +64,10 @@ public abstract class AbstractAreaLngLatPane extends JPanel {
locationType.setSelectedIndex(0); locationType.setSelectedIndex(0);
JPanel northPane = DataLayoutHelper.createDataLayoutPane(Toolkit.i18nText("FR-Plugin_Design_Geographic_Location"), locationType);
this.setLayout(new BorderLayout(0, 6)); this.setLayout(new BorderLayout(0, 6));
this.add(locationType, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
} }
@ -103,12 +102,8 @@ public abstract class AbstractAreaLngLatPane extends JPanel {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponents[i]}; components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponents[i]};
} }
double p = TableLayout.PREFERRED;
double[] columnSize = {ChartDataPane.LABEL_WIDTH, 122};
double[] rowSize = new double[len];
Arrays.fill(rowSize, p);
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 6); return DataLayoutHelper.createDataLayoutPane(components);
} }
} }

1
designer-chart/src/main/java/com/fr/design/chartx/data/map/MapChartDataPane.java

@ -38,6 +38,7 @@ public class MapChartDataPane extends AbstractChartDataPane<MapChartDataDefiniti
VanChartMapPlot mapPlot = this.getVanChart().getPlot(); VanChartMapPlot mapPlot = this.getVanChart().getPlot();
mapType = mapPlot == null ? mapType : mapPlot.getMapType(); mapType = mapPlot == null ? mapType : mapPlot.getMapType();
} }
AreaMapDataSetFieldsPane areaMapDataSetFieldsPane; AreaMapDataSetFieldsPane areaMapDataSetFieldsPane;
PointMapDataSetFieldsPane pointMapDataSetFieldsPane; PointMapDataSetFieldsPane pointMapDataSetFieldsPane;
LineMapDataSetFieldsPane lineMapDataSetFieldsPane; LineMapDataSetFieldsPane lineMapDataSetFieldsPane;

15
designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java

@ -3,17 +3,13 @@ package com.fr.design.chartx.fields;
import com.fr.chartx.data.field.AbstractColumnFieldCollection; import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.ColumnField; import com.fr.chartx.data.field.ColumnField;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.util.Arrays;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
@ -46,8 +42,6 @@ public abstract class AbstractCellDataFieldsPane<T extends AbstractColumnFieldCo
if (south != null) { if (south != null) {
this.add(south, BorderLayout.SOUTH); this.add(south, BorderLayout.SOUTH);
} }
this.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
} }
protected JPanel createCenterPane() { protected JPanel createCenterPane() {
@ -65,12 +59,7 @@ public abstract class AbstractCellDataFieldsPane<T extends AbstractColumnFieldCo
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), formulaPanes[i]}; components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), formulaPanes[i]};
} }
double p = TableLayout.PREFERRED; return DataLayoutHelper.createDataLayoutPane(components);
double[] columnSize = {ChartDataPane.LABEL_WIDTH, 122};
double[] rowSize = new double[len];
Arrays.fill(rowSize, p);
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 6);
} }

15
designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractDataSetFieldsPane.java

@ -4,25 +4,21 @@ import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.ColumnField; import com.fr.chartx.data.field.ColumnField;
import com.fr.data.util.function.AbstractDataFunction; import com.fr.data.util.function.AbstractDataFunction;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
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.CalculateComboBox; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper; import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.util.Arrays;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.List;
import static com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper.refreshBoxItems; import static com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper.refreshBoxItems;
@ -49,7 +45,6 @@ public abstract class AbstractDataSetFieldsPane<T extends AbstractColumnFieldCol
protected void initComponents() { protected void initComponents() {
this.setLayout(new BorderLayout(0, 6)); this.setLayout(new BorderLayout(0, 6));
this.setBorder(BorderFactory.createEmptyBorder(6, 24, 0, 15));
JPanel north = createNorthPane(), JPanel north = createNorthPane(),
center = createCenterPane(), center = createCenterPane(),
@ -86,12 +81,8 @@ public abstract class AbstractDataSetFieldsPane<T extends AbstractColumnFieldCol
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponents[i]}; components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponents[i]};
} }
double p = TableLayout.PREFERRED;
double[] columnSize = {ChartDataPane.LABEL_WIDTH, 122};
double[] rowSize = new double[len];
Arrays.fill(rowSize, p);
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 6); return DataLayoutHelper.createDataLayoutPane(components);
} }
protected JPanel createSouthPane() { protected JPanel createSouthPane() {

7
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java

@ -5,23 +5,24 @@ import com.fr.base.Utils;
import com.fr.chartx.TwoTuple; import com.fr.chartx.TwoTuple;
import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue; import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue;
import com.fr.design.chartx.component.MapAreaMatchPane; import com.fr.design.chartx.component.MapAreaMatchPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.DialogActionListener;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.plugin.chart.map.data.MapMatchResult;
import com.fr.plugin.chart.map.VanChartMapPlot; import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.map.data.MapMatchResult;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import com.fr.plugin.chart.vanchart.VanChart; import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import java.util.Set;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.Set;
/** /**
* @author Bjorn * @author Bjorn
@ -53,7 +54,7 @@ public abstract class MapDataSetFieldsPane<T extends ColumnFieldCollectionWithSe
public JPanel createAreaPanel(final UIComboBox areaBox) { public JPanel createAreaPanel(final UIComboBox areaBox) {
JPanel areaPanel = new JPanel(new BorderLayout(10, 0)); JPanel areaPanel = new JPanel(new BorderLayout(10, 0));
areaBox.setPreferredSize(new Dimension(91, 20)); areaBox.setPreferredSize(new Dimension(DataLayoutHelper.WIDTH - 10 - 20, DataLayoutHelper.LABEL_HEIGHT));
areaPanel.add(areaBox, BorderLayout.WEST); areaPanel.add(areaBox, BorderLayout.WEST);
UIButton uiButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png")); UIButton uiButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png"));
uiButton.addActionListener(new ActionListener() { uiButton.addActionListener(new ActionListener() {

2
designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java

@ -2,6 +2,7 @@ package com.fr.design.chartx.single;
import com.fr.chartx.data.CellDataDefinition; import com.fr.chartx.data.CellDataDefinition;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; import com.fr.design.chartx.fields.AbstractCellDataFieldsPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -23,6 +24,7 @@ public class CellDataPane extends FurtherBasicBeanPane<CellDataDefinition> {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(cellDataFieldsPane, BorderLayout.CENTER); this.add(cellDataFieldsPane, BorderLayout.CENTER);
DataLayoutHelper.addNormalBorder(this);
} }
@Override @Override

30
designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java

@ -3,25 +3,20 @@ package com.fr.design.chartx.single;
import com.fr.chartx.data.DataSetDefinition; import com.fr.chartx.data.DataSetDefinition;
import com.fr.data.impl.NameTableData; import com.fr.data.impl.NameTableData;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane; import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane;
import com.fr.design.utils.gui.UIComponentUtils;
import java.util.List; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.util.List;
/** /**
* Created by shine on 2019/5/21. * Created by shine on 2019/5/21.
*/ */
public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> { public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
private static final int TABLE_DATA_LABEL_LINE_WRAP_WIDTH = 65;
private static final int TABLE_DATA_PANE_WIDTH = 246;
private DatabaseTableDataPane tableDataPane; private DatabaseTableDataPane tableDataPane;
@ -32,24 +27,27 @@ public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
} }
private void initComps(AbstractDataSetFieldsPane dataSetFieldsPane) { private void initComps(AbstractDataSetFieldsPane dataSetFieldsPane) {
UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Table_Data")); tableDataPane = new DatabaseTableDataPane(null) {
UIComponentUtils.setLineWrap(label, TABLE_DATA_LABEL_LINE_WRAP_WIDTH);
UIComponentUtils.setPreferedWidth(label, ChartDataPane.LABEL_WIDTH);
tableDataPane = new DatabaseTableDataPane(label) {
@Override @Override
protected void userEvent() { protected void userEvent() {
refreshBoxListAndTableName(); refreshBoxListAndTableName();
checkBoxUse(); checkBoxUse();
} }
@Override
protected void setBorder() {
}
}; };
tableDataPane.setPreferredSize(new Dimension(TABLE_DATA_PANE_WIDTH, tableDataPane.getPreferredSize().height));
this.dataSetFieldsPane = dataSetFieldsPane; this.dataSetFieldsPane = dataSetFieldsPane;
this.setLayout(new BorderLayout()); JPanel northPane = DataLayoutHelper.createDataLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Table_Data"), tableDataPane);
this.add(tableDataPane, BorderLayout.NORTH); this.setLayout(new BorderLayout(0, 6));
this.add(northPane, BorderLayout.NORTH);
this.add(dataSetFieldsPane, BorderLayout.CENTER); this.add(dataSetFieldsPane, BorderLayout.CENTER);
DataLayoutHelper.addNormalBorder(this);
checkBoxUse(); checkBoxUse();
} }

22
designer-chart/src/main/java/com/fr/design/chartx/single/SingleDataPane.java

@ -3,28 +3,22 @@ package com.fr.design.chartx.single;
import com.fr.chartx.data.AbstractDataDefinition; import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.chartx.fields.AbstractCellDataFieldsPane; import com.fr.design.chartx.fields.AbstractCellDataFieldsPane;
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane; import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.UIComponentUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.awt.BorderLayout;
/** /**
* Created by shine on 2019/5/21. * Created by shine on 2019/5/21.
*/ */
public class SingleDataPane extends BasicBeanPane<AbstractDataDefinition> { public class SingleDataPane extends BasicBeanPane<AbstractDataDefinition> {
private static final int TABLE_DATA_LABEL_LINE_WIDTH = 81;
private UIComboBoxPane<AbstractDataDefinition> comboBoxPane; private UIComboBoxPane<AbstractDataDefinition> comboBoxPane;
private DataSetPane dataSetPane; private DataSetPane dataSetPane;
@ -50,18 +44,12 @@ public class SingleDataPane extends BasicBeanPane<AbstractDataDefinition> {
} }
protected void initLayout() { protected void initLayout() {
this.setLayout(new BorderLayout(LayoutConstants.HGAP_LARGE, 6)); this.setLayout(new BorderLayout(0, 6));
JPanel northPane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE, 0)); JPanel northPane = DataLayoutHelper.createDataLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Data_Source"), jcb);
DataLayoutHelper.addNormalBorder(northPane);
UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Source"));
UIComponentUtils.setPreferedWidth(label, TABLE_DATA_LABEL_LINE_WIDTH);
northPane.add(label,BorderLayout.WEST);
northPane.add(jcb, BorderLayout.CENTER);
northPane.setBorder(BorderFactory.createEmptyBorder(5,24,0,15));
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER); this.add(cardPane, BorderLayout.CENTER);
} }
@Override @Override

8
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java

@ -7,9 +7,9 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.TopDefinition; import com.fr.chart.chartdata.TopDefinition;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.style.AbstractChartTabPane; import com.fr.design.mainframe.chart.gui.style.AbstractChartTabPane;
@ -21,12 +21,12 @@ import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.util.ArrayList;
import java.util.List;
/** /**
* 图表数据 分类 系列 过滤界面. * 图表数据 分类 系列 过滤界面.
@ -37,7 +37,7 @@ import java.util.List;
public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> { public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
private static final long serialVersionUID = 3650522989381790194L; private static final long serialVersionUID = 3650522989381790194L;
private static final int PAN_WIDTH = 246; private static final int PAN_WIDTH = 246;
private static final int FIL_HEIGHT = 150; private static final int FIL_HEIGHT = 200;
private CategoryFilterPane categoryPane; private CategoryFilterPane categoryPane;
private SeriesFilterPane seriesPane; private SeriesFilterPane seriesPane;

18
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java

@ -99,13 +99,13 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {f}; double[] columnSize = {f};
double[] rowSize = {p, p, p, p}; double[] rowSize = {p, p, p, p};
UILabel Label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name")); UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name"));
Label1.setPreferredSize(new Dimension(75, 20)); label1.setPreferredSize(getLabelDimension());
UILabel Label2 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Value")); UILabel label2 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Value"));
Label2.setPreferredSize(new Dimension(75, 20)); label2.setPreferredSize(getLabelDimension());
UILabel Label3 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method")); UILabel label3 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"));
Label3.setPreferredSize(new Dimension(75, 20)); label3.setPreferredSize(getLabelDimension());
Component[][] components = getUseComponentWithOutSummary(Label1, Label2, Label3); Component[][] components = getUseComponentWithOutSummary(label1, label2, label3);
centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 4, 6); centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 4, 6);
centerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); centerPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1));
@ -113,6 +113,10 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
this.add(centerPane, BorderLayout.CENTER); this.add(centerPane, BorderLayout.CENTER);
} }
protected Dimension getLabelDimension() {
return new Dimension(75, 20);
}
protected Component[][] getUseComponent(UILabel Label1, UILabel Label2, UILabel Label3) { protected Component[][] getUseComponent(UILabel Label1, UILabel Label2, UILabel Label3) {
return new Component[][]{ return new Component[][]{
new Component[]{GUICoreUtils.createBorderLayoutPane(new Component[]{seriesName, null, null, Label1, null})}, new Component[]{GUICoreUtils.createBorderLayoutPane(new Component[]{seriesName, null, null, Label1, null})},

20
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java

@ -100,24 +100,30 @@ public class SeriesTypeUseComboxPane extends BasicBeanPane<ChartCollection> {
protected void initLayout() { protected void initLayout() {
this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM)); this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM));
JPanel northPane = new JPanel(new BorderLayout(4, 0)); JPanel northPane = new JPanel(new BorderLayout(4, 0));
UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); //使用系列名/系列值选项面板
JPanel borderLayoutPane = GUICoreUtils.createBorderLayoutPane(new Component[]{content, null, null, label1, null}); UILabel seriesLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
seriesLabel.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
JPanel borderLayoutPane = GUICoreUtils.createBorderLayoutPane(new Component[]{content, null, null, seriesLabel, null});
northPane.add(borderLayoutPane); northPane.add(borderLayoutPane);
northPane.setBorder(BorderFactory.createEmptyBorder(10, 24, 0, 15)); northPane.setBorder(BorderFactory.createEmptyBorder(10, 24, 0, 16));
cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
//系列名/系列值配置面板
cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
this.add(cardPane, BorderLayout.CENTER); this.add(cardPane, BorderLayout.CENTER);
//数据筛选
dataScreeningPane = new ChartDataFilterPane(this.initplot, parent); dataScreeningPane = new ChartDataFilterPane(this.initplot, parent);
JPanel panel = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 250, 24, dataScreeningPane); JPanel panel = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 250, 24, dataScreeningPane);
panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 15)); panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
this.add(panel, BorderLayout.SOUTH); this.add(panel, BorderLayout.SOUTH);
} }
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension preferredSize = super.getPreferredSize(); Dimension preferredSize = super.getPreferredSize();
return new Dimension(260, (int) preferredSize.getHeight()); return new Dimension(246, (int) preferredSize.getHeight());
} }
/** /**

12
designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java

@ -27,21 +27,19 @@ public class ExtendedCustomFieldComboBoxPane extends AbstractCustomFieldComboBox
public void populateBean(AbstractDataConfig ob) { public void populateBean(AbstractDataConfig ob) {
if (ob.isCustomName()) { if (ob.isCustomName()) {
populateCustomFieldNamePane(ob); populateCustomFieldNamePane(ob);
jcb.setSelectedIndex(1);
} else { } else {
populateUseFieldValuePane(ob); populateUseFieldValuePane(ob);
jcb.setSelectedIndex(0);
} }
populateNameOrValue(ob.isCustomName());
} }
@Override @Override
public void updateBean(AbstractDataConfig ob) { public void updateBean(AbstractDataConfig ob) {
if (jcb.getSelectedIndex() == 0) { ob.setCustomName(updateNameOrValue());
ob.setCustomName(false); if (ob.isCustomName()) {
updateUseFieldValuePane(ob);
} else {
ob.setCustomName(true);
updateCustomFieldNamePane(ob); updateCustomFieldNamePane(ob);
} else {
updateUseFieldValuePane(ob);
} }
} }

15
designer-chart/src/main/java/com/fr/van/chart/box/BoxIndependentVanChartInterface.java

@ -6,15 +6,17 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.AbstractChartAttrPane; import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.van.chart.box.data.report.BoxPlotReportDataContentPane; import com.fr.van.chart.box.data.report.BoxPlotReportDataContentPane;
import com.fr.van.chart.box.data.table.BoxPlotTableDataContentPane; import com.fr.van.chart.box.data.table.BoxPlotTableDataContentPane;
import com.fr.van.chart.designer.other.AutoRefreshPane;
import com.fr.van.chart.designer.other.AutoRefreshPaneWithoutTooltip;
import com.fr.van.chart.designer.other.VanChartInteractivePane; import com.fr.van.chart.designer.other.VanChartInteractivePane;
import com.fr.van.chart.designer.other.VanChartOtherPane; import com.fr.van.chart.designer.other.VanChartOtherPane;
import com.fr.van.chart.designer.other.zoom.ZoomPane; import com.fr.van.chart.designer.other.zoom.ZoomPane;
@ -73,15 +75,12 @@ public class BoxIndependentVanChartInterface extends AbstractIndependentVanChart
return new VanChartInteractivePane() { return new VanChartInteractivePane() {
protected Component[][] createToolBarComponents() { protected Component[][] createToolBarComponents() {
return new Component[][]{ return createToolBarComponentsWithOutSort();
new Component[]{null, exportImages},
new Component[]{null, fullScreenDisplay}
};
} }
protected double[] getToolBarRowSize() { protected AutoRefreshPane getMoreLabelPane(VanChartPlot plot) {
double p = TableLayout.PREFERRED; boolean isLargeModel = largeModel(plot);
return new double[]{p, p}; return new AutoRefreshPaneWithoutTooltip(chart, isLargeModel);
} }
protected ZoomPane createZoomPane() { protected ZoomPane createZoomPane() {

4
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxPlotTooltipPane.java

@ -2,6 +2,7 @@ package com.fr.van.chart.box;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.plugin.chart.base.AttrTooltip; import com.fr.plugin.chart.base.AttrTooltip;
import com.fr.plugin.chart.box.VanChartBoxPlot;
import com.fr.plugin.chart.box.attr.AttrBoxTooltip; import com.fr.plugin.chart.box.attr.AttrBoxTooltip;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipPane; import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipPane;
@ -13,7 +14,8 @@ public class VanChartBoxPlotTooltipPane extends VanChartPlotTooltipPane {
} }
protected void initTooltipContentPane(Plot plot) { protected void initTooltipContentPane(Plot plot) {
tooltipContentPane = new VanChartBoxTooltipContentPane(parent, VanChartBoxPlotTooltipPane.this); boolean isDetailed = ((VanChartBoxPlot) plot).isDetailed();
tooltipContentPane = new VanChartBoxTooltipContentPane(parent, VanChartBoxPlotTooltipPane.this, isDetailed);
} }
protected AttrTooltip getAttrTooltip() { protected AttrTooltip getAttrTooltip() {

93
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java

@ -1,6 +1,8 @@
package com.fr.van.chart.box; package com.fr.van.chart.box;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent; import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
@ -10,10 +12,13 @@ import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane { public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
private boolean detailed;
private VanChartFormatPaneWithCheckBox number; private VanChartFormatPaneWithCheckBox number;
private VanChartFormatPaneWithCheckBox max; private VanChartFormatPaneWithCheckBox max;
private VanChartFormatPaneWithCheckBox q3; private VanChartFormatPaneWithCheckBox q3;
@ -22,8 +27,12 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
private VanChartFormatPaneWithCheckBox min; private VanChartFormatPaneWithCheckBox min;
private VanChartFormatPaneWithCheckBox outlier; private VanChartFormatPaneWithCheckBox outlier;
public VanChartBoxTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) { private JPanel dataNumberPane;
private JPanel dataOutlierPane;
public VanChartBoxTooltipContentPane(VanChartStylePane parent, JPanel showOnPane, boolean isDetailed) {
super(parent, showOnPane); super(parent, showOnPane);
checkFormatVisible(isDetailed);
} }
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) { protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
@ -67,22 +76,79 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
}; };
} }
protected JPanel createCommonPanel() {
JPanel commonPanel = new JPanel(new BorderLayout());
commonPanel.add(createCateAndSeriesPane(), BorderLayout.NORTH);
commonPanel.add(createDataNumberPane(), BorderLayout.CENTER);
commonPanel.add(createDataDetailPane(), BorderLayout.SOUTH);
return commonPanel;
}
protected double[] getRowSize(double p) { protected double[] getRowSize(double p) {
return new double[]{p, p, p, p, p, p, p, p, p}; return new double[]{p, p, p, p, p, p, p, p, p, p, p, p};
} }
protected Component[][] getPaneComponents() { private JPanel createCateAndSeriesPane() {
return new Component[][]{ double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f, p};
double[] rowSize = {p, p};
Component[][] cateAndSeries = new Component[][]{
new Component[]{categoryNameFormatPane, null}, new Component[]{categoryNameFormatPane, null},
new Component[]{seriesNameFormatPane, null}, new Component[]{seriesNameFormatPane, null}
};
return TableLayoutHelper.createTableLayoutPane(cateAndSeries, rowSize, columnSize);
}
private JPanel createDataNumberPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f, p};
double[] rowSize = {p, p};
Component[][] dataNumber = new Component[][]{
new Component[]{null, null},
new Component[]{number, null}, new Component[]{number, null},
};
dataNumberPane = TableLayoutHelper.createTableLayoutPane(dataNumber, rowSize, columnSize);
return dataNumberPane;
}
private JPanel createDataDetailPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f, p};
JPanel detailPane = new JPanel(new BorderLayout());
Component[][] dataDetail = new Component[][]{
new Component[]{null, null},
new Component[]{max, null}, new Component[]{max, null},
new Component[]{q3, null}, new Component[]{q3, null},
new Component[]{median, null}, new Component[]{median, null},
new Component[]{q1, null}, new Component[]{q1, null},
new Component[]{min, null}, new Component[]{min, null}
new Component[]{outlier, null} };
Component[][] dataOutlier = new Component[][]{
new Component[]{null, null},
new Component[]{outlier, null},
}; };
dataOutlierPane = TableLayoutHelper.createTableLayoutPane(dataOutlier, new double[]{p, p}, columnSize);
detailPane.add(TableLayoutHelper.createTableLayoutPane(dataDetail, new double[]{p, p, p, p, p, p}, columnSize), BorderLayout.NORTH);
detailPane.add(dataOutlierPane, BorderLayout.CENTER);
return detailPane;
} }
public boolean isDirty() { public boolean isDirty() {
@ -110,7 +176,7 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
} }
protected AttrTooltipContent createAttrTooltip() { protected AttrTooltipContent createAttrTooltip() {
return new AttrBoxTooltipContent(); return new AttrBoxTooltipContent(detailed);
} }
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
@ -127,6 +193,8 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
q1.populate(boxTooltipContent.getQ1()); q1.populate(boxTooltipContent.getQ1());
min.populate(boxTooltipContent.getMin()); min.populate(boxTooltipContent.getMin());
outlier.populate(boxTooltipContent.getOutlier()); outlier.populate(boxTooltipContent.getOutlier());
checkFormatVisible(boxTooltipContent.isDetailed());
} }
} }
@ -144,6 +212,15 @@ public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
q1.update(boxTooltipContent.getQ1()); q1.update(boxTooltipContent.getQ1());
min.update(boxTooltipContent.getMin()); min.update(boxTooltipContent.getMin());
outlier.update(boxTooltipContent.getOutlier()); outlier.update(boxTooltipContent.getOutlier());
boxTooltipContent.setDetailed(this.detailed);
} }
} }
public void checkFormatVisible(boolean detailed) {
this.detailed = detailed;
dataNumberPane.setVisible(detailed);
dataOutlierPane.setVisible(detailed);
}
} }

12
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipPane.java

@ -1,6 +1,9 @@
package com.fr.van.chart.box; package com.fr.van.chart.box;
import com.fr.chart.base.DataSeriesCondition;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.AttrTooltip;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipPane; import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipPane;
import com.fr.van.chart.designer.style.tooltip.VanChartTooltipPane; import com.fr.van.chart.designer.style.tooltip.VanChartTooltipPane;
@ -14,4 +17,13 @@ public class VanChartBoxTooltipPane extends VanChartTooltipPane {
protected VanChartPlotTooltipPane getTooltipPane(Plot plot) { protected VanChartPlotTooltipPane getTooltipPane(Plot plot) {
return new VanChartBoxPlotTooltipPane(plot, parent); return new VanChartBoxPlotTooltipPane(plot, parent);
} }
public void populateTooltipPane(Plot plot) {
DataSeriesCondition attr = ((VanChartPlot) plot).getAttrTooltipFromConditionCollection();
VanChartPlotTooltipPane tooltipPane = getPlotTooltipPane();
if (tooltipPane instanceof VanChartBoxPlotTooltipPane) {
tooltipPane.populate((AttrTooltip) attr);
}
}
} }

4
designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java

@ -58,7 +58,7 @@ public class BoxPlotReportDataContentPane extends AbstractReportDataContentPane
pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null})); pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null}));
pane.setPreferredSize(new Dimension(246, 30)); pane.setPreferredSize(new Dimension(246, 30));
pane.setBorder(BorderFactory.createEmptyBorder(0, 24, 10, 15)); pane.setBorder(BorderFactory.createEmptyBorder(0, 18, 10, 15));
return pane; return pane;
} }
@ -101,7 +101,7 @@ public class BoxPlotReportDataContentPane extends AbstractReportDataContentPane
boolean isDetailed = dataType.getSelectedIndex() == 0; boolean isDetailed = dataType.getSelectedIndex() == 0;
report.setDetailed(isDetailed); report.setDetailed(isDetailed);
((VanChartBoxPlot) initplot).setDetailed(isDetailed); ((VanChartBoxPlot) initplot).updateDetailedAttr(isDetailed);
} }
if (detailedDataSeriesPane != null) { if (detailedDataSeriesPane != null) {
detailedDataSeriesPane.updateBean(collection); detailedDataSeriesPane.updateBean(collection);

2
designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java

@ -154,7 +154,7 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
boolean isDetailed = dataType.getSelectedIndex() == 0; boolean isDetailed = dataType.getSelectedIndex() == 0;
table.setDetailed(isDetailed); table.setDetailed(isDetailed);
((VanChartBoxPlot) initplot).setDetailed(isDetailed); ((VanChartBoxPlot) initplot).updateDetailedAttr(isDetailed);
} }
if (seriesTypeComboxPane != null) { if (seriesTypeComboxPane != null) {
seriesTypeComboxPane.updateBean(collection); seriesTypeComboxPane.updateBean(collection);

16
designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableResultDataSeriesPane.java

@ -56,11 +56,16 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
median = createUIComboBoxWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Median")); median = createUIComboBoxWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Median"));
q1 = createUIComboBoxWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q1")); q1 = createUIComboBoxWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q1"));
min = createUIComboBoxWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Min")); min = createUIComboBoxWithEditLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Min"));
addNoneItem();
seriesName.setSelectedItem(null);
median.populateComboBox(null);
} }
private JPanel createUIComboBoxPane(UIComboBox comboBox, String title) { private JPanel createUIComboBoxPane(UIComboBox comboBox, String title) {
UILabel label = new UILabel(title); UILabel label = new UILabel(title);
label.setPreferredSize(new Dimension(75, 20)); label.setPreferredSize(new Dimension(80, 20));
JPanel panel = new JPanel(); JPanel panel = new JPanel();
@ -134,6 +139,8 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
refreshBoxItems(median.getComboBox(), list); refreshBoxItems(median.getComboBox(), list);
refreshBoxItems(q1.getComboBox(), list); refreshBoxItems(q1.getComboBox(), list);
refreshBoxItems(min.getComboBox(), list); refreshBoxItems(min.getComboBox(), list);
addNoneItem();
} }
public void clearAllBoxList() { public void clearAllBoxList() {
@ -145,6 +152,13 @@ public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPa
clearBoxItems(median.getComboBox()); clearBoxItems(median.getComboBox());
clearBoxItems(q1.getComboBox()); clearBoxItems(q1.getComboBox());
clearBoxItems(min.getComboBox()); clearBoxItems(min.getComboBox());
addNoneItem();
}
private void addNoneItem() {
seriesName.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
median.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} }
public void populateBean(ChartCollection collection) { public void populateBean(ChartCollection collection) {

7
designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableSeriesNameUseFieldValuePane.java

@ -1,12 +1,19 @@
package com.fr.van.chart.box.data.table; package com.fr.van.chart.box.data.table;
import com.fr.chart.chartdata.OneValueCDDefinition; import com.fr.chart.chartdata.OneValueCDDefinition;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldValuePane; import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldValuePane;
import com.fr.plugin.chart.box.data.VanBoxOneValueCDDefinition; import com.fr.plugin.chart.box.data.VanBoxOneValueCDDefinition;
import java.awt.Dimension;
public class BoxPlotTableSeriesNameUseFieldValuePane extends SeriesNameUseFieldValuePane { public class BoxPlotTableSeriesNameUseFieldValuePane extends SeriesNameUseFieldValuePane {
protected OneValueCDDefinition createOneValueCDDefinition() { protected OneValueCDDefinition createOneValueCDDefinition() {
return new VanBoxOneValueCDDefinition(); return new VanBoxOneValueCDDefinition();
} }
protected Dimension getLabelDimension() {
return new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT);
}
} }

99
designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableSeriesTypeUsePane.java

@ -5,9 +5,10 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartdata.MoreNameCDDefinition; import com.fr.chart.chartdata.MoreNameCDDefinition;
import com.fr.chart.chartdata.NormalTableDataDefinition; import com.fr.chart.chartdata.NormalTableDataDefinition;
import com.fr.chart.chartdata.OneValueCDDefinition; import com.fr.chart.chartdata.OneValueCDDefinition;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -15,7 +16,6 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper; import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.box.data.VanBoxTableDefinition; import com.fr.plugin.chart.box.data.VanBoxTableDefinition;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -24,57 +24,102 @@ import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollection> { public class BoxPlotTableSeriesTypeUsePane extends BasicBeanPane<ChartCollection> {
private static boolean NEED_SUMMERY = false; private static final boolean NEED_SUMMERY = false;
private UIComboBox categoryCombox; private UIComboBox categoryCombox;
private BoxPlotTableSeriesNameUseFieldValuePane nameFieldValuePane; private BoxPlotTableSeriesNameUseFieldValuePane nameFieldValuePane;
private BoxPlotTableSeriesNameUseFieldNamePane nameFieldNamePane; private BoxPlotTableSeriesNameUseFieldNamePane nameFieldNamePane;
private UIButtonGroup<Integer> seriesFrom;
private JPanel cardPane;
public BoxPlotTableSeriesTypeUsePane() { public BoxPlotTableSeriesTypeUsePane() {
cards = initPaneList();
initComponents(); initComponents();
initLayout();
initListener(); initListener();
} }
protected void initLayout() { private void initComponents() {
this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM)); nameFieldValuePane = new BoxPlotTableSeriesNameUseFieldValuePane();
nameFieldNamePane = new BoxPlotTableSeriesNameUseFieldNamePane();
nameFieldValuePane.relayoutPane(NEED_SUMMERY);
nameFieldNamePane.relayoutPane(NEED_SUMMERY);
cardPane = new JPanel(new CardLayout()) {
public Dimension getPreferredSize() {
if (seriesFrom.getSelectedIndex() == 0) {
return nameFieldValuePane.getPreferredSize();
} else {
return nameFieldNamePane.getPreferredSize();
}
}
};
cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
cardPane.add(nameFieldValuePane, nameFieldValuePane.title4PopupWindow());
cardPane.add(nameFieldNamePane, nameFieldNamePane.title4PopupWindow());
seriesFrom = new UIButtonGroup<>(new String[]{nameFieldValuePane.title4PopupWindow(), nameFieldNamePane.title4PopupWindow()});
seriesFrom.setSelectedIndex(0);
addItemChangeEvent();
}
private void addItemChangeEvent() {
seriesFrom.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkCardPane();
}
});
}
private void checkCardPane() {
comboBoxItemStateChanged();
CardLayout cl = (CardLayout) cardPane.getLayout();
if (seriesFrom.getSelectedIndex() == 0) {
cl.show(cardPane, nameFieldValuePane.title4PopupWindow());
} else {
cl.show(cardPane, nameFieldNamePane.title4PopupWindow());
}
}
private void initLayout() {
this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM));
this.add(createNorthPane(), BorderLayout.NORTH); this.add(createNorthPane(), BorderLayout.NORTH);
this.add(createCenterPane(), BorderLayout.CENTER); this.add(createCenterPane(), BorderLayout.CENTER);
this.add(cardPane, BorderLayout.SOUTH); this.add(cardPane, BorderLayout.SOUTH);
} }
protected UIComboBox createComboBox() {
UIComboBox uiComboBox = new UIComboBox();
UIComponentUtils.setPreferedWidth(uiComboBox, 100);
return uiComboBox;
}
private JPanel createNorthPane() { private JPanel createNorthPane() {
JPanel north = new JPanel(new BorderLayout(4, 0)); JPanel north = new JPanel(new BorderLayout(4, 0));
north.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); north.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, getBackground()));
UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category")); UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
categoryCombox = new UIComboBox(); categoryCombox = new UIComboBox();
categoryCombox.setPreferredSize(new Dimension(100, 20)); categoryCombox.setPreferredSize(new Dimension(100, 20));
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None")); categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
categoryCombox.setSelectedItem(null);
north.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, null, null, label, null})); north.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, null, null, label, null}));
north.setPreferredSize(new Dimension(246, 30)); north.setPreferredSize(new Dimension(246, 20));
north.setBorder(BorderFactory.createEmptyBorder(0, 24, 10, 15)); north.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
return north; return north;
} }
@ -84,7 +129,7 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From")); UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
center.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label, null})); center.add(GUICoreUtils.createBorderLayoutPane(new Component[]{seriesFrom, null, null, label, null}));
center.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); center.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
return center; return center;
@ -101,7 +146,7 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
public void checkBoxUse(boolean hasUse) { public void checkBoxUse(boolean hasUse) {
categoryCombox.setEnabled(hasUse); categoryCombox.setEnabled(hasUse);
jcb.setEnabled(hasUse); seriesFrom.setEnabled(hasUse);
nameFieldValuePane.checkUse(hasUse); nameFieldValuePane.checkUse(hasUse);
} }
@ -151,15 +196,15 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
} }
public void relayoutPane() { public void relayoutPane() {
if (jcb.getSelectedIndex() == 0) { if (seriesFrom.getSelectedIndex() == 0) {
nameFieldValuePane.relayoutPane(NEED_SUMMERY); nameFieldValuePane.relayoutPane(NEED_SUMMERY);
} else { } else {
nameFieldNamePane.relayoutPane(NEED_SUMMERY); nameFieldNamePane.relayoutPane(NEED_SUMMERY);
} }
} }
protected void comboBoxItemStateChanged() { private void comboBoxItemStateChanged() {
if (jcb.getSelectedIndex() == 0) { if (seriesFrom.getSelectedIndex() == 0) {
nameFieldValuePane.relayoutPane(NEED_SUMMERY); nameFieldValuePane.relayoutPane(NEED_SUMMERY);
} else { } else {
nameFieldNamePane.relayoutPane(NEED_SUMMERY); nameFieldNamePane.relayoutPane(NEED_SUMMERY);
@ -175,14 +220,16 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
} }
if (definition instanceof OneValueCDDefinition) { if (definition instanceof OneValueCDDefinition) {
this.setSelectedIndex(0); seriesFrom.setSelectedIndex(0);
nameFieldValuePane.populateDefinition(definition, NEED_SUMMERY); nameFieldValuePane.populateDefinition(definition, NEED_SUMMERY);
} else if (definition instanceof MoreNameCDDefinition) { } else if (definition instanceof MoreNameCDDefinition) {
this.setSelectedIndex(1); seriesFrom.setSelectedIndex(1);
nameFieldNamePane.populateDefinition(definition, NEED_SUMMERY); nameFieldNamePane.populateDefinition(definition, NEED_SUMMERY);
} }
populateCategoryItem(categoryCombox, definition.getCategoryName()); populateCategoryItem(categoryCombox, definition.getCategoryName());
checkCardPane();
} }
public void updateBean(ChartCollection collection) { public void updateBean(ChartCollection collection) {
@ -194,7 +241,7 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
NormalTableDataDefinition definition; NormalTableDataDefinition definition;
if (this.getSelectedIndex() == 0) { if (seriesFrom.getSelectedIndex() == 0) {
definition = nameFieldValuePane.updateDefinition(); definition = nameFieldValuePane.updateDefinition();
} else { } else {
definition = nameFieldNamePane.updateDefinition(table.getDetailedDefinition()); definition = nameFieldNamePane.updateDefinition(table.getDetailedDefinition());
@ -221,4 +268,8 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
} }
} }
public ChartCollection updateBean() {
return null;
}
} }

6
designer-chart/src/main/java/com/fr/van/chart/box/data/table/UIComboBoxWithEditLabel.java

@ -29,7 +29,7 @@ public abstract class UIComboBoxWithEditLabel extends JPanel implements UIObserv
} }
}; };
editLabel.setPreferredSize(new Dimension(75, 20)); editLabel.setPreferredSize(new Dimension(80, 20));
comboBox = new UIComboBox(); comboBox = new UIComboBox();
this.setLayout(new BorderLayout(4, 0)); this.setLayout(new BorderLayout(4, 0));
@ -45,6 +45,10 @@ public abstract class UIComboBoxWithEditLabel extends JPanel implements UIObserv
this.comboBox = comboBox; this.comboBox = comboBox;
} }
public void addItem(String value) {
comboBox.addItem(value);
}
protected void addItemListener(ItemListener aListener) { protected void addItemListener(ItemListener aListener) {
comboBox.addItemListener(aListener); comboBox.addItemListener(aListener);
} }

16
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java

@ -42,6 +42,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
protected ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane; protected ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane;
private JPanel centerPane; private JPanel centerPane;
private JPanel commonPanel;
private VanChartHtmlLabelPane htmlLabelPane; private VanChartHtmlLabelPane htmlLabelPane;
private VanChartStylePane parent; private VanChartStylePane parent;
@ -64,11 +65,8 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, p};
double[] rowSize = getRowSize(p);
final JPanel commonPanel = TableLayoutHelper.createTableLayoutPane(getPaneComponents(), rowSize, columnSize);
commonPanel = createCommonPanel();
htmlLabelPane = createHtmlLabelPane(); htmlLabelPane = createHtmlLabelPane();
htmlLabelPane.setParent(parent); htmlLabelPane.setParent(parent);
@ -109,6 +107,16 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return new VanChartHtmlLabelPaneWithOutWidthAndHeight(); return new VanChartHtmlLabelPaneWithOutWidthAndHeight();
} }
protected JPanel createCommonPanel() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f, p};
double[] rowSize = getRowSize(p);
return TableLayoutHelper.createTableLayoutPane(getPaneComponents(), rowSize, columnSize);
}
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane){ protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane){
categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane); categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane);
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane); seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane);

2
designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java

@ -22,6 +22,7 @@ import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot;
import com.fr.plugin.chart.axis.type.AxisPlotType; import com.fr.plugin.chart.axis.type.AxisPlotType;
import com.fr.plugin.chart.base.AttrEffect; import com.fr.plugin.chart.base.AttrEffect;
import com.fr.plugin.chart.base.AttrFloatColor;
import com.fr.plugin.chart.base.AttrLabel; import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.RefreshMoreLabel; import com.fr.plugin.chart.base.RefreshMoreLabel;
import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.base.VanChartAttrMarker;
@ -434,6 +435,7 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
conditionAttr.remove(ScatterAttrLabel.class); conditionAttr.remove(ScatterAttrLabel.class);
conditionAttr.remove(AttrEffect.class); conditionAttr.remove(AttrEffect.class);
conditionAttr.remove(AttrLineEffect.class); conditionAttr.remove(AttrLineEffect.class);
conditionAttr.remove(AttrFloatColor.class);
VanChartAttrMarker attrMarker = conditionAttr.getExisted(VanChartAttrMarker.class); VanChartAttrMarker attrMarker = conditionAttr.getExisted(VanChartAttrMarker.class);
if (attrMarker != null && !attrMarker.isCommon()) { if (attrMarker != null && !attrMarker.isCommon()) {

4
designer-chart/src/main/java/com/fr/van/chart/designer/other/condition/item/VanChartLineMapTooltipConditionPane.java

@ -4,7 +4,7 @@ package com.fr.van.chart.designer.other.condition.item;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.condition.ConditionAttributesPane;
import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipPane; import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipPane;
import com.fr.van.chart.map.line.VanChartLineMapPlotTooltipPane; import com.fr.van.chart.map.line.VanChartLineMapPlotTooltipNoCheckPane;
/** /**
* Created by hufan on 2016/12/23. * Created by hufan on 2016/12/23.
@ -16,6 +16,6 @@ public class VanChartLineMapTooltipConditionPane extends VanChartTooltipConditio
} }
protected VanChartPlotTooltipPane createTooltipContentsPane() { protected VanChartPlotTooltipPane createTooltipContentsPane() {
return new VanChartLineMapPlotTooltipPane(getPlot(), null); return new VanChartLineMapPlotTooltipNoCheckPane(getPlot(), null);
} }
} }

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

@ -1,7 +1,6 @@
package com.fr.van.chart.designer.style; package com.fr.van.chart.designer.style;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UIBubbleFloatPane; import com.fr.design.gui.frpane.UIBubbleFloatPane;
@ -61,6 +60,7 @@ public class VanChartPlotLegendPane extends BasicPane {
private UIButtonGroup<LayoutType> layoutButton; private UIButtonGroup<LayoutType> layoutButton;
private JPanel layoutPane; private JPanel layoutPane;
private VanChartFloatPositionPane customFloatPositionPane; private VanChartFloatPositionPane customFloatPositionPane;
private UIBubbleFloatPane uiBubbleFloatPane;
//区域显示策略 恢复用注释。下面4行删除。 //区域显示策略 恢复用注释。下面4行删除。
private UIButtonGroup<Integer> customSize; private UIButtonGroup<Integer> customSize;
@ -80,7 +80,7 @@ public class VanChartPlotLegendPane extends BasicPane {
initComponents(); initComponents();
} }
public VanChartPlotLegendPane(VanChartStylePane parent){ public VanChartPlotLegendPane(VanChartStylePane parent) {
this.parent = parent; this.parent = parent;
initComponents(); initComponents();
} }
@ -118,9 +118,9 @@ public class VanChartPlotLegendPane extends BasicPane {
new Component[]{legendPane}, new Component[]{legendPane},
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components,row,col); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
addLegendListener(); addLegendListener();
} }
@ -133,7 +133,7 @@ public class VanChartPlotLegendPane extends BasicPane {
}); });
} }
protected JPanel createLegendPaneWithoutHighlight(){ protected JPanel createLegendPaneWithoutHighlight() {
borderPane = new VanChartBorderWithRadiusPane(); borderPane = new VanChartBorderWithRadiusPane();
backgroundPane = new VanChartBackgroundWithOutImagePane(); backgroundPane = new VanChartBackgroundWithOutImagePane();
@ -141,19 +141,19 @@ public class VanChartPlotLegendPane extends BasicPane {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] rowSize = { p,p,p,p,p,p,p}; double[] rowSize = {p, p, p, p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),null}, new Component[]{createTitlePositionPane(new double[]{p, p, p}, columnSize), null},
new Component[]{createTitleStylePane(),null} , new Component[]{createTitleStylePane(), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), createDisplayStrategy()),null} new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), createDisplayStrategy()), null}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
protected JPanel createLegendPane(){ protected JPanel createLegendPane() {
borderPane = new VanChartBorderWithRadiusPane(); borderPane = new VanChartBorderWithRadiusPane();
backgroundPane = new VanChartBackgroundWithOutImagePane(); backgroundPane = new VanChartBackgroundWithOutImagePane();
highlightPane = createHighlightPane(); highlightPane = createHighlightPane();
@ -166,14 +166,14 @@ public class VanChartPlotLegendPane extends BasicPane {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] rowSize = { p,p,p,p,p,p,p,p}; double[] rowSize = {p, p, p, p, p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createTitlePositionPane(new double[]{p,p,p},columnSize),null}, new Component[]{createTitlePositionPane(new double[]{p, p, p}, columnSize), null},
new Component[]{createTitleStylePane(),null} , new Component[]{createTitleStylePane(), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"),borderPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Display_Strategy"), panel), null},
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
@ -205,12 +205,12 @@ public class VanChartPlotLegendPane extends BasicPane {
customFloatPositionButton.setEventBannded(true); customFloatPositionButton.setEventBannded(true);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),location}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Layout_Position")), location},
new Component[]{null,customFloatPositionButton} new Component[]{null, customFloatPositionButton}
}; };
customFloatPositionPane = new VanChartFloatPositionPane(); customFloatPositionPane = new VanChartFloatPositionPane();
layoutPane = createLayoutPane(); layoutPane = createLayoutPane();
initPositionListener(); initPositionListener();
@ -241,7 +241,7 @@ public class VanChartPlotLegendPane extends BasicPane {
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{f, e}); return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{f, e});
} }
private void initPositionListener(){ private void initPositionListener() {
location.addChangeListener(new ChangeListener() { location.addChangeListener(new ChangeListener() {
@Override @Override
@ -262,18 +262,20 @@ public class VanChartPlotLegendPane extends BasicPane {
checkLayoutPaneVisible(); checkLayoutPaneVisible();
checkDisplayStrategyUse(); checkDisplayStrategyUse();
if(customFloatPositionPane == null) { if (customFloatPositionPane == null) {
customFloatPositionPane = new VanChartFloatPositionPane(); customFloatPositionPane = new VanChartFloatPositionPane();
}
if (uiBubbleFloatPane == null) {
Point comPoint = customFloatPositionButton.getLocationOnScreen();
Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight());
uiBubbleFloatPane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) {
@Override
public void updateContentPane() {
parent.attributeChanged();
}
};
} }
Point comPoint = customFloatPositionButton.getLocationOnScreen(); uiBubbleFloatPane.show(VanChartPlotLegendPane.this, null);
Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth()/2 - GAP, comPoint.y + customFloatPositionButton.getHeight());
UIBubbleFloatPane<Style> pane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) {
@Override
public void updateContentPane() {
parent.attributeChanged();
}
};
pane.show(VanChartPlotLegendPane.this, null);
} }
}); });
} }
@ -309,19 +311,19 @@ public class VanChartPlotLegendPane extends BasicPane {
// return limitPane; // return limitPane;
} }
private JPanel createHighlightPane(){ private JPanel createHighlightPane() {
highlightButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); highlightButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_On"), Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false});
highlightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Highlight")); highlightLabel = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Highlight"));
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] rowSize = {p,p}; double[] rowSize = {p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null, null},
new Component[]{highlightLabel, highlightButton} new Component[]{highlightLabel, highlightButton}
}; };
return TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); return TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
} }
protected void checkAllUse() { protected void checkAllUse() {
@ -368,6 +370,7 @@ public class VanChartPlotLegendPane extends BasicPane {
/** /**
* 标题 * 标题
*
* @return 标题 * @return 标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
@ -375,7 +378,7 @@ public class VanChartPlotLegendPane extends BasicPane {
} }
public void updateBean(VanChartLegend legend) { public void updateBean(VanChartLegend legend) {
if(legend == null) { if (legend == null) {
legend = new VanChartLegend(); legend = new VanChartLegend();
} }
legend.setLegendVisible(isLegendVisible.isSelected()); legend.setLegendVisible(isLegendVisible.isSelected());
@ -383,7 +386,7 @@ public class VanChartPlotLegendPane extends BasicPane {
borderPane.update(legend); borderPane.update(legend);
backgroundPane.update(legend); backgroundPane.update(legend);
if(!customFloatPositionButton.isSelected()){ if (!customFloatPositionButton.isSelected()) {
legend.setPosition(location.getSelectedItem()); legend.setPosition(location.getSelectedItem());
} else { } else {
legend.setPosition(-1); legend.setPosition(-1);
@ -397,7 +400,7 @@ public class VanChartPlotLegendPane extends BasicPane {
//legend.setLimitAttribute(limitPane.updateBean()); //legend.setLimitAttribute(limitPane.updateBean());
legend.setFloatPercentX(customFloatPositionPane.getFloatPosition_x()); legend.setFloatPercentX(customFloatPositionPane.getFloatPosition_x());
legend.setFloatPercentY(customFloatPositionPane.getFloatPosition_y()); legend.setFloatPercentY(customFloatPositionPane.getFloatPosition_y());
if(highlightButton != null && highlightButton.getSelectedItem() != null){ if (highlightButton != null && highlightButton.getSelectedItem() != null) {
legend.setHighlight(highlightButton.getSelectedItem()); legend.setHighlight(highlightButton.getSelectedItem());
} }
} }
@ -408,7 +411,7 @@ public class VanChartPlotLegendPane extends BasicPane {
textAttrPane.populate(legend.getFRFont()); textAttrPane.populate(legend.getFRFont());
borderPane.populate(legend); borderPane.populate(legend);
backgroundPane.populate(legend); backgroundPane.populate(legend);
if(!legend.isFloating()){ if (!legend.isFloating()) {
location.setSelectedItem(legend.getPosition()); location.setSelectedItem(legend.getPosition());
} }
customFloatPositionButton.setSelected(legend.isFloating()); customFloatPositionButton.setSelected(legend.isFloating());
@ -420,7 +423,7 @@ public class VanChartPlotLegendPane extends BasicPane {
maxProportion.setValue(legend.getMaxHeight()); maxProportion.setValue(legend.getMaxHeight());
//区域显示策略 恢复用注释。取消注释。 //区域显示策略 恢复用注释。取消注释。
//limitPane.populateBean(legend.getLimitAttribute()); //limitPane.populateBean(legend.getLimitAttribute());
if(highlightButton != null){ if (highlightButton != null) {
highlightButton.setSelectedItem(legend.isHighlight()); highlightButton.setSelectedItem(legend.isHighlight());
boolean largeDataModel = PlotFactory.largeDataModel(plot); boolean largeDataModel = PlotFactory.largeDataModel(plot);
highlightButton.setEnabled(!largeDataModel); highlightButton.setEnabled(!largeDataModel);

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

@ -2,7 +2,6 @@ package com.fr.van.chart.designer.style;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.base.TextAttr; import com.fr.chart.base.TextAttr;
import com.fr.chartx.config.info.constant.ConfigType; import com.fr.chartx.config.info.constant.ConfigType;
@ -61,6 +60,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
private UIToggleButton useHtml; private UIToggleButton useHtml;
private UIToggleButton customFloatPositionButton; private UIToggleButton customFloatPositionButton;
private VanChartFloatPositionPane customFloatPositionPane; private VanChartFloatPositionPane customFloatPositionPane;
private UIBubbleFloatPane uiBubbleFloatPane;
//区域显示策略 恢复用注释。下面3行删除。 //区域显示策略 恢复用注释。下面3行删除。
private UIButtonGroup<Integer> limitSize; private UIButtonGroup<Integer> limitSize;
@ -101,7 +101,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
isTitleVisible.addActionListener(new ActionListener() { isTitleVisible.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -111,7 +111,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
} }
} }
private JPanel createTitlePane(){ private JPanel createTitlePane() {
backgroundPane = new VanChartBackgroundWithOutShadowWithRadiusPane(); backgroundPane = new VanChartBackgroundWithOutShadowWithRadiusPane();
@ -120,32 +120,32 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {p, f}; double[] columnSize = {p, f};
double[] column = {f, e}; double[] column = {f, e};
double[] rowSize = {p,p,p,p,p,p,p,p}; double[] rowSize = {p, p, p, p, p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createTitleContentPane(new double[]{p,p,p},column),null}, new Component[]{createTitleContentPane(new double[]{p, p, p}, column), null},
new Component[]{createTitlePositionPane(new double[]{p,p,p},column),null}, new Component[]{createTitlePositionPane(new double[]{p, p, p}, column), null},
new Component[]{createTitleStylePane(),null}, new Component[]{createTitleStylePane(), null},
new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane),null}, new Component[]{TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane), null},
new Component[]{createDisplayStrategy(),null} new Component[]{createDisplayStrategy(), null}
}; };
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
private JPanel createTitleContentPane(double[] row, double[] col){ private JPanel createTitleContentPane(double[] row, double[] col) {
titleContent = new TinyFormulaPane(); titleContent = new TinyFormulaPane();
useHtml = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Html")); useHtml = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Html"));
UIComponentUtils.setLineWrap(useHtml); UIComponentUtils.setLineWrap(useHtml);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null ,null}, new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"), SwingConstants.LEFT), titleContent}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text"), SwingConstants.LEFT), titleContent},
new Component[]{null ,useHtml}, new Component[]{null, useHtml},
}; };
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,row,col); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content"), panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content"), panel);
} }
private JPanel createTitlePositionPane(double[] row, double[] col){ private JPanel createTitlePositionPane(double[] row, double[] col) {
Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")};
@ -157,25 +157,25 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
customFloatPositionButton.setEventBannded(true); customFloatPositionButton.setEventBannded(true);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_BorderLayout_Constraints"), SwingConstants.LEFT),alignmentPane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_BorderLayout_Constraints"), SwingConstants.LEFT), alignmentPane},
new Component[]{null,customFloatPositionButton} new Component[]{null, customFloatPositionButton}
}; };
customFloatPositionPane = new VanChartFloatPositionPane(); customFloatPositionPane = new VanChartFloatPositionPane();
initPositionListener(); initPositionListener();
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components,row,col); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Form_Layout"), panel);
} }
private JPanel createTitleStylePane(){ private JPanel createTitleStylePane() {
textAttrPane = new ChartTextAttrPane(); textAttrPane = new ChartTextAttrPane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), textAttrPane);
} }
private JPanel createDisplayStrategy(){ private JPanel createDisplayStrategy() {
//区域显示策略 恢复用注释。开始删除。 //区域显示策略 恢复用注释。开始删除。
maxProportion = new UISpinner(0, 100, 1, 30); maxProportion = new UISpinner(0, 100, 1, 30);
limitSize = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); limitSize = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")});
@ -203,7 +203,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
// return limitPane; // return limitPane;
} }
private void initPositionListener(){ private void initPositionListener() {
alignmentPane.addChangeListener(new ChangeListener() { alignmentPane.addChangeListener(new ChangeListener() {
@Override @Override
@ -225,15 +225,17 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
if (customFloatPositionPane == null) { if (customFloatPositionPane == null) {
customFloatPositionPane = new VanChartFloatPositionPane(); customFloatPositionPane = new VanChartFloatPositionPane();
} }
Point comPoint = customFloatPositionButton.getLocationOnScreen(); if (uiBubbleFloatPane == null) {
Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight()); Point comPoint = customFloatPositionButton.getLocationOnScreen();
UIBubbleFloatPane<Style> pane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) { Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight());
@Override uiBubbleFloatPane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) {
public void updateContentPane() { @Override
parent.attributeChanged(); public void updateContentPane() {
} parent.attributeChanged();
}; }
pane.show(VanChartTitlePane.this, null); };
}
uiBubbleFloatPane.show(VanChartTitlePane.this, null);
} }
}); });
} }
@ -270,6 +272,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
/** /**
* 弹出框的界面标题 * 弹出框的界面标题
*
* @return 界面标题 * @return 界面标题
*/ */
public String title4PopupWindow() { public String title4PopupWindow() {
@ -283,7 +286,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
@Override @Override
public void populateBean(VanChart chart) { public void populateBean(VanChart chart) {
VanChartTitle title = (VanChartTitle)chart.getTitle(); VanChartTitle title = (VanChartTitle) chart.getTitle();
if (title == null) { if (title == null) {
return; return;
} }
@ -293,7 +296,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
} else { } else {
titleContent.populateBean(Utils.objectToString(title.getTextObject())); titleContent.populateBean(Utils.objectToString(title.getTextObject()));
} }
if(!title.isFloating()){ if (!title.isFloating()) {
alignmentPane.setSelectedItem(title.getPosition()); alignmentPane.setSelectedItem(title.getPosition());
} else { } else {
alignmentPane.setSelectedIndex(-1); alignmentPane.setSelectedIndex(-1);
@ -323,7 +326,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
if (chart == null) { if (chart == null) {
chart = new VanChart(); chart = new VanChart();
} }
VanChartTitle title = (VanChartTitle)chart.getTitle(); VanChartTitle title = (VanChartTitle) chart.getTitle();
if (title == null) { if (title == null) {
title = new VanChartTitle(StringUtils.EMPTY); title = new VanChartTitle(StringUtils.EMPTY);
} }
@ -341,7 +344,7 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
if (textAttr == null) { if (textAttr == null) {
textAttr = new TextAttr(); textAttr = new TextAttr();
} }
if(!customFloatPositionButton.isSelected()){ if (!customFloatPositionButton.isSelected()) {
title.setPosition(alignmentPane.getSelectedItem()); title.setPosition(alignmentPane.getSelectedItem());
} }
title.setUseHtml(useHtml.isSelected()); title.setUseHtml(useHtml.isSelected());

6
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartTimeAxisPane.java

@ -162,8 +162,10 @@ public class VanChartTimeAxisPane extends VanChartBaseAxisPane {
JPanel mainTickPane = new JPanel(); JPanel mainTickPane = new JPanel();
mainTickPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); mainTickPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
mainUnitField.setPreferredSize(new Dimension(100,20));
secondUnitField.setPreferredSize(new Dimension(100,20)); int width = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH - (int) Math.ceil(mainType.getPreferredSize().getWidth());
mainUnitField.setPreferredSize(new Dimension(width,20));
secondUnitField.setPreferredSize(new Dimension(width,20));
mainTickPane.add(mainUnitField); mainTickPane.add(mainUnitField);
mainTickPane.add(mainType); mainTickPane.add(mainType);

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

@ -1,10 +1,12 @@
package com.fr.van.chart.designer.style.datasheet; package com.fr.van.chart.designer.style.datasheet;
import com.fr.chart.chartglyph.DataSheet; import com.fr.chart.chartglyph.DataSheet;
import com.fr.design.gui.iscrollbar.UIScrollBar;
import com.fr.plugin.chart.base.AttrDataSheet; import com.fr.plugin.chart.base.AttrDataSheet;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.Component; import java.awt.Component;
import java.awt.Container;
/** /**
* Created by mengao on 2017/5/24. * Created by mengao on 2017/5/24.
@ -19,6 +21,20 @@ public class VanchartDataSheetNoCheckPane extends VanChartDataSheetPane {
return components; return components;
} }
@Override
protected void layoutContentPane() {
leftcontentPane = createContentPane();
this.add(leftcontentPane);
}
@Override
protected void setLeftContentPaneBounds(Container parent, UIScrollBar scrollBar, int beginY, int maxheight) {
int width = parent.getWidth();
int height = parent.getHeight();
scrollBar.setBounds(0, 0, 0, 0);
leftcontentPane.setBounds(0, 0, width, height);
}
public void populate(AttrDataSheet attrDataSheet) { public void populate(AttrDataSheet attrDataSheet) {
populate(attrDataSheet.getDataSheet()); populate(attrDataSheet.getDataSheet());
} }

12
designer-chart/src/main/java/com/fr/van/chart/designer/style/tooltip/VanChartTooltipPane.java

@ -5,6 +5,7 @@ import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.chartx.config.info.constant.ConfigType; import com.fr.chartx.config.info.constant.ConfigType;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.plugin.chart.attr.plot.VanChartPlot; import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.AttrTooltip; import com.fr.plugin.chart.base.AttrTooltip;
@ -27,6 +28,10 @@ public class VanChartTooltipPane extends AbstractVanChartScrollPane<Chart> {
this.parent = parent; this.parent = parent;
} }
public VanChartPlotTooltipPane getPlotTooltipPane() {
return tooltipPane;
}
@Override @Override
protected JPanel createContentPane() { protected JPanel createContentPane() {
JPanel contentPane = new JPanel(new BorderLayout()); JPanel contentPane = new JPanel(new BorderLayout());
@ -48,7 +53,10 @@ public class VanChartTooltipPane extends AbstractVanChartScrollPane<Chart> {
parent.initAllListeners(); parent.initAllListeners();
} }
Plot plot = this.chart.getPlot(); populateTooltipPane(this.chart.getPlot());
}
public void populateTooltipPane(Plot plot) {
DataSeriesCondition attr = ((VanChartPlot)plot).getAttrTooltipFromConditionCollection(); DataSeriesCondition attr = ((VanChartPlot)plot).getAttrTooltipFromConditionCollection();
if(tooltipPane != null) { if(tooltipPane != null) {
tooltipPane.populate((AttrTooltip)attr); tooltipPane.populate((AttrTooltip)attr);
@ -74,7 +82,7 @@ public class VanChartTooltipPane extends AbstractVanChartScrollPane<Chart> {
@Override @Override
public String title4PopupWindow() { public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Tooltip"); return Toolkit.i18nText("Fine-Design_Chart_Tooltip");
} }
protected VanChartPlotTooltipPane getTooltipPane(Plot plot) { protected VanChartPlotTooltipPane getTooltipPane(Plot plot) {

4
designer-chart/src/main/java/com/fr/van/chart/gauge/VanChartGaugeSeriesPane.java

@ -69,7 +69,7 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
new Component[]{createGaugeBandsPane()} new Component[]{createGaugeBandsPane()}
}; };
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
private JPanel createGaugeLayoutPane() { private JPanel createGaugeLayoutPane() {
@ -311,4 +311,4 @@ public class VanChartGaugeSeriesPane extends VanChartAbstractPlotSeriesPane {
protected VanChartBeautyPane createStylePane() { protected VanChartBeautyPane createStylePane() {
return null; return null;
} }
} }

2
designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java

@ -111,7 +111,7 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane {
double[] col = {f}; double[] col = {f};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{getVanChartFillStylePane()}, new Component[]{getVanChartValueColorPane()},
}; };
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);

17
designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

@ -38,6 +38,7 @@ import com.fr.van.chart.map.line.VanChartCurvePane;
import com.fr.van.chart.map.line.VanChartLineMapEffectPane; import com.fr.van.chart.map.line.VanChartLineMapEffectPane;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
@ -60,6 +61,9 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
private static final String[] MARKER_TYPES = new String[]{MapMarkerType.DEFAULT.toLocalString(), private static final String[] MARKER_TYPES = new String[]{MapMarkerType.DEFAULT.toLocalString(),
MapMarkerType.COMMON.toLocalString(), MapMarkerType.BUBBLE.toLocalString(), MapMarkerType.IMAGE.toLocalString()}; MapMarkerType.COMMON.toLocalString(), MapMarkerType.BUBBLE.toLocalString(), MapMarkerType.IMAGE.toLocalString()};
private static final String[] LARGE_MARKER_TYPES = new String[]{MapMarkerType.DEFAULT.toLocalString(),
MapMarkerType.COMMON.toLocalString(), MapMarkerType.BUBBLE.toLocalString()};
//custom //custom
private UIButtonGroup<Integer> areaPointAndLineGroup; private UIButtonGroup<Integer> areaPointAndLineGroup;
@ -145,8 +149,18 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
} }
private void checkPointCompsEnabledWithLarge(Plot plot) { private void checkPointCompsEnabledWithLarge(Plot plot) {
boolean largeModel = largeModel(plot);
if (pointEffectPane != null) { if (pointEffectPane != null) {
GUICoreUtils.setEnabled(pointEffectPane, !largeModel(plot)); GUICoreUtils.setEnabled(pointEffectPane, !largeModel);
}
if (markerTypeCom != null) {
Object selectedItem = markerTypeCom.getSelectedItem();
markerTypeCom.setModel(new DefaultComboBoxModel(largeModel ? LARGE_MARKER_TYPES : MARKER_TYPES));
if (ComparatorUtils.equals(MapMarkerType.IMAGE.toLocalString(), selectedItem) && largeModel) {
markerTypeCom.setSelectedItem(MapMarkerType.COMMON.toLocalString());
} else {
markerTypeCom.setSelectedItem(selectedItem);
}
} }
} }
@ -366,6 +380,7 @@ public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
} else { } else {
panel = createMapCustomGroupPane(areaPane, pointPane, linePane); panel = createMapCustomGroupPane(areaPane, pointPane, linePane);
} }
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
return panel; return panel;
} }

3
designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartBubblePointMapConditionPane.java

@ -3,8 +3,10 @@ package com.fr.van.chart.map.designer.other.condition.pane;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.plugin.chart.attr.EffectHelper; import com.fr.plugin.chart.attr.EffectHelper;
import com.fr.plugin.chart.base.AttrEffect; import com.fr.plugin.chart.base.AttrEffect;
import com.fr.plugin.chart.base.AttrFloatColor;
import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble; import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble;
import com.fr.van.chart.designer.other.condition.item.VanChartEffectConditionPane; 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.map.designer.other.condition.item.VanChartBubbleMarkerConditionPane; import com.fr.van.chart.map.designer.other.condition.item.VanChartBubbleMarkerConditionPane;
/** /**
@ -21,6 +23,7 @@ public class VanChartBubblePointMapConditionPane extends VanChartMapConditionPan
classPaneMap.put(VanChartAttrBubble.class, new VanChartBubbleMarkerConditionPane(this)); classPaneMap.put(VanChartAttrBubble.class, new VanChartBubbleMarkerConditionPane(this));
if (addLabelOrEffectAction()) { if (addLabelOrEffectAction()) {
addLabelAction(); addLabelAction();
classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this));
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getBubblePlotDefaultEffect())); classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getBubblePlotDefaultEffect()));
} }
} }

3
designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartCommonPointMapConditionPane.java

@ -3,8 +3,10 @@ package com.fr.van.chart.map.designer.other.condition.pane;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.plugin.chart.attr.EffectHelper; import com.fr.plugin.chart.attr.EffectHelper;
import com.fr.plugin.chart.base.AttrEffect; import com.fr.plugin.chart.base.AttrEffect;
import com.fr.plugin.chart.base.AttrFloatColor;
import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.base.VanChartAttrMarker;
import com.fr.van.chart.designer.other.condition.item.VanChartEffectConditionPane; 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.map.designer.other.condition.item.VanChartCommonMarkerConditionPane; import com.fr.van.chart.map.designer.other.condition.item.VanChartCommonMarkerConditionPane;
/** /**
@ -21,6 +23,7 @@ public class VanChartCommonPointMapConditionPane extends VanChartMapConditionPan
classPaneMap.put(VanChartAttrMarker.class, new VanChartCommonMarkerConditionPane(this)); classPaneMap.put(VanChartAttrMarker.class, new VanChartCommonMarkerConditionPane(this));
if(addLabelOrEffectAction()) { if(addLabelOrEffectAction()) {
addLabelAction(); addLabelAction();
classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this));
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getScatterPlotDefaultEffect())); classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getScatterPlotDefaultEffect()));
} }
} }

3
designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartDefaultPointMapConditionPane.java

@ -3,7 +3,9 @@ package com.fr.van.chart.map.designer.other.condition.pane;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.plugin.chart.attr.EffectHelper; import com.fr.plugin.chart.attr.EffectHelper;
import com.fr.plugin.chart.base.AttrEffect; import com.fr.plugin.chart.base.AttrEffect;
import com.fr.plugin.chart.base.AttrFloatColor;
import com.fr.van.chart.designer.other.condition.item.VanChartEffectConditionPane; import com.fr.van.chart.designer.other.condition.item.VanChartEffectConditionPane;
import com.fr.van.chart.designer.other.condition.item.VanChartFloatColorConditionPane;
/** /**
* Created by Mitisky on 16/5/23. * Created by Mitisky on 16/5/23.
@ -17,6 +19,7 @@ public class VanChartDefaultPointMapConditionPane extends VanChartMapConditionPa
protected void addDiffAction() { protected void addDiffAction() {
if(addLabelOrEffectAction()) { if(addLabelOrEffectAction()) {
addLabelAction(); addLabelAction();
classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this));
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getPointMapPlotDefaultEffect())); classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getPointMapPlotDefaultEffect()));
} }
} }

3
designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartImagePointMapConditionPane.java

@ -1,7 +1,9 @@
package com.fr.van.chart.map.designer.other.condition.pane; package com.fr.van.chart.map.designer.other.condition.pane;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.plugin.chart.base.AttrFloatColor;
import com.fr.plugin.chart.base.VanChartAttrMarker; import com.fr.plugin.chart.base.VanChartAttrMarker;
import com.fr.van.chart.designer.other.condition.item.VanChartFloatColorConditionPane;
import com.fr.van.chart.map.designer.other.condition.item.VanChartImageMarkerConditionPane; import com.fr.van.chart.map.designer.other.condition.item.VanChartImageMarkerConditionPane;
/** /**
@ -18,6 +20,7 @@ public class VanChartImagePointMapConditionPane extends VanChartMapConditionPane
classPaneMap.put(VanChartAttrMarker.class, new VanChartImageMarkerConditionPane(this)); classPaneMap.put(VanChartAttrMarker.class, new VanChartImageMarkerConditionPane(this));
if (addLabelOrEffectAction()) { if (addLabelOrEffectAction()) {
addLabelAction(); addLabelAction();
classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this));
} }
} }
} }

2
designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartLineMapConditionPane.java

@ -43,13 +43,13 @@ public class VanChartLineMapConditionPane extends DataSeriesConditionPane {
@Override @Override
protected void addBasicAction() { protected void addBasicAction() {
classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this)); classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this));
classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this));
classPaneMap.put(AttrCurve.class, new VanChartCurveConditionPane(this)); classPaneMap.put(AttrCurve.class, new VanChartCurveConditionPane(this));
classPaneMap.put(AttrTooltip.class, new VanChartLineMapTooltipConditionPane(this, plot)); classPaneMap.put(AttrTooltip.class, new VanChartLineMapTooltipConditionPane(this, plot));
//大数据模式 恢复用注释。下面1行删除。 //大数据模式 恢复用注释。下面1行删除。
if (!PlotFactory.lineMapLargeModel(plot)) { if (!PlotFactory.lineMapLargeModel(plot)) {
//大数据模式 恢复用注释。取消注释。 //大数据模式 恢复用注释。取消注释。
//if (!PlotFactory.largeDataModel(plot)) { //if (!PlotFactory.largeDataModel(plot)) {
classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this));
classPaneMap.put(AttrLineEffect.class, new VanChartLineEffectConditionPane(this, EffectHelper.getLineMapDefaultLineEffect())); classPaneMap.put(AttrLineEffect.class, new VanChartLineEffectConditionPane(this, EffectHelper.getLineMapDefaultLineEffect()));
} }
} }

2
designer-chart/src/main/java/com/fr/van/chart/map/designer/other/condition/pane/VanChartMapConditionPane.java

@ -49,11 +49,11 @@ public class VanChartMapConditionPane extends DataSeriesConditionPane {
classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this)); classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this));
classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this)); classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this));
classPaneMap.put(AttrTooltip.class, new VanChartTooltipConditionPane(this, plot)); classPaneMap.put(AttrTooltip.class, new VanChartTooltipConditionPane(this, plot));
classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this));
addDiffAction(); addDiffAction();
} }
protected void addDiffAction() { protected void addDiffAction() {
classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this));
classPaneMap.put(AttrBorderWithAlpha.class, new VanChartBorderWithAlphaConditionPane(this)); classPaneMap.put(AttrBorderWithAlpha.class, new VanChartBorderWithAlphaConditionPane(this));
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getMapPlotDefaultEffect())); classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getMapPlotDefaultEffect()));
addLabelAction(); addLabelAction();

36
designer-chart/src/main/java/com/fr/van/chart/map/line/VanChartLineMapPlotTooltipNoCheckPane.java

@ -0,0 +1,36 @@
package com.fr.van.chart.map.line;
import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.AttrTooltip;
import com.fr.van.chart.designer.style.VanChartStylePane;
import java.awt.BorderLayout;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-08-20
*/
public class VanChartLineMapPlotTooltipNoCheckPane extends VanChartLineMapPlotTooltipPane {
public VanChartLineMapPlotTooltipNoCheckPane(Plot plot, VanChartStylePane parent) {
super(plot, parent);
}
protected void addComponents(Plot plot) {
isTooltipShow = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Use_Tooltip"));
tooltipPane = createTooltipPane(plot);
this.setLayout(new BorderLayout());
this.add(tooltipPane, BorderLayout.CENTER);
}
@Override
public void populate(AttrTooltip attr) {
super.populate(attr);
isTooltipShow.setSelected(true);
tooltipPane.setEnabled(isTooltipShow.isSelected());
}
}

159
designer-chart/src/main/java/com/fr/van/chart/range/component/LegendGradientBar.java

@ -7,7 +7,6 @@ import com.fr.design.event.UIObserverListener;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.style.background.gradient.SelectColorPointBtn; import com.fr.design.style.background.gradient.SelectColorPointBtn;
import com.fr.design.style.color.ColorCell; import com.fr.design.style.color.ColorCell;
import com.fr.design.style.color.ColorSelectConfigManager;
import com.fr.design.style.color.ColorSelectDetailPane; import com.fr.design.style.color.ColorSelectDetailPane;
import com.fr.design.style.color.ColorSelectDialog; import com.fr.design.style.color.ColorSelectDialog;
import com.fr.design.style.color.ColorSelectable; import com.fr.design.style.color.ColorSelectable;
@ -18,6 +17,9 @@ import com.fr.stable.AssistUtils;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.awt.Color; import java.awt.Color;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
@ -27,9 +29,6 @@ import java.awt.LinearGradientPaint;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class LegendGradientBar extends JComponent implements ColorSelectable, UIObserver { public class LegendGradientBar extends JComponent implements ColorSelectable, UIObserver {
@ -75,11 +74,11 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
private List<ChangeListener> changeListenerList = new ArrayList<ChangeListener>(); private List<ChangeListener> changeListenerList = new ArrayList<ChangeListener>();
public LegendGradientBar(){ public LegendGradientBar() {
startPos = 4; startPos = 4;
endPos = max; endPos = max;
setSubColor(new Color(36,167,255)); setSubColor(new Color(36, 167, 255));
setColorSelectionBtnNum(2 + 1); setColorSelectionBtnNum(2 + 1);
@ -117,10 +116,10 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
private float[] initDist(int colorSelectionBtnNum) { private float[] initDist(int colorSelectionBtnNum) {
float[] dist = new float[colorSelectionBtnNum]; float[] dist = new float[colorSelectionBtnNum];
dist[0] = 0f; dist[0] = 0f;
for (int i = 0; i < colorSelectionBtnNum-2; i++) { for (int i = 0; i < colorSelectionBtnNum - 2; i++) {
dist[i+1] = (float) ((selectColorPointBtnList.get(i).getX() - 4) / (max - 4)); dist[i + 1] = (float) ((selectColorPointBtnList.get(i).getX() - 4) / (max - 4));
} }
dist[colorSelectionBtnNum-1] = 1f; dist[colorSelectionBtnNum - 1] = 1f;
return dist; return dist;
} }
@ -141,8 +140,8 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
private Color[] initColors(Color subColor, int colorSelectionBtnNum) { private Color[] initColors(Color subColor, int colorSelectionBtnNum) {
Color[] converseColors = getColorArray(subColor, colorSelectionBtnNum); Color[] converseColors = getColorArray(subColor, colorSelectionBtnNum);
Color[] colors = new Color[colorSelectionBtnNum]; Color[] colors = new Color[colorSelectionBtnNum];
for (int i = 0; i < colorSelectionBtnNum; i++){ for (int i = 0; i < colorSelectionBtnNum; i++) {
colors[i] = converseColors[colorSelectionBtnNum-1 - i]; colors[i] = converseColors[colorSelectionBtnNum - 1 - i];
} }
return colors; return colors;
} }
@ -150,30 +149,32 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
private void initColorSelectBtn(Color[] colors, int colorSelectionBtnNum) { private void initColorSelectBtn(Color[] colors, int colorSelectionBtnNum) {
//获取按钮颜色数组 //获取按钮颜色数组
Color startSlotColor = colors[0]; Color startSlotColor = colors[0];
Color endSlotColor = colors[colorSelectionBtnNum-1]; Color endSlotColor = colors[colorSelectionBtnNum - 1];
Color[] pColors = new Color[colorSelectionBtnNum - 2]; Color[] pColors = new Color[colorSelectionBtnNum - 2];
for (int i = 0; i < pColors.length; i++){ for (int i = 0; i < pColors.length; i++) {
pColors[i] = colors[i + 1]; pColors[i] = colors[i + 1];
} }
selectColorSlotBtnStart = new SelectColorPointBtn(startPos, REC_HEIGHT, startSlotColor, new Color(138,138,138)); selectColorSlotBtnStart = new SelectColorPointBtn(startPos, REC_HEIGHT, startSlotColor, new Color(138, 138, 138));
selectColorSlotBtnEnd = new SelectColorPointBtn(endPos, REC_HEIGHT, endSlotColor, new Color(138,138,138)); selectColorSlotBtnEnd = new SelectColorPointBtn(endPos, REC_HEIGHT, endSlotColor, new Color(138, 138, 138));
//初始化list //初始化list
selectColorPointBtnList = new ArrayList<SelectColorPointBtn>(); selectColorPointBtnList = new ArrayList<SelectColorPointBtn>();
//加入可滑动颜色选择器 //加入可滑动颜色选择器
for (int i = 0; i < pColors.length; i++){ for (int i = 0; i < pColors.length; i++) {
SelectColorPointBtn pi = new SelectColorPointBtn(((startPos+endPos)/(pColors.length+1))*(i+1), REC_HEIGHT, pColors[i]); SelectColorPointBtn pi = new SelectColorPointBtn(((startPos + endPos) / (pColors.length + 1)) * (i + 1), REC_HEIGHT, pColors[i]);
selectColorPointBtnList.add(pi); selectColorPointBtnList.add(pi);
} }
refreshColorsAndDist(selectColorPointBtnList);
this.repaint(); this.repaint();
} }
/** /**
* 添加事件 * 添加事件
*
* @param changeListener 事件 * @param changeListener 事件
*/ */
public void addChangeListener(ChangeListener changeListener) { public void addChangeListener(ChangeListener changeListener) {
@ -216,7 +217,7 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
//如果该位置已经有滑块占领,则做跨越偏移 //如果该位置已经有滑块占领,则做跨越偏移
selectColorPointBtnList.get(index).setX(LegendGradientBar.this.setOffset(e.getX(), index, OFFSETSTEP)); selectColorPointBtnList.get(index).setX(LegendGradientBar.this.setOffset(e.getX(), index, OFFSETSTEP));
} }
refreshColorsAndDist(selectColorPointBtnList);
LegendGradientBar.this.repaint(); LegendGradientBar.this.repaint();
} }
}); });
@ -224,25 +225,23 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
//防止位置重复,设置偏移 //防止位置重复,设置偏移
private int setOffset(int x, int index, int offset) { private int setOffset(int x, int index, int offset) {
for (int i = 0; i < selectColorPointBtnList.size(); i++){ for (int i = 0; i < selectColorPointBtnList.size(); i++) {
if (i != index && AssistUtils.equals(x, selectColorPointBtnList.get(i).getX())) { if (i != index && AssistUtils.equals(x, selectColorPointBtnList.get(i).getX())) {
if (x >= (min+max)/2) { if (x >= (min + max) / 2) {
x -= offset; x -= offset;
x = setOffset(x, index, offset+OFFSETSTEP); x = setOffset(x, index, offset + OFFSETSTEP);
} } else {
else{
x += offset; x += offset;
x = setOffset(x, index, offset+OFFSETSTEP); x = setOffset(x, index, offset + OFFSETSTEP);
} }
} }
} }
//边界情况 //边界情况
if (x <= min){ if (x <= min) {
x = min + (index+1)*OFFSETSTEP; x = min + (index + 1) * OFFSETSTEP;
} } else if (x >= max) {
else if (x >= max){ x = max - (index + 1) * OFFSETSTEP;
x = max - (index+1)*OFFSETSTEP;
} }
return x; return x;
} }
@ -259,50 +258,33 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
break; break;
} }
} }
if (select >= 0) { if (select >= 0) {
ColorSelectDetailPane pane = new ColorSelectDetailPane(Color.WHITE); dealClick(selectColorPointBtnList.get(select));
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, LegendGradientBar.this); } else if (selectColorSlotBtnStart.contains(e.getX(), e.getY())) {
Color color = LegendGradientBar.this.getColor(); dealClick(selectColorSlotBtnStart);
if (color != null) {
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
selectColorPointBtnList.get(select).setColorInner(color);
LegendGradientBar.this.repaint();
}
}
//是否选中颜色编辑槽
else if (selectColorSlotBtnStart.contains(e.getX(), e.getY())) {
ColorSelectDetailPane pane = new ColorSelectDetailPane(Color.WHITE);
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, LegendGradientBar.this);
Color color = LegendGradientBar.this.getColor();
if (color != null) {
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
selectColorSlotBtnStart.setColorInner(color);
//stateChanged();
LegendGradientBar.this.repaint();
}
} else if (selectColorSlotBtnEnd.contains(e.getX(), e.getY())) { } else if (selectColorSlotBtnEnd.contains(e.getX(), e.getY())) {
ColorSelectDetailPane pane = new ColorSelectDetailPane(Color.WHITE); dealClick(selectColorSlotBtnEnd);
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, LegendGradientBar.this);
Color color = LegendGradientBar.this.getColor();
if (color != null) {
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
selectColorSlotBtnEnd.setColorInner(color);
//stateChanged();
LegendGradientBar.this.repaint();
}
} }
LegendGradientBar.this.repaint();
} }
} }
}); });
} }
private void addMouseReleasedListener(){ private void dealClick(SelectColorPointBtn selectColorPointBtn) {
ColorSelectDetailPane pane = new ColorSelectDetailPane(Color.WHITE);
this.setColor(selectColorPointBtn.getColorInner());
ColorSelectDialog.showDialog(DesignerContext.getDesignerFrame(), pane, Color.WHITE, LegendGradientBar.this);
Color color = this.getColor();
if (color != null) {
DesignerEnvManager.getEnvManager().getColorConfigManager().addToColorQueue(color);
selectColorPointBtn.setColorInner(color);
refreshColorsAndDist(selectColorPointBtnList);
LegendGradientBar.this.repaint();
}
}
private void addMouseReleasedListener() {
this.addMouseListener(new MouseAdapter() { this.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
@ -318,14 +300,11 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
Point2D start = new Point2D.Float(4, 0); Point2D start = new Point2D.Float(4, 0);
Point2D end = new Point2D.Float(max, 0); Point2D end = new Point2D.Float(max, 0);
//获取排序后的颜色数组和位置数组
refreshColorsAndDist(selectColorPointBtnList);
LinearGradientPaint paint = new LinearGradientPaint(start, end, dist, colors); LinearGradientPaint paint = new LinearGradientPaint(start, end, dist, colors);
g2.setPaint(paint); g2.setPaint(paint);
g2.fillRect(4, 0, max - 4, 30); g2.fillRect(4, 0, max - 4, 30);
g2.setColor(new Color(138,138,138)); g2.setColor(new Color(138, 138, 138));
g2.drawRect(4, 0, max - 4, 30); g2.drawRect(4, 0, max - 4, 30);
//开始和结束位置颜色选择槽位 //开始和结束位置颜色选择槽位
@ -343,22 +322,22 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
Collections.sort(select); Collections.sort(select);
colors[0] = selectColorSlotBtnStart.getColorInner(); colors[0] = selectColorSlotBtnStart.getColorInner();
for (int i = 0; i < colorSelectionBtnNum-2; i++) { for (int i = 0; i < colorSelectionBtnNum - 2; i++) {
colors[i+1] = select.get(i).getColorInner(); colors[i + 1] = select.get(i).getColorInner();
} }
colors[colorSelectionBtnNum-1] = selectColorSlotBtnEnd.getColorInner(); colors[colorSelectionBtnNum - 1] = selectColorSlotBtnEnd.getColorInner();
dist = new float[colorSelectionBtnNum]; dist = new float[colorSelectionBtnNum];
dist[0] = 0f; dist[0] = 0f;
for (int i = 0; i < colorSelectionBtnNum-2; i++) { for (int i = 0; i < colorSelectionBtnNum - 2; i++) {
dist[i+1] = (float) ((select.get(i).getX() - 4) / (max - 4)); dist[i + 1] = (float) ((select.get(i).getX() - 4) / (max - 4));
} }
dist[colorSelectionBtnNum-1] = 1f; dist[colorSelectionBtnNum - 1] = 1f;
fireColorAndDistChangeListener(); fireColorAndDistChangeListener();
} }
public void refreshSubColor(Color subColor){ public void refreshSubColor(Color subColor) {
//设置主题色 //设置主题色
setSubColor(subColor); setSubColor(subColor);
@ -370,9 +349,9 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
} }
public void refreshColorSelectionBtnNum(int num){ public void refreshColorSelectionBtnNum(int num) {
//设置主题色 //设置主题色
colorSelectionBtnNum = num+1; colorSelectionBtnNum = num + 1;
//计算colors数组 //计算colors数组
colors = initColors(subColor, colorSelectionBtnNum); colors = initColors(subColor, colorSelectionBtnNum);
@ -418,14 +397,14 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
} }
public void populate(GradualIntervalConfig intervalConfig){ public void populate(GradualIntervalConfig intervalConfig) {
if(intervalConfig == null) { if (intervalConfig == null) {
return; return;
} }
setSubColor(intervalConfig.getSubColor()); setSubColor(intervalConfig.getSubColor());
setColorSelectionBtnNum((int)(intervalConfig.getDivStage() + 1)); setColorSelectionBtnNum((int) (intervalConfig.getDivStage() + 1));
populateColorAndDist(intervalConfig.getGradualColorDistList()); populateColorAndDist(intervalConfig.getGradualColorDistList());
@ -436,15 +415,15 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
int num = gradualColorDistList.size(); int num = gradualColorDistList.size();
this.colors = new Color[num]; this.colors = new Color[num];
this.dist = new float[num]; this.dist = new float[num];
for (int i = 0; i < num; i++){ for (int i = 0; i < num; i++) {
this.colors[i] = gradualColorDistList.get(i).getColor(); this.colors[i] = gradualColorDistList.get(i).getColor();
this.dist[i] = gradualColorDistList.get(i).getPosition(); this.dist[i] = gradualColorDistList.get(i).getPosition();
} }
} }
public void update(GradualIntervalConfig intervalConfig){ public void update(GradualIntervalConfig intervalConfig) {
ArrayList<GradualColorDist> colorDistList = new ArrayList<GradualColorDist>(); ArrayList<GradualColorDist> colorDistList = new ArrayList<GradualColorDist>();
for (int i = 0; i < getColorSelectionBtnNum(); i++){ for (int i = 0; i < getColorSelectionBtnNum(); i++) {
colorDistList.add(new GradualColorDist(this.dist[i], this.colors[i])); colorDistList.add(new GradualColorDist(this.dist[i], this.colors[i]));
} }
intervalConfig.setGradualColorDistList(colorDistList); intervalConfig.setGradualColorDistList(colorDistList);
@ -453,26 +432,26 @@ public class LegendGradientBar extends JComponent implements ColorSelectable, UI
private void refreshColorSelectBtn(Color[] colors, float[] dist) { private void refreshColorSelectBtn(Color[] colors, float[] dist) {
//获取按钮颜色数组 //获取按钮颜色数组
Color startSlotColor = colors[0]; Color startSlotColor = colors[0];
Color endSlotColor = colors[colors.length-1]; Color endSlotColor = colors[colors.length - 1];
Color[] pColors = new Color[colors.length - 2]; Color[] pColors = new Color[colors.length - 2];
for (int i = 0; i < pColors.length; i++){ for (int i = 0; i < pColors.length; i++) {
pColors[i] = colors[i + 1]; pColors[i] = colors[i + 1];
} }
float[] position = new float[dist.length - 2]; float[] position = new float[dist.length - 2];
for (int i = 0; i < position.length; i++){ for (int i = 0; i < position.length; i++) {
position[i] = dist[i+1]*(max-4) + 4; position[i] = dist[i + 1] * (max - 4) + 4;
} }
selectColorSlotBtnStart = new SelectColorPointBtn(startPos, REC_HEIGHT, startSlotColor, new Color(138,138,138)); selectColorSlotBtnStart = new SelectColorPointBtn(startPos, REC_HEIGHT, startSlotColor, new Color(138, 138, 138));
selectColorSlotBtnEnd = new SelectColorPointBtn(endPos, REC_HEIGHT, endSlotColor, new Color(138,138,138)); selectColorSlotBtnEnd = new SelectColorPointBtn(endPos, REC_HEIGHT, endSlotColor, new Color(138, 138, 138));
//刷新可移动按钮的位置 //刷新可移动按钮的位置
selectColorPointBtnList = new ArrayList<SelectColorPointBtn>(); selectColorPointBtnList = new ArrayList<SelectColorPointBtn>();
//加入可滑动颜色选择器 //加入可滑动颜色选择器
for (int i = 0; i < pColors.length; i++){ for (int i = 0; i < pColors.length; i++) {
SelectColorPointBtn pi = new SelectColorPointBtn(position[i], REC_HEIGHT, pColors[i]); SelectColorPointBtn pi = new SelectColorPointBtn(position[i], REC_HEIGHT, pColors[i]);
selectColorPointBtnList.add(pi); selectColorPointBtnList.add(pi);
} }

12
designer-chart/src/main/java/com/fr/van/chart/structure/desinger/data/StructurePlotReportDataContentPane.java

@ -5,10 +5,10 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.plugin.chart.structure.data.StructureReportDefinition; import com.fr.plugin.chart.structure.data.StructureReportDefinition;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -40,11 +40,11 @@ public class StructurePlotReportDataContentPane extends AbstractReportDataConten
nodeValue = new TinyFormulaPane(); nodeValue = new TinyFormulaPane();
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Node_Name")), nodeName}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Node_Name")), nodeName},
new Component[]{new UILabel("id"), nodeID}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Node_Id")), nodeID},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Parent_ID")), parentID}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Parent_Node_Id")), parentID},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name")), seriesName}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name")), seriesName},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Value")), nodeValue}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Value")), nodeValue},
}; };
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components,rowSize,columnSize,24,6); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components,rowSize,columnSize,24,6);

16
designer-chart/src/main/java/com/fr/van/chart/structure/desinger/data/StructurePlotTableDataContentPane.java

@ -6,19 +6,19 @@ import com.fr.data.util.function.AbstractDataFunction;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.plugin.chart.structure.data.StructureTableDefinition; import com.fr.plugin.chart.structure.data.StructureTableDefinition;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.util.List;
/** /**
* Created by shine on 2017/2/15. * Created by shine on 2017/2/15.
@ -45,12 +45,12 @@ public class StructurePlotTableDataContentPane extends AbstractTableDataContentP
calculateCombox = new CalculateComboBox(); calculateCombox = new CalculateComboBox();
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Node_Name")), nodeName}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Node_Name")), nodeName},
new Component[]{new UILabel("id"), nodeId}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Node_Id")), nodeId},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Parent_ID")), parenrId}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Parent_Node_Id")), parenrId},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name")), seriesName}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name")), seriesName},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Value")), nodeValue}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Value")), nodeValue},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method")), calculateCombox} new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method")), calculateCombox}
}; };
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components,rowSize,columnSize,24,6); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components,rowSize,columnSize,24,6);

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 623 B

BIN
designer-chart/src/main/resources/com/fr/van/chart/box.images/box.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 658 B

5
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java

@ -310,14 +310,15 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
public void fix(XCreator creator ,int x, int y) { public void fix(XCreator creator ,int x, int y) {
int height = creator.getHeight(); int height = creator.getHeight();
int width = creator.getWidth(); int width = creator.getWidth();
//坐标小于0时让它还在容器内
if (x < 0) { if (x < 0) {
x = container.getX(); x = 0;
} else if (x + creator.getWidth() > container.getWidth()) { } else if (x + creator.getWidth() > container.getWidth()) {
x = container.getWidth() - width; x = container.getWidth() - width;
} }
if (y < 0) { if (y < 0) {
y = container.getY(); y = 0;
} else if (y + creator.getHeight() > container.getHeight()) { } else if (y + creator.getHeight() > container.getHeight()) {
y = container.getHeight() - height; y = container.getHeight() - height;
} }

17
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java

@ -35,19 +35,18 @@ public class FRBorderLayoutAdapter extends AbstractLayoutAdapter {
* @param creator 组件 * @param creator 组件
*/ */
public void fix(XCreator creator) { public void fix(XCreator creator) {
FRBorderLayout layout = (FRBorderLayout) container.getFRLayout(); FRBorderLayout layout = (FRBorderLayout)container.getFRLayout();
Object constraints = layout.getConstraints(creator); Object constraints = layout.getConstraints(creator);
double scale = container.getScale();
if (ComparatorUtils.equals(constraints, BorderLayout.NORTH)) { if (ComparatorUtils.equals(constraints, BorderLayout.NORTH)) {
((XWBorderLayout) container).toData().setNorthSize((int) (creator.getHeight() / scale)); ((XWBorderLayout)container).toData().setNorthSize(creator.getHeight());
} else if (ComparatorUtils.equals(constraints, BorderLayout.SOUTH)) { } else if (ComparatorUtils.equals(constraints, BorderLayout.SOUTH)) {
((XWBorderLayout) container).toData().setSouthSize((int) (creator.getHeight() / scale)); ((XWBorderLayout)container).toData().setSouthSize(creator.getHeight());
} else if (ComparatorUtils.equals(constraints, BorderLayout.EAST)) { } else if (ComparatorUtils.equals(constraints, BorderLayout.EAST)) {
((XWBorderLayout) container).toData().setEastSize((int) (creator.getWidth() / scale)); ((XWBorderLayout)container).toData().setEastSize(creator.getWidth());
} else if (ComparatorUtils.equals(constraints, BorderLayout.WEST)) { } else if (ComparatorUtils.equals(constraints, BorderLayout.WEST)) {
((XWBorderLayout) container).toData().setWestSize((int) (creator.getWidth() / scale)); ((XWBorderLayout)container).toData().setWestSize(creator.getWidth());
} else { } else {
return; return;
} }
container.recalculateChildrenPreferredSize(); container.recalculateChildrenPreferredSize();
} }
@ -59,7 +58,7 @@ public class FRBorderLayoutAdapter extends AbstractLayoutAdapter {
* @param y 纵坐标 * @param y 纵坐标
*/ */
public void addComp(XCreator child, int x, int y) { public void addComp(XCreator child, int x, int y) {
String placement = getPlacement(child, x, y); String placement = getPlacement(child, x, y);
container.add(child, placement); container.add(child, placement);
LayoutUtils.layoutRootContainer(container); LayoutUtils.layoutRootContainer(container);
} }
@ -105,7 +104,7 @@ public class FRBorderLayoutAdapter extends AbstractLayoutAdapter {
int northSize = wLayout.getNorthSize(); int northSize = wLayout.getNorthSize();
int southSize = wLayout.getSouthSize(); int southSize = wLayout.getSouthSize();
int eastSize = wLayout.getEastSize(); int eastSize = wLayout.getEastSize();
int westSize = wLayout.getWestSize(); int westSize = wLayout.getWestSize();
if (y < northSize) { if (y < northSize) {
return BorderLayout.NORTH; return BorderLayout.NORTH;
} else if ((y >= northSize) && (y < (height - southSize))) { } else if ((y >= northSize) && (y < (height - southSize))) {

15
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -114,6 +114,15 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
XCreator creator = (XCreator) container.getComponent(i); XCreator creator = (XCreator) container.getComponent(i);
creator.updateChildBound(minHeight); creator.updateChildBound(minHeight);
creator.setBackupBound(creator.getBounds()); creator.setBackupBound(creator.getBounds());
//tab布局用到
ArrayList<?> childrenList = creator.getTargetChildrenList();
for (int j = 0; j < childrenList.size(); j++) {
XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList.get(j);
for (int m = 0; m < tabLayout.getComponentCount(); m++) {
XCreator childCreator = tabLayout.getXCreator(m);
childCreator.setBackupBound(childCreator.getBounds());
}
}
} }
} }
@ -1039,15 +1048,15 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList.get(j); XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList.get(j);
tabLayout.setBackupBound(tabLayout.getBounds()); tabLayout.setBackupBound(tabLayout.getBounds());
int refSize = isHor ? tabLayout.getWidth() : tabLayout.getHeight(); int refSize = isHor ? tabLayout.getWidth() : tabLayout.getHeight();
double percent = (double) offset / refSize; double percent = offset / (double) (refSize - offset);
if (percent < 0 && !tabLayout.canReduce(percent)) { if (percent < 0 && !tabLayout.canReduce(percent)) {
return; return;
} }
setAdjustedSize(tabLayout, offset, isHor);
for (int m = 0; m < tabLayout.getComponentCount(); m++) { for (int m = 0; m < tabLayout.getComponentCount(); m++) {
XCreator childCreator = tabLayout.getXCreator(m); XCreator childCreator = tabLayout.getXCreator(m);
WAbsoluteLayout.BoundsWidget wgt = (WAbsoluteLayout.BoundsWidget) tabLayout.toData().getBoundsWidget(childCreator.toData()); WAbsoluteLayout.BoundsWidget wgt = (WAbsoluteLayout.BoundsWidget) tabLayout.toData().getBoundsWidget(childCreator.toData());
wgt.setBounds(tabLayout.getComponent(m).getBounds()); wgt.setBounds(childCreator.getBackupBound());
wgt.setBackupBounds(childCreator.getBackupBound());
} }
adjustCreatorsSize(percent, tabLayout, isHor); adjustCreatorsSize(percent, tabLayout, isHor);
} }

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

@ -17,14 +17,14 @@ import java.awt.Rectangle;
* 添加状态下的model * 添加状态下的model
*/ */
public class AddingModel { public class AddingModel {
// 当前要添加的组件 // 当前要添加的组件
private XCreator creator; private XCreator creator;
// 记录当前鼠标的位置信息 // 记录当前鼠标的位置信息
private int currentX; private int currentX;
private int currentY; private int currentY;
private boolean added; private boolean added;
public AddingModel(FormDesigner designer, XCreator xCreator) { public AddingModel(FormDesigner designer, XCreator xCreator) {
this.creator = xCreator; this.creator = xCreator;
instantiateCreator(designer); instantiateCreator(designer);
@ -32,14 +32,14 @@ public class AddingModel {
currentY = -this.creator.getWidth(); currentY = -this.creator.getWidth();
currentX = -this.creator.getHeight(); currentX = -this.creator.getHeight();
} }
/** /**
* 待说明 * 待说明
* *
* @param designer 设计器 * @param designer 设计器
*/ */
public void instantiateCreator(FormDesigner designer) { public void instantiateCreator(FormDesigner designer) {
ModelUtil.renameWidgetName(designer.getTarget(), creator); ModelUtil.renameWidgetName(designer.getTarget(), creator);
ComponentAdapter adapter = new CompositeComponentAdapter(designer, creator); ComponentAdapter adapter = new CompositeComponentAdapter(designer, creator);
adapter.initialize(); adapter.initialize();
@ -55,7 +55,7 @@ public class AddingModel {
currentX = x - (xCreator.getWidth() / 2); currentX = x - (xCreator.getWidth() / 2);
currentY = y - (xCreator.getHeight() / 2); currentY = y - (xCreator.getHeight() / 2);
} }
/** /**
* 隐藏当前组件的图标 * 隐藏当前组件的图标
*/ */
@ -63,7 +63,7 @@ public class AddingModel {
currentX = -this.creator.getWidth(); currentX = -this.creator.getWidth();
currentY = -this.creator.getHeight(); currentY = -this.creator.getHeight();
} }
public String getXCreatorName(FormDesigner designer, XCreator x) { public String getXCreatorName(FormDesigner designer, XCreator x) {
String def = x.createDefaultName(); String def = x.createDefaultName();
if (x.acceptType(XWParameterLayout.class)) { if (x.acceptType(XWParameterLayout.class)) {
@ -75,17 +75,17 @@ public class AddingModel {
} }
return def + i; return def + i;
} }
public int getCurrentX() { public int getCurrentX() {
return currentX; return currentX;
} }
public int getCurrentY() { public int getCurrentY() {
return currentY; return currentY;
} }
/** /**
* 移动组件图标到鼠标事件发生的位置 * 移动组件图标到鼠标事件发生的位置
* *
@ -101,6 +101,10 @@ public class AddingModel {
return this.creator; return this.creator;
} }
public boolean need2paint(){
return currentX + this.creator.getWidth() > 0 && currentY + this.creator.getHeight() > 0;
}
/** /**
* 当前组件是否已经添加到某个容器中 * 当前组件是否已经添加到某个容器中
* *
@ -138,4 +142,4 @@ public class AddingModel {
y + designer.getArea().getVerticalValue() - rect.y); y + designer.getArea().getVerticalValue() - rect.y);
return added; return added;
} }
} }

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

@ -452,8 +452,8 @@ public class SelectionModel {
} }
} }
if (hasSelectionComponent()) { if (hasSelectionComponent()) {
int x = e.getX() + designer.getArea().getHorizontalValue(); int x = e.getX() + designer.getHorizontalScaleValue();
int y = e.getY() + designer.getArea().getVerticalValue(); int y = e.getY() + designer.getVerticalScaleValue();
dir = getDirection(selection.getRelativeBounds(), x, y); dir = getDirection(selection.getRelativeBounds(), x, y);
if (selection.size() == 1 && !ArrayUtils.contains(selection.getSelectedCreator().getDirections(), dir if (selection.size() == 1 && !ArrayUtils.contains(selection.getSelectedCreator().getDirections(), dir
.getActual())) { .getActual())) {

23
designer-form/src/main/java/com/fr/design/designer/creator/XButton.java

@ -147,7 +147,7 @@ public class XButton extends XWidgetCreator {
public void propertyChange() { public void propertyChange() {
FreeButton button = (FreeButton) data; FreeButton button = (FreeButton) data;
if (button.getFont() != null) { if (button.getFont() != null) {
setContentLabelFont(button.getFont().applyResolutionNP( contentLabel.setFont(button.getFont().applyResolutionNP(
FontTransformUtil.getDesignerFontResolution())); FontTransformUtil.getDesignerFontResolution()));
contentLabel.setForeground(button.getFont().getForeground()); contentLabel.setForeground(button.getFont().getForeground());
} }
@ -230,7 +230,7 @@ public class XButton extends XWidgetCreator {
if (!button.isCustomStyle()) { if (!button.isCustomStyle()) {
l.setBorder(BorderFactory.createLineBorder(new Color(148, 148, 148))); l.setBorder(BorderFactory.createLineBorder(new Color(148, 148, 148)));
bg = DEFAULTBG; bg = DEFAULTBG;
setContentLabelFont(DEFAULTFT); contentLabel.setFont(DEFAULTFT);
contentLabel.setForeground(DEFAULTFOREGROUNDCOLOR); contentLabel.setForeground(DEFAULTFOREGROUNDCOLOR);
editor.setLayout(new BorderLayout()); editor.setLayout(new BorderLayout());
editor.add(l, BorderLayout.CENTER); editor.add(l, BorderLayout.CENTER);
@ -239,7 +239,7 @@ public class XButton extends XWidgetCreator {
editor.setLayout(new BorderLayout()); editor.setLayout(new BorderLayout());
editor.add(l,BorderLayout.CENTER); editor.add(l,BorderLayout.CENTER);
if (button.getFont() != null) { if (button.getFont() != null) {
setContentLabelFont(button.getFont().applyResolutionNP( contentLabel.setFont(button.getFont().applyResolutionNP(
FontTransformUtil.getDesignerFontResolution())); FontTransformUtil.getDesignerFontResolution()));
contentLabel.setForeground(button.getFont().getForeground()); contentLabel.setForeground(button.getFont().getForeground());
} }
@ -302,26 +302,11 @@ public class XButton extends XWidgetCreator {
setButtonText(button.getText()); setButtonText(button.getText());
checkButonType(); checkButonType();
if (button.getFont() != null) { if (button.getFont() != null) {
setContentLabelFont(button.getFont().applyResolutionNP( contentLabel.setFont(button.getFont().applyResolutionNP(
FontTransformUtil.getDesignerFontResolution())); FontTransformUtil.getDesignerFontResolution()));
contentLabel.setForeground(button.getFont().getForeground()); contentLabel.setForeground(button.getFont().getForeground());
} }
} }
private void setContentLabelFont(Font font) {
float size = (float) (font.getSize() * getScale());
contentLabel.setFont(font.deriveFont(size));
}
public void setScale(double scale){
super.setScale(scale);
FreeButton button = (FreeButton) data;
if (button.getFont() != null) {
setContentLabelFont(button.getFont().applyResolutionNP(
FontTransformUtil.getDesignerFontResolution()));
}else {
setContentLabelFont(DEFAULTFT);
}
}
} }

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

@ -49,7 +49,6 @@ import java.util.Set;
* *
*/ */
public abstract class XCreator extends JPanel implements XComponent, XCreatorTools { public abstract class XCreator extends JPanel implements XComponent, XCreatorTools {
private double scale = 1.0;
protected static final Border DEFALUTBORDER = BorderFactory.createLineBorder(new Color(210, 210, 210), 1); protected static final Border DEFALUTBORDER = BorderFactory.createLineBorder(new Color(210, 210, 210), 1);
public static final Dimension SMALL_PREFERRED_SIZE = new Dimension(80, 21); public static final Dimension SMALL_PREFERRED_SIZE = new Dimension(80, 21);
@ -103,14 +102,6 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
} }
} }
public double getScale() {
return scale;
}
public void setScale(double scale) {
this.scale = scale;
}
/** /**
* 初始化组件大小 * 初始化组件大小
*/ */

6
designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java

@ -17,7 +17,6 @@ import com.fr.design.mainframe.widget.renderer.LabelHorizontalAlignmentRenderer;
import com.fr.form.ui.Label; import com.fr.form.ui.Label;
import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WParameterLayout;
import com.fr.general.FRFont;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
@ -95,11 +94,8 @@ public class XLabel extends XWidgetCreator {
} }
if (label.getWidgetValue() != null) { if (label.getWidgetValue() != null) {
Graphics2D g2d = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
FRFont font = label.getFont();
float fontsize = (float) (font.getSize() * this.getScale());
BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), label.getWidgetValue() BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), label.getWidgetValue()
.toString(), Style.getInstance(font.applySize(fontsize)) .toString(), Style.getInstance(label.getFont()).deriveHorizontalAlignment(label.getTextalign())
.deriveHorizontalAlignment(label.getTextalign())
.deriveVerticalAlignment(label.isVerticalCenter() ? SwingConstants.CENTER : SwingConstants.TOP) .deriveVerticalAlignment(label.isVerticalCenter() ? SwingConstants.CENTER : SwingConstants.TOP)
.deriveTextStyle(label.isWrap() ? Style.TEXTSTYLE_WRAPTEXT : Style.TEXTSTYLE_SINGLELINE), .deriveTextStyle(label.isWrap() ? Style.TEXTSTYLE_WRAPTEXT : Style.TEXTSTYLE_SINGLELINE),
FontTransformUtil.getDesignerFontResolution()); FontTransformUtil.getDesignerFontResolution());

4
designer-form/src/main/java/com/fr/design/designer/creator/XNumberEditor.java

@ -96,10 +96,10 @@ public class XNumberEditor extends XWrapperedFieldEditor {
setBorder(FIELDBORDER); setBorder(FIELDBORDER);
return this; return this;
} }
@Override @Override
protected String getIconName() { protected String getIconName() {
return "number_field_16.png"; return "number_field_16.png";
} }
} }

4
designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java

@ -59,10 +59,8 @@ public class XTextArea extends XFieldEditor {
TextArea area = (TextArea) data; TextArea area = (TextArea) data;
if (area.getWidgetValue() != null) { if (area.getWidgetValue() != null) {
Graphics2D g2d = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
FRFont font = FRFont.getInstance();
float fontsize = (float) (font.getSize() * this.getScale());
BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), area.getWidgetValue() BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), area.getWidgetValue()
.toString(), Style.getInstance(font.applySize(fontsize)).deriveHorizontalAlignment(Constants.LEFT) .toString(), Style.getInstance(FRFont.getInstance()).deriveHorizontalAlignment(Constants.LEFT)
.deriveVerticalAlignment(SwingConstants.TOP) .deriveVerticalAlignment(SwingConstants.TOP)
.deriveTextStyle(Style.TEXTSTYLE_WRAPTEXT), ScreenResolution.getScreenResolution()); .deriveTextStyle(Style.TEXTSTYLE_WRAPTEXT), ScreenResolution.getScreenResolution());
} }

4
designer-form/src/main/java/com/fr/design/designer/creator/XTextEditor.java

@ -67,10 +67,8 @@ public class XTextEditor extends XWrapperedFieldEditor {
TextEditor area = (TextEditor) data; TextEditor area = (TextEditor) data;
if (area.getWidgetValue() != null) { if (area.getWidgetValue() != null) {
Graphics2D g2d = (Graphics2D) g.create(); Graphics2D g2d = (Graphics2D) g.create();
FRFont font = FRFont.getInstance();
float fontsize = (float) (font.getSize() * this.getScale());
BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), area.getWidgetValue() BaseUtils.drawStringStyleInRotation(g2d, this.getWidth(), this.getHeight(), area.getWidgetValue()
.toString(), Style.getInstance(font.applySize(fontsize)).deriveHorizontalAlignment(Constants.LEFT) .toString(), Style.getInstance(FRFont.getInstance()).deriveHorizontalAlignment(Constants.LEFT)
.deriveTextStyle(Style.TEXTSTYLE_SINGLELINE), ScreenResolution.getScreenResolution()); .deriveTextStyle(Style.TEXTSTYLE_SINGLELINE), ScreenResolution.getScreenResolution());
} }
} }

16
designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -30,8 +30,6 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
@ -399,7 +397,6 @@ public class XWAbsoluteLayout extends XLayoutContainer {
return; return;
} }
XWidgetCreator creator = (XWidgetCreator) e.getChild(); XWidgetCreator creator = (XWidgetCreator) e.getChild();
creator.setScale(this.getScale());
WAbsoluteLayout wabs = this.toData(); WAbsoluteLayout wabs = this.toData();
if (!creator.acceptType(XWFitLayout.class)) { if (!creator.acceptType(XWFitLayout.class)) {
creator.setDirections(Direction.ALL); creator.setDirections(Direction.ALL);
@ -605,17 +602,4 @@ public class XWAbsoluteLayout extends XLayoutContainer {
return super.getWidgetPropertyUIProviders(); return super.getWidgetPropertyUIProviders();
} }
} }
public void adjustCompSize(double percent) {
double p = percent + 1;
WAbsoluteLayout absoluteLayout = this.toData();
for (int i = 0; i < this.getComponentCount(); i++) {
XCreator component = (XCreator) this.getComponent(i);
CRBoundsWidget boundsWidget = absoluteLayout.getBoundsWidget(component.toData());
Rectangle rec = new Rectangle(boundsWidget.getBounds());
component.adjustCompSize(percent);
component.setBounds((int) (rec.x * p), (int) (rec.y * p), (int) (rec.width * p), (int) (rec.height * p));
}
}
} }

56
designer-form/src/main/java/com/fr/design/designer/creator/XWBorderLayout.java

@ -126,14 +126,14 @@ public class XWBorderLayout extends XLayoutContainer {
WBorderLayout wlayout = this.toData(); WBorderLayout wlayout = this.toData();
Object constraints = wlayout.getConstraints(wgt); Object constraints = wlayout.getConstraints(wgt);
Dimension d = new Dimension(); Dimension d = new Dimension();
if (ComparatorUtils.equals(WBorderLayout.NORTH, constraints)) { if (ComparatorUtils.equals(WBorderLayout.NORTH,constraints)) {
d.height = (int) (wlayout.getNorthSize() * getScale()); d.height = wlayout.getNorthSize();
} else if (ComparatorUtils.equals(WBorderLayout.SOUTH, constraints)) { } else if (ComparatorUtils.equals(WBorderLayout.SOUTH,constraints)) {
d.height = (int) (wlayout.getSouthSize() * getScale()); d.height = wlayout.getSouthSize();
} else if (ComparatorUtils.equals(WBorderLayout.EAST, constraints)) { } else if (ComparatorUtils.equals(WBorderLayout.EAST,constraints)) {
d.width = (int) (wlayout.getEastSize() * getScale()); d.width = wlayout.getEastSize();
} else if (ComparatorUtils.equals(WBorderLayout.WEST, constraints)) { } else if (ComparatorUtils.equals(WBorderLayout.WEST,constraints)) {
d.width = (int) (wlayout.getWestSize() * getScale()); d.width = wlayout.getWestSize();
} }
return d; return d;
} }
@ -203,40 +203,8 @@ public class XWBorderLayout extends XLayoutContainer {
} }
} }
@Override @Override
public LayoutAdapter getLayoutAdapter() { public LayoutAdapter getLayoutAdapter() {
return new FRBorderLayoutAdapter(this); return new FRBorderLayoutAdapter(this);
} }
/**
* 自适应布局的缩放
*
* @param percent 百分比
*/
public void adjustCompSize(double percent) {
for (int i = 0; i < this.getComponentCount(); i++) {
XCreator creator = this.getXCreator(i);
WBorderLayout wlayout = this.toData();
Object constraints = wlayout.getConstraints(creator.toData());
if (ComparatorUtils.equals(BorderLayout.NORTH, constraints)) {
int northSize = (int) (this.toData().getNorthSize() * this.getScale());
Dimension dim = creator.getSize();
creator.setPreferredSize(new Dimension(dim.width, northSize));
} else if (ComparatorUtils.equals(BorderLayout.SOUTH, constraints)) {
int southSize = (int) (this.toData().getSouthSize() * this.getScale());
Dimension dim = creator.getSize();
creator.setPreferredSize(new Dimension(dim.width, southSize));
} else if (ComparatorUtils.equals(BorderLayout.EAST, constraints)) {
int eastSize = (int) (this.toData().getEastSize() * this.getScale());
Dimension dim = creator.getSize();
creator.setPreferredSize(new Dimension(eastSize, dim.height));
} else if (ComparatorUtils.equals(BorderLayout.WEST, constraints)) {
int westSize = (int) (this.toData().getWestSize() * this.getScale());
Dimension dim = creator.getSize();
creator.setPreferredSize(new Dimension(westSize, dim.height));
}
}
}
} }

94
designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java

@ -18,7 +18,7 @@ import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.widget.CRBoundsWidget; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -130,7 +130,6 @@ public class XWFitLayout extends XLayoutContainer {
} }
} }
/** /**
* 直接拖动滑条改变整体像素大小时不用考虑控件的最小高度宽度内部组件全部一起缩小放大 * 直接拖动滑条改变整体像素大小时不用考虑控件的最小高度宽度内部组件全部一起缩小放大
* 只是界面显示大小改变不改变对应的BoundsWidget大小 * 只是界面显示大小改变不改变对应的BoundsWidget大小
@ -139,28 +138,32 @@ public class XWFitLayout extends XLayoutContainer {
public void adjustCreatorsWhileSlide(double percent) { public void adjustCreatorsWhileSlide(double percent) {
int count = this.getComponentCount(); int count = this.getComponentCount();
if (count == 0) { if (count == 0) {
Dimension size = new Dimension(this.toData().getContentWidth(), this.toData().getContentHeight()); Dimension size = new Dimension(this.getSize());
size.width += size.width * percent; size.width += size.width*percent;
size.height += size.height * percent; size.height += size.height*percent;
this.setSize(size); this.setSize(size);
return; return;
} }
// 初始化时还未加间隔
if (hasCalGap) {
moveContainerMargin();
moveCompInterval(backupGap);
LayoutUtils.layoutContainer(this);
}
int containerW = 0; int containerW = 0;
int containerH = 0; int containerH = 0;
int[] hors = getDataHors(); int[] hors = getHors(false);
int[] veris = getDataVeris(); int[] veris = getVeris(false);
PaddingMargin margin = new PaddingMargin(); PaddingMargin margin = toData().getMargin();
for (int i = 0; i < count; i++) { for (int i=0; i<count; i++) {
XCreator creator = getXCreator(i); XCreator creator = getXCreator(i);
WFitLayout fitLayout = this.toData();
CRBoundsWidget boundsWidget = fitLayout.getBoundsWidget(creator.toData());
// 百分比和updateBoundsWidget时都会调整大小 // 百分比和updateBoundsWidget时都会调整大小
// 子组件非空时,调整界面大小、 撤销、再次打开表单,都会按屏幕百分比调整,此时必须考虑内边距 // 子组件非空时,调整界面大小、 撤销、再次打开表单,都会按屏幕百分比调整,此时必须考虑内边距
Rectangle rec = modifyCreatorPoint(boundsWidget.getBounds(), percent, hors, veris); Rectangle rec = modifyCreatorPoint(creator.getBounds(), percent, hors, veris);
if (rec.x == margin.getLeft()) { if (rec.x == margin.getLeft()) {
containerH += rec.height; containerH += rec.height;
} }
if (rec.y == margin.getTop()) { if (rec.y == margin.getTop()) {
containerW += rec.width; containerW += rec.width;
} }
creator.setBounds(rec); creator.setBounds(rec);
@ -168,12 +171,15 @@ public class XWFitLayout extends XLayoutContainer {
} }
// 布局内部组件放大缩小后,都是乘以百分比后取整,可能会产生空隙,此处调整容器 // 布局内部组件放大缩小后,都是乘以百分比后取整,可能会产生空隙,此处调整容器
this.setSize( this.setSize(
containerW + (int) (margin.getLeft() * (1.0 + percent) + margin.getRight() * (1.0 + percent)), containerW + (int)(margin.getLeft() * (1.0+percent) + margin.getRight() * (1.0+percent)),
containerH + (int) (margin.getTop() * (1.0 + percent) + margin.getBottom() * (1.0 + percent)) containerH + (int)(margin.getTop() * (1.0+percent) + margin.getBottom() * (1.0+percent))
); );
updateCreatorsBackupBound(); updateCreatorsBackupBound();
// 间隔也按显示大小比例调整 // 间隔也按显示大小比例调整
addCompInterval(getAcualInterval()); if (!hasCalGap) {
moveContainerMargin();
addCompInterval(getAcualInterval());
}
LayoutUtils.layoutContainer(this); LayoutUtils.layoutContainer(this);
} }
@ -181,7 +187,6 @@ public class XWFitLayout extends XLayoutContainer {
* 调整控件的point和size,避免拖动滑块出现空隙 * 调整控件的point和size,避免拖动滑块出现空隙
*/ */
private Rectangle modifyCreatorPoint(Rectangle rec, double percent, int[] hors, int[] veris) { private Rectangle modifyCreatorPoint(Rectangle rec, double percent, int[] hors, int[] veris) {
rec = new Rectangle(rec);
int xIndex = 0, yIndex = 0; int xIndex = 0, yIndex = 0;
PaddingMargin margin = toData().getMargin(); PaddingMargin margin = toData().getMargin();
Rectangle bound = new Rectangle(rec); Rectangle bound = new Rectangle(rec);
@ -260,41 +265,6 @@ public class XWFitLayout extends XLayoutContainer {
return ArrayUtils.toPrimitive(posX.toArray(new Integer[]{posX.size()})); return ArrayUtils.toPrimitive(posX.toArray(new Integer[]{posX.size()}));
} }
public int[] getDataHors() {
List<Integer> posX = new ArrayList<Integer>();
// 保存实际大小时,组件大小已经去除内边距,此处也判断下
posX.add(0);
int width = this.toData().getContainerWidth();
posX.add(width);
for (int i = 0, len = this.toData().getWidgetCount(); i < len; i++) {
CRBoundsWidget widget = (CRBoundsWidget) this.toData().getWidget(i);
Rectangle rec = widget.getBounds();
if (!posX.contains(rec.x)) {
posX.add(rec.x);
}
}
Collections.sort(posX);
return ArrayUtils.toPrimitive(posX.toArray(new Integer[]{posX.size()}));
}
public int[] getDataVeris() {
List<Integer> posY = new ArrayList<Integer>();
// 保存实际大小时,组件大小已经去除内边距,此处也判断下
posY.add(0);
int height = this.toData().getContainerHeight();
posY.add(height);
for (int i = 0, len = this.toData().getWidgetCount(); i < len; i++) {
CRBoundsWidget boundsWidget = (CRBoundsWidget) this.toData().getWidget(i);
Rectangle rec = boundsWidget.getBounds();
if (!posY.contains(rec.y)) {
posY.add(rec.y);
}
}
Collections.sort(posY);
return ArrayUtils.toPrimitive(posY.toArray(new Integer[]{posY.size()}));
}
/** /**
* 获取内部组件纵坐标值 * 获取内部组件纵坐标值
* @param isActualSize 实际大小 * @param isActualSize 实际大小
@ -321,7 +291,6 @@ public class XWFitLayout extends XLayoutContainer {
return ArrayUtils.toPrimitive(posY.toArray(new Integer[]{posY.size()})); return ArrayUtils.toPrimitive(posY.toArray(new Integer[]{posY.size()}));
} }
/** /**
* 是否能缩小 * 是否能缩小
* @param percent 百分比 * @param percent 百分比
@ -892,14 +861,12 @@ public class XWFitLayout extends XLayoutContainer {
} }
super.add(comp, constraints); super.add(comp, constraints);
XCreator creator = (XCreator) comp; XCreator creator = (XCreator) comp;
creator.setScale(this.getScale());
dealDirections(creator, false); dealDirections(creator, false);
} }
private void add(Component comp, Object constraints, boolean isInit) { private void add(Component comp, Object constraints, boolean isInit) {
super.add(comp, constraints); super.add(comp, constraints);
XCreator creator = (XCreator) comp; XCreator creator = (XCreator) comp;
creator.setScale(this.getScale());
dealDirections(creator, isInit); dealDirections(creator, isInit);
} }
@ -1125,7 +1092,12 @@ public class XWFitLayout extends XLayoutContainer {
public Component getBottomComp(int x, int y, int h) { public Component getBottomComp(int x, int y, int h) {
int val = getAcualInterval(); int val = getAcualInterval();
return this.getComponentAt(x, y+h+default_Length+val); Component comp = this.getComponentAt(x, y+h+default_Length+val);
if (ComparatorUtils.equals(this, comp)) {
// 如果获取组件等于自身 说明存在偏移 加上一个默认偏移量
return this.getComponentAt(x + default_Length, y+h+default_Length+val);
}
return comp;
} }
public Component getRightTopComp(int x, int y, int w) { public Component getRightTopComp(int x, int y, int w) {
@ -1365,14 +1337,4 @@ public class XWFitLayout extends XLayoutContainer {
} }
} }
} }
/**
* 自适应布局的缩放
*
* @param percent 百分比
*/
@Override
public void adjustCompSize(double percent) {
this.adjustCreatorsWhileSlide(percent);
}
} }

40
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardAddButton.java

@ -25,18 +25,18 @@ import java.awt.Graphics2D;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
public class XCardAddButton extends XButton { public class XCardAddButton extends XButton {
private XWCardTagLayout tagLayout; private XWCardTagLayout tagLayout;
private XWCardLayout cardLayout; private XWCardLayout cardLayout;
private static final int DEFAULT_BUTTON_WIDTH = 80; private static final int DEFAULT_BUTTON_WIDTH = 80;
private static final int ICON_OFFSET = 8; private static final int ICON_OFFSET = 8;
private static Icon ADD_ICON = BaseUtils.readIcon("/com/fr/design/form/images/add.png"); private static Icon ADD_ICON = BaseUtils.readIcon("/com/fr/design/form/images/add.png");
private Icon addIcon = ADD_ICON; private Icon addIcon = ADD_ICON;
/** /**
* card布局添加card按钮 * card布局添加card按钮
*/ */
@ -65,7 +65,7 @@ public class XCardAddButton extends XButton {
public XCardAddButton(CardAddButton widget, Dimension initSize) { public XCardAddButton(CardAddButton widget, Dimension initSize) {
super(widget, initSize); super(widget, initSize);
} }
/** /**
* 构造函数 * 构造函数
* @param widget 按钮 * @param widget 按钮
@ -76,18 +76,18 @@ public class XCardAddButton extends XButton {
this.tagLayout = fit; this.tagLayout = fit;
this.cardLayout = cardLayout; this.cardLayout = cardLayout;
} }
/** /**
* 响应点击事件 * 响应点击事件
* @param editingMouseListener 事件处理器 * @param editingMouseListener 事件处理器
* @param e 点击事件 * @param e 点击事件
* *
*/ */
@Override @Override
public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e){ public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e){
FormDesigner designer = editingMouseListener.getDesigner(); FormDesigner designer = editingMouseListener.getDesigner();
designer.fireTargetModified(); designer.fireTargetModified();
// addbutton对应的XWCardLayout和XWCardTagLayout暂未存入到xml中,重新打开之后先根据父子层获取 // addbutton对应的XWCardLayout和XWCardTagLayout暂未存入到xml中,重新打开之后先根据父子层获取
if(cardLayout == null && tagLayout ==null ){ if(cardLayout == null && tagLayout ==null ){
initRelateLayout(); initRelateLayout();
@ -96,17 +96,17 @@ public class XCardAddButton extends XButton {
throw new IllegalArgumentException("cardLayout can not be null"); throw new IllegalArgumentException("cardLayout can not be null");
} }
int index = cardLayout.toData().getWidgetCount(); int index = cardLayout.toData().getWidgetCount();
//添加新的tab,并将原来的设为未选中状态 //添加新的tab,并将原来的设为未选中状态
setTabUnselected(); setTabUnselected();
addTab(index); addTab(index);
this.tagLayout.adjustComponentWidth(); this.tagLayout.adjustComponentWidth();
if (editingMouseListener.stopEditing()) { if (editingMouseListener.stopEditing()) {
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this); ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, this);
editingMouseListener.startEditing(this, adapter.getDesignerEditor(), adapter); editingMouseListener.startEditing(this, adapter.getDesignerEditor(), adapter);
} }
FormHierarchyTreePane.getInstance().refreshRoot(); FormHierarchyTreePane.getInstance().refreshRoot();
//将焦点切换到新增的tab对应的tabfitLayout上 //将焦点切换到新增的tab对应的tabfitLayout上
showNewTab(editingMouseListener,index); showNewTab(editingMouseListener,index);
@ -118,28 +118,28 @@ public class XCardAddButton extends XButton {
public UIPopupMenu createPopupMenu(FormDesigner formDesigner) { public UIPopupMenu createPopupMenu(FormDesigner formDesigner) {
return UIPopupMenu.EMPTY; // 不要菜单 return UIPopupMenu.EMPTY; // 不要菜单
} }
private void initRelateLayout(){ private void initRelateLayout(){
XWCardTitleLayout titleLayout = (XWCardTitleLayout)this.getBackupParent(); XWCardTitleLayout titleLayout = (XWCardTitleLayout)this.getBackupParent();
this.tagLayout = titleLayout.getTagPart(); this.tagLayout = titleLayout.getTagPart();
XWCardMainBorderLayout borderLayout = (XWCardMainBorderLayout)titleLayout.getBackupParent(); XWCardMainBorderLayout borderLayout = (XWCardMainBorderLayout)titleLayout.getBackupParent();
this.cardLayout = borderLayout.getCardPart(); this.cardLayout = borderLayout.getCardPart();
} }
@Override @Override
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
drawAddIcon(g2d); drawAddIcon(g2d);
} }
private void drawAddIcon(Graphics2D g2d){ private void drawAddIcon(Graphics2D g2d){
int width = this.getWidth(); int width = this.getWidth();
int height = this.getHeight(); int height = this.getHeight();
addIcon.paintIcon(this, g2d, width / 2 - ICON_OFFSET, height / 2 - ICON_OFFSET); addIcon.paintIcon(this, g2d, width / 2 - ICON_OFFSET, height / 2 - ICON_OFFSET);
} }
//将原来的tab页设置为未选中状态 //将原来的tab页设置为未选中状态
private void setTabUnselected(){ private void setTabUnselected(){
for(int i=0;i<this.tagLayout.getComponentCount();i++){ for(int i=0;i<this.tagLayout.getComponentCount();i++){
@ -148,12 +148,12 @@ public class XCardAddButton extends XButton {
button.setShowButton(false); button.setShowButton(false);
} }
} }
//新增tab //新增tab
private void addTab(int index){ private void addTab(int index){
Dimension dimension = new Dimension(); Dimension dimension = new Dimension();
dimension.width = DEFAULT_BUTTON_WIDTH; dimension.width = DEFAULT_BUTTON_WIDTH;
String cardLayoutName = cardLayout.toData().getWidgetName(); String cardLayoutName = cardLayout.toData().getWidgetName();
CardSwitchButton titleButton = new CardSwitchButton(index,cardLayoutName); CardSwitchButton titleButton = new CardSwitchButton(index,cardLayoutName);
WCardTagLayout layout = (WCardTagLayout) this.tagLayout.toData(); WCardTagLayout layout = (WCardTagLayout) this.tagLayout.toData();
@ -170,7 +170,7 @@ public class XCardAddButton extends XButton {
this.tagLayout.setTabFitIndex(index); this.tagLayout.setTabFitIndex(index);
this.tagLayout.add(showButton); this.tagLayout.add(showButton);
} }
//切换焦点到新增tab页 //切换焦点到新增tab页
private void showNewTab(EditingMouseListener editingMouseListener, int index){ private void showNewTab(EditingMouseListener editingMouseListener, int index){
SelectionModel selectionModel = editingMouseListener.getSelectionModel(); SelectionModel selectionModel = editingMouseListener.getSelectionModel();
@ -179,7 +179,7 @@ public class XCardAddButton extends XButton {
tabFitLayout.setxCardSwitchButton(xCardSwitchButton); tabFitLayout.setxCardSwitchButton(xCardSwitchButton);
selectionModel.setSelectedCreator(tabFitLayout); selectionModel.setSelectedCreator(tabFitLayout);
} }
//新增时去tabFitLayout名字中最大的Index+1,防止重名 //新增时去tabFitLayout名字中最大的Index+1,防止重名
private String getTabTitleName(WCardTagLayout layout){ private String getTabTitleName(WCardTagLayout layout){
int size = layout.getWidgetCount(); int size = layout.getWidgetCount();

32
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -202,7 +202,8 @@ public class XCardSwitchButton extends XButton {
jPopupMenu.add(prev); jPopupMenu.add(prev);
jPopupMenu.add(next); jPopupMenu.add(next);
jPopupMenu.add(end); jPopupMenu.add(end);
GUICoreUtils.showPopupMenu(jPopupMenu, editingMouseListener.getDesigner(), e.getX(), e.getY()); FormDesigner designer = editingMouseListener.getDesigner();
GUICoreUtils.showPopupMenu(jPopupMenu, editingMouseListener.getDesigner(), designer.getOriginX(e.getX()), designer.getOriginY(e.getY()));
} }
@Override @Override
@ -237,7 +238,6 @@ public class XCardSwitchButton extends XButton {
layout.setIndex(--tabFitIndex); layout.setIndex(--tabFitIndex);
} }
} }
tagLayout.setTabsAndAdjust();
} }
@ -252,17 +252,32 @@ public class XCardSwitchButton extends XButton {
//是否进入点击关闭按钮区域 //是否进入点击关闭按钮区域
private boolean isSelectedClose(MouseEvent e, FormDesigner designer){ private boolean isSelectedClose(MouseEvent e, FormDesigner designer){
int diff = designer.getArea().getHorScrollBar().getValue(); int diff = designer.getHorizontalScaleValue();
// mouse position // mouse position
int ex = e.getX() + diff; int ex = e.getX() + diff;
int ey = e.getY(); int ey = e.getY();
//获取tab布局的位置,鼠标相对于tab按钮的位置 //获取tab布局的位置,鼠标相对于tab按钮的位置
XLayoutContainer mainLayout = cardLayout.getBackupParent(); Container mainLayout = cardLayout.getBackupParent();
Point point = mainLayout.getLocation(); Point point = mainLayout.getLocation();
double mainX = point.getX(); int y = 0;
double mainY = point.getY(); int x = 0;
//遍历一下,不然是相对位置,嵌套后位置不对
while (mainLayout.getParent() != null){
if(mainLayout instanceof XWCardLayout){
y += mainLayout.getY();
}
mainLayout = mainLayout.getParent();
if(mainLayout instanceof XWCardMainBorderLayout){
x += mainLayout.getX();
y += mainLayout.getY();
}
}
double mainX = point.getX() + x;
double mainY = point.getY() + y;
// 参数界面对坐标的影响 // 参数界面对坐标的影响
JForm jform = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JForm jform = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
@ -338,8 +353,7 @@ public class XCardSwitchButton extends XButton {
String titleText = button.getText(); String titleText = button.getText();
this.setButtonText(titleText); this.setButtonText(titleText);
FRFont font = widgetTitle.getFrFont(); FRFont font = widgetTitle.getFrFont();
int fontsize = font.getSize() + FONT_SIZE_ADJUST; FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(),font.getSize() + FONT_SIZE_ADJUST);
FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(), (float) (fontsize * getScale()));
UILabel label = this.getContentLabel(); UILabel label = this.getContentLabel();
label.setFont(newFont); label.setFont(newFont);
label.setForeground(font.getForeground()); label.setForeground(font.getForeground());
@ -461,7 +475,7 @@ public class XCardSwitchButton extends XButton {
TitlePacker title = getWidgetTitle(); TitlePacker title = getWidgetTitle();
FRFont font = title.getFrFont(); FRFont font = title.getFrFont();
int fontSize = font.getSize() + FONT_SIZE_ADJUST; int fontSize = font.getSize() + FONT_SIZE_ADJUST;
FRFont newFont = FRFont.getInstance(font.getName(), font.getStyle(), (float) (fontSize * getScale())); FRFont newFont = FRFont.getInstance(font.getName(), font.getStyle(), fontSize);
FontMetrics fm = GraphHelper.getFontMetrics(newFont); FontMetrics fm = GraphHelper.getFontMetrics(newFont);
for (int i = 0; i < titleText.length(); i++) { for (int i = 0; i < titleText.length(); i++) {
titleStringBuf.append(titleText.charAt(i)); titleStringBuf.append(titleText.charAt(i));

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

Loading…
Cancel
Save