Browse Source

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

feature/big-screen
Yuan.Wang 4 years ago
parent
commit
3b8ff6b44c
  1. 1
      build.gradle
  2. 8
      designer-base/src/main/java/com/fr/design/actions/UpdateAction.java
  3. 9
      designer-base/src/main/java/com/fr/design/actions/file/OpenRecentReportMenuDef.java
  4. 2
      designer-base/src/main/java/com/fr/design/actions/help/AboutDialog.java
  5. 12
      designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java
  6. 23
      designer-base/src/main/java/com/fr/design/cell/AbstractCellElementPropertyPane.java
  7. 34
      designer-base/src/main/java/com/fr/design/cell/CellElementPropertyComponent.java
  8. 11
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  9. 17
      designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java
  10. 5
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  11. 53
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  12. 13
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java
  13. 27
      designer-base/src/main/java/com/fr/design/env/RemoteDesignerWorkspaceInfo.java
  14. 2
      designer-base/src/main/java/com/fr/design/fun/CellAttributeProvider.java
  15. 18
      designer-base/src/main/java/com/fr/design/fun/CellPropertyPaneProvider.java
  16. 15
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractCellPropertyPaneProvider.java
  17. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java
  18. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java
  19. 12
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  20. 7
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  21. 4
      designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java
  22. 13
      designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java
  23. 16
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  24. 351
      designer-base/src/main/java/com/fr/design/mainframe/JFormSliderPane.java
  25. 25
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  26. 39
      designer-base/src/main/java/com/fr/design/os/impl/PopupDialogSaveAction.java
  27. 12
      designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java
  28. 11
      designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java
  29. 55
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  30. 4
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  31. 22
      designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java
  32. 27
      designer-base/src/test/java/com/fr/design/data/BasicTableDataUtilsTest.java
  33. 25
      designer-base/src/test/java/com/fr/design/env/RemoteDesignerWorkspaceInfoTest.java
  34. 51
      designer-base/src/test/java/com/fr/design/mainframe/JFormSliderPaneTest.java
  35. 3
      designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java
  36. 13
      designer-chart/src/main/java/com/fr/design/chartx/component/combobox/ColorSchemeComboBox.java
  37. 53
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/ChartDataFilterPane.java
  38. 9
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java
  39. 11
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java
  40. 53
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java
  41. 25
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/DataPaneHelper.java
  42. 36
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java
  43. 59
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java
  44. 125
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java
  45. 12
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java
  46. 57
      designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java
  47. 142
      designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java
  48. 156
      designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java
  49. 2
      designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java
  50. 6
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java
  51. 97
      designer-chart/src/main/java/com/fr/van/chart/box/BoxIndependentVanChartInterface.java
  52. 53
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxConditionPane.java
  53. 45
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxPlotPane.java
  54. 26
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxPlotTooltipPane.java
  55. 107
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxSeriesPane.java
  56. 21
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxStylePane.java
  57. 149
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipContentPane.java
  58. 17
      designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxTooltipPane.java
  59. 11
      designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotReportDataContentPane.java
  60. 4
      designer-chart/src/main/java/com/fr/van/chart/box/data/BoxPlotReportResultDataSeriesPane.java
  61. 212
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java
  62. 178
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableResultDataSeriesPane.java
  63. 12
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableSeriesNameUseFieldNamePane.java
  64. 12
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableSeriesNameUseFieldValuePane.java
  65. 224
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableSeriesTypeUsePane.java
  66. 59
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxTableDefinitionHelper.java
  67. 11
      designer-chart/src/main/java/com/fr/van/chart/designer/other/condition/item/VanChartAreaFillColorConditionPane.java
  68. 22
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java
  69. 9
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/radar/VanChartRadarAlertValuePane.java
  70. 15
      designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartAbstractPlotSeriesPane.java
  71. 38
      designer-chart/src/main/java/com/fr/van/chart/multilayer/data/MultiPiePlotTableDataContentPane.java
  72. BIN
      designer-chart/src/main/resources/com/fr/design/images/form/toolbar/box.png
  73. BIN
      designer-chart/src/main/resources/com/fr/van/chart/box.images/box.png
  74. 15
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRBorderLayoutAdapter.java
  75. 4
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  76. 23
      designer-form/src/main/java/com/fr/design/designer/creator/XButton.java
  77. 25
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  78. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  79. 6
      designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java
  80. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java
  81. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XTextEditor.java
  82. 16
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  83. 56
      designer-form/src/main/java/com/fr/design/designer/creator/XWBorderLayout.java
  84. 86
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  85. 6
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  86. 2
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java
  87. 83
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  88. 39
      designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java
  89. 194
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  90. 2
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java
  91. 6
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  92. 9
      designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java
  93. 17
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java
  94. 32
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  95. 24
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetCardTagBoundPane.java
  96. 12
      designer-realize/src/main/java/com/fr/design/actions/report/ReportWriteAttrAction.java
  97. 35
      designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java
  98. 2
      designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java
  99. 4
      designer-realize/src/main/java/com/fr/design/condition/HyperlinkPane.java
  100. 6
      designer-realize/src/main/java/com/fr/design/condition/WidgetHighlightPane.java
  101. Some files were not shown because too many files have changed in this diff Show More

1
build.gradle

@ -58,7 +58,6 @@ allprojects {
dependencies {
implementation 'com.fr.third:jxbrowser:6.23'
implementation 'com.fr.third:jxbrowser-swing:6.23'
implementation 'com.fr.third:jxbrowser-mac:6.23'
implementation 'com.fr.third:jxbrowser-win64:6.23'
implementation 'com.fr.third.server:servlet-api:3.0'

8
designer-base/src/main/java/com/fr/design/actions/UpdateAction.java

@ -17,6 +17,7 @@ import com.fr.design.mainframe.toolbar.UpdateActionManager;
import com.fr.design.menu.ShortCut;
import com.fr.design.selection.SelectionListener;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.stable.pinyin.PinyinFormat;
import com.fr.stable.pinyin.PinyinHelper;
@ -562,7 +563,12 @@ public abstract class UpdateAction extends ShortCut implements Action {
for (int i = 0; i < component.getTabCount(); i++) {
String title = component.getTitleAt(i);
handleSearchText(separator, text, pinyin, shortPinyin, title);
Component tabComponent = component.getComponentAt(i);
Component tabComponent = null;
try {
tabComponent = component.getComponentAt(i);
} catch (Exception ignore) {
FineLoggerFactory.getLogger().info("AlphaFine index tabPane end");
}
if (tabComponent instanceof JPanel) {
getComponentTexts((JPanel) tabComponent, separator, text, pinyin, shortPinyin);
} else if (tabComponent instanceof JTabbedPane) {

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

@ -1,6 +1,7 @@
package com.fr.design.actions.file;
import java.awt.event.ActionEvent;
import java.io.File;
import java.util.List;
import com.fr.base.BaseUtils;
@ -11,6 +12,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.menu.MenuDef;
import com.fr.file.FILEFactory;
import com.fr.file.FileFILE;
/**
* Open Resent MenuDef.
@ -68,7 +70,12 @@ public class OpenRecentReportMenuDef extends MenuDef {
* @param e 事件
*/
public void actionPerformed(ActionEvent e) {
DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(this.getPath()));
File file = new File(this.getPath());
if (file.exists()) {
DesignerContext.getDesignerFrame().openTemplate(new FileFILE(file));
} else {
DesignerContext.getDesignerFrame().openTemplate(FILEFactory.createFILE(this.getPath()));
}
}
public String getPath() {

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

@ -76,7 +76,7 @@ public class AboutDialog extends JDialog implements ActionListener {
this.getRootPane().setDefaultButton(okButton);
this.setSize(new Dimension(660, 600));
this.setSize(defaultPane.getPreferredSize().width, 600);
GUICoreUtils.centerWindow(this);
}

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

@ -4,6 +4,7 @@
package com.fr.design.actions.help;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper;
import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.BoldFontTextLabel;
@ -36,9 +37,13 @@ public class AboutPane extends JPanel {
private static final String COMPANY_TELEPHONE = CloudCenter.getInstance().acquireUrlByKind("help.compNo");
private static final String PRESIDENT_PHONE = CloudCenter.getInstance().acquireUrlByKind("help.PNo");
private int maxWidth;
public AboutPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.maxWidth = GraphHelper.getWidth(getBuildTitle() + GeneralUtils.readFullBuildNO() +
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"));
//center panel
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(centerPane, BorderLayout.CENTER);
@ -90,6 +95,11 @@ public class AboutPane extends JPanel {
}
}
@Override
public Dimension getPreferredSize() {
return new Dimension(this.maxWidth, super.getPreferredSize().height);
}
private void addPhoneAndQQPane(JPanel contentPane) {
BoxCenterAligmentPane boxCenterAlignmentPane;
// 英文版不显示服务电话和QQ

23
designer-base/src/main/java/com/fr/design/cell/AbstractCellElementPropertyPane.java

@ -0,0 +1,23 @@
package com.fr.design.cell;
import com.fr.design.designer.TargetComponent;
import com.fr.design.dialog.BasicPane;
import javax.swing.JPanel;
/**
* @author zack
* @version 10.0
* Created by zack on 2020/7/14
*/
public abstract class AbstractCellElementPropertyPane extends BasicPane implements CellElementPropertyComponent {
@Override
public JPanel toPanel() {
return this;
}
@Override
public boolean accept(TargetComponent tc) {
return true;
}
}

34
designer-base/src/main/java/com/fr/design/cell/CellElementPropertyComponent.java

@ -0,0 +1,34 @@
package com.fr.design.cell;
import com.fr.design.designer.TargetComponent;
import javax.swing.JPanel;
/**
* 单元格属性配置面板接口
* @author zack
* @version 10.0
* Created by zack on 2020/7/14
*/
public interface CellElementPropertyComponent {
/**
* 判断当前编辑的对象是否显示当前实现
* @param tc
* @return
*/
boolean accept(TargetComponent tc);
/**
* 加载数据
* @param tc
*/
void populate(TargetComponent tc);
/**
* 返回当前属性面板,默认返回this
* @return
*/
JPanel toPanel();
}

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

@ -446,7 +446,16 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
* @param srcName 数据集来源(比如报表块就是报表块的名称)
* @param tableDataSource 数据集
*/
public Map<String, String> addTableData(String srcName, TableDataSource tableDataSource, boolean isCover) {
return new HashMap<>(0);
}
public Map<String, String> addTableData(String srcName, TableDataSource tableDataSource) {
return new HashMap<>(0);
return addTableData(srcName, tableDataSource, false);
}
public void removeTableData(String sourceName) {
}
}

17
designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java

@ -1,5 +1,6 @@
package com.fr.design.data;
import com.fr.data.TableDataSource;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.StringUtils;
@ -10,6 +11,7 @@ import com.fr.stable.StringUtils;
* Created by hades on 2020/4/27
*/
public abstract class BasicTableDataUtils {
private static final String SEPARATOR = "-";
private static final int LEN = 2;
@ -33,4 +35,19 @@ public abstract class BasicTableDataUtils {
}
return false;
}
public static String getTableDataName(boolean isCover, TableDataSource tds, String tdName, String srcName, boolean isDsNameRepeaded) {
if (isCover) {
return srcName + SEPARATOR + tdName;
}
if (tds.getTableData(tdName) != null || isDsNameRepeaded) {//如果有同名的就拼上来源名称
tdName = srcName + SEPARATOR + tdName;
}
int i = 0;
while (tds.getTableData(tdName) != null) {
i++;//如果拼上名字后依然已经存在就加编号
tdName += i;
}
return tdName;
}
}

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

@ -60,7 +60,10 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
if (StringUtils.isEmpty(tempName)) {
isNamePermitted = false;
nameableList.stopEditing();
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Empty_Name_Tips"));
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this),
Toolkit.i18nText("Fine-Design_Basic_Table_Data_Empty_Name_Tips"),
Toolkit.i18nText("Fine-Design_Report_Alert"),
JOptionPane.WARNING_MESSAGE);
setIllegalIndex(editingIndex);
return;
}

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

@ -9,6 +9,7 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.BasicTableDataTreePane;
import com.fr.design.data.BasicTableDataUtils;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.StoreProcedureWorkerListener;
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane;
@ -59,7 +60,7 @@ import java.util.Map;
public class TableDataTreePane extends BasicTableDataTreePane {
private static TableDataTreePane singleton = new TableDataTreePane();
public static final int PLUGIN_LISTENER_PRIORITY = 1;
public synchronized static BasicTableDataTreePane getInstance(DesignModelAdapter<?, ?> tc) {
@ -96,10 +97,10 @@ public class TableDataTreePane extends BasicTableDataTreePane {
addMenuDef.setIconPath(IconPathConstants.ADD_POPMENU_ICON_PATH);
createAddMenuDef();
// 创建插件监听
createPluginListener();
editAction = new EditAction();
removeAction = new RemoveAction();
previewTableDataAction = new PreviewTableDataAction(dataTree);
@ -139,27 +140,27 @@ public class TableDataTreePane extends BasicTableDataTreePane {
new TableDataTreeDragSource(dataTree, DnDConstants.ACTION_COPY);
checkButtonEnabled();
}
private void createPluginListener() {
//菜单栏监听
GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) {
@Override
public void on(PluginEvent event) {
addMenuDef.clearShortCuts();
createAddMenuDef();
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign);
}
});
//监听数据集插件
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
@ -188,8 +189,8 @@ public class TableDataTreePane extends BasicTableDataTreePane {
}
});
}
protected void checkButtonEnabled() {
super.checkButtonEnabled(editAction, previewTableDataAction, removeAction, op, dataTree);
}
@ -339,10 +340,11 @@ public class TableDataTreePane extends BasicTableDataTreePane {
/**
* 合并数据集
* @param srcName 数据集来源(比如报表块就是报表块的名称)
*
* @param srcName 数据集来源(比如报表块就是报表块的名称)
* @param tableDataSource 数据集
*/
public Map<String, String> addTableData(String srcName, TableDataSource tableDataSource) {
public Map<String, String> addTableData(String srcName, TableDataSource tableDataSource, boolean isCover) {
Map<String, String> tdNameMap = new HashMap<>();
allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook());
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
@ -352,14 +354,8 @@ public class TableDataTreePane extends BasicTableDataTreePane {
String tdName = (String) tdIterator.next();
String oldName = tdName;
TableData td = tableDataSource.getTableData(tdName);
if (tds.getTableData(tdName) != null || isDsNameRepeaded(tdName)) {//如果有同名的就拼上来源名称
tdName = srcName + tdName;
}
int i = 0;
while (tds.getTableData(tdName) != null) {
i++;//如果拼上名字后依然已经存在就加编号
tdName += i;
}
boolean isDsNameRepeaded = isDsNameRepeaded(tdName);
tdName = BasicTableDataUtils.getTableDataName(isCover, tds, tdName, srcName, isDsNameRepeaded);
tds.putTableData(tdName, td);
if (!ComparatorUtils.equals(oldName, tdName)) {
tdNameMap.put(oldName, tdName);
@ -367,8 +363,19 @@ public class TableDataTreePane extends BasicTableDataTreePane {
}
tc.parameterChanged();
dataTree.refresh();
return Collections.unmodifiableMap(tdNameMap);
return Collections.unmodifiableMap(tdNameMap);
}
@Override
public void removeTableData(String sourceName) {
TableDataSource tds = tc.getBook();
tds.removeTableData(sourceName);
dataTree.refresh();
}
public void addDataPane(final AbstractTableDataPane<?> uPanel, String paneName) {
final NamePane nPanel = uPanel.asNamePane();
nPanel.setObjectName(paneName);

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

@ -1,5 +1,6 @@
package com.fr.design.data.tabledata.tabledatapane;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -11,6 +12,8 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.StringUtils;
public class MaxMemRowCountPanel extends UIToolbar {
@ -19,7 +22,7 @@ public class MaxMemRowCountPanel extends UIToolbar {
private static final String[] CACHE_LIST = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Save_All_Records_In_Memory"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Max_Mem_Row_Count") };
private static final int MAX_WIDTH = getMaxComBoBoxWidth() > 200 ? 350 : 250;
private static final int MAX_COMPONENT_COUNT_OF_MAX_MEMORY = 4;
private static int getMaxComBoBoxWidth() {
int maxWidth = GraphHelper.getWidth(CACHE_LIST[0]);
for (int i = 1; i < CACHE_LIST.length; i++) {
@ -86,9 +89,13 @@ public class MaxMemRowCountPanel extends UIToolbar {
this.removeAll();
this.add(switchCache);
switchCache.setSelectedIndex(MAX_IN_MEMORY);
this.add(new UILabel(" "));
if (this.getComponentCount() == MAX_COMPONENT_COUNT_OF_MAX_MEMORY) {
//此处因为switchCache的setSelectedIndex可能会造成双层调用,然后因为重复添加组件产生bug,故而定义这个工具栏的正常最大组件数,做个判断
return;
}
this.add(new UILabel(StringUtils.BLANK));
this.add(numberSpinner);
this.add(new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Row")));
this.add(new UILabel(StringUtils.BLANK + Toolkit.i18nText("Fine-Design_Basic_Row")));
this.validate();
this.repaint();
}

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

@ -1,16 +1,39 @@
package com.fr.design.env;
import com.fr.design.DesignerEnvManager;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.security.SecurityToolbox;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.workspace.WorkContext;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import java.util.HashSet;
import java.util.Set;
public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
private static final Set<String> FILTER_SET = new HashSet<>();
private static final String HTTPS = "https://";
private static final String HTTP = "http://";
private static final String DEFAULT_SERVLET_NAME = "decision";
private static final String PATH = ProjectConstants.FORWARD_SLASH + ProjectConstants.WEBAPP_NAME + ProjectConstants.FORWARD_SLASH + DEFAULT_SERVLET_NAME;
private static final String HOST_NAME = "127.0.0.1";
private static final String LOCAL_HOTS_NAME = "localhost";
private static final String QUOTATION = ":";
private static final String PORT = Integer.toString(DesignerEnvManager.getEnvManager().getEmbedServerPort());
static {
FILTER_SET.add(HTTP + HOST_NAME + QUOTATION + PORT + PATH);
FILTER_SET.add(HTTPS + HOST_NAME + QUOTATION + PORT + PATH);
FILTER_SET.add(HTTP + LOCAL_HOTS_NAME + QUOTATION + PORT + PATH);
FILTER_SET.add(HTTPS + LOCAL_HOTS_NAME + QUOTATION + PORT + PATH);
}
private String name;
private String remindTime;
@ -109,6 +132,10 @@ public class RemoteDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
@Override
public boolean checkValid() {
boolean result = false;
if (FILTER_SET.contains(connection.getUrl())) {
FineLoggerFactory.getLogger().error("url is same with local designer");
return result;
}
try {
result = WorkContext.getConnector().testConnection(connection);
} catch (Exception e) {

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

@ -4,8 +4,10 @@ import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.stable.fun.mark.Immutable;
/**
* 单元格属性面板扩展接口,接口基本逻辑不通且不符合接口设计规范,单元格属性扩展可以使用CellPropertyPaneProvider
* Created by zhouping on 2015/11/11.
*/
@Deprecated
public interface CellAttributeProvider extends Immutable{
String MARK_STRING = "CellAttributeProvider";

18
designer-base/src/main/java/com/fr/design/fun/CellPropertyPaneProvider.java

@ -0,0 +1,18 @@
package com.fr.design.fun;
import com.fr.design.cell.CellElementPropertyComponent;
/**
* 单元格设置(属性)扩展接口
* @author zack
* @version 10.0
* Created by zack on 2020/7/14
*/
public interface CellPropertyPaneProvider extends PropertyItemPaneProvider {
/**
* 构造单元格属性面板,面板实现需要使用单例模式实现
* @return 面板类
*/
CellElementPropertyComponent getSingletonCelPropertyPane();
}

15
designer-base/src/main/java/com/fr/design/fun/impl/AbstractCellPropertyPaneProvider.java

@ -0,0 +1,15 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.CellPropertyPaneProvider;
import com.fr.stable.fun.mark.API;
/**
* Created by zhouping on 2015/11/11.
*/
@API(level = CellPropertyPaneProvider.CURRENT_LEVEL)
public abstract class AbstractCellPropertyPaneProvider extends AbstractPropertyItemPaneProvider implements CellPropertyPaneProvider {
public int currentAPILevel() {
return CellPropertyPaneProvider.CURRENT_LEVEL;
}
}

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

@ -9,12 +9,14 @@ import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.ShortCut;
import com.fr.design.os.impl.PopupDialogSaveAction;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.invoke.Reflect;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSSupportCenter;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
@ -273,6 +275,8 @@ abstract class UIControlPane extends JControlPane {
}
saveSettings();
setVisible(false);
PopupDialogSaveAction saveAction = OSSupportCenter.getAction(PopupDialogSaveAction.class);
saveAction.unregister();
}
private void initListener() {

4
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java

@ -7,9 +7,11 @@ import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.UINameEdList;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.PopupDialogSaveAction;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import com.fr.stable.os.support.OSSupportCenter;
import javax.swing.DefaultListModel;
import javax.swing.JList;
@ -216,6 +218,8 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon
((PopupEditDialog)popupEditDialog).setTitle(getSelectedName());
}
popupEditDialog.setVisible(true);
PopupDialogSaveAction osBasedAction = OSSupportCenter.getAction(PopupDialogSaveAction.class);
osBasedAction.register(this, popupEditDialog);
}
}

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

@ -18,6 +18,10 @@ import java.awt.event.MouseMotionListener;
*/
public class UIEastResizableContainer extends JPanel {
private static final long serialVersionUID = 1854340560790476907L;
public static final int MAX_CONTAINER_WIDTH = 500;
public static final int MIN_CONTAINER_WIDTH = 286;
private int containerWidth = 240;
private int preferredWidth = 240;
private int topToolPaneHeight = 25;
@ -262,7 +266,13 @@ public class UIEastResizableContainer extends JPanel {
@Override
public void mouseDragged(MouseEvent e) {
// do nothing
containerWidth = UIEastResizableContainer.this.getWidth() + (UIEastResizableContainer.this.getLocationOnScreen().x - e.getXOnScreen());
containerWidth = Math.min(containerWidth, MAX_CONTAINER_WIDTH);
containerWidth = Math.max(containerWidth, MIN_CONTAINER_WIDTH);
refreshContainer();
if ( DesignModeContext.isAuthorityEditing()) {
DesignerContext.getDesignerFrame().doResize();
}
}
});
addMouseListener(new MouseAdapter() {

7
designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java

@ -96,4 +96,11 @@ public class ProgressDialog extends UIDialog {
public void updateLoadingText(String text) {
this.text.setText(text);
}
public void updateLoadingText(String text, FRFont font) {
if (font != null) {
this.text.setFont(font);
}
this.text.setText(text);
}
}

4
designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java

@ -395,7 +395,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane<ReportletHyp
// 自定义
custom = new UIRadioButton(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Custom"));
custom.setBorder(BorderFactory.createEmptyBorder(4, 20, 4, 5));
custom.setBorder(BorderFactory.createEmptyBorder(4, 15, 4, 5));
ButtonGroup group = new ButtonGroup();
group.setSelected(center.getModel(), true);
group.add(center);
@ -405,7 +405,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane<ReportletHyp
// 位置 距左
final UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Dialog_Position_Left"));
leftLabel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 10));
leftLabel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 10));
leftLocation = new UINumberField();
leftLocation.setMinValue(0);
leftLocation.setPreferredSize(new Dimension(40, 20));

13
designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java

@ -38,7 +38,18 @@ public enum SupportLocaleImpl implements SupportLocale {
set.add(Locale.TAIWAN);
return set;
}
}
},
/**
* 支持韩文
*/
SUPPORT_KOREA {
@Override
public Set<Locale> support() {
Set<Locale> set = new HashSet<Locale>();
set.add(Locale.KOREA);
return set;
}
}
}

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

@ -1,6 +1,7 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
@ -66,7 +67,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private JPanel leftPane;
private JPanel rightPane;
private FixedPopupPane currentPopupPane;
private static final int CONTAINER_WIDTH = 286;
private static final int CONTAINER_WIDTH = containerWidth();
private static final int TAB_WIDTH = 38;
private static final int TAB_BUTTON_WIDTH = 32;
private static final int TAB_BUTTON_HEIGHT = 28;
@ -107,6 +108,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private PropertyMode currentMode; // 当前模式(根据不同模式,显示不同的可用面板)
private static int containerWidth() {
if (FRContext.isChineseEnv()) {
return UIEastResizableContainer.MIN_CONTAINER_WIDTH;
}
return UIEastResizableContainer.MAX_CONTAINER_WIDTH;
}
/**
* 得到实例
*
@ -219,8 +227,10 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
itemBean.getEnableModes());
UIButton button = propertyItem.getButton();
List<ActionListener> buttonListeners = itemBean.getButtonListeners();
for (ActionListener buttonListener : buttonListeners) {
button.addActionListener(buttonListener);
if (buttonListeners != null) {
for (ActionListener buttonListener : buttonListeners) {
button.addActionListener(buttonListener);
}
}
propertyItemMap.put(key, propertyItem);

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

@ -1,45 +1,27 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ibutton.UISliderButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.islider.UISlider;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButton;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.NumberFormatter;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.math.BigDecimal;
@ -51,72 +33,37 @@ public class JFormSliderPane extends JPanel {
private static final double ONEPOINTEIGHT = 1.8;
private static final int SIX = 6;
private static final int TEN = 10;
private static final int ONE_EIGHT = 18;
private static final int FONT_SIZE = 12;
private static final int SPINNER_WIDTH = 45;
private static final int SPINNER_HEIGHT = 20;
private static final int HALF_HUNDRED = 50;
private static final int HUNDRED = 100;
private static final int TWO_HUNDRED = 200;
private static final int THREE_HUNDRED = 300;
private static final int FOUR_HUNDRED = 400;
private static final int DIALOG_WIDTH = 157;
private static final int DIALOG_HEIGHT = 172;
private static final int SLIDER_WIDTH = 220;
private static final int SLIDER_HEIGHT = 20;
private static final int SHOWVALBUTTON_WIDTH = 40;
private static final int SHOWVALBUTTON_HEIGHTH = 20;
private static final int SLIDER_GAP = 5;
private static final String SUFFIX = "%";
private static final String REGEX = "[\\d%]*";
private static final int TOOLTIP_Y = 30;
private static final Color BACK_COLOR = new Color(245, 245, 247);
public int showValue = 100;
public double resolutionTimes = 1.0;
private UITextField showVal;
private JSpinner showValSpinner;
private UITextField showValField;
private UISlider slider;
private int times;
private int sliderValue;
private UIButton downButton;
private UIButton upButton;
private UISliderButton showValButton;
private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton;
private UIRadioButton sevenFiveButton;
private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton;
private UIRadioButton customButton;
//拖动条处理和button、直接输入不一样
private boolean isButtonOrIsTxt = true;
//是否选中指定的几个缩放等级,避免触发不必要的事件
private boolean selectSpecified = false;
private FormPopupPane dialog;
private int upButtonX;
private JPanel dialogContentPanel;
public JFormSliderPane() {
this.setLayout(new BorderLayout());
initSlider();
initShowValSpinner();
//MoMeak:控制只能输入10-400
JSpinner.NumberEditor editor = new JSpinner.NumberEditor(showValSpinner, "0");
showValSpinner.setEditor(editor);
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.setEditable(true);
DefaultFormatterFactory factory = (DefaultFormatterFactory) textField.getFormatterFactory();
NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
formatter.setAllowsInvalid(false);
initDownUpButton();
initShowValButton();
initUIRadioButton();
initPane();
initShowValField();
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
panel.add(downButton);
panel.add(slider);
panel.add(upButton);
panel.add(showValButton);
panel.add(showValField);
panel.setBackground(BACK_COLOR);
this.add(panel, BorderLayout.NORTH);
}
@ -131,6 +78,7 @@ public class JFormSliderPane extends JPanel {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
slider.setValue(HALF_HUNDRED);
slider.setUI(new JSliderPaneUI(slider));
slider.addChangeListener(listener);
slider.setPreferredSize(new Dimension(220, 20));
@ -139,16 +87,6 @@ public class JFormSliderPane extends JPanel {
slider.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Slider"));
}
private void initShowValSpinner() {
showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, 0, FOUR_HUNDRED, 1)) {
public Point getToolTipLocation(MouseEvent event) {
return new Point(event.getX(), event.getY() - TOOLTIP_Y);
}
};
showValSpinner.setEnabled(true);
showValSpinner.addChangeListener(showValSpinnerChangeListener);
showValSpinner.setPreferredSize(new Dimension(SPINNER_WIDTH, SPINNER_HEIGHT));
}
private void initDownUpButton() {
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png")) {
@ -173,128 +111,76 @@ public class JFormSliderPane extends JPanel {
upButton.addActionListener(buttonActionListener);
}
private void initShowValButton() {
showValButton = new UISliderButton(showValSpinner.getValue() + "%");
showValButton.setBackground(BACK_COLOR);
showValButton.setBorderPainted(false);
showValButton.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH));
showValButton.addActionListener(showValButtonActionListener);
showValButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Grade"));
}
private void initShowValField() {
showValField = new UITextField(showValue + SUFFIX);
showValField.setBorderPainted(false);
showValField.setPreferredSize(new Dimension(SHOWVALBUTTON_WIDTH, SHOWVALBUTTON_HEIGHTH));
showValField.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent evt) {
int code = evt.getKeyCode();
private void initUIRadioButton() {
twoHundredButton = new UIRadioButton("200%");
oneHundredButton = new UIRadioButton("100%");
sevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%");
selfAdaptButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Self_Adapt_Button"));
selfAdaptButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
customButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Custom_Button"));
customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener);
sevenFiveButton.addItemListener(radioButtonItemListener);
fiveTenButton.addItemListener(radioButtonItemListener);
twoFiveButton.addItemListener(radioButtonItemListener);
customButton.addItemListener(new ItemListener() {
if (code == KeyEvent.VK_ENTER) {
showValue = parseInputValue(showValField.getText());
showValField.setText(showValue + SUFFIX);
showValFieldChange();
}
}
});
showValField.setDocument(new PlainDocument() {
@Override
public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource();
if (temp.isSelected()) {
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.requestFocus();
textField.selectAll();
public void insertString(int offset, String s, AttributeSet a) throws BadLocationException {
if (!s.matches(REGEX)) {
return;
}
super.insertString(offset, s, a);
}
});
ButtonGroup bg = new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton);
bg.add(sevenFiveButton);
bg.add(fiveTenButton);
bg.add(twoFiveButton);
bg.add(selfAdaptButton);
bg.add(customButton);
customButton.setSelected(true);
}
private void initPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p, p, p, p, p, p, p, p};
UILabel upLabel = new UILabel(" " + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_EnlargeOrReduce"));
upLabel.setOpaque(false);
JPanel septPane = new JPanel(new BorderLayout());
JSeparator sept = new JSeparator();
sept.setBackground(new Color(232, 232, 233));
septPane.add(sept, BorderLayout.NORTH);
septPane.setBorder(BorderFactory.createEmptyBorder(2, 5, 1, 10));
septPane.setBackground(BACK_COLOR);
twoHundredButton.setBackground(BACK_COLOR);
oneHundredButton.setBackground(BACK_COLOR);
sevenFiveButton.setBackground(BACK_COLOR);
fiveTenButton.setBackground(BACK_COLOR);
twoFiveButton.setBackground(BACK_COLOR);
// selfAdaptButton.setBackground(BACK_COLOR);
customButton.setBackground(BACK_COLOR);
Component[][] components = new Component[][]{
new Component[]{upLabel, null},
new Component[]{septPane, null},
new Component[]{twoHundredButton, null},
new Component[]{oneHundredButton, null},
new Component[]{sevenFiveButton, null},
new Component[]{fiveTenButton, null},
new Component[]{twoFiveButton, null},
new Component[]{customButton, createSpinnerPanel()}
};
dialogContentPanel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_MEDIUM, 0);
dialogContentPanel.setBackground(BACK_COLOR);
dialogContentPanel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
private void showValFieldChange() {
isButtonOrIsTxt = true;
showValue = getPreferredValue(showValue);
refreshShowValueFieldText();
refreshSlider();
}
private JPanel createSpinnerPanel() {
JPanel spinnerPanel = new JPanel(new FlowLayout());
spinnerPanel.add(showValSpinner);
UILabel percent = new UILabel("%");
percent.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE));
spinnerPanel.add(percent);
spinnerPanel.setBackground(BACK_COLOR);
return spinnerPanel;
private int getPreferredValue(int value){
if (value > FOUR_HUNDRED) {
value = FOUR_HUNDRED;
}
if (value < TEN) {
value = TEN;
}
return value;
}
private ActionListener showValButtonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
popupDialog();
}
};
private void refreshShowValueFieldText(){
showValField.setText(showValue + SUFFIX);
}
private ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
int val = (int) ((UIBasicSpinner) e.getSource()).getValue();
isButtonOrIsTxt = true;
resolutionTimes = divide(showValue, 100, 2);
if (val > FOUR_HUNDRED) {
showValSpinner.setValue(FOUR_HUNDRED);
val = FOUR_HUNDRED;
}
if (val < TEN) {
showValSpinner.setValue(TEN);
val = TEN;
}
refreshSlider(val);
refreshBottun(val);
JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
textField.setCaretPosition(showValSpinner.getValue().toString().length());
if (!selectSpecified) {
customButton.setSelected(true);
}
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;
}
}
//定义一个监听器,用于监听所有滑动条
@ -302,13 +188,12 @@ public class JFormSliderPane extends JPanel {
public void stateChanged(ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt) {
customButton.setSelected(true);
EventQueue.invokeLater(new Runnable() {
public void run() {
sliderValue = slider.getValue();
getTimes(sliderValue);
showValue = times;
showValSpinner.setValue(times);
refreshShowValueFieldText();
}
});
} else {
@ -317,41 +202,23 @@ public class JFormSliderPane extends JPanel {
}
};
private ItemListener radioButtonItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
JRadioButton temp = (JRadioButton) e.getSource();
if (temp.isSelected()) {
selectSpecified = true;
showValSpinner.setValue(Integer.valueOf(temp.getText().substring(0, temp.getText().indexOf("%"))));
selectSpecified = false;
}
}
};
private void refreshSlider(int val) {
showValue = val;
if (showValue > HUNDRED) {
slider.setValue((int) (showValue + TWO_HUNDRED) / SIX);
} else if (showValue < HUNDRED) {
slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT));
} else {
slider.setValue(HALF_HUNDRED);
}
}
private void refreshBottun(int val) {
showValButton.setText(val + "%");
private void refreshSlider() {
slider.setValue(calSliderValue(showValue));
}
public double getResolutionTimes() {
return this.resolutionTimes;
private int calSliderValue(int value) {
int result;
if (value > HUNDRED) {
result = (value + TWO_HUNDRED) / SIX;
} else if (value < HUNDRED) {
result = (int) ((value - TEN) / ONEPOINTEIGHT);
} else {
result = HALF_HUNDRED;
}
return result;
}
public int getshowValue() {
return this.showValue;
}
public static double divide(double v1, double v2, int scale) {
BigDecimal b1 = new BigDecimal(Double.toString(v1));
@ -362,30 +229,28 @@ public class JFormSliderPane extends JPanel {
private ActionListener buttonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showValue = (int) showValSpinner.getValue();
isButtonOrIsTxt = true;
if ("less".equals(e.getActionCommand())) {
int newDownVal = showValue - TEN;
if (newDownVal >= TEN) {
showValue = newDownVal;
showValSpinner.setValue(newDownVal);
} else {
showValue = newDownVal;
showValSpinner.setValue(TEN);
showValue = TEN;
}
refreshShowValueFieldText();
refreshSlider();
}
if ("more".equals(e.getActionCommand())) {
int newUpVal = showValue + TEN;
if (newUpVal <= FOUR_HUNDRED) {
showValue = newUpVal;
showValSpinner.setValue(newUpVal);
} else {
showValue = newUpVal;
showValSpinner.setValue(FOUR_HUNDRED);
showValue = TEN;
}
refreshShowValueFieldText();
refreshSlider();
}
isButtonOrIsTxt = true;
customButton.setSelected(true);
}
};
@ -396,37 +261,26 @@ public class JFormSliderPane extends JPanel {
} else if (value < HALF_HUNDRED) {
times = (int) Math.round(ONEPOINTEIGHT * value + TEN);
} else {
times = (int) (SIX * value - TWO_HUNDRED);
times = SIX * value - TWO_HUNDRED;
}
}
public JSpinner getShowVal() {
return this.showValSpinner;
public int getShowValue() {
return this.showValue;
}
public UIRadioButton getSelfAdaptButton() {
return this.selfAdaptButton;
public void setShowValue(int value) {
showValue = value;
showValFieldChange();
}
private void popupDialog() {
Point btnCoords = upButton.getLocationOnScreen();
if (dialog == null) {
dialog = new FormPopupPane(upButton, dialogContentPanel);
if (upButtonX == 0) {
upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
}
} else {
if (upButtonX == 0) {
upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
} else {
GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT);
}
}
public void addValueChangeListener(ChangeListener changeListener){
this.slider.addChangeListener(changeListener);
}
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@ -440,16 +294,3 @@ public class JFormSliderPane extends JPanel {
}
}
class FormPopupPane extends JPopupMenu {
private static final int DIALOG_WIDTH = 157;
private static final int DIALOG_HEIGHT = 172;
FormPopupPane(UIButton b, JPanel dialogContentPanel) {
this.add(dialogContentPanel, BorderLayout.CENTER);
this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
this.setBackground(new Color(245, 245, 247));
}
}

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

@ -8,6 +8,7 @@ import com.fr.design.ui.util.UIUtil;
import com.fr.general.ComparatorUtils;
import com.fr.general.log.Log4jConfig;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.third.apache.log4j.Level;
import com.fr.third.apache.log4j.spi.LoggingEvent;
import com.fr.third.apache.log4j.spi.ThrowableInformation;
@ -53,12 +54,14 @@ public class DesignerLogHandler {
private static final int SERVER_GAP_Y = -20;
private static final String ERROR_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert") + ":";
private static final String ERROR_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Seriously") + ":";
private static final String WARN_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Seriously") + ":";
private static final String WARN_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Alert") + ":";
private static final String NORMAL_MARK = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Normal") + ":";
private static final String ACTION_MAP_KEY = "clear";
public static DesignerLogHandler getInstance() {
return HOLDER.singleton;
@ -223,14 +226,14 @@ public class DesignerLogHandler {
InputMap inputMap = resultPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER), DefaultEditorKit.copyAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, DEFAULT_MODIFIER), DefaultEditorKit.selectAllAction);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_L, DEFAULT_MODIFIER), "clear");
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_L, DEFAULT_MODIFIER), ACTION_MAP_KEY);
ActionMap actionMap = resultPane.getActionMap();
actionMap.put("clear", new AbstractAction() {
actionMap.put(ACTION_MAP_KEY, new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) {
resultPane.setText("");
resultPane.setText(StringUtils.EMPTY);
caption.clearMessage();
}
});
@ -293,10 +296,10 @@ public class DesignerLogHandler {
SimpleAttributeSet attrSet = new SimpleAttributeSet();
if (style == DesignerLogger.ERROR_INT) {
StyleConstants.setForeground(attrSet, new Color(247, 148, 29));
StyleConstants.setForeground(attrSet, Color.RED);
StyleConstants.setBold(attrSet, true);
} else if (style == DesignerLogger.WARN_INT) {
StyleConstants.setForeground(attrSet, Color.red);
StyleConstants.setForeground(attrSet, new Color(247, 148, 29));
StyleConstants.setBold(attrSet, true);
} else if (style == DesignerLogger.INFO_INT) {
StyleConstants.setForeground(attrSet, Color.black);
@ -330,9 +333,9 @@ public class DesignerLogHandler {
LogMessageBar.getInstance().setMessage(message);
if (level == DesignerLogger.INFO_INT && showInfo.isSelected()) {
caption.infoAdd();
} else if (level == DesignerLogger.ERROR_INT && showError.isSelected()) {
} else if (level == DesignerLogger.WARN_INT && showError.isSelected()) {
caption.errorAdd();
} else if (level == DesignerLogger.WARN_INT && showServer.isSelected()) {
} else if (level == DesignerLogger.ERROR_INT && showServer.isSelected()) {
caption.serverAdd();
}
}
@ -343,7 +346,7 @@ public class DesignerLogHandler {
this.copy.setEnabled(true);
this.clear.setEnabled(true);
if (ComparatorUtils.equals(this.jTextArea.getText(), "")) {
if (ComparatorUtils.equals(this.jTextArea.getText(), StringUtils.EMPTY)) {
this.selectAll.setEnabled(false);
this.clear.setEnabled(false);
}
@ -367,7 +370,7 @@ public class DesignerLogHandler {
} else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.copy.getText())) {
LogHandlerArea.this.jTextArea.copy();
} else if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.clear.getText())) {
LogHandlerArea.this.jTextArea.setText("");
LogHandlerArea.this.jTextArea.setText(StringUtils.EMPTY);
caption.clearMessage();
}
}

39
designer-base/src/main/java/com/fr/design/os/impl/PopupDialogSaveAction.java

@ -0,0 +1,39 @@
package com.fr.design.os.impl;
import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
import java.awt.*;
/**
* linux下超链弹窗等保存问题
*
* @author hades
* @version 10.0
* Created by hades on 2020/7/21
*/
public class PopupDialogSaveAction implements OSBasedAction {
private UIListControlPane currentControlPane;
private Window popupDialog;
@Override
public void execute(Object... objects) {
boolean canSave = OperatingSystem.isLinux() && popupDialog != null && popupDialog.isVisible() && currentControlPane != null;
if (canSave) {
currentControlPane.saveSettings();
}
}
public void register(UIListControlPane currentControlPane, Window popupDialog) {
this.currentControlPane = currentControlPane;
this.popupDialog = popupDialog;
}
public void unregister() {
this.currentControlPane = null;
this.popupDialog = null;
}
}

12
designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java

@ -2,8 +2,6 @@ package com.fr.design.os.impl;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.update.ui.dialog.UpdateMainDialog;
import com.fr.design.utils.DesignUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.stable.os.support.OSBasedAction;
/**
@ -12,14 +10,10 @@ import com.fr.stable.os.support.OSBasedAction;
* @date 2019/10/9
*/
public class UpdateDialogAction implements OSBasedAction {
private static String UPDATE_ROUTE = "#management/backup";
@Override
public void execute(Object... objects) {
if(!OperatingSystem.isLinux()) {
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.showDialog();
}else{
DesignUtils.visitEnvServerByParameters( UPDATE_ROUTE,null,null);
}
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.showDialog();
}
}

11
designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java

@ -11,6 +11,7 @@ import com.fr.design.style.color.ColorSelectDialog;
import com.fr.design.style.color.ColorSelectable;
import com.fr.stable.AssistUtils;
import com.fr.stable.os.OperatingSystem;
import javax.swing.JComponent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@ -124,14 +125,20 @@ public class GradientBar extends JComponent implements UIObserver, ColorSelectab
protected void addMouseDragListener() {
this.addMouseMotionListener(new MouseAdapter() {
public void mouseDragged(MouseEvent e) {
int oldIndex = index;
for (int i = 0; i < list.size(); i++) {
if (list.get(i).contains(e.getX(), e.getY())) {
index = i;
break;
}
}
if(OperatingSystem.isLinux() && AssistUtils.equals(oldIndex,index)){
if(Math.abs(p1.getX() - e.getX()) > Math.abs(p2.getX() - e.getX())){
index = 1;
}else{
index = 0;
}
}
boolean x = e.getX() <= max && e.getX() >= min;
if (x && e.getY() < MAX_VERTICAL) {
list.get(index).setX(e.getX());

55
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -27,6 +27,7 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.style.color.ColorCell;
import com.fr.design.style.color.ColorFactory;
import com.fr.design.style.color.ColorSelectBox;
@ -387,31 +388,35 @@ public final class GUICoreUtils {
* @param y y坐标
*/
public static void showPopupMenu(JPopupMenu popup, Component parentComponent, int x, int y) {
if (popup == null) {// check null.
return;
}
Point point = new Point(x, y);
SwingUtilities.convertPointToScreen(point, parentComponent);
Dimension size = popup.getPreferredSize();
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
screen.setSize(screen.getSize().width, screen.height - HEIGHT_GAP);
int showOnScreenX = Math.min(screen.width, parentComponent.getLocationOnScreen().x + parentComponent.getWidth());
// peter:调整X的高度.
if (point.x + size.width > showOnScreenX && size.width < showOnScreenX) {
x += (showOnScreenX - point.x - size.width);
}
// peter:调整y高度.
if (point.y + size.height > screen.height && size.height < screen.height) {
y -= size.height;
}
popup.show(parentComponent, x, y);
}
if (popup == null) {// check null.
return;
}
Point point = new Point(x, y);
SwingUtilities.convertPointToScreen(point, parentComponent);
Dimension size = popup.getPreferredSize();
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
screen.setSize(screen.getSize().width, screen.height - HEIGHT_GAP);
//父元素右边界的坐标
int parentComponentRightBorderPosition = parentComponent.getLocationOnScreen().x + parentComponent.getWidth();
//设计器右边界的坐标
Rectangle rectangle = DesignerContext.getDesignerFrame().getBounds();
int designerRightBorderPosition = rectangle.x + rectangle.width;
rectangle = SwingUtilities.getWindowAncestor(parentComponent).getBounds();
designerRightBorderPosition = Math.max(designerRightBorderPosition, rectangle.x + rectangle.width);
// peter:调整X的高度.
if (point.x + size.width > designerRightBorderPosition && size.width < designerRightBorderPosition) {
x += (parentComponentRightBorderPosition - point.x - size.width);
}
// peter:调整y高度.
if (point.y + size.height > screen.height && size.height < screen.height) {
y -= size.height;
}
popup.show(parentComponent, x, y);
}
/**
* Set enabled.<br>

4
designer-base/src/main/java/com/fr/file/FILEChooserPane.java

@ -12,6 +12,7 @@ import com.fr.design.dialog.UIDialog;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.NodeAuthProcessor;
import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI;
@ -916,7 +917,8 @@ public class FILEChooserPane extends BasicPane {
try {
access = FRContext.getOrganizationOperator().canAccess(selectedFile.getPath());
if (selectedFile.isEnvFile() && selectedFile instanceof FileNodeFILE) {
access = access && ((FileNodeFILE) selectedFile).hasFullAuth();
FileNodeFILE fileNodeFILE = ((FileNodeFILE) selectedFile);
access = access && fileNodeFILE.hasFullAuth() && NodeAuthProcessor.getInstance().checkFileNodeAuth(new FileNode(fileNodeFILE.getPath(), fileNodeFILE.isDirectory()));
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);

22
designer-base/src/main/java/com/fr/start/server/FineEmbedServerMonitor.java

@ -2,12 +2,18 @@ package com.fr.start.server;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.gui.iprogressbar.ProgressDialog;
import com.fr.design.i18n.Toolkit;
import com.fr.design.locale.impl.SupportLocaleImpl;
import com.fr.design.mainframe.DesignerContext;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.general.FRFont;
import com.fr.general.locale.LocaleAction;
import com.fr.general.locale.LocaleCenter;
import javax.swing.plaf.ColorUIResource;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@ -27,6 +33,11 @@ public class FineEmbedServerMonitor {
private static final int STEP_HEARTBEAT = 40;
private static volatile FineEmbedServerMonitor monitor;
private static ProgressDialog progressBar = DesignerContext.getDesignerFrame().getProgressDialog();
//由于默认值的字体不支持韩文,所以要对韩文单独生成字体
private FRFont font = null;
private static final int FONT_RGB = 333334;
private static final int FONT_SIZE = 14;
private static final String FONT_NAME = "Dialog";
private FineEmbedServerMonitor() {
}
@ -86,8 +97,15 @@ public class FineEmbedServerMonitor {
}
if (!DesignerContext.getDesignerFrame().getProgressDialog().isVisible()) {
DesignerContext.getDesignerFrame().showProgressDialog();
DesignerContext.getDesignerFrame().getProgressDialog()
.updateLoadingText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server"));
//如果为韩文则改变字体
LocaleCenter.buildAction(new LocaleAction() {
@Override
public void execute() {
font = FRFont.getInstance().applySize(FONT_SIZE).applyForeground(new ColorUIResource(FONT_RGB)).applyName(FONT_NAME);
}
}, SupportLocaleImpl.SUPPORT_KOREA);
String text = Toolkit.i18nText("Fine-Design_Basic_Loading_Embed_Server");
DesignerContext.getDesignerFrame().getProgressDialog().updateLoadingText(text, font);
}
DesignerContext.getDesignerFrame().updateProgress(getProgress());
}

27
designer-base/src/test/java/com/fr/design/data/BasicTableDataUtilsTest.java

@ -1,6 +1,9 @@
package com.fr.design.data;
import com.fr.base.TableData;
import com.fr.data.TableDataSource;
import junit.framework.TestCase;
import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.Test;
@ -41,4 +44,26 @@ public class BasicTableDataUtilsTest extends TestCase {
Assert.assertFalse(result12);
}
}
@Test
public void testGetTableDataName() {
TableDataSource source = EasyMock.mock(TableDataSource.class);
TableData tableData = EasyMock.mock(TableData.class);
EasyMock.expect(source.getTableData("ds1")).andReturn(tableData).anyTimes();
EasyMock.expect(source.getTableData("test-ds1")).andReturn(tableData).anyTimes();
EasyMock.expect(source.getTableData("test-ds11")).andReturn(null).anyTimes();
EasyMock.replay(source, tableData);
Assert.assertEquals("test-ds1", BasicTableDataUtils.getTableDataName(true, source, "ds1", "test", false));
Assert.assertEquals("test-ds11", BasicTableDataUtils.getTableDataName(false, source, "ds1", "test", false));
source = EasyMock.mock(TableDataSource.class);
EasyMock.expect(source.getTableData("ds1")).andReturn(null).anyTimes();
EasyMock.expect(source.getTableData("test-ds1")).andReturn(null).anyTimes();
EasyMock.replay(source);
Assert.assertEquals("test-ds1", BasicTableDataUtils.getTableDataName(true, source, "ds1", "test", false));
Assert.assertEquals("ds1", BasicTableDataUtils.getTableDataName(false, source, "ds1", "test", false));
Assert.assertEquals("test-ds1", BasicTableDataUtils.getTableDataName(false, source, "ds1", "test", true));
}
}

25
designer-base/src/test/java/com/fr/design/env/RemoteDesignerWorkspaceInfoTest.java vendored

@ -0,0 +1,25 @@
package com.fr.design.env;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import junit.framework.TestCase;
import org.junit.Assert;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/7/15
*/
public class RemoteDesignerWorkspaceInfoTest extends TestCase {
public void testCheckValid() {
RemoteDesignerWorkspaceInfo workspaceInfo0 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("http://localhost:8075/webroot/decision", "admin", "123", "", "", true));
RemoteDesignerWorkspaceInfo workspaceInfo1 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("http://127.0.0.1:8075/webroot/decision", "admin", "123", "", "", true));
RemoteDesignerWorkspaceInfo workspaceInfo2 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("https://127.0.0.1:8075/webroot/decision", "admin", "123", "", "", true));
RemoteDesignerWorkspaceInfo workspaceInfo3 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("https://localhost:8075/webroot/decision", "admin", "123", "", "", true));
Assert.assertFalse(workspaceInfo0.checkValid());
Assert.assertFalse(workspaceInfo1.checkValid());
Assert.assertFalse(workspaceInfo2.checkValid());
Assert.assertFalse(workspaceInfo3.checkValid());
}
}

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

@ -0,0 +1,51 @@
package com.fr.design.mainframe;
import com.fr.invoke.Reflect;
import org.junit.Assert;
import org.junit.Test;
/**
* Created by kerry on 2020-07-28
*/
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
public void testGetPreferredValue() {
JFormSliderPane sliderPane = new JFormSliderPane();
int result = Reflect.on(sliderPane).call("getPreferredValue", 100).get();
Assert.assertEquals(100, result);
result = Reflect.on(sliderPane).call("getPreferredValue", 0).get();
Assert.assertEquals(10, result);
result = Reflect.on(sliderPane).call("getPreferredValue", 1000).get();
Assert.assertEquals(400, result);
}
@Test
public void testCalSliderValue() {
JFormSliderPane sliderPane = new JFormSliderPane();
int result = Reflect.on(sliderPane).call("calSliderValue", 10).get();
Assert.assertEquals(0, result);
result = Reflect.on(sliderPane).call("calSliderValue", 90).get();
Assert.assertEquals(44, result);
result = Reflect.on(sliderPane).call("calSliderValue", 100).get();
Assert.assertEquals(50, result);
result = Reflect.on(sliderPane).call("calSliderValue", 200).get();
Assert.assertEquals(66, result);
result = Reflect.on(sliderPane).call("calSliderValue", 400).get();
Assert.assertEquals(100, result);
}
}

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

@ -49,6 +49,7 @@ import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.area.VanChartAreaPlot;
import com.fr.plugin.chart.box.VanChartBoxPlot;
import com.fr.plugin.chart.bubble.VanChartBubblePlot;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.plugin.chart.custom.VanChartCustomPlot;
@ -79,6 +80,7 @@ import com.fr.stable.StringUtils;
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider;
import com.fr.van.chart.area.AreaIndependentVanChartInterface;
import com.fr.van.chart.bar.BarIndependentVanChartInterface;
import com.fr.van.chart.box.BoxIndependentVanChartInterface;
import com.fr.van.chart.bubble.BubbleIndependentVanChartInterface;
import com.fr.van.chart.column.VanColumnChartTypeUI;
import com.fr.van.chart.custom.CustomIndependentVanChartInterface;
@ -202,6 +204,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartWordCloudPlot.WORD_CLOUD_PLOT_ID, new WordCloudIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartGanttPlot.VAN_CHART_GANTT_PLOT_ID, new GanttIndependentVanChartInterface());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartStructurePlot.STRUCTURE_PLOT_ID, new VanStructureChartTypeUI());
addChartTypeInterface(VAN_CHART_PRIORITY, VanChartBoxPlot.VAN_CHART_BOX_PLOT_ID, new BoxIndependentVanChartInterface());
}

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

@ -52,7 +52,7 @@ public class ColorSchemeComboBox extends UIComboBox {
this.setRenderer(new ColorSchemeCellRenderer());
}
private Map<String, ColorInfo> getColorSchemesFromConfig() {
protected Map<String, ColorInfo> getColorSchemesFromConfig() {
Map<String, ColorInfo> colorSchemes = new LinkedHashMap<>();
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
@ -92,7 +92,14 @@ public class ColorSchemeComboBox extends UIComboBox {
}
public void refresh() {
this.colorSchemes = getColorSchemesFromConfig();
refresh(null);
}
public void refresh(Map<String, ColorInfo> colorSchemes) {
if (colorSchemes == null) {
colorSchemes = getColorSchemesFromConfig();
}
this.colorSchemes = colorSchemes;
this.setModel(new DefaultComboBoxModel(colorSchemes.keySet().toArray()));
}
@ -149,7 +156,7 @@ public class ColorSchemeComboBox extends UIComboBox {
return colorSchemes.keySet();
}
public class ColorInfo {
public static class ColorInfo {
private List<Color> colors;

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

@ -7,13 +7,13 @@ import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.TopDefinition;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
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.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
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.ThirdTabPane;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -50,6 +50,11 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
this.isNeedPresent = true;
}
public ChartDataFilterPane(Plot plot, ChartDataPane parent, boolean isNeedPresent) {
super(plot, parent);
this.isNeedPresent = isNeedPresent;
}
protected void initTabPane() {
super.initTabPane();
tabPane.setPreferredSize(new Dimension(221, 25));
@ -109,7 +114,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
* @return 返回标题.
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter");
return Toolkit.i18nText("Fine-Design_Chart_Data_Filter");
}
/**
@ -144,12 +149,17 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
}
public void populateBean(ChartCollection collection, boolean isNeedPresent) {
relayoutPane(isNeedPresent);
TopDefinitionProvider topDefinition = collection.getSelectedChart().getFilterDefinition();
populateDefinition(topDefinition, isNeedPresent);
}
public void populateDefinition(TopDefinitionProvider topDefinition, boolean isNeedSummary) {
relayoutPane(isNeedSummary);
if (categoryPane != null) {
categoryPane.populateBean(collection.getSelectedChart().getFilterDefinition());
categoryPane.populateBean(topDefinition);
}
if (seriesPane != null) {
seriesPane.populateBean(collection.getSelectedChart().getFilterDefinition());
seriesPane.populateBean(topDefinition);
}
checkBoxUse();
}
@ -165,11 +175,16 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
* 保存界面数据筛选.
*/
public void updateBean(ChartCollection collection) {
TopDefinitionProvider topDefinition = collection.getSelectedChart().getFilterDefinition();
updateDefinition(topDefinition);
}
public void updateDefinition(TopDefinitionProvider topDefinition) {
if (categoryPane != null) {
categoryPane.updateBean(collection.getSelectedChart().getFilterDefinition());
categoryPane.updateBean(topDefinition);
}
if (seriesPane != null) {
seriesPane.updateBean(collection.getSelectedChart().getFilterDefinition());
seriesPane.updateBean(topDefinition);
}
}
@ -222,13 +237,13 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
}
protected JPanel initOtherPane() {
onlyPreData = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Only_Use_Before_Records"));
onlyPreData = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Only_Use_Before_Records"));
JPanel panel1 = new JPanel(new BorderLayout());
JPanel panel2 = new JPanel(new BorderLayout());
panel1.add(onlyPreData, BorderLayout.NORTH);
preDataNum = new UITextField();
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Records_Num"));
combineOther = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_CombineOther"));
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Records_Num"));
combineOther = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Data_CombineOther"));
combineOther.setSelected(true);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
@ -244,7 +259,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
//默认不显示
preDataNumPane.setVisible(false);
panel1.add(preDataNumPane, BorderLayout.CENTER);
notShowNull = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Not_Show_Cate"));
notShowNull = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Data_Not_Show_Cate"));
panel2.add(notShowNull, BorderLayout.NORTH);
onlyPreData.addChangeListener(new ChangeListener() {
@ -258,7 +273,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
fire();
}
};
presentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Present") ,present);
presentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Style_Present") ,present);
panel2.add(presentPane, BorderLayout.SOUTH);
double[] column = {f};
@ -281,7 +296,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
* 界面标题 "分类"
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Category");
return Toolkit.i18nText("Fine-Design_Chart_Style_Category");
}
/**
@ -397,13 +412,13 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
protected JPanel initOtherPane() {
onlyPreData = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Only_Use_Before_Records"));
onlyPreData = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Only_Use_Before_Records"));
JPanel panel1 = new JPanel(new BorderLayout());
JPanel panel2 = new JPanel(new BorderLayout());
panel1.add(onlyPreData, BorderLayout.NORTH);
preDataNum = new UITextField();
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Records_Num"));
combineOther = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_CombineOther"));
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Records_Num"));
combineOther = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Data_CombineOther"));
combineOther.setSelected(true);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
@ -419,7 +434,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
//默认不显示
preDataNumPane.setVisible(false);
panel1.add(preDataNumPane, BorderLayout.CENTER);
notShowNull = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Not_Show_Series"));
notShowNull = new UICheckBox(Toolkit.i18nText("Fine-Design_Chart_Data_Not_Show_Series"));
panel2.add(notShowNull, BorderLayout.NORTH);
onlyPreData.addChangeListener(new ChangeListener() {
@ -433,7 +448,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
fire();
}
};
presentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Present") ,present);
presentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Style_Present") ,present);
panel2.add(presentPane, BorderLayout.SOUTH);
double[] column = {f};
@ -457,7 +472,7 @@ public class ChartDataFilterPane extends ThirdTabPane<ChartCollection> {
* 界面标题
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series");
return Toolkit.i18nText("Fine-Design_Chart_Series");
}
/**

9
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotMoreCateReportDataContentPane.java

@ -13,21 +13,20 @@ import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/**
@ -72,14 +71,14 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor
catePane.add(boxPane, BorderLayout.SOUTH);
catePane.setBorder(BorderFactory.createEmptyBorder(0,24,10,6));
catePane.setBorder(BorderFactory.createEmptyBorder(0,24,10,20));
this.add(catePane, "0,0,2,0");
filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent);
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane);
panel.setBorder(getSidesBorder());
filterPane.setBorder(getFilterPaneBorder());
this.add(panel, "0,6,2,4");
this.add(panel, "0,6,1,4");
addButton.addActionListener(new ActionListener() {
@Override

11
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java

@ -10,7 +10,6 @@ import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -18,9 +17,9 @@ import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.List;
public class CategoryPlotReportDataContentPane extends AbstractReportDataContentPane {
protected static final int PRE_WIDTH = 210;
@ -35,14 +34,14 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
public CategoryPlotReportDataContentPane(ChartDataPane parent) {
initEveryPane();
categoryName = initCategoryBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Name"));
categoryName.setPreferredSize(new Dimension(246,30));
categoryName.setBorder(BorderFactory.createEmptyBorder(0,24,0,7));
this.add(categoryName, "0,0,2,0");
categoryName.setPreferredSize(new Dimension(236,30));
categoryName.setBorder(BorderFactory.createEmptyBorder(0,24,0,20));
this.add(categoryName, "0,0,1,0");
filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent);
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"),filterPane);
panel.setBorder(getSidesBorder());
filterPane.setBorder(getFilterPaneBorder());
this.add(panel, "0,6,2,4"); }
this.add(panel, "0,6,1,4"); }
protected TinyFormulaPane initCategoryBox(final String leftLabel) {
TinyFormulaPane categoryName = new TinyFormulaPane() {

53
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotTableDataContentPane.java

@ -11,6 +11,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
@ -28,24 +29,24 @@ import java.util.List;
*/
public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPane{
private static final long serialVersionUID = 7284078589672079657L;
protected UIComboBox categoryCombox;
protected SeriesTypeUseComboxPane seriesTypeComboxPane;
public CategoryPlotTableDataContentPane() {
}
public CategoryPlotTableDataContentPane(ChartDataPane parent) {
categoryCombox = new UIComboBox();
JPanel categoryPane = new JPanel(new BorderLayout(4,0));
categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground()));
UILabel label1 = new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Style_Category")) ;
UILabel label1 = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category")) ;
label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH,ChartDataPane.LABEL_HEIGHT));
categoryCombox.setPreferredSize(new Dimension(100,20));
categoryCombox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox,null,null,label1,null}));
categoryPane.setPreferredSize(new Dimension(246,30));
categoryPane.setBorder(BorderFactory.createEmptyBorder(0,24,10,15));
@ -56,7 +57,7 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
this.add(getJSeparator());
seriesTypeComboxPane = new SeriesTypeUseComboxPane(parent, new Bar2DPlot());
this.add(seriesTypeComboxPane, BorderLayout.SOUTH);
categoryCombox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
checkSeriseUse(categoryCombox.getSelectedItem() != null);
@ -64,7 +65,7 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
}
});
}
protected void makeToolTipUse(UIComboBox comBox) {
if(comBox.getSelectedItem() != null) {
comBox.setToolTipText(comBox.getSelectedItem().toString());
@ -72,7 +73,7 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
comBox.setToolTipText(null);
}
}
/**
* 检查 某些Box是否可用
* @param hasUse 是否使用.
@ -81,16 +82,16 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
categoryCombox.setEnabled(hasUse);
checkSeriseUse(hasUse);
}
protected void checkSeriseUse(boolean hasUse) {
if(seriesTypeComboxPane != null) {
seriesTypeComboxPane.checkUseBox(hasUse && categoryCombox.getSelectedItem() != null);
}
}
protected void refreshBoxListWithSelectTableData(List list) {
refreshBoxItems(categoryCombox, list);
categoryCombox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
seriesTypeComboxPane.refreshBoxListWithSelectTableData(list);
}
@ -100,10 +101,10 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
*/
public void clearAllBoxList(){
clearBoxItems(categoryCombox);
categoryCombox.addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
seriesTypeComboxPane.clearAllBoxList();
}
/**
* 保存界面内容到ChartCollection
*/
@ -129,15 +130,15 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
public void populateBean(ChartCollection collection) {
super.populateBean(collection);
TopDefinition top = (TopDefinition)collection.getSelectedChart().getFilterDefinition();
if(!(top instanceof NormalTableDataDefinition)) {
return;
}
NormalTableDataDefinition data = (NormalTableDataDefinition)top;
if(data == null || ComparatorUtils.equals(data.getCategoryName(), StringUtils.EMPTY)) {
categoryCombox.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} else if(data!= null && !this.boxItemsContainsObject(categoryCombox,data.getCategoryName())){
if(ComparatorUtils.equals(data.getCategoryName(), StringUtils.EMPTY)) {
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} else if(!DataPaneHelper.boxItemsContainsObject(categoryCombox,data.getCategoryName())){
categoryCombox.setSelectedItem(null);
}else {
combineCustomEditValue(categoryCombox, data.getCategoryName());
@ -146,20 +147,6 @@ public class CategoryPlotTableDataContentPane extends AbstractTableDataContentPa
seriesTypeComboxPane.populateBean(collection,this.isNeedSummaryCaculateMethod());
}
private boolean boxItemsContainsObject(UIComboBox box,Object item){
if(box == null){
return false;
}
ComboBoxModel dataModel = box.getModel();
for (int i = 0; i < dataModel.getSize(); i++) {
if(ComparatorUtils.equals(dataModel.getElementAt(i),item)){
return true;
}
}
return false;
}
/**
* 重新布局整个面板
*/

25
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/DataPaneHelper.java

@ -7,6 +7,7 @@ import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.ComboBoxModel;
import java.util.List;
/**
@ -24,6 +25,30 @@ public class DataPaneHelper {
box.refreshBoxItems(list);
}
public static boolean boxItemsContainsObject(UIComboBox box, Object item) {
if (box == null) {
return false;
}
ComboBoxModel dataModel = box.getModel();
for (int i = 0; i < dataModel.getSize(); i++) {
if (ComparatorUtils.equals(dataModel.getElementAt(i), item)) {
return true;
}
}
return false;
}
public static void combineCustomEditValue(UIComboBox comBox, String value) {
if(comBox != null) {
comBox.setEditable(true);
comBox.setSelectedItem(value);
comBox.setEditable(false);
}
}
/**
* 清空box里所有东西
*

36
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java

@ -14,6 +14,7 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.itable.UITable;
import com.fr.design.gui.itable.UITableEditor;
import com.fr.design.gui.itextfield.UITextField;
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.data.CalculateComboBox;
@ -23,6 +24,8 @@ import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.event.ChangeEvent;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
@ -30,8 +33,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/**
* 属性表 数据集界面: 系列名 使用字段名.
@ -40,8 +41,15 @@ import java.util.List;
* @version 创建时间2012-12-26 下午04:39:46
*/
public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollection> {
private static final String[] HEADS = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Field_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method")};
private static final String[] HEADS_NO_SUMMARY = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Field_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name")};
private static final String[] HEADS = {
Toolkit.i18nText("Fine-Design_Chart_Field_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Name"),
Toolkit.i18nText("Fine-Design_Chart_Summary_Method")};
private static final String[] HEADS_NO_SUMMARY = {
Toolkit.i18nText("Fine-Design_Chart_Field_Name"),
Toolkit.i18nText("Fine-Design_Chart_Series_Name")};
private UICorrelationPane seriesDataPane;
private List<String> field = new ArrayList<String>();
private JPanel centerPane;
@ -62,7 +70,7 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String[] blank =heads.length == 3?new String[]{StringUtils.EMPTY, StringUtils.EMPTY, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")}:
String[] blank = heads.length == 3 ? new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Use_None")} :
new String[]{StringUtils.EMPTY, StringUtils.EMPTY};
tablePane.addLine(blank);
fireTargetChanged();
@ -121,7 +129,7 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
* @return 标题
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Name");
return Toolkit.i18nText("Fine-Design_Basic_Chart_Field_Name");
}
/**
@ -186,9 +194,13 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
}
}
public void populateBean(ChartCollection collection,boolean isNeedSummary){
relayoutPane(isNeedSummary);
public void populateBean(ChartCollection collection, boolean isNeedSummary) {
TopDefinitionProvider topDefinition = collection.getSelectedChart().getFilterDefinition();
populateDefinition(topDefinition, isNeedSummary);
}
public void populateDefinition(TopDefinitionProvider topDefinition, boolean isNeedSummary) {
relayoutPane(isNeedSummary);
if (topDefinition instanceof MoreNameCDDefinition) {
MoreNameCDDefinition moreDefinition = (MoreNameCDDefinition) topDefinition;
ChartSummaryColumn[] chartSummaryColumnArray = moreDefinition.getChartSummaryColumn();
@ -221,6 +233,11 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
*/
public void updateBean(ChartCollection collection) {
TopDefinitionProvider normalDefinition = collection.getSelectedChart().getFilterDefinition();
MoreNameCDDefinition moreDefinition = updateDefinition(normalDefinition);
collection.getSelectedChart().setFilterDefinition(moreDefinition);
}
public MoreNameCDDefinition updateDefinition(TopDefinitionProvider normalDefinition) {
MoreNameCDDefinition moreDefinition = null;
if (normalDefinition instanceof MoreNameCDDefinition) {
moreDefinition = (MoreNameCDDefinition) normalDefinition;
@ -242,7 +259,8 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
}
}
moreDefinition.setChartSummaryColumn(dataArray);
collection.getSelectedChart().setFilterDefinition(moreDefinition);
return moreDefinition;
}
/**

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

@ -8,22 +8,22 @@ import com.fr.data.util.function.NoneFunction;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.extended.chart.UIComboBoxWithNone;
import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.JPanel;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.List;
/**
* 属性表 数据集 系列名使用 系列值 界面.
@ -39,7 +39,7 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
private boolean isNeedSummary = true;
public SeriesNameUseFieldValuePane() {
seriesName = new UIComboBox();
seriesName = new UIComboBoxWithNone();
seriesValue = new UIComboBox();
calculateCombox = new CalculateComboBox();
calculateCombox.reset();
@ -79,11 +79,11 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p, p, p, p};
UILabel Label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"));
UILabel Label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name"));
Label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
UILabel Label2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Value"));
UILabel Label2 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Value"));
Label2.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
UILabel Label3 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method"));
UILabel Label3 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"));
Label3.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
Component[][] components = getUseComponent(Label1, Label2, Label3);
@ -93,16 +93,16 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
this.add(centerPane, BorderLayout.CENTER);
}
private void initCenterPaneWithOutCaculateSummary(){
private void initCenterPaneWithOutCaculateSummary() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p, p, p};
UILabel Label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"));
UILabel Label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name"));
Label1.setPreferredSize(new Dimension(75, 20));
UILabel Label2 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Value"));
UILabel Label2 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Value"));
Label2.setPreferredSize(new Dimension(75, 20));
UILabel Label3 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method"));
UILabel Label3 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"));
Label3.setPreferredSize(new Dimension(75, 20));
Component[][] components = getUseComponentWithOutSummary(Label1, Label2, Label3);
@ -170,20 +170,6 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
DataPaneHelper.clearBoxItems(seriesValue);
}
private boolean boxItemsContainsObject(UIComboBox box,Object item){
if(box == null){
return false;
}
ComboBoxModel dataModel = box.getModel();
for (int i = 0; i < dataModel.getSize(); i++) {
if(ComparatorUtils.equals(dataModel.getElementAt(i),item)){
return true;
}
}
return false;
}
/**
* 判断界面是否接受
* @param ob 接受的对象
@ -199,7 +185,7 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
* @return 界面标题
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Value");
return Toolkit.i18nText("Fine-Design_Chart_Field_Value");
}
/**
@ -226,17 +212,22 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
}
}
public void populateBean(ChartCollection ob , boolean isNeedSummary){
relayoutPane(isNeedSummary);
public void populateBean(ChartCollection ob, boolean isNeedSummary) {
TopDefinitionProvider topDefinition = ob.getSelectedChart().getFilterDefinition();
populateDefinition(topDefinition, isNeedSummary);
}
public void populateDefinition(TopDefinitionProvider topDefinition, boolean isNeedSummary) {
relayoutPane(isNeedSummary);
if (topDefinition instanceof OneValueCDDefinition) {
OneValueCDDefinition oneDefinition = (OneValueCDDefinition) topDefinition;
seriesName.setEditable(true);
seriesName.setSelectedItem(this.boxItemsContainsObject(seriesName,oneDefinition.getSeriesColumnName())
seriesName.setSelectedItem(DataPaneHelper.boxItemsContainsObject(seriesName, oneDefinition.getSeriesColumnName())
? oneDefinition.getSeriesColumnName() : null);
seriesName.setEditable(false);
seriesValue.setEditable(true);
seriesValue.setSelectedItem(this.boxItemsContainsObject(seriesValue,oneDefinition.getValueColumnName())
seriesValue.setSelectedItem(DataPaneHelper.boxItemsContainsObject(seriesValue,oneDefinition.getValueColumnName())
? oneDefinition.getValueColumnName() : null);
seriesValue.setEditable(false);
if(this.isNeedSummary){
@ -256,6 +247,11 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
* 保存界面内容 字段值
*/
public void updateBean(ChartCollection collection) {
OneValueCDDefinition oneDefinition = updateDefinition();
collection.getSelectedChart().setFilterDefinition(oneDefinition);
}
public OneValueCDDefinition updateDefinition() {
OneValueCDDefinition oneDefinition = createOneValueCDDefinition();
String seriesName = (String) this.seriesName.getSelectedItem();
@ -267,7 +263,8 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
}else{
oneDefinition.setDataFunction(new NoneFunction());
}
collection.getSelectedChart().setFilterDefinition(oneDefinition);
return oneDefinition;
}
protected OneValueCDDefinition createOneValueCDDefinition(){

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

@ -5,24 +5,25 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.MoreNameCDDefinition;
import com.fr.chart.chartdata.OneValueCDDefinition;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* 属性表: 柱形, 饼图 数据集界面, "系列名使用"界面.
@ -30,7 +31,7 @@ import java.awt.Dimension;
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-26 下午03:17:08
*/
public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
public class SeriesTypeUseComboxPane extends BasicBeanPane<ChartCollection> {
private SeriesNameUseFieldValuePane nameFieldValuePane;
private SeriesNameUseFieldNamePane nameFieldNamePane;
@ -39,50 +40,100 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
private ChartDataPane parent;
private Plot initplot;
private boolean isNeedSummary = true;
private boolean isNeedSummary;
protected UIButtonGroup<Integer> content;
protected JPanel cardPane;
public SeriesTypeUseComboxPane(ChartDataPane parent, Plot initplot) {
this.initplot = initplot;
this.parent = parent;
cards = initPaneList();
this.isNeedSummary = true;
initComponents();
}
protected void initComponents() {
nameFieldValuePane = createValuePane();
nameFieldNamePane = createNamePane();
cardPane = new JPanel(new CardLayout()) {
@Override
public Dimension getPreferredSize() {
if (content.getSelectedIndex() == 0) {
return nameFieldValuePane.getPreferredSize();
} else {
return nameFieldNamePane.getPreferredSize();
}
}
};
cardPane.add(nameFieldValuePane, nameFieldValuePane.title4PopupWindow());
cardPane.add(nameFieldNamePane, nameFieldNamePane.title4PopupWindow());
content = new UIButtonGroup<>(new String[]{nameFieldValuePane.title4PopupWindow(), nameFieldNamePane.title4PopupWindow()});
addItemChangeEvent();
initLayout();
content.setSelectedIndex(0);
}
private void addItemChangeEvent() {
content.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkCardPane();
}
});
}
protected void checkCardPane() {
comboBoxItemStateChanged();
CardLayout cl = (CardLayout) cardPane.getLayout();
if (content.getSelectedIndex() == 0) {
cl.show(cardPane, nameFieldValuePane.title4PopupWindow());
} else {
cl.show(cardPane, nameFieldNamePane.title4PopupWindow());
}
}
protected void initLayout() {
this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM));
JPanel northPane = new JPanel(new BorderLayout(4, 0));
UILabel label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null}));
JPanel borderLayoutPane = GUICoreUtils.createBorderLayoutPane(new Component[]{content, null, null, label1, null});
northPane.add(borderLayoutPane);
northPane.setBorder(BorderFactory.createEmptyBorder(10, 24, 0, 15));
cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER);
dataScreeningPane = new ChartDataFilterPane(this.initplot, parent);
JPanel panel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 290, 24, dataScreeningPane);
panel.setBorder(BorderFactory.createEmptyBorder(0,5,0,5));
dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10,5,0,5));
dataScreeningPane = new ChartDataFilterPane(this.initplot, parent);
JPanel panel = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 250, 24, dataScreeningPane);
panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 15));
dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
this.add(panel, BorderLayout.SOUTH);
}
protected UIComboBox createComboBox() {
UIComboBox uiComboBox = new UIComboBox();
UIComponentUtils.setPreferedWidth(uiComboBox, 100);
return uiComboBox;
public Dimension getPreferredSize() {
Dimension preferredSize = super.getPreferredSize();
return new Dimension(260, (int) preferredSize.getHeight());
}
/**
* 检查box 是否使用, hasUse, 表示上层已经使用, 否则, 则此界面都可使用
*
* @param hasUse 是否使用
*/
public void checkUseBox(boolean hasUse) {
jcb.setEnabled(hasUse);
content.setEnabled(hasUse);
nameFieldValuePane.checkUse(hasUse);
dataScreeningPane.checkBoxUse();
}
/**
* 切换 变更数据集时, 刷新Box选中项目
*
* @param list 列表
*/
public void refreshBoxListWithSelectTableData(List list) {
@ -93,28 +144,20 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
/**
* 清空所有的box设置
*/
public void clearAllBoxList(){
public void clearAllBoxList() {
nameFieldValuePane.clearAllBoxList();
nameFieldNamePane.clearAllBoxList();
}
/**
* 界面标题
*
* @return 界面标题
*/
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From");
}
@Override
protected List<FurtherBasicBeanPane<? extends ChartCollection>> initPaneList() {
nameFieldValuePane = createValuePane();
nameFieldNamePane = createNamePane();
List<FurtherBasicBeanPane<? extends ChartCollection>> paneList = new ArrayList<FurtherBasicBeanPane<? extends ChartCollection>>();
paneList.add(nameFieldValuePane);
paneList.add(nameFieldNamePane);
return paneList;
}
protected SeriesNameUseFieldValuePane createValuePane() {
return new SeriesNameUseFieldValuePane();
@ -135,15 +178,17 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
nameFieldNamePane.populateBean(ob, isNeedSummary);
}
dataScreeningPane.populateBean(ob, isNeedSummary);
checkCardPane();
}
/**
* 重新布局整个面板
*
* @param isNeedSummary 是否需要汇总
*/
public void relayoutPane(boolean isNeedSummary) {
this.isNeedSummary = isNeedSummary;
if (jcb.getSelectedIndex() == 0) {
if (this.getSelectedIndex() == 0) {
nameFieldValuePane.relayoutPane(this.isNeedSummary);
} else {
nameFieldNamePane.relayoutPane(this.isNeedSummary);
@ -152,9 +197,8 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
}
@Override
protected void comboBoxItemStateChanged() {
if (jcb.getSelectedIndex() == 0) {
if (this.getSelectedIndex() == 0) {
nameFieldValuePane.relayoutPane(this.isNeedSummary);
} else {
nameFieldNamePane.relayoutPane(this.isNeedSummary);
@ -178,4 +222,21 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
dataScreeningPane.updateBean(ob);
}
/**
* 保存数据
*
* @return 待保存的对象
*/
public ChartCollection updateBean() {
return null;
}
public int getSelectedIndex() {
return content.getSelectedIndex();
}
public void setSelectedIndex(int index) {
content.setSelectedIndex(index);
}
}

12
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java

@ -10,6 +10,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import javax.swing.JPanel;
import javax.swing.border.Border;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
@ -20,7 +21,6 @@ import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
public abstract class ThirdTabPane<T> extends BasicBeanPane<T>{
@ -74,16 +74,6 @@ public abstract class ThirdTabPane<T> extends BasicBeanPane<T>{
}
}
@Override
public void paint(Graphics g) {
super.paint(g);
if (!paneList.isEmpty()) {
Graphics2D g2d = (Graphics2D)g;
g2d.setColor(UIConstants.LINE_COLOR);
g2d.drawLine(getWidth() - 2, tabPane.getPreferredSize().height, getWidth() - 2, getHeight() - 1);
}
}
protected void initLayout() {
this.setLayout(new BorderLayout());
if (!paneList.isEmpty()) {

57
designer-chart/src/main/java/com/fr/design/module/ChartPreFillStylePane.java

@ -2,14 +2,16 @@ package com.fr.design.module;
import com.fr.base.ChartColorMatching;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartColorAdjustPane;
import com.fr.design.style.background.gradient.FixedGradientBar;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.Collections;
@ -19,7 +21,6 @@ import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -35,8 +36,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
private JPanel changeColorSetPane;
private CardLayout cardLayout;
private UIButton accButton;
private UIButton gradientButton;
private UIButtonGroup groupButton;
private ChartColorAdjustPane colorAdjustPane;
private FixedGradientBar colorGradient;
@ -52,25 +52,22 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
JPanel customPane = new JPanel(FRGUIPaneFactory.createBorderLayout());
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.LEFT));
buttonPane.add(accButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom_Color")));
buttonPane.add(gradientButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gradient_Color")));
customPane.add(buttonPane, BorderLayout.NORTH);
groupButton = new UIButtonGroup<>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Custom_Color"), Toolkit.i18nText("Fine-Design_Chart_Gradient_Color")});
groupButton.setSelectedIndex(0);
customPane.add(groupButton, BorderLayout.NORTH);
changeColorSetPane = new JPanel(cardLayout = new CardLayout());
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 130), "gradient");
changeColorSetPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
changeColorSetPane.add(colorGradient = new FixedGradientBar(4, 150), "gradient");
changeColorSetPane.add(colorAdjustPane = new ChartColorAdjustPane(), "acc");
cardLayout.show(changeColorSetPane, "acc");
customPane.add(changeColorSetPane, BorderLayout.CENTER);
accButton.setSelected(true);
customPane.setPreferredSize(new Dimension(200, 200));
colorGradient.setPreferredSize(new Dimension(120, 30));
customPane.setPreferredSize(new Dimension(155, 300));
colorGradient.setPreferredSize(new Dimension(155, 30));
colorGradient.getSelectColorPointBtnP1().setColorInner(Color.WHITE);
colorGradient.getSelectColorPointBtnP2().setColorInner(FixedGradientBar.NEW_CHARACTER);
double p = TableLayout.PREFERRED;
double[] columnSize = {p, p};
double[] rowSize = {p, p, p};
@ -84,24 +81,20 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
}
private void initListener() {
accButton.addActionListener(new ActionListener() {
groupButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
accButton.setSelected(true);
gradientButton.setSelected(false);
cardLayout.show(changeColorSetPane, "acc");
checkCardPane();
}
});
}
gradientButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
gradientButton.setSelected(true);
accButton.setSelected(false);
cardLayout.show(changeColorSetPane, "gradient");
}
});
private void checkCardPane() {
if (groupButton.getSelectedIndex() == 0) {
cardLayout.show(changeColorSetPane, "acc");
} else {
cardLayout.show(changeColorSetPane, "gradient");
}
}
@Override
@ -117,8 +110,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
boolean isGradient = condition.getGradient();
List<Color> colorList = condition.getColorList();
if (isGradient) {
gradientButton.setSelected(true);
accButton.setSelected(false);
groupButton.setSelectedIndex(1);
cardLayout.show(changeColorSetPane, "gradient");
if (colorList.size() == 2) {
@ -127,8 +119,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
colorGradient.repaint();
}
} else {
accButton.setSelected(true);
gradientButton.setSelected(false);
groupButton.setSelectedIndex(0);
cardLayout.show(changeColorSetPane, "acc");
if (colorList.isEmpty()) {
@ -148,7 +139,7 @@ public class ChartPreFillStylePane extends BasicBeanPane<ChartColorMatching> {
List<Color> colorList = new ArrayList<Color>();
if (gradientButton.isSelected()) {
if (groupButton.getSelectedIndex() == 1) {
chartColorMatching.setGradient(true);
Color start = colorGradient.getSelectColorPointBtnP1().getColorInner();

142
designer-chart/src/main/java/com/fr/design/module/ChartPreStyleListPane.java

@ -0,0 +1,142 @@
package com.fr.design.module;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.base.Utils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.ShortCut4JControlPane;
import com.fr.design.gui.ilist.ModNameActionListener;
import com.fr.design.menu.ShortCut;
import com.fr.general.NameObject;
import com.fr.stable.Nameable;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.util.ArrayList;
import java.util.Iterator;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-07-08
*/
public class ChartPreStyleListPane extends JListControlPane {
ChartPreStyleManagerPane chartPreStyleManagerPane;
public ChartPreStyleListPane(ChartPreStyleManagerPane chartPreStyleManagerPane) {
super();
this.chartPreStyleManagerPane = chartPreStyleManagerPane;
initListener();
}
/**
* 创建有名字的creator
*
* @return 有名字的creator数组
*/
@Override
public NameableCreator[] createNameableCreators() {
return new NameableCreator[]{
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_PreStyle_Duplicate"),
ChartColorMatching.class, ChartPreStylePane.class)
};
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_PreStyle");
}
@Override
public BasicBeanPane createPaneByCreators(NameableCreator creator) {
return new ChartPreStylePane() {
@Override
protected void refreshWhenStyleChange(ChartColorMatching preStyle) {
super.refreshWhenStyleChange(preStyle);
chartPreStyleManagerPane.refreshDefaultColorBox();
}
};
}
protected ShortCut4JControlPane[] createShortcuts() {
return new ShortCut4JControlPane[]{
shortCutFactory.addItemShortCut(),
createRemoveItemShortCut(),
shortCutFactory.copyItemShortCut(),
shortCutFactory.moveUpItemShortCut(),
shortCutFactory.moveDownItemShortCut(),
shortCutFactory.sortItemShortCut()
};
}
private ShortCut4JControlPane createRemoveItemShortCut() {
ShortCut4JControlPane shortCut4JControlPane = shortCutFactory.removeItemShortCut();
//替换删除按钮的check事件。
ShortCut shortCut = shortCut4JControlPane.getShortCut();
shortCut4JControlPane = new MoreThanOneShortCut(shortCut);
return shortCut4JControlPane;
}
public void initListener() {
nameableList.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
chartPreStyleManagerPane.refreshDefaultColorBox();
}
});
nameableList.addModNameActionListener(new ModNameActionListener() {
@Override
public void nameModed(int index, String oldName, String newName) {
chartPreStyleManagerPane.refreshDefaultColorBox(oldName, newName);
}
});
}
public void populateBean() {
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance().mirror();
ArrayList list = new ArrayList();
Iterator keys = config.names();
while (keys.hasNext()) {
Object key = keys.next();
ChartColorMatching value = (ChartColorMatching) config.getPreStyle(key);
list.add(new NameObject(Utils.objectToString(key), value));
}
Nameable[] values = (Nameable[]) list.toArray(new Nameable[list.size()]);
populate(values);
if (config.containsName(config.getCurrentStyle())) {
this.setSelectedName(config.getCurrentStyle());
}
}
public void updateBean() {
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
Nameable[] values = update();
config.clearAllPreStyle();
for (Nameable value : values) {
config.putPreStyle(value.getName(), ((NameObject) value).getObject());
}
}
private class MoreThanOneShortCut extends ShortCut4JControlPane {
public MoreThanOneShortCut(ShortCut shortCut) {
this.shortCut = shortCut;
}
@Override
public void checkEnable() {
this.shortCut.setEnabled(nameableList.getModel().getSize() > 1);
}
}
}

156
designer-chart/src/main/java/com/fr/design/module/ChartPreStyleManagerPane.java

@ -2,72 +2,114 @@ package com.fr.design.module;
import com.fr.base.ChartColorMatching;
import com.fr.base.ChartPreStyleConfig;
import com.fr.base.Utils;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.chartx.component.combobox.ColorSchemeComboBox;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.general.NameObject;
import com.fr.stable.Nameable;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import java.util.ArrayList;
import javax.swing.JPanel;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.awt.BorderLayout;
import java.awt.Dimension;
/**
* 图表预定义管理 界面, 在工具栏-服务器管理中.
*
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2013-8-21 下午02:33:48
*/
public class ChartPreStyleManagerPane extends JListControlPane {
@Override
/**
* 创建有名字的creator
* @return 有名字的creator数组
*/
public NameableCreator[] createNameableCreators() {
return new NameableCreator[]{
new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_PreStyle_Duplicate"),
ChartColorMatching.class, ChartPreStylePane.class)
};
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_PreStyle");
}
public void populateBean() {
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance().mirror();
ArrayList list = new ArrayList();
Iterator keys = config.names();
while(keys.hasNext()) {
Object key = keys.next();
ChartColorMatching value = (ChartColorMatching) config.getPreStyle(key);
list.add(new NameObject(Utils.objectToString(key), value));
}
Nameable[] values = (Nameable[])list.toArray(new Nameable[list.size()]);
populate(values);
if(config.containsName(config.getCurrentStyle())) {
this.setSelectedName(config.getCurrentStyle());
}
}
public void updateBean() {
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
config.setCurrentStyle(getSelectedName());
Nameable[] values = update();
config.clearAllPreStyle();
for (Nameable value : values) {
config.putPreStyle(value.getName(), ((NameObject) value).getObject());
}
}
public class ChartPreStyleManagerPane extends BasicPane {
private ColorSchemeComboBox defaultColorBox;
private ChartPreStyleListPane chartPreStyleListPane;
public ChartPreStyleManagerPane() {
initComponent();
}
private void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel colorBoxPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
chartPreStyleListPane = new ChartPreStyleListPane(this);
initDefaultColorBox();
colorBoxPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Chart_Match_Default_Color_Scheme") + ":"));
colorBoxPane.add(defaultColorBox);
this.add(colorBoxPane, BorderLayout.NORTH);
this.add(chartPreStyleListPane, BorderLayout.CENTER);
}
private void initDefaultColorBox() {
Map<String, ColorSchemeComboBox.ColorInfo> colorSchemes = new LinkedHashMap<>();
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
Iterator names = config.names();
while (names.hasNext()) {
Object key = names.next();
ColorSchemeComboBox.ColorInfo colorInfo = new ColorSchemeComboBox.ColorInfo();
ChartColorMatching colorMatching = (ChartColorMatching) config.getPreStyle(key);
colorInfo.setGradient(colorMatching.getGradient());
colorInfo.setColors(colorMatching.getColorList());
colorSchemes.put(colorMatching.getId(), colorInfo);
}
defaultColorBox = new ColorSchemeComboBox(colorSchemes);
defaultColorBox.setPreferredSize(new Dimension(TableLayout4VanChartHelper.EDIT_AREA_WIDTH, 20));
}
private void refreshColorSchemes() {
Nameable[] nameables = chartPreStyleListPane.update();
Map<String, ColorSchemeComboBox.ColorInfo> colorSchemes = new LinkedHashMap<>();
for (Nameable value : nameables) {
String name = value.getName();
ChartColorMatching colorMatching = (ChartColorMatching) ((NameObject) value).getObject();
ColorSchemeComboBox.ColorInfo colorInfo = new ColorSchemeComboBox.ColorInfo();
colorInfo.setGradient(colorMatching.getGradient());
colorInfo.setColors(colorMatching.getColorList());
colorSchemes.put(name, colorInfo);
}
defaultColorBox.refresh(colorSchemes);
}
public void refreshDefaultColorBox() {
Object selectedItem = defaultColorBox.getSelectedItem();
refreshColorSchemes();
defaultColorBox.setSelectedItem(selectedItem);
}
public void refreshDefaultColorBox(String oldName, String newName) {
Object selectedItem = defaultColorBox.getSelectedItem();
if (ComparatorUtils.equals(selectedItem, oldName)) {
selectedItem = newName;
}
refreshColorSchemes();
defaultColorBox.setSelectedItem(selectedItem);
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Report_ServerM_Predefined_Styles");
}
public void populateBean() {
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
String currentStyle = config.getCurrentStyle();
defaultColorBox.setSelectedItem(currentStyle);
chartPreStyleListPane.populateBean();
}
public void updateBean() {
ChartPreStyleConfig config = ChartPreStyleConfig.getInstance();
config.setCurrentStyle(GeneralUtils.objectToString(defaultColorBox.getSelectedItem()));
chartPreStyleListPane.updateBean();
}
}

2
designer-chart/src/main/java/com/fr/design/module/ChartPreStylePane.java

@ -80,7 +80,7 @@ public class ChartPreStylePane extends BasicBeanPane<ChartColorMatching> {
}
}
private void refreshWhenStyleChange(ChartColorMatching preStyle) {
protected void refreshWhenStyleChange(ChartColorMatching preStyle) {
if(chartComponent != null) {
demoPlot.setPlotFillStyle(ChartUtils.chartColorMatching2AttrFillStyle(preStyle));
chartComponent.reset();

6
designer-chart/src/main/java/com/fr/extended/chart/ExtendedOtherPane.java

@ -109,7 +109,7 @@ public class ExtendedOtherPane<T extends AbstractChart> extends AbstractChartAtt
}
});
autoRefreshTime = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
autoRefreshTime = createIntervalTime();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f, 20};
@ -129,6 +129,10 @@ public class ExtendedOtherPane<T extends AbstractChart> extends AbstractChartAtt
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Refresh"), gapPane);
}
protected UISpinner createIntervalTime() {
return new UISpinner(1, Integer.MAX_VALUE, 5, 60);
}
private JPanel createHyperlinkPane() {
hyperLinkPane = new ExtendedChartHyperLinkPane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_M_Insert_Hyperlink"), hyperLinkPane);

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

@ -0,0 +1,97 @@
package com.fr.van.chart.box;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
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.gui.ChartDataPane;
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.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.van.chart.box.data.BoxPlotReportDataContentPane;
import com.fr.van.chart.box.data.table.BoxPlotTableDataContentPane;
import com.fr.van.chart.designer.other.VanChartInteractivePane;
import com.fr.van.chart.designer.other.VanChartOtherPane;
import com.fr.van.chart.designer.other.zoom.ZoomPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.vanchart.AbstractIndependentVanChartUI;
import java.awt.Component;
public class BoxIndependentVanChartInterface extends AbstractIndependentVanChartUI {
public String getName() {
return Toolkit.i18nText("Fine-Design_Chart_New_Box");
}
public String[] getSubName() {
return new String[]{
Toolkit.i18nText("Fine-Design_Chart_New_Box")
};
}
public String[] getDemoImagePath() {
return new String[]{
"com/fr/plugin/chart/demo/image/box.png"
};
}
public String getIconPath() {
return "com/fr/design/images/form/toolbar/box.png";
}
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) {
return new BoxPlotTableDataContentPane(plot, parent);
}
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) {
return new BoxPlotReportDataContentPane(parent);
}
public AbstractChartTypePane getPlotTypePane() {
return new VanChartBoxPlotPane();
}
public ConditionAttributesPane getPlotConditionPane(Plot plot) {
return new VanChartBoxConditionPane(plot);
}
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot) {
return new VanChartBoxSeriesPane(parent, plot);
}
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener) {
VanChartStylePane stylePane = new VanChartBoxStylePane(listener);
VanChartOtherPane otherPane = new VanChartOtherPane() {
protected BasicBeanPane<Chart> createInteractivePane() {
return new VanChartInteractivePane() {
protected Component[][] createToolBarComponents() {
return new Component[][]{
new Component[]{null, exportImages},
new Component[]{null, fullScreenDisplay}
};
}
protected double[] getToolBarRowSize() {
double p = TableLayout.PREFERRED;
return new double[]{p, p};
}
protected ZoomPane createZoomPane() {
return new ZoomPane();
}
};
}
};
return new AbstractChartAttrPane[]{stylePane, otherPane};
}
}

53
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxConditionPane.java

@ -0,0 +1,53 @@
package com.fr.van.chart.box;
import com.fr.chart.base.AttrAlpha;
import com.fr.chart.base.AttrBackground;
import com.fr.chart.base.AttrBorder;
import com.fr.chart.chartattr.Plot;
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane;
import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane;
import com.fr.design.chart.series.SeriesCondition.LabelAlphaPane;
import com.fr.plugin.chart.box.VanChartBoxPlot;
import com.fr.plugin.chart.type.ConditionKeyType;
import com.fr.van.chart.column.VanChartColumnLabelBorderPane;
import com.fr.van.chart.designer.other.condition.item.VanChartColumnSeriesColorConditionPane;
import java.awt.Dimension;
public class VanChartBoxConditionPane extends DataSeriesConditionPane {
public VanChartBoxConditionPane(Plot plot) {
super(plot);
}
protected void initComponents() {
super.initComponents();
liteConditionPane.setPreferredSize(new Dimension(300, 400));
}
protected void addBasicAction() {
classPaneMap.put(AttrBackground.class, new VanChartColumnSeriesColorConditionPane(this));
classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this));
classPaneMap.put(AttrBorder.class, new VanChartColumnLabelBorderPane(this));
}
protected void addStyleAction() {
}
protected ChartConditionPane createListConditionPane() {
return new ChartConditionPane() {
@Override
protected ConditionKeyType[] conditionKeyTypes() {
return ConditionKeyType.BOX_CONDITION_KEY_TYPES;
}
};
}
public Class<? extends Plot> class4Correspond() {
return VanChartBoxPlot.class;
}
}

45
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxPlotPane.java

@ -0,0 +1,45 @@
package com.fr.van.chart.box;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.Plot;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.box.BoxIndependentVanChart;
import com.fr.plugin.chart.box.VanChartBoxPlot;
import com.fr.van.chart.designer.type.AbstractVanChartTypePane;
public class VanChartBoxPlotPane extends AbstractVanChartTypePane {
protected String[] getTypeIconPath() {
return new String[]{"/com/fr/van/chart/box.images/box.png"
};
}
protected Plot getSelectedClonedPlot() {
VanChartBoxPlot newPlot = null;
Chart[] boxChartGroup = BoxIndependentVanChart.BoxVanChartTypes;
for (int i = 0, len = boxChartGroup.length; i < len; i++) {
if (typeDemo.get(i).isPressing) {
newPlot = boxChartGroup[i].getPlot();
}
}
Plot cloned = null;
try {
if (newPlot != null) {
cloned = (Plot) newPlot.clone();
}
} catch (CloneNotSupportedException e) {
FineLoggerFactory.getLogger().error("Error In ColumnChart");
}
return cloned;
}
public Chart getDefaultChart() {
return BoxIndependentVanChart.BoxVanChartTypes[0];
}
}

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

@ -0,0 +1,26 @@
package com.fr.van.chart.box;
import com.fr.chart.chartattr.Plot;
import com.fr.plugin.chart.base.AttrTooltip;
import com.fr.plugin.chart.box.attr.AttrBoxTooltip;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.tooltip.VanChartPlotTooltipPane;
public class VanChartBoxPlotTooltipPane extends VanChartPlotTooltipPane {
public VanChartBoxPlotTooltipPane(Plot plot, VanChartStylePane parent) {
super(plot, parent);
}
protected void initTooltipContentPane(Plot plot) {
tooltipContentPane = new VanChartBoxTooltipContentPane(parent, VanChartBoxPlotTooltipPane.this);
}
protected AttrTooltip getAttrTooltip() {
return new AttrBoxTooltip();
}
protected boolean hasTooltipSeriesType() {
return false;
}
}

107
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxSeriesPane.java

@ -0,0 +1,107 @@
package com.fr.van.chart.box;
import com.fr.chart.chartattr.Plot;
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.ChartStylePane;
import com.fr.plugin.chart.box.VanChartBoxPlot;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.component.VanChartMarkerPane;
import com.fr.van.chart.designer.component.border.VanChartBorderPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
public class VanChartBoxSeriesPane extends VanChartAbstractPlotSeriesPane {
private JPanel normalMarker;
private JPanel outlierMarker;
private VanChartMarkerPane normalValuePane;
private VanChartMarkerPane outlierValuePane;
public VanChartBoxSeriesPane(ChartStylePane parent, Plot plot) {
super(parent, plot);
}
protected JPanel getContentInPlotType() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{createBorderPane()},
new Component[]{createNormalValuePane()},
new Component[]{createOutlierValuePane()}
};
contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
return contentPane;
}
protected VanChartBorderPane createDiffBorderPane() {
return new VanChartBorderPane();
}
private JPanel createNormalValuePane() {
normalValuePane = new VanChartMarkerPane();
normalMarker = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Engine_Chart_Normal_Value"), normalValuePane);
return normalMarker;
}
private JPanel createOutlierValuePane() {
outlierValuePane = new VanChartMarkerPane();
outlierMarker = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Engine_Chart_Outlier_Value"), outlierValuePane);
return outlierMarker;
}
private void checkMarkerPane(boolean isDetailed) {
normalMarker.setVisible(isDetailed);
outlierMarker.setVisible(isDetailed);
}
protected void setColorPaneContent(JPanel panel) {
panel.add(createAlphaPane(), BorderLayout.SOUTH);
}
protected VanChartBeautyPane createStylePane() {
return null;
}
public void populateBean(Plot plot) {
if (plot == null) {
return;
}
super.populateBean(plot);
if (plot instanceof VanChartBoxPlot) {
normalValuePane.populate(((VanChartBoxPlot) plot).getNormalValue());
outlierValuePane.populate(((VanChartBoxPlot) plot).getOutlierValue());
checkMarkerPane(((VanChartBoxPlot) plot).isDetailed());
}
}
public void updateBean(Plot plot) {
if (plot == null) {
return;
}
if (plot instanceof VanChartBoxPlot) {
((VanChartBoxPlot) plot).setNormalValue(normalValuePane.update());
((VanChartBoxPlot) plot).setOutlierValue(outlierValuePane.update());
}
super.updateBean(plot);
}
}

21
designer-chart/src/main/java/com/fr/van/chart/box/VanChartBoxStylePane.java

@ -0,0 +1,21 @@
package com.fr.van.chart.box;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.van.chart.designer.style.VanChartStylePane;
import java.util.List;
public class VanChartBoxStylePane extends VanChartStylePane {
public VanChartBoxStylePane(AttributeChangeListener listener) {
super(listener);
}
protected void createVanChartLabelPane(List<BasicPane> paneList) {
}
protected void addVanChartTooltipPane(List<BasicPane> paneList) {
paneList.add(new VanChartBoxTooltipPane(VanChartBoxStylePane.this));
}
}

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

@ -0,0 +1,149 @@
package com.fr.van.chart.box;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.plugin.chart.box.attr.AttrBoxTooltipContent;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.SeriesNameFormatPaneWithCheckBox;
import com.fr.van.chart.designer.component.format.VanChartFormatPaneWithCheckBox;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel;
import java.awt.Component;
public class VanChartBoxTooltipContentPane extends VanChartTooltipContentPane {
private VanChartFormatPaneWithCheckBox number;
private VanChartFormatPaneWithCheckBox max;
private VanChartFormatPaneWithCheckBox q3;
private VanChartFormatPaneWithCheckBox median;
private VanChartFormatPaneWithCheckBox q1;
private VanChartFormatPaneWithCheckBox min;
private VanChartFormatPaneWithCheckBox outlier;
public VanChartBoxTooltipContentPane(VanChartStylePane parent, JPanel showOnPane) {
super(parent, showOnPane);
}
protected void initFormatPane(VanChartStylePane parent, JPanel showOnPane) {
categoryNameFormatPane = new CategoryNameFormatPaneWithCheckBox(parent, showOnPane);
seriesNameFormatPane = new SeriesNameFormatPaneWithCheckBox(parent, showOnPane);
number = new VanChartFormatPaneWithCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Data_Number");
}
};
max = new VanChartFormatPaneWithCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Max_Value");
}
};
q3 = new VanChartFormatPaneWithCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Data_Q3");
}
};
median = new VanChartFormatPaneWithCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Data_Median");
}
};
q1 = new VanChartFormatPaneWithCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Data_Q1");
}
};
min = new VanChartFormatPaneWithCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Design_Chart_Min_Value");
}
};
outlier = new VanChartFormatPaneWithCheckBox(parent, showOnPane) {
protected String getCheckBoxText() {
return Toolkit.i18nText("Fine-Engine_Chart_Outlier_Value");
}
};
}
protected double[] getRowSize(double p) {
return new double[]{p, p, p, p, p, p, p, p, p};
}
protected Component[][] getPaneComponents() {
return new Component[][]{
new Component[]{categoryNameFormatPane, null},
new Component[]{seriesNameFormatPane, null},
new Component[]{number, null},
new Component[]{max, null},
new Component[]{q3, null},
new Component[]{median, null},
new Component[]{q1, null},
new Component[]{min, null},
new Component[]{outlier, null}
};
}
public boolean isDirty() {
return categoryNameFormatPane.isDirty()
|| seriesNameFormatPane.isDirty()
|| number.isDirty()
|| max.isDirty()
|| q3.isDirty()
|| median.isDirty()
|| q1.isDirty()
|| min.isDirty()
|| outlier.isDirty();
}
public void setDirty(boolean isDirty) {
categoryNameFormatPane.setDirty(isDirty);
seriesNameFormatPane.setDirty(isDirty);
number.setDirty(isDirty);
max.setDirty(isDirty);
q3.setDirty(isDirty);
median.setDirty(isDirty);
q1.setDirty(isDirty);
min.setDirty(isDirty);
outlier.setDirty(isDirty);
}
protected AttrTooltipContent createAttrTooltip() {
return new AttrBoxTooltipContent();
}
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
categoryNameFormatPane.populate(attrTooltipContent.getCategoryFormat());
seriesNameFormatPane.populate(attrTooltipContent.getSeriesFormat());
if (attrTooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent;
number.populate(boxTooltipContent.getNumber());
max.populate(boxTooltipContent.getMax());
q3.populate(boxTooltipContent.getQ3());
median.populate(boxTooltipContent.getMedian());
q1.populate(boxTooltipContent.getQ1());
min.populate(boxTooltipContent.getMin());
outlier.populate(boxTooltipContent.getOutlier());
}
}
protected void updateFormatPane(AttrTooltipContent attrTooltipContent) {
categoryNameFormatPane.update(attrTooltipContent.getCategoryFormat());
seriesNameFormatPane.update(attrTooltipContent.getSeriesFormat());
if (attrTooltipContent instanceof AttrBoxTooltipContent) {
AttrBoxTooltipContent boxTooltipContent = (AttrBoxTooltipContent) attrTooltipContent;
number.update(boxTooltipContent.getNumber());
max.update(boxTooltipContent.getMax());
q3.update(boxTooltipContent.getQ3());
median.update(boxTooltipContent.getMedian());
q1.update(boxTooltipContent.getQ1());
min.update(boxTooltipContent.getMin());
outlier.update(boxTooltipContent.getOutlier());
}
}
}

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

@ -0,0 +1,17 @@
package com.fr.van.chart.box;
import com.fr.chart.chartattr.Plot;
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.VanChartTooltipPane;
public class VanChartBoxTooltipPane extends VanChartTooltipPane {
public VanChartBoxTooltipPane(VanChartStylePane parent) {
super(parent);
}
protected VanChartPlotTooltipPane getTooltipPane(Plot plot) {
return new VanChartBoxPlotTooltipPane(plot, parent);
}
}

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

@ -0,0 +1,11 @@
package com.fr.van.chart.box.data;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotReportDataContentPane;
public class BoxPlotReportDataContentPane extends CategoryPlotReportDataContentPane {
public BoxPlotReportDataContentPane(ChartDataPane parent) {
super(parent);
}
}

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

@ -0,0 +1,4 @@
package com.fr.van.chart.box.data;
public class BoxPlotReportResultDataSeriesPane {
}

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

@ -0,0 +1,212 @@
package com.fr.van.chart.box.data.table;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.NormalTableDataDefinition;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.plugin.chart.box.VanChartBoxPlot;
import com.fr.plugin.chart.box.data.VanBoxTableDefinition;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
private UIButtonGroup dataType;
private BoxPlotTableSeriesTypeUsePane seriesTypeComboxPane;
private BoxPlotTableResultDataSeriesPane resultDataSeriesPane;
private JPanel filterPane;
private ChartDataFilterPane dataScreeningPane;
private ChartDataPane parent;
private Plot initplot;
public BoxPlotTableDataContentPane(Plot plot, ChartDataPane parent) {
this.initplot = plot;
this.parent = parent;
this.setLayout(new BorderLayout());
this.add(createDataTypePane(), BorderLayout.NORTH);
this.add(createSeriesPane(), BorderLayout.CENTER);
this.add(createFilterPane(), BorderLayout.SOUTH);
initDataTypeListener();
checkDataPaneVisible();
}
private JPanel createDataTypePane() {
JPanel pane = new JPanel(new BorderLayout(4, 0));
pane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground()));
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Type"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
String[] names = new String[]{
Toolkit.i18nText("Fine-Design_Chart_Detailed_Data"),
Toolkit.i18nText("Fine-Design_Chart_Result_Data")
};
dataType = new UIButtonGroup(names);
dataType.setPreferredSize(new Dimension(100, 20));
pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null}));
pane.setPreferredSize(new Dimension(246, 30));
pane.setBorder(BorderFactory.createEmptyBorder(0, 24, 10, 15));
return pane;
}
private JPanel createSeriesPane() {
seriesTypeComboxPane = new BoxPlotTableSeriesTypeUsePane();
resultDataSeriesPane = new BoxPlotTableResultDataSeriesPane();
JPanel pane = new JPanel(new BorderLayout(4, 0));
pane.add(seriesTypeComboxPane, BorderLayout.CENTER);
pane.add(resultDataSeriesPane, BorderLayout.SOUTH);
return pane;
}
private JPanel createFilterPane() {
dataScreeningPane = new ChartDataFilterPane(initplot, parent, false);
dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10, 24, 10, 15));
filterPane = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 290, 24, dataScreeningPane);
filterPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
return filterPane;
}
private void initDataTypeListener() {
dataType.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkDataPaneVisible();
}
});
}
private void checkDataPaneVisible() {
if (seriesTypeComboxPane != null) {
seriesTypeComboxPane.setVisible(dataType.getSelectedIndex() == 0);
}
if (resultDataSeriesPane != null) {
resultDataSeriesPane.setVisible(dataType.getSelectedIndex() == 1);
}
if (filterPane != null) {
filterPane.setVisible(dataType.getSelectedIndex() == 0);
}
}
public void checkBoxUse(boolean hasUse) {
if (dataType.getSelectedIndex() == 0 && seriesTypeComboxPane != null) {
seriesTypeComboxPane.checkBoxUse(hasUse);
}
if (dataType.getSelectedIndex() == 1 && resultDataSeriesPane != null) {
resultDataSeriesPane.checkBoxUse(hasUse);
}
dataScreeningPane.checkBoxUse();
}
protected void refreshBoxListWithSelectTableData(List list) {
if (seriesTypeComboxPane != null) {
seriesTypeComboxPane.refreshBoxListWithSelectTableData(list);
}
if (resultDataSeriesPane != null) {
resultDataSeriesPane.refreshBoxListWithSelectTableData(list);
}
}
public void clearAllBoxList() {
if (seriesTypeComboxPane != null) {
seriesTypeComboxPane.clearAllBoxList();
}
if (resultDataSeriesPane != null) {
resultDataSeriesPane.clearAllBoxList();
}
}
public void updateBean(ChartCollection collection) {
checkChartCollection(collection);
VanBoxTableDefinition table = BoxTableDefinitionHelper.getBoxTableDefinition(collection);
if (table != null) {
boolean isDetailed = dataType.getSelectedIndex() == 0;
table.setDetailed(isDetailed);
((VanChartBoxPlot) initplot).setDetailed(isDetailed);
}
if (seriesTypeComboxPane != null) {
seriesTypeComboxPane.updateBean(collection);
}
if (resultDataSeriesPane != null) {
resultDataSeriesPane.updateBean(collection);
}
if (dataScreeningPane != null) {
updateDataScreeningPane(dataScreeningPane, collection);
}
}
public void populateBean(ChartCollection collection) {
checkChartCollection(collection);
if (dataType != null) {
dataType.setSelectedIndex(BoxTableDefinitionHelper.isDetailedTableDataType(collection) ? 0 : 1);
}
if (seriesTypeComboxPane != null) {
seriesTypeComboxPane.populateBean(collection);
}
if (resultDataSeriesPane != null) {
resultDataSeriesPane.populateBean(collection);
}
if (dataScreeningPane != null) {
populateDataScreeningPane(dataScreeningPane, collection);
}
checkDataPaneVisible();
}
private void checkChartCollection(ChartCollection collection) {
VanBoxTableDefinition table = BoxTableDefinitionHelper.getBoxTableDefinition(collection);
if (table == null) {
collection.getSelectedChart().setFilterDefinition(new VanBoxTableDefinition());
}
}
private void populateDataScreeningPane(ChartDataFilterPane dataScreeningPane, ChartCollection collection) {
NormalTableDataDefinition detailedDefinition = BoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection);
if (detailedDefinition != null) {
dataScreeningPane.populateDefinition(detailedDefinition, false);
}
}
private void updateDataScreeningPane(ChartDataFilterPane dataScreeningPane, ChartCollection collection) {
NormalTableDataDefinition detailedDefinition = BoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection);
if (detailedDefinition != null) {
dataScreeningPane.updateDefinition(detailedDefinition);
}
}
}

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

@ -0,0 +1,178 @@
package com.fr.van.chart.box.data.table;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.plugin.chart.box.data.VanBoxTableDefinition;
import com.fr.plugin.chart.box.data.VanBoxTableResultDefinition;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.util.List;
public class BoxPlotTableResultDataSeriesPane extends AbstractTableDataContentPane {
private UIComboBox category;
private UIComboBox seriesName;
private UIComboBox max;
private UIComboBox q3;
private UIComboBox median;
private UIComboBox q1;
private UIComboBox min;
public BoxPlotTableResultDataSeriesPane() {
initComboxSize();
this.setLayout(new BorderLayout());
this.add(createDataSeriesPane(), BorderLayout.CENTER);
addItemListener();
}
private void initComboxSize() {
Dimension preferredSize = new Dimension(100, 20);
category = new UIComboBox();
seriesName = new UIComboBox();
max = new UIComboBox();
q3 = new UIComboBox();
median = new UIComboBox();
q1 = new UIComboBox();
min = new UIComboBox();
category.setPreferredSize(preferredSize);
seriesName.setPreferredSize(preferredSize);
max.setPreferredSize(preferredSize);
q3.setPreferredSize(preferredSize);
median.setPreferredSize(preferredSize);
q1.setPreferredSize(preferredSize);
min.setPreferredSize(preferredSize);
}
private void addItemListener() {
category.addItemListener(tooltipListener);
seriesName.addItemListener(tooltipListener);
max.addItemListener(tooltipListener);
q3.addItemListener(tooltipListener);
median.addItemListener(tooltipListener);
q1.addItemListener(tooltipListener);
min.addItemListener(tooltipListener);
}
private JPanel createDataSeriesPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] column = {f, COMPONENT_WIDTH};
double[] row = {p, p, p, p, p, p, p};
Component[][] components_north = new Component[][]{
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Category")), category},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name")), seriesName},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Max")), max},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q3")), q3},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Median")), median},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Q1")), q1},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Min")), min},
};
JPanel center = TableLayout4VanChartHelper.createGapTableLayoutPane(components_north, row, column);
center.setBorder(BorderFactory.createEmptyBorder(10, 24, 10, 15));
return center;
}
public void checkBoxUse(boolean hasUse) {
}
protected void refreshBoxListWithSelectTableData(List list) {
refreshBoxItems(category, list);
refreshBoxItems(seriesName, list);
refreshBoxItems(max, list);
refreshBoxItems(q3, list);
refreshBoxItems(median, list);
refreshBoxItems(q1, list);
refreshBoxItems(min, list);
}
public void clearAllBoxList() {
clearBoxItems(category);
clearBoxItems(seriesName);
clearBoxItems(max);
clearBoxItems(q3);
clearBoxItems(median);
clearBoxItems(q1);
clearBoxItems(min);
}
public void populateBean(ChartCollection collection) {
super.populateBean(collection);
VanBoxTableResultDefinition definition = BoxTableDefinitionHelper.getBoxTableResultDefinition(collection);
if (definition == null) {
return;
}
combineCustomEditValue(category, definition.getCategoryName());
combineCustomEditValue(seriesName, definition.getSeriesName());
combineCustomEditValue(max, definition.getMax());
combineCustomEditValue(q3, definition.getQ3());
combineCustomEditValue(median, definition.getMedian());
combineCustomEditValue(q1, definition.getQ1());
combineCustomEditValue(min, definition.getMin());
}
public void updateBean(ChartCollection collection) {
VanBoxTableDefinition table = BoxTableDefinitionHelper.getBoxTableDefinition(collection);
VanBoxTableResultDefinition definition = new VanBoxTableResultDefinition();
Object resultCategory = category.getSelectedItem();
Object resultSeries = seriesName.getSelectedItem();
Object resultMax = max.getSelectedItem();
Object resultQ3 = q3.getSelectedItem();
Object resultMedian = median.getSelectedItem();
Object resultQ1 = q1.getSelectedItem();
Object resultMin = min.getSelectedItem();
if (resultCategory == null || ArrayUtils.contains(ChartConstants.getNoneKeys(), resultCategory)) {
definition.setCategoryName(StringUtils.EMPTY);
} else {
definition.setCategoryName(resultCategory.toString());
}
if (resultSeries == null || ArrayUtils.contains(ChartConstants.getNoneKeys(), resultSeries)) {
definition.setSeriesName(StringUtils.EMPTY);
} else {
definition.setSeriesName(resultSeries.toString());
}
if (resultMax != null) {
definition.setMax(resultMax.toString());
}
if (resultQ3 != null) {
definition.setQ3(resultQ3.toString());
}
if (resultMedian != null) {
definition.setMedian(resultMedian.toString());
}
if (resultQ1 != null) {
definition.setQ1(resultQ1.toString());
}
if (resultMin != null) {
definition.setMin(resultMin.toString());
}
table.setResultDefinition(definition);
}
}

12
designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableSeriesNameUseFieldNamePane.java

@ -0,0 +1,12 @@
package com.fr.van.chart.box.data.table;
import com.fr.chart.chartdata.MoreNameCDDefinition;
import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldNamePane;
import com.fr.plugin.chart.box.data.VanBoxMoreNameCDDefinition;
public class BoxPlotTableSeriesNameUseFieldNamePane extends SeriesNameUseFieldNamePane {
protected MoreNameCDDefinition createMoreNameCDDefinition() {
return new VanBoxMoreNameCDDefinition();
}
}

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

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

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

@ -0,0 +1,224 @@
package com.fr.van.chart.box.data.table;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartdata.MoreNameCDDefinition;
import com.fr.chart.chartdata.NormalTableDataDefinition;
import com.fr.chart.chartdata.OneValueCDDefinition;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.box.data.VanBoxTableDefinition;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollection> {
private static boolean NEED_SUMMERY = false;
private UIComboBox categoryCombox;
private BoxPlotTableSeriesNameUseFieldValuePane nameFieldValuePane;
private BoxPlotTableSeriesNameUseFieldNamePane nameFieldNamePane;
public BoxPlotTableSeriesTypeUsePane() {
cards = initPaneList();
initComponents();
initListener();
}
protected void initLayout() {
this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM));
cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
this.add(createNorthPane(), BorderLayout.NORTH);
this.add(createCenterPane(), BorderLayout.CENTER);
this.add(cardPane, BorderLayout.SOUTH);
}
protected UIComboBox createComboBox() {
UIComboBox uiComboBox = new UIComboBox();
UIComponentUtils.setPreferedWidth(uiComboBox, 100);
return uiComboBox;
}
private JPanel createNorthPane() {
JPanel north = new JPanel(new BorderLayout(4, 0));
north.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground()));
UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
categoryCombox = new UIComboBox();
categoryCombox.setPreferredSize(new Dimension(100, 20));
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
north.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, null, null, label, null}));
north.setPreferredSize(new Dimension(246, 30));
north.setBorder(BorderFactory.createEmptyBorder(0, 24, 10, 15));
return north;
}
private JPanel createCenterPane() {
JPanel center = new JPanel(new BorderLayout(4, 0));
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
center.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label, null}));
center.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
return center;
}
private void initListener() {
categoryCombox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
checkBoxUse(categoryCombox.getSelectedItem() != null);
makeToolTipUse(categoryCombox);
}
});
}
public void checkBoxUse(boolean hasUse) {
categoryCombox.setEnabled(hasUse);
jcb.setEnabled(hasUse);
nameFieldValuePane.checkUse(hasUse);
}
private void makeToolTipUse(UIComboBox comBox) {
if (comBox.getSelectedItem() != null) {
comBox.setToolTipText(comBox.getSelectedItem().toString());
} else {
comBox.setToolTipText(null);
}
}
public void refreshBoxListWithSelectTableData(List list) {
DataPaneHelper.refreshBoxItems(categoryCombox, list);
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
nameFieldValuePane.refreshBoxListWithSelectTableData(list);
nameFieldNamePane.refreshBoxListWithSelectTableData(list);
}
public void clearAllBoxList() {
DataPaneHelper.clearBoxItems(categoryCombox);
categoryCombox.addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
nameFieldValuePane.clearAllBoxList();
nameFieldNamePane.clearAllBoxList();
}
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Chart_Series_Name_From");
}
protected List<FurtherBasicBeanPane<? extends ChartCollection>> initPaneList() {
nameFieldValuePane = new BoxPlotTableSeriesNameUseFieldValuePane();
nameFieldNamePane = new BoxPlotTableSeriesNameUseFieldNamePane();
nameFieldValuePane.relayoutPane(NEED_SUMMERY);
nameFieldNamePane.relayoutPane(NEED_SUMMERY);
List<FurtherBasicBeanPane<? extends ChartCollection>> paneList = new ArrayList<FurtherBasicBeanPane<? extends ChartCollection>>();
paneList.add(nameFieldValuePane);
paneList.add(nameFieldNamePane);
return paneList;
}
public void relayoutPane() {
if (jcb.getSelectedIndex() == 0) {
nameFieldValuePane.relayoutPane(NEED_SUMMERY);
} else {
nameFieldNamePane.relayoutPane(NEED_SUMMERY);
}
}
protected void comboBoxItemStateChanged() {
if (jcb.getSelectedIndex() == 0) {
nameFieldValuePane.relayoutPane(NEED_SUMMERY);
} else {
nameFieldNamePane.relayoutPane(NEED_SUMMERY);
}
}
public void populateBean(ChartCollection collection) {
NormalTableDataDefinition definition = BoxTableDefinitionHelper.getBoxTableDetailedDefinition(collection);
if (definition == null) {
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
return;
}
if (definition instanceof OneValueCDDefinition) {
this.setSelectedIndex(0);
nameFieldValuePane.populateDefinition(definition, NEED_SUMMERY);
} else if (definition instanceof MoreNameCDDefinition) {
this.setSelectedIndex(1);
nameFieldNamePane.populateDefinition(definition, NEED_SUMMERY);
}
populateCategoryItem(categoryCombox, definition.getCategoryName());
}
public void updateBean(ChartCollection collection) {
VanBoxTableDefinition table = BoxTableDefinitionHelper.getBoxTableDefinition(collection);
if (table == null) {
return;
}
NormalTableDataDefinition definition;
if (this.getSelectedIndex() == 0) {
definition = nameFieldValuePane.updateDefinition();
} else {
definition = nameFieldNamePane.updateDefinition(table.getDetailedDefinition());
}
Object categoryName = categoryCombox.getSelectedItem();
if (ArrayUtils.contains(ChartConstants.getNoneKeys(), categoryName)) {
definition.setCategoryName(StringUtils.EMPTY);
} else {
definition.setCategoryName(categoryName == null ? null : categoryName.toString());
}
table.setDetailedDefinition(definition);
}
private void populateCategoryItem(UIComboBox categoryCombox, String item) {
if (ComparatorUtils.equals(item, StringUtils.EMPTY)) {
categoryCombox.setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} else if (!DataPaneHelper.boxItemsContainsObject(categoryCombox, item)) {
categoryCombox.setSelectedItem(null);
} else {
DataPaneHelper.combineCustomEditValue(categoryCombox, item);
}
}
}

59
designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxTableDefinitionHelper.java

@ -0,0 +1,59 @@
package com.fr.van.chart.box.data.table;
import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartdata.NormalTableDataDefinition;
import com.fr.plugin.chart.box.data.VanBoxTableDefinition;
import com.fr.plugin.chart.box.data.VanBoxTableResultDefinition;
public class BoxTableDefinitionHelper {
public static VanBoxTableDefinition getBoxTableDefinition(ChartCollection collection) {
if (collection != null) {
Chart chart = collection.getSelectedChart();
if (chart != null) {
TopDefinitionProvider definitionProvider = chart.getFilterDefinition();
if (definitionProvider instanceof VanBoxTableDefinition) {
return (VanBoxTableDefinition) definitionProvider;
}
}
}
return null;
}
public static VanBoxTableResultDefinition getBoxTableResultDefinition(ChartCollection collection) {
VanBoxTableDefinition table = getBoxTableDefinition(collection);
if (table != null) {
return table.getResultDefinition();
}
return null;
}
public static NormalTableDataDefinition getBoxTableDetailedDefinition(ChartCollection collection) {
VanBoxTableDefinition table = getBoxTableDefinition(collection);
if (table != null) {
return table.getDetailedDefinition();
}
return null;
}
public static boolean isDetailedTableDataType(ChartCollection collection) {
VanBoxTableDefinition table = getBoxTableDefinition(collection);
if (table != null) {
return table.isDetailed();
}
return true;
}
}

11
designer-chart/src/main/java/com/fr/van/chart/designer/other/condition/item/VanChartAreaFillColorConditionPane.java

@ -1,11 +1,11 @@
package com.fr.van.chart.designer.other.condition.item;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.DataSeriesCondition;
import com.fr.chart.chartattr.Plot;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.plugin.chart.attr.plot.VanChartPlot;
import com.fr.plugin.chart.base.AttrAreaSeriesFillColorBackground;
import com.fr.plugin.chart.type.GradientType;
import com.fr.van.chart.designer.component.VanChartAreaSeriesFillColorPane;
import javax.swing.JPanel;
@ -13,7 +13,7 @@ import javax.swing.JPanel;
/**
* 面积图填充色
*/
public class VanChartAreaFillColorConditionPane extends AbstractNormalMultiLineConditionPane {
public class VanChartAreaFillColorConditionPane extends AbstractNormalMultiLineConditionPane {
private Plot plot;
private static final long serialVersionUID = -4148284851967140012L;
private VanChartAreaSeriesFillColorPane fillColorBackground;
@ -40,6 +40,7 @@ public class VanChartAreaFillColorConditionPane extends AbstractNormalMultiLine
/**
* 条件属性item的名称
*
* @return item的名称
*/
public String nameForPopupMenuItem() {
@ -54,13 +55,13 @@ public class VanChartAreaFillColorConditionPane extends AbstractNormalMultiLine
public void setDefault() {
//下面这句话是给各组件一个默认值
fillColorBackground.populate(new AttrAreaSeriesFillColorBackground());
fillColorBackground.checkoutAlpha(!(plot != null && plot.getPlotStyle() == ChartConstants.STYLE_SHADE));
fillColorBackground.checkoutAlpha(plot != null && ((VanChartPlot) plot).getGradientStyle().getGradientType() == GradientType.NONE);
}
public void populate(DataSeriesCondition condition) {
if (condition instanceof AttrAreaSeriesFillColorBackground) {
fillColorBackground.populate((AttrAreaSeriesFillColorBackground) condition);
fillColorBackground.checkoutAlpha(!(plot != null && plot.getPlotStyle() == ChartConstants.STYLE_SHADE));
fillColorBackground.checkoutAlpha(plot != null && ((VanChartPlot) plot).getGradientStyle().getGradientType() == GradientType.NONE);
}
}

22
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java

@ -50,10 +50,10 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
private static final double LINE_WIDTH_DEFAULT_VALUE = 1;
private UIButtonGroup alertAxis;
protected TinyFormulaPane alertValue;
protected LineTypeComboBox alertLineStyle;//线型
private TinyFormulaPane alertValue;
private LineTypeComboBox alertLineStyle;//线型
private UISpinner lineWidthSpinner;//线宽
protected ColorSelectBox alertLineColor;
private ColorSelectBox alertLineColor;
private UIButtonGroup alertTextPosition;
private TinyFormulaPane alertText;
@ -67,6 +67,22 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
initComponents();
}
public TinyFormulaPane getAlertValue() {
return alertValue;
}
public LineTypeComboBox getAlertLineStyle() {
return alertLineStyle;
}
public UISpinner getLineWidthSpinner() {
return lineWidthSpinner;
}
public ColorSelectBox getAlertLineColor() {
return alertLineColor;
}
private void initComponents() {
alertValue = new TinyFormulaPane();

9
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/radar/VanChartRadarAlertValuePane.java

@ -1,7 +1,7 @@
package com.fr.van.chart.designer.style.background.radar;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.van.chart.designer.style.background.VanChartAlertValuePane;
import java.awt.Component;
@ -14,9 +14,10 @@ public class VanChartRadarAlertValuePane extends VanChartAlertValuePane {
protected Component[][] getTopPaneComponents() {
return new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Value")),alertValue},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")),alertLineStyle},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),alertLineColor},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Use_Value")), getAlertValue()},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")), getAlertLineStyle()},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Line_Width")), getLineWidthSpinner()},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), getAlertLineColor()},
};
}

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

@ -5,7 +5,6 @@ import com.fr.base.chart.chartdata.model.LargeDataModel;
import com.fr.base.chart.chartdata.model.NormalDataModel;
import com.fr.chart.base.AttrAlpha;
import com.fr.chart.base.AttrBorder;
import com.fr.chart.base.ChartConstants;
import com.fr.chart.base.GradientStyle;
import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr;
@ -90,7 +89,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
}
JPanel panel = new JPanel(new BorderLayout());
JPanel colorPane = getColorPane();
if(colorPane != null) {
if (colorPane != null) {
panel.add(colorPane, BorderLayout.NORTH);
}
panel.add(getContentInPlotType(), BorderLayout.CENTER);
@ -279,7 +278,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
checkoutMapType(plot);
if(vanChartFillStylePane != null) { //配色
if (vanChartFillStylePane != null) { //配色
vanChartFillStylePane.populateBean(plot.getPlotFillStyle());
}
@ -310,7 +309,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
populateCondition(plot.getConditionCollection().getDefaultAttr());
checkAreaSeriesFillColorPane(plot.getPlotStyle());
checkAreaSeriesFillColorPane(((VanChartPlot) plot).getGradientStyle());
checkCompsEnabledWithLarge(plot);
}
@ -340,7 +339,7 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
//更新之前先更新界面的map类型属性
checkoutMapType(plot);
if(vanChartFillStylePane != null) {//配色
if (vanChartFillStylePane != null) {//配色
plot.setPlotFillStyle(vanChartFillStylePane.updateBean());
}
@ -369,16 +368,16 @@ public abstract class VanChartAbstractPlotSeriesPane extends AbstractPlotSeriesP
updateCondition(plot.getConditionCollection().getDefaultAttr());
checkAreaSeriesFillColorPane(plot.getPlotStyle());
checkAreaSeriesFillColorPane(((VanChartPlot) plot).getGradientStyle());
}
protected void checkoutMapType(Plot plot) {
}
protected void checkAreaSeriesFillColorPane(int plotStyle) {
protected void checkAreaSeriesFillColorPane(GradientStyle gradientStyle) {
if (areaSeriesFillColorPane != null) {
areaSeriesFillColorPane.checkoutAlpha(plotStyle == ChartConstants.STYLE_NONE);
areaSeriesFillColorPane.checkoutAlpha(gradientStyle.getGradientType() == GradientType.NONE);
}
}

38
designer-chart/src/main/java/com/fr/van/chart/multilayer/data/MultiPiePlotTableDataContentPane.java

@ -14,16 +14,16 @@ import com.fr.design.layout.TableLayout;
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.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.multilayer.data.MultiPieValueDefinition;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.ArrayUtils;
import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import java.awt.BorderLayout;
@ -72,7 +72,7 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
for (int i = 0; i < levelNum; i++){
levelNameList.add(new UIComboBox());
levelNameList.get(i).setPreferredSize(new Dimension(WD, HT));
levelNameList.get(i).addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
levelNameList.get(i).addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
}
}
@ -103,7 +103,7 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
Component[][] components_center = new Component[levelNum + 3][];
for (int i = 0; i < levelNum; i++){
components_center[i] = new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Level") + String.valueOf(i+1)), levelNameList.get(i)};
components_center[i] = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Level") + String.valueOf(i+1)), levelNameList.get(i)};
}
value = new UIComboBox();
@ -113,8 +113,8 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
calculateCombox.setPreferredSize(new Dimension(WD, HT));
components_center[levelNum] = new Component[]{getJSeparator(), null};
components_center[levelNum+1] = new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Value")), value};
components_center[levelNum+2] = new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method")), calculateCombox};
components_center[levelNum+1] = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Use_Value")), value};
components_center[levelNum+2] = new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method")), calculateCombox};
initCenterItemListener();
@ -181,9 +181,9 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
nameField = new UITextField();
Component[][] components_north = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name")), nameField},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_MultiPie_Series_Name")), nameField},
new Component[]{getJSeparator(),null },
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Level_Number")), levelNumEdit},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Level_Number")), levelNumEdit},
};
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components_north, rowSize_north, columnSize_north);
@ -243,7 +243,7 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
columnNameList = list;
for (int i = 0; i < levelNum; i++) {
refreshBoxItems(levelNameList.get(i), list);
levelNameList.get(i).addItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
levelNameList.get(i).addItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
}
refreshBoxItems(value, list);
}
@ -282,7 +282,7 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
//值
value.setEditable(true);
value.setSelectedItem(this.boxItemsContainsObject(value,data.getValueColumnName())
value.setSelectedItem(DataPaneHelper.boxItemsContainsObject(value,data.getValueColumnName())
? data.getValueColumnName() : null);
value.setEditable(false);
//汇总方式
@ -327,8 +327,8 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
for (int i = 0; i < levelNameList.size(); i++){
if(!definition.hasLevelIndex(i) || ComparatorUtils.equals(levelColumnNameList.get(i), StringUtils.EMPTY)) {
levelNameList.get(i).setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} else if(definition.hasLevelIndex(i) && !this.boxItemsContainsObject(levelNameList.get(i),levelColumnNameList.get(i))){
levelNameList.get(i).setSelectedItem(Toolkit.i18nText("Fine-Design_Chart_Use_None"));
} else if(definition.hasLevelIndex(i) && !DataPaneHelper.boxItemsContainsObject(levelNameList.get(i),levelColumnNameList.get(i))){
levelNameList.get(i).setSelectedItem(null);
}else {
combineCustomEditValue(levelNameList.get(i), definition.hasLevelIndex(i) ? levelColumnNameList.get(i) : null);
@ -353,20 +353,6 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
}
}
private boolean boxItemsContainsObject(UIComboBox box,Object item){
if(box == null){
return false;
}
ComboBoxModel dataModel = box.getModel();
for (int i = 0; i < dataModel.getSize(); i++) {
if(ComparatorUtils.equals(dataModel.getElementAt(i),item)){
return true;
}
}
return false;
}
protected JSeparator getJSeparator() {
JSeparator jSeparator = new JSeparator();
jSeparator.setPreferredSize(new Dimension(220, 2));

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 918 B

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

@ -35,18 +35,19 @@ public class FRBorderLayoutAdapter extends AbstractLayoutAdapter {
* @param creator 组件
*/
public void fix(XCreator creator) {
FRBorderLayout layout = (FRBorderLayout)container.getFRLayout();
FRBorderLayout layout = (FRBorderLayout) container.getFRLayout();
Object constraints = layout.getConstraints(creator);
double scale = container.getScale();
if (ComparatorUtils.equals(constraints, BorderLayout.NORTH)) {
((XWBorderLayout)container).toData().setNorthSize(creator.getHeight());
((XWBorderLayout) container).toData().setNorthSize((int) (creator.getHeight() / scale));
} else if (ComparatorUtils.equals(constraints, BorderLayout.SOUTH)) {
((XWBorderLayout)container).toData().setSouthSize(creator.getHeight());
((XWBorderLayout) container).toData().setSouthSize((int) (creator.getHeight() / scale));
} else if (ComparatorUtils.equals(constraints, BorderLayout.EAST)) {
((XWBorderLayout)container).toData().setEastSize(creator.getWidth());
((XWBorderLayout) container).toData().setEastSize((int) (creator.getWidth() / scale));
} else if (ComparatorUtils.equals(constraints, BorderLayout.WEST)) {
((XWBorderLayout)container).toData().setWestSize(creator.getWidth());
((XWBorderLayout) container).toData().setWestSize((int) (creator.getWidth() / scale));
} else {
return;
return;
}
container.recalculateChildrenPreferredSize();
}
@ -185,4 +186,4 @@ public class FRBorderLayoutAdapter extends AbstractLayoutAdapter {
return new FRBorderLayoutConstraints(container, creator);
}
}
}

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

@ -306,12 +306,12 @@ public class SelectionModel {
// 清除被选中的组件
selection.reset();
}
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_DELETED);
setSelectedCreator(isInPara ? designer.getParaComponent() : designer.getRootComponent());
setSelectedCreator(isInPara ? designer.getParaComponent() : designer.getRootComponent());
// 触发事件
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_DELETED);
designer.repaint();
}
}

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() {
FreeButton button = (FreeButton) data;
if (button.getFont() != null) {
contentLabel.setFont(button.getFont().applyResolutionNP(
setContentLabelFont(button.getFont().applyResolutionNP(
FontTransformUtil.getDesignerFontResolution()));
contentLabel.setForeground(button.getFont().getForeground());
}
@ -230,7 +230,7 @@ public class XButton extends XWidgetCreator {
if (!button.isCustomStyle()) {
l.setBorder(BorderFactory.createLineBorder(new Color(148, 148, 148)));
bg = DEFAULTBG;
contentLabel.setFont(DEFAULTFT);
setContentLabelFont(DEFAULTFT);
contentLabel.setForeground(DEFAULTFOREGROUNDCOLOR);
editor.setLayout(new BorderLayout());
editor.add(l, BorderLayout.CENTER);
@ -239,7 +239,7 @@ public class XButton extends XWidgetCreator {
editor.setLayout(new BorderLayout());
editor.add(l,BorderLayout.CENTER);
if (button.getFont() != null) {
contentLabel.setFont(button.getFont().applyResolutionNP(
setContentLabelFont(button.getFont().applyResolutionNP(
FontTransformUtil.getDesignerFontResolution()));
contentLabel.setForeground(button.getFont().getForeground());
}
@ -302,11 +302,26 @@ public class XButton extends XWidgetCreator {
setButtonText(button.getText());
checkButonType();
if (button.getFont() != null) {
contentLabel.setFont(button.getFont().applyResolutionNP(
setContentLabelFont(button.getFont().applyResolutionNP(
FontTransformUtil.getDesignerFontResolution()));
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);
}
}
}

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

@ -49,6 +49,7 @@ import java.util.Set;
*
*/
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);
public static final Dimension SMALL_PREFERRED_SIZE = new Dimension(80, 21);
@ -102,6 +103,14 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
}
}
public double getScale() {
return scale;
}
public void setScale(double scale) {
this.scale = scale;
}
/**
* 初始化组件大小
*/
@ -298,7 +307,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
@Override
public JComponent createToolPane(BaseJForm jform, FormDesigner formEditor) {
if (!DesignerMode.isAuthorityEditing()) {
if (isDedicateContainer()) {
if (isDedicateContainer() && this.getComponentCount() > 0) {
// 图表块和报表块由于控件树处不显示,但对应的属性表要显示,此处处理下
XCreator child = ((XLayoutContainer) this).getXCreator(0);
return child.createToolPane(jform, formEditor);
@ -408,7 +417,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public Component getParentShow(){
return this.getParent();
}
/**
* 重置组件的名称
*
@ -418,18 +427,18 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public void resetCreatorName(String name) {
toData().setWidgetName(name);
}
/**
* 遍历所有命名相关的组件到集合中
*
* @param xCreators 集合
*/
public void traversalNameRelatedXCreators(Set<XCreator> xCreators) {
xCreators.add(this);
int componentCount = getComponentCount();
for (int i = 0; i < componentCount; i++) {
Component component = getComponent(i);
if (component instanceof XCreator) {
XCreator xCreator = (XCreator) component;
@ -439,7 +448,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
}
}
}
/**
* 重置组件的可见性
*
@ -448,7 +457,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
public void resetVisible(boolean visible) {
toData().setVisible(visible);
}
/**
* 返回编辑的子组件scale为其内部组件
* @return 组件
@ -804,4 +813,4 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
return false;
}
}
}

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

@ -11,6 +11,7 @@ import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.fun.ChartWidgetOptionProvider;
import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.fun.ParameterWidgetOptionProvider;
import com.fr.design.module.DesignModuleFactory;
@ -102,7 +103,8 @@ public class XCreatorUtils {
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, ParameterWidgetOptionProvider.XML_TAG)
|| context.contain(PluginModule.ExtraDesign, FormWidgetOptionProvider.XML_TAG);
|| context.contain(PluginModule.ExtraDesign, FormWidgetOptionProvider.XML_TAG)
|| context.contain(PluginModule.ExtraDesign, ChartWidgetOptionProvider.XML_TAG);
}
});
}

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

@ -17,6 +17,7 @@ import com.fr.design.mainframe.widget.renderer.LabelHorizontalAlignmentRenderer;
import com.fr.form.ui.Label;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.general.FRFont;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.core.PropertyChangeAdapter;
@ -94,8 +95,11 @@ public class XLabel extends XWidgetCreator {
}
if (label.getWidgetValue() != null) {
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()
.toString(), Style.getInstance(label.getFont()).deriveHorizontalAlignment(label.getTextalign())
.toString(), Style.getInstance(font.applySize(fontsize))
.deriveHorizontalAlignment(label.getTextalign())
.deriveVerticalAlignment(label.isVerticalCenter() ? SwingConstants.CENTER : SwingConstants.TOP)
.deriveTextStyle(label.isWrap() ? Style.TEXTSTYLE_WRAPTEXT : Style.TEXTSTYLE_SINGLELINE),
FontTransformUtil.getDesignerFontResolution());

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

@ -59,8 +59,10 @@ public class XTextArea extends XFieldEditor {
TextArea area = (TextArea) data;
if (area.getWidgetValue() != null) {
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()
.toString(), Style.getInstance(FRFont.getInstance()).deriveHorizontalAlignment(Constants.LEFT)
.toString(), Style.getInstance(font.applySize(fontsize)).deriveHorizontalAlignment(Constants.LEFT)
.deriveVerticalAlignment(SwingConstants.TOP)
.deriveTextStyle(Style.TEXTSTYLE_WRAPTEXT), ScreenResolution.getScreenResolution());
}

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

@ -67,8 +67,10 @@ public class XTextEditor extends XWrapperedFieldEditor {
TextEditor area = (TextEditor) data;
if (area.getWidgetValue() != null) {
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()
.toString(), Style.getInstance(FRFont.getInstance()).deriveHorizontalAlignment(Constants.LEFT)
.toString(), Style.getInstance(font.applySize(fontsize)).deriveHorizontalAlignment(Constants.LEFT)
.deriveTextStyle(Style.TEXTSTYLE_SINGLELINE), ScreenResolution.getScreenResolution());
}
}

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

@ -30,6 +30,8 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
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.IOUtils;
@ -397,6 +399,7 @@ public class XWAbsoluteLayout extends XLayoutContainer {
return;
}
XWidgetCreator creator = (XWidgetCreator) e.getChild();
creator.setScale(this.getScale());
WAbsoluteLayout wabs = this.toData();
if (!creator.acceptType(XWFitLayout.class)) {
creator.setDirections(Direction.ALL);
@ -602,4 +605,17 @@ public class XWAbsoluteLayout extends XLayoutContainer {
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();
Object constraints = wlayout.getConstraints(wgt);
Dimension d = new Dimension();
if (ComparatorUtils.equals(WBorderLayout.NORTH,constraints)) {
d.height = wlayout.getNorthSize();
} else if (ComparatorUtils.equals(WBorderLayout.SOUTH,constraints)) {
d.height = wlayout.getSouthSize();
} else if (ComparatorUtils.equals(WBorderLayout.EAST,constraints)) {
d.width = wlayout.getEastSize();
} else if (ComparatorUtils.equals(WBorderLayout.WEST,constraints)) {
d.width = wlayout.getWestSize();
if (ComparatorUtils.equals(WBorderLayout.NORTH, constraints)) {
d.height = (int) (wlayout.getNorthSize() * getScale());
} else if (ComparatorUtils.equals(WBorderLayout.SOUTH, constraints)) {
d.height = (int) (wlayout.getSouthSize() * getScale());
} else if (ComparatorUtils.equals(WBorderLayout.EAST, constraints)) {
d.width = (int) (wlayout.getEastSize() * getScale());
} else if (ComparatorUtils.equals(WBorderLayout.WEST, constraints)) {
d.width = (int) (wlayout.getWestSize() * getScale());
}
return d;
}
@ -203,8 +203,40 @@ public class XWBorderLayout extends XLayoutContainer {
}
}
@Override
public LayoutAdapter getLayoutAdapter() {
return new FRBorderLayoutAdapter(this);
}
@Override
public LayoutAdapter getLayoutAdapter() {
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));
}
}
}
}

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

@ -18,6 +18,7 @@ import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.general.FRLogger;
import com.fr.general.FRScreen;
import com.fr.stable.ArrayUtils;
@ -129,6 +130,7 @@ public class XWFitLayout extends XLayoutContainer {
}
}
/**
* 直接拖动滑条改变整体像素大小时不用考虑控件的最小高度宽度内部组件全部一起缩小放大
* 只是界面显示大小改变不改变对应的BoundsWidget大小
@ -137,32 +139,28 @@ public class XWFitLayout extends XLayoutContainer {
public void adjustCreatorsWhileSlide(double percent) {
int count = this.getComponentCount();
if (count == 0) {
Dimension size = new Dimension(this.getSize());
size.width += size.width*percent;
size.height += size.height*percent;
Dimension size = new Dimension(this.toData().getContentWidth(), this.toData().getContentHeight());
size.width += size.width * percent;
size.height += size.height * percent;
this.setSize(size);
return;
}
// 初始化时还未加间隔
if (hasCalGap) {
moveContainerMargin();
moveCompInterval(backupGap);
LayoutUtils.layoutContainer(this);
}
int containerW = 0;
int containerH = 0;
int[] hors = getHors(false);
int[] veris = getVeris(false);
PaddingMargin margin = toData().getMargin();
for (int i=0; i<count; i++) {
int[] hors = getDataHors();
int[] veris = getDataVeris();
PaddingMargin margin = new PaddingMargin();
for (int i = 0; i < count; i++) {
XCreator creator = getXCreator(i);
WFitLayout fitLayout = this.toData();
CRBoundsWidget boundsWidget = fitLayout.getBoundsWidget(creator.toData());
// 百分比和updateBoundsWidget时都会调整大小
// 子组件非空时,调整界面大小、 撤销、再次打开表单,都会按屏幕百分比调整,此时必须考虑内边距
Rectangle rec = modifyCreatorPoint(creator.getBounds(), percent, hors, veris);
Rectangle rec = modifyCreatorPoint(boundsWidget.getBounds(), percent, hors, veris);
if (rec.x == margin.getLeft()) {
containerH += rec.height;
}
if (rec.y == margin.getTop()) {
if (rec.y == margin.getTop()) {
containerW += rec.width;
}
creator.setBounds(rec);
@ -170,15 +168,12 @@ public class XWFitLayout extends XLayoutContainer {
}
// 布局内部组件放大缩小后,都是乘以百分比后取整,可能会产生空隙,此处调整容器
this.setSize(
containerW + (int)(margin.getLeft() * (1.0+percent) + margin.getRight() * (1.0+percent)),
containerH + (int)(margin.getTop() * (1.0+percent) + margin.getBottom() * (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))
);
updateCreatorsBackupBound();
// 间隔也按显示大小比例调整
if (!hasCalGap) {
moveContainerMargin();
addCompInterval(getAcualInterval());
}
addCompInterval(getAcualInterval());
LayoutUtils.layoutContainer(this);
}
@ -186,6 +181,7 @@ public class XWFitLayout extends XLayoutContainer {
* 调整控件的point和size,避免拖动滑块出现空隙
*/
private Rectangle modifyCreatorPoint(Rectangle rec, double percent, int[] hors, int[] veris) {
rec = new Rectangle(rec);
int xIndex = 0, yIndex = 0;
PaddingMargin margin = toData().getMargin();
Rectangle bound = new Rectangle(rec);
@ -264,6 +260,41 @@ public class XWFitLayout extends XLayoutContainer {
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 实际大小
@ -290,6 +321,7 @@ public class XWFitLayout extends XLayoutContainer {
return ArrayUtils.toPrimitive(posY.toArray(new Integer[]{posY.size()}));
}
/**
* 是否能缩小
* @param percent 百分比
@ -860,12 +892,14 @@ public class XWFitLayout extends XLayoutContainer {
}
super.add(comp, constraints);
XCreator creator = (XCreator) comp;
creator.setScale(this.getScale());
dealDirections(creator, false);
}
private void add(Component comp, Object constraints, boolean isInit) {
super.add(comp, constraints);
XCreator creator = (XCreator) comp;
creator.setScale(this.getScale());
dealDirections(creator, isInit);
}
@ -1331,4 +1365,14 @@ public class XWFitLayout extends XLayoutContainer {
}
}
}
/**
* 自适应布局的缩放
*
* @param percent 百分比
*/
@Override
public void adjustCompSize(double percent) {
this.adjustCreatorsWhileSlide(percent);
}
}

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

@ -237,6 +237,7 @@ public class XCardSwitchButton extends XButton {
layout.setIndex(--tabFitIndex);
}
}
tagLayout.setTabsAndAdjust();
}
@ -337,7 +338,8 @@ public class XCardSwitchButton extends XButton {
String titleText = button.getText();
this.setButtonText(titleText);
FRFont font = widgetTitle.getFrFont();
FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(),font.getSize() + FONT_SIZE_ADJUST);
int fontsize = font.getSize() + FONT_SIZE_ADJUST;
FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(), (float) (fontsize * getScale()));
UILabel label = this.getContentLabel();
label.setFont(newFont);
label.setForeground(font.getForeground());
@ -459,7 +461,7 @@ public class XCardSwitchButton extends XButton {
TitlePacker title = getWidgetTitle();
FRFont font = title.getFrFont();
int fontSize = font.getSize() + FONT_SIZE_ADJUST;
FRFont newFont = FRFont.getInstance(font.getName(), font.getStyle(), fontSize);
FRFont newFont = FRFont.getInstance(font.getName(), font.getStyle(), (float) (fontSize * getScale()));
FontMetrics fm = GraphHelper.getFontMetrics(newFont);
for (int i = 0; i < titleText.length(); i++) {
titleStringBuf.append(titleText.charAt(i));

2
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java

@ -290,7 +290,6 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
@Override
public void doLayout() {
setTabsAndAdjust();
//设置布局
super.doLayout();
}
@ -382,7 +381,6 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
} else {
adjustTabsV(parent, tabLength, cardWidth, cardHeight);
}
fixTitleLayout(parent);
}
public void adjustTabsH(XLayoutContainer parent, int tabLength, Map<Integer, Integer> width, Map<Integer, Integer> height) {

83
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

@ -8,15 +8,11 @@ import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI;
import com.fr.design.designer.properties.mobile.MobileBookMarkPropertyUI;
import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.ButtonTypeEditor;
import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor;
import com.fr.design.utils.gui.LayoutUtils;
@ -44,7 +40,7 @@ import java.beans.IntrospectionException;
* @date 2014-6-23
*/
public class XWTabFitLayout extends XWFitLayout {
private static final int MIN_SIZE = 0;
private static final int WIDTH_SIDE_OFFSET = 57;
@ -101,7 +97,7 @@ public class XWTabFitLayout extends XWFitLayout {
public XWTabFitLayout(){
this(new WTabFitLayout(), new Dimension());
}
public XWTabFitLayout(WTabFitLayout widget, Dimension initSize) {
super(widget, initSize);
}
@ -252,13 +248,13 @@ public class XWTabFitLayout extends XWFitLayout {
public LayoutAdapter getLayoutAdapter() {
return new FRTabFitLayoutAdapter(this);
}
/**
* tab布局里删除XWTabFitLayout对应的tab按钮
*
*
* @param creator 当前组件
* @param designer 表单设计器
*
*
*/
@Override
public void deleteRelatedComponent(XCreator creator, FormDesigner designer){
@ -288,15 +284,15 @@ public class XWTabFitLayout extends XWFitLayout {
deleteTabLayout(mainLayout,designer);
return;
}
//刷新tab按钮和tabFitLayout的index
refreshIndex(tag,cardLayout,index);
LayoutUtils.layoutRootContainer(designer.getRootComponent());
}
private void deleteTabLayout(XLayoutContainer mainLayout, FormDesigner designer){
SelectionModel selectionModel = designer.getSelectionModel();
if(mainLayout != null){
@ -323,7 +319,7 @@ public class XWTabFitLayout extends XWFitLayout {
}
}
}
/**
* tab布局里切换到相应的tab按钮
* @param comp 当前组件
@ -344,44 +340,37 @@ public class XWTabFitLayout extends XWFitLayout {
button.setShowButton(button.getIndex()==index);
}
}
/**
* 寻找最近的为自适应布局的父容器
*
*
* @return 布局容器
*
*
*
* @date 2014-12-30-下午3:15:28
*
*
*/
@Override
public XLayoutContainer findNearestFit(){
XLayoutContainer parent = this.getBackupParent();
return parent == null ? null : parent.findNearestFit();
}
/**
* 非顶层自适应布局的缩放
* @param percent 百分比
*/
@Override
public void adjustCompSize(double percent) {
this.adjustCreatorsWhileSlide(percent);
}
}
/**
* 该布局需要隐藏无需对边框进行操作
* @param border 边框
*
*
*/
public void setBorder(Border border) {
return;
}
/**
* 按照百分比缩放内部组件宽度
*
*
* @param percent 宽度变化的百分比
*/
@Override
@ -397,7 +386,7 @@ public class XWTabFitLayout extends XWFitLayout {
moveCompInterval(getAcualInterval());
updateCompsWidget();
}
layoutWidthResize(percent);
layoutWidthResize(percent);
if (percent < 0 && this.getNeedAddWidth() > 0) {
this.setSize(this.getWidth()+this.getNeedAddWidth(), this.getHeight());
modifyEdgemostCreator(true);
@ -410,8 +399,8 @@ public class XWTabFitLayout extends XWFitLayout {
updateWidgetBackupBounds();
LayoutUtils.layoutContainer(this);
}
/**
* 布局容器高度手动修改时
* 同时调整容器内的组件们,缩小时需要考虑有的组件高度不满足缩小高度
@ -441,13 +430,13 @@ public class XWTabFitLayout extends XWFitLayout {
updateWidgetBackupBounds();
LayoutUtils.layoutContainer(this);
}
@Override
public XLayoutContainer getOuterLayout(){
XWCardLayout cardLayout = (XWCardLayout) this.getBackupParent();
return cardLayout.getBackupParent();
}
// 更新内部组件的widget
private void updateCompsWidget(){
for(int m=0;m<this.getComponentCount();m++){
@ -487,7 +476,7 @@ public class XWTabFitLayout extends XWFitLayout {
this.setxCardSwitchButton((XCardSwitchButton)xCreator);
}
}
/**
* 去除原有的间隔
* @param gap 间隔
@ -498,11 +487,11 @@ public class XWTabFitLayout extends XWFitLayout {
return;
}
int val = gap/2;
// 比较组件大小和tab布局的大小的参照宽高
double referWidth = getReferWidth();
double referHeight = getReferHeight();
for (int i=0, len=this.getComponentCount(); i<len; i++) {
Component comp = this.getComponent(i);
Rectangle rec = comp.getBounds();
@ -523,10 +512,10 @@ public class XWTabFitLayout extends XWFitLayout {
}
comp.setBounds(bound);
}
this.hasCalGap = false;
}
private double getReferWidth(){
if(referDim != null){
return referDim.getWidth();
@ -534,7 +523,7 @@ public class XWTabFitLayout extends XWFitLayout {
return this.getWidth();
}
}
private double getReferHeight(){
if(referDim != null){
return referDim.getHeight();
@ -542,8 +531,8 @@ public class XWTabFitLayout extends XWFitLayout {
return this.getHeight();
}
}
/**
* 间隔大于0时界面处加上间隔
* 界面的间隔是针对显示实际保存的大小不受间隔影响
@ -578,7 +567,7 @@ public class XWTabFitLayout extends XWFitLayout {
}
comp.setBounds(bound);
}
this.hasCalGap = true;
}

39
designer-form/src/main/java/com/fr/design/form/parameter/FormParaDesigner.java

@ -83,6 +83,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
private static final int SUBMIT_BUTTON_H_LOCATION = 270;
private static final int PARA_IMAGE_SHIFT_X = -4;
private static final int FORM_AREA_PADDING_LEFT = 13;
private int addableRegionY;
private static Image paraImage = BaseUtils.readImage("/com/fr/design/images/form/parameter.png");
@ -412,10 +413,30 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
if (layoutContainer == null) {
layoutContainer = new XWParameterLayout();
}
refreshAddableRegion(layoutContainer);
layoutContainer.setSize(LARGE_PREFERRED_SIZE);
setRootComponent(layoutContainer);
}
/**
* @param layoutContainer
* @Description: 为了不覆盖以前的组件所以要计算可以添加组件的区域
* @return:
* @Author: Henry.Wang
* @date: 2020/7/15 15:12
*/
public void refreshAddableRegion(XLayoutContainer layoutContainer) {
addableRegionY = 0;
for (int i = 0; i < layoutContainer.getComponentCount(); i++) {
Rectangle rectangle = layoutContainer.getComponent(i).getBounds();
if (addableRegionY < rectangle.y + rectangle.height) {
addableRegionY = rectangle.y + rectangle.height;
}
}
int vGap = V_COMPONENT_GAP - (int) XCreator.SMALL_PREFERRED_SIZE.getHeight();
addableRegionY = Math.max(0, addableRegionY - FIRST_V_LOCATION + (int) (XCreator.SMALL_PREFERRED_SIZE.getHeight() / 2) + vGap);
}
/**
* 是否是报表的参数面板
*
@ -583,14 +604,15 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
label.setWidgetName("Label" + name);
label.setWidgetValue(new WidgetValue(name + ":"));
XCreator xCreator = XCreatorUtils.createXCreator(label);
if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE)
+ FIRST_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) {
int x = H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE) + FIRST_H_LOCATION;
int y = addableRegionY + FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE);
if (!(this.autoAddComponent(xCreator, x, y))) {
return false;
}
EditorHolder editor = new EditorHolder(parameter);
xCreator = XCreatorUtils.createXCreator(editor);
if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE)
+ SECOND_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) {
x = H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE) + SECOND_H_LOCATION;
if (!(this.autoAddComponent(xCreator, x, y))) {
return false;
}
return true;
@ -646,16 +668,17 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
label.setWidgetValue(new WidgetValue(parameterArray[i].getName() + ":"));
XCreator xCreator = XCreatorUtils.createXCreator(label);
if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE)
+ FIRST_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) {
int x = H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE) + FIRST_H_LOCATION;
int y = addableRegionY + FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE);
if (!(this.autoAddComponent(xCreator, x, y))) {
break;
}
// 每行显示5组
EditorHolder editor = new EditorHolder(parameterArray[i]);
editor.setWidgetName(parameterArray[i].getName());
xCreator = XCreatorUtils.createXCreator(editor);
if (!(this.autoAddComponent(xCreator, H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE)
+ SECOND_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP * (currentIndex / NUM_IN_A_LINE)))) {
x = H_COMPONENT_GAP * (currentIndex % NUM_IN_A_LINE) + SECOND_H_LOCATION;
if (!(this.autoAddComponent(xCreator, x, y))) {
break;
}
currentIndex++;

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

@ -2,16 +2,13 @@ package com.fr.design.mainframe;
import com.fr.base.ScreenResolution;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.FormAdaptiveConfigUIProcessor;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -28,8 +25,10 @@ import com.fr.general.FRScreen;
import com.fr.stable.AssistUtils;
import javax.swing.AbstractAction;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.border.LineBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@ -46,13 +45,17 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.MouseEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER;
public class FormArea extends JComponent implements ScrollRulerComponent {
private static final double SLIDER_FLOAT = 400.0;
private static final double SLIDER_MIN = 10.0;
private static final String SCALE_PLUS_COMMAND = "scale_plus";
private static final String SCALE_MINUS_COMMAND = "scale_minus";
public static final double DEFAULT_SLIDER = 100.0;
private static final int ROTATIONS = 50;
private static final int SHOWVALMAX = 400;
@ -72,8 +75,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
private UINumberField heightPane;
private JFormSliderPane slidePane;
private boolean isValid = true;
// 初始时滑块值为100,托动后的值设为START_VALUE;
private double START_VALUE = DEFAULT_SLIDER;
private int resolution = ScreenResolution.getScreenResolution();
private double screenValue;
@ -112,16 +113,33 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
addFormRuler();
}
this.setFocusTraversalKeysEnabled(false);
this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener);
this.addMouseWheelListener(showValSpinnerMouseWheelListener);
registerShortCutKey();
}
private boolean openSliderZoom(){
FormAdaptiveConfigUIProcessor adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING);
if (adaptiveConfigUI != null) {
return adaptiveConfigUI.openFormSliderZoom();
}
return false;
/**
* 注册缩放快捷键
* mac: command + command -
* windows: ctr + ctr -
*/
private void registerShortCutKey() {
this.registerKeyboardAction(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
int old_resolution = slidePane.getShowValue();
slidePane.setShowValue(old_resolution + SHOWVALMIN);
}
}, SCALE_PLUS_COMMAND, KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, DEFAULT_MODIFIER), WHEN_IN_FOCUSED_WINDOW);
this.registerKeyboardAction(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
int old_resolution = slidePane.getShowValue();
slidePane.setShowValue(old_resolution - SHOWVALMIN);
}
}, SCALE_MINUS_COMMAND, KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, DEFAULT_MODIFIER), WHEN_IN_FOCUSED_WINDOW);
}
public void onMobileAttrModified() {
FormMobileAttr formMobileAttr = designer.getTarget().getFormMobileAttr();
if (formMobileAttr.isMobileOnly()) {
@ -138,12 +156,14 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
public void mouseWheelMoved(MouseWheelEvent e) {
if (InputEventBaseOnOS.isControlDown(e)) {
int dir = e.getWheelRotation();
int old_resolution = (int) slidePane.getShowVal().getValue();
slidePane.getShowVal().setValue(old_resolution - (dir * SHOWVALMIN));
int old_resolution = slidePane.getShowValue();
slidePane.setShowValue(old_resolution - (dir * SHOWVALMIN));
}
}
};
/**
* 增加表单的页面大小控制界面包括手动修改和滑块拖动
*/
@ -151,9 +171,9 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {f};
double[] columnSize = {p, f, p, p, p, p, p, p};
double[] columnSize = {p, f, p, p, p, p, p, f, p};
UILabel tipsPane = new UILabel("form");
tipsPane.setPreferredSize(new Dimension(200, 0));
tipsPane.setPreferredSize(new Dimension(375, 0));
widthPane = new UINumberField();
widthPane.setPreferredSize(new Dimension(60, 0));
heightPane = new UINumberField();
@ -167,17 +187,15 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel")),
new UILabel("x"), heightPane,
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel")),
new UILabel(),
slidePane}}, rowSize, columnSize, RESIZE_PANE_GAP);
this.add(FormRulerLayout.BOTTOM, resizePane);
setWidgetsConfig();
boolean needOpenSliderZoom = openSliderZoom();
// 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小
slidePane.setEnabled(needOpenSliderZoom);
slidePane.setVisible(needOpenSliderZoom);
if (needOpenSliderZoom) {
initTransparent();
}
slidePane.setEnabled(true);
slidePane.setVisible(true);
initCalculateSize();
slidePane.addValueChangeListener(showValSpinnerChangeListener);
}
private void setWidgetsConfig() {
@ -192,21 +210,14 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
addHeightPaneListener();
}
private void initTransparent() {
initCalculateSize();
slidePane.getShowVal().addChangeListener(showValSpinnerChangeListener);
}
ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
double value = (int) ((UIBasicSpinner) e.getSource()).getValue();
double value = slidePane.getShowValue();
value = value > SHOWVALMAX ? SHOWVALMAX : value;
value = value < SHOWVALMIN ? SHOWVALMIN : value;
JForm jf = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jf.getFormDesign().setResolution((int) value);
jf.getFormDesign().getArea().resolution = (int) value;
reCalculateRoot(value, true);
scale((int) value);
JTemplate form = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (form != null) {
form.fireTargetModified();
@ -214,6 +225,12 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
}
};
private void scale(int value){
this.designer.setResolution(value);
this.designer.getArea().resolution = value;
reCalculateRoot(value, true);
}
/**
* 返回当前的屏幕分辨率对应的百分比值
*
@ -238,7 +255,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
this.screenValue = FRScreen.getDesignScreenByDimension(scrnsize).getValue();
XLayoutContainer root = FormArea.this.designer.getRootComponent();
// 7.1.1不放缩放滑块,但表单大小仍按屏幕分辨率调整
// slidePane.populateBean(screenValue);
if (root.acceptType(XWFitLayout.class)) {
XWFitLayout layout = (XWFitLayout) root;
if ( !AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) {
@ -246,7 +262,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
} else {
// 组件间隔啊
// REPORT-2585 原有的逻辑导致嵌套的tab中的间隔加不上去,会在后续拖动的过程中出问题
reCalculateDefaultRoot(screenValue, true);
reCalculateDefaultRoot();
}
}
LayoutUtils.layoutContainer(root);
@ -366,16 +382,14 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
* 修改大小后再根据屏幕分辨率调整下
*/
private void doReCalculateRoot(int width, int height, XWFitLayout layout) {
// double value = slidePane.updateBean();
//重置滑块的值为默认值100
START_VALUE = DEFAULT_SLIDER;
if ( AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) {
layout.getParent().setSize(width, height + designer.getParaHeight());
FormArea.this.validate();
} else {
layout.setBackupGap(screenValue / DEFAULT_SLIDER);
reCalculateRoot(screenValue, false);
}
reCalculateRoot(slidePane.getShowValue(), true);
}
/**
@ -385,71 +399,60 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
* @param value
*/
private void reCalculateRoot(double value, boolean needCalculateParaHeight) {
if ( AssistUtils.equals(value, START_VALUE) ) {
return;
}
double percent = (value - START_VALUE) / START_VALUE;
double percent = (value - DEFAULT_SLIDER) / DEFAULT_SLIDER;
double scale = value / DEFAULT_SLIDER;
XLayoutContainer root = FormArea.this.designer.getRootComponent();
if (root.acceptType(XWFitLayout.class)) {
XWFitLayout layout = (XWFitLayout) root;
layout.setContainerPercent(value / DEFAULT_SLIDER);
layout.setContainerPercent(scale);
layout.adjustCompSize(percent);
traverAndAdjust(layout, percent);
layout.adjustCreatorsWhileSlide(percent);
// 拖动滑块,先将内部组件百分比大小计算,再计算容器大小
Dimension d = new Dimension(layout.getWidth(), layout.getHeight());
XWBorderLayout parent = (XWBorderLayout) layout.getParent();
root.setScale(scale);
// 自适应布局的父层是border
if (layout.getParent() != null) {
int paraHeight = designer.getParaHeight();
if (needCalculateParaHeight && paraHeight > 0) {
designer.setParaHeight(paraHeight);
XWBorderLayout parent = (XWBorderLayout) layout.getParent();
parent.toData().setNorthSize(paraHeight);
if (parent != null) {
parent.setScale(scale);
int paraHeight = parent.toData().getNorthSize();
XLayoutContainer paraComponent = designer.getParaComponent();
if (needCalculateParaHeight && paraComponent != null) {
paraComponent.setScale(scale);
this.designer.setParaHeight(paraHeight);
paraComponent.setPreferredSize(new Dimension(d.width, this.designer.getParaHeight()));
paraComponent.adjustCompSize( percent);
parent.removeAll();
parent.add(designer.getParaComponent(), WBorderLayout.NORTH);
parent.add(designer.getRootComponent(), WBorderLayout.CENTER);
parent.add(paraComponent, WBorderLayout.NORTH);
parent.add(root, WBorderLayout.CENTER);
root.setBounds(0, this.designer.getParaHeight(), d.width, d.height);
}
layout.getParent().setSize(d.width, d.height + paraHeight);
parent.setSize(d.width, d.height + this.designer.getParaHeight());
// 调整自适应布局大小后,同步调整参数界面和border大小,此时刷新下formArea
FormArea.this.validate();
LayoutUtils.layoutRootContainer(designer.getRootComponent());
}
START_VALUE = value;
}
}
/**
* 按照界面大小的百分比值调整root大小
*
* @param needCalculateParaHeight 是否需要调整参数界面高度
* @param value
*/
private void reCalculateDefaultRoot(double value, boolean needCalculateParaHeight) {
private void reCalculateDefaultRoot() {
XLayoutContainer root = FormArea.this.designer.getRootComponent();
if (root.acceptType(XWFitLayout.class)) {
XWFitLayout layout = (XWFitLayout) root;
layout.setContainerPercent(1.0);
traverAndAdjust(layout, 0.0);
layout.adjustCreatorsWhileSlide(0.0);
// 拖动滑块,先将内部组件百分比大小计算,再计算容器大小
Dimension d = new Dimension(layout.getWidth(), layout.getHeight());
// 自适应布局的父层是border
if (layout.getParent() != null) {
int paraHeight = designer.getParaHeight();
if (needCalculateParaHeight && paraHeight > 0) {
designer.setParaHeight(paraHeight);
XWBorderLayout parent = (XWBorderLayout) layout.getParent();
parent.toData().setNorthSize(paraHeight);
parent.removeAll();
parent.add(designer.getParaComponent(), WBorderLayout.NORTH);
parent.add(designer.getRootComponent(), WBorderLayout.CENTER);
}
layout.getParent().setSize(d.width, d.height + paraHeight);
// 调整自适应布局大小后,同步调整参数界面和border大小,此时刷新下formArea
FormArea.this.validate();
Dimension dimension = layout.getSize();
double widthScale = 960D / dimension.width;
double heightScale = 960D / dimension.height;
final double scaleValue = Math.min(widthScale, heightScale);
int value = (int) (scaleValue * 100);
slidePane.setShowValue(value);
if (value == 100) {
return;
}
scale(value);
}
}
@ -459,6 +462,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
Object object = creator.getComponent(i);
if (object instanceof XCreator) {
XCreator temp = (XCreator) object;
temp.setScale(1 + percent);
temp.adjustCompSize(percent);
traverAndAdjust(temp, percent);
}
@ -480,17 +484,17 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
* 鼠标滚轮事件
* 由于表单设计界面要求 容器大小大于界面时滚动条才可以拖动所以不支持滚动无限往下滚
*/
@Override
protected void processMouseWheelEvent(java.awt.event.MouseWheelEvent evt) {
int id = evt.getID();
switch (id) {
case MouseEvent.MOUSE_WHEEL: {
onMouseWheelScroll(evt);
break;
}
default:
}
}
// @Override
// protected void processMouseWheelEvent(java.awt.event.MouseWheelEvent evt) {
// int id = evt.getID();
// switch (id) {
// case MouseEvent.MOUSE_WHEEL: {
// onMouseWheelScroll(evt);
// break;
// }
// default:
// }
// }
private void onMouseWheelScroll(MouseWheelEvent evt) {
int value = this.verScrollBar.getValue() + evt.getWheelRotation() * ROTATIONS;
@ -723,9 +727,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
* @return 百分比值
*/
public double getSlideValue() {
// return slidePane.updateBean();
//7.1.1不加缩放滑块
return this.screenValue;
return slidePane.getShowValue();
}
/**
@ -763,7 +765,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
layout.moveContainerMargin();
layout.addCompInterval(layout.getAcualInterval());
} else if (designer.getRootComponent().acceptType(XWFitLayout.class)) {
START_VALUE = DEFAULT_SLIDER;
reCalculateRoot(slide, true);
// slidePane.populateBean(slide);
}
@ -840,7 +841,8 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
DESIGNERWIDTH = DESIGNERWIDTH > maxWidth ? maxWidth : DESIGNERWIDTH;
DESIGNERHEIGHT = DESIGNERHEIGHT > maxHeight ? maxHeight : DESIGNERHEIGHT;
int designerLeft = left + (verScrollBar.getX() - DESIGNERWIDTH) / 2;
rec = new Rectangle(designerLeft, TOPGAP, DESIGNERWIDTH, DESIGNERHEIGHT);
int designerTop = top + (horScrollBar.getY() - DESIGNERHEIGHT) / 2;
rec = new Rectangle(designerLeft, designerTop, DESIGNERWIDTH, DESIGNERHEIGHT);
}
// designer是整个表单设计界面中的面板部分,目前只放自适应布局和参数界面。
designer.setBounds(rec);

2
designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -105,7 +105,7 @@ public class FormCreatorDropTarget extends DropTarget {
SharableEditorProvider sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(shareId);
SharableWidgetProvider bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId);
if (sharableEditor != null && bindInfo != null) {
Map<String, String> tdNameMap = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(), sharableEditor.getTableDataSource());
Map<String, String> tdNameMap = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(), sharableEditor.getTableDataSource(), true);
//合并数据集之后,可能会有数据集名称变化,做一下联动
//共享的组件拿的时候都是克隆的,这边改拖拽中克隆的对象而非新克隆对象,上面这个新克隆的对象只是为了拿数据集
for (Map.Entry<String, String> entry : tdNameMap.entrySet()) {

6
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -493,10 +493,12 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
public void setParaHeight(int height) {
XWBorderLayout container = (XWBorderLayout) getTopContainer();
container.toData().setNorthSize(height);
container.setSize(container.getWidth(), container.getHeight() + height - getParaHeight());
paraHeight = height;
int displayHeight = (int) (height * container.getScale());
container.setSize(container.getWidth(), container.getHeight() + displayHeight - getParaHeight());
paraHeight = displayHeight;
}
/**
* 删除参数界面
*/

9
designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java

@ -15,6 +15,8 @@ import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.log.FineLoggerFactory;
import java.awt.LayoutManager;
@ -232,12 +234,13 @@ public class FormSelection {
int size = selection.size();
if (size == 1) {
XCreator creator = selection.get(0);
if(creator.acceptType(XWCardTagLayout.class)){
creator = (XCreator)selection.get(0).getParent();
if (creator.acceptType(XWCardTagLayout.class)) {
creator = (XCreator) selection.get(0).getParent();
}
creator.setBounds(rec);
if (creator.acceptType(XWParameterLayout.class)) {
designer.setParaHeight((int) rec.getHeight());
double height = rec.getHeight() / creator.getScale();
designer.setParaHeight((int) height);
designer.getArea().doLayout();
}
LayoutUtils.layoutContainer(creator);

17
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java

@ -8,6 +8,7 @@ import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import java.awt.Rectangle;
@ -42,15 +43,13 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().getSelection().backupBounds();
super.update();
Rectangle bounds = new Rectangle(creator.getBounds());
bounds.x = (int) x.getValue();
bounds.y = (int) y.getValue();
Rectangle bounds = new Rectangle((int) x.getValue(), (int) y.getValue(), (int) width.getValue(), (int) height.getValue());
if (parent == null) {
return;
}
WLayout wabs = parent.toData();
wabs.setBounds(creator.toData(), bounds);
creator.setBounds(bounds);
parent.adjustCompSize(parent.getScale() -1);
LayoutUtils.layoutContainer(creator);
XWAbsoluteLayout layout = (XWAbsoluteLayout) parent;
layout.updateBoundsWidget(creator);
@ -59,14 +58,13 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
@Override
public void limitWidth(WLayout wabs, int w, Rectangle bounds, Rectangle rec){
bounds.width = w;
creator.setBounds(bounds);
}
@Override
public void limitHeight(WLayout wabs, int h, Rectangle bounds, Rectangle rec){
bounds.height = h;
creator.setBounds(bounds);
}
@Override
protected String title4PopupWindow() {
return "absoluteBound";
@ -75,7 +73,12 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
@Override
public void populate() {
super.populate();
Rectangle bounds = new Rectangle(creator.getBounds());
WLayout wabs = parent.toData();
CRBoundsWidget boundsWidget = wabs.getBoundsWidget(creator.toData());
if (boundsWidget == null){
return;
}
Rectangle bounds = boundsWidget.getBounds();
x.setValue(bounds.x);
y.setValue(bounds.y);
}

32
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -20,9 +20,8 @@ import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.form.ui.PaddingMargin;
import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import javax.swing.JOptionPane;
import java.awt.Rectangle;
@ -46,8 +45,8 @@ public class WidgetBoundPane extends BasicPane {
}
public XLayoutContainer getParent(XCreator source) {
if(source.acceptType(XWCardTagLayout.class)){
return (XLayoutContainer)source.getParent();
if (source.acceptType(XWCardTagLayout.class)) {
return (XLayoutContainer) source.getParent();
}
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source);
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) {
@ -79,18 +78,24 @@ public class WidgetBoundPane extends BasicPane {
}
public void populate() {
Rectangle bounds = new Rectangle(creator.getBounds());
WLayout wabs = parent.toData();
CRBoundsWidget boundsWidget = wabs.getBoundsWidget(creator.toData());
if (boundsWidget == null){
return;
}
Rectangle bounds = new Rectangle(boundsWidget.getBounds());
width.setValue(bounds.width);
height.setValue(bounds.height);
}
public void fix() {
Rectangle bounds = new Rectangle(creator.getBounds());
WLayout wabs = parent.toData();
CRBoundsWidget boundsWidget = wabs.getBoundsWidget(creator.toData());
Rectangle bounds = new Rectangle(boundsWidget.getBounds());
creator.setBackupBound(creator.getBounds());
int w = (int) width.getValue();
int h = (int) height.getValue();
Rectangle rec = ComponentUtils.getRelativeBounds(parent);
WLayout wabs = parent.toData();
if (bounds.width != w) {
limitWidth(wabs, w, bounds, rec);
}
@ -101,25 +106,27 @@ public class WidgetBoundPane extends BasicPane {
public void adjustComponents(Rectangle bounds, int difference, int row) {
double scale = parent.getScale();
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
Rectangle backupBounds = getBound();
FRFitLayoutAdapter layoutAdapter = (FRFitLayoutAdapter) AdapterBus.searchLayoutAdapter(formDesigner, creator);
if (layoutAdapter != null) {
layoutAdapter.setEdit(true);
layoutAdapter.calculateBounds(backupBounds, bounds, creator, row, difference);
layoutAdapter.calculateBounds(backupBounds, new Rectangle((int) (bounds.x * scale), (int) (bounds.y * scale), (int) (bounds.width * scale), (int) (bounds.height * scale)), creator, row, difference);
}
}
public void limitWidth(WLayout wabs, int w, Rectangle bounds, Rectangle rec) {
int difference = 0;
double scale = parent.getScale();
int minWidth = (int) (MINWIDTH * ((WFitLayout) wabs).getResolutionScaling());
PaddingMargin margin = wabs.getMargin();
if (bounds.width != w) {
if (bounds.width == rec.width - margin.getLeft() - margin.getRight()) {
if ((int) (bounds.width * scale) == rec.width - margin.getLeft() - margin.getRight()) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Bounds"));
width.setValue(bounds.width);
return;
} else if (w < minWidth) {
} else if (w * scale < minWidth) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Min_Width") + Integer.toString(minWidth));
width.setValue(bounds.width);
return;
@ -132,15 +139,16 @@ public class WidgetBoundPane extends BasicPane {
}
public void limitHeight(WLayout wabs, int h, Rectangle bounds, Rectangle rec) {
double scale = parent.getScale();
int difference = 0;
PaddingMargin margin = wabs.getMargin();
int minHeight = (int) (MINHEIGHT * ((WFitLayout) wabs).getResolutionScaling());
if (bounds.height != h) {
if (bounds.height == rec.height - margin.getTop() - margin.getBottom()) {
if ((int) (bounds.height * scale) == rec.height - margin.getTop() - margin.getBottom()) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Bounds"));
height.setValue(bounds.height);
return;
} else if (h < minHeight) {
} else if (h * scale < minHeight) {
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Min_Height") + Integer.toString(minHeight));
height.setValue(bounds.height);
return;

24
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetCardTagBoundPane.java

@ -10,11 +10,9 @@ import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.form.ui.container.WTabDisplayPosition;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.ComparatorUtils;
import javax.swing.JOptionPane;
import java.awt.Rectangle;
/**
@ -39,6 +37,7 @@ public class WidgetCardTagBoundPane extends WidgetBoundPane {
if (parent == null) {
return;
}
double scale = parent.getScale();
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
Rectangle parentBounds = new Rectangle(parent.getBounds());
@ -48,17 +47,17 @@ public class WidgetCardTagBoundPane extends WidgetBoundPane {
XLayoutContainer tabLayout = creator.getTopLayout();
Rectangle rectangle = tabLayout.getBounds();
if(ComparatorUtils.equals(displayPosition, WTabDisplayPosition.TOP_POSITION) || ComparatorUtils.equals(displayPosition, WTabDisplayPosition.BOTTOM_POSITION)){
if(rectangle.height < size){
if(rectangle.height < size* scale){
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds"));
return;
}
parentBounds.height = size;
parentBounds.height = (int) (size * scale);
}else{
if(rectangle.width < size){
if(rectangle.width < size*scale){
FineJOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Beyond_Tablayout_Bounds"));
return;
}
parentBounds.width = size;
parentBounds.width = (int) (size * scale);
}
parent.setBounds(parentBounds);
@ -76,15 +75,8 @@ public class WidgetCardTagBoundPane extends WidgetBoundPane {
@Override
public void populate() {
WCardTagLayout tagLayout = (WCardTagLayout)creator.toData();
Rectangle bounds = new Rectangle(creator.getBounds());
WTabDisplayPosition displayPosition = tagLayout.getDisplayPosition();
if( ComparatorUtils.equals(displayPosition, WTabDisplayPosition.TOP_POSITION) || ComparatorUtils.equals(displayPosition, WTabDisplayPosition.BOTTOM_POSITION)){
cardTagWidth.setValue(bounds.height);
}else{
cardTagWidth.setValue(bounds.width);
}
WCardMainBorderLayout wCardMainBorderLayout = (WCardMainBorderLayout)creator.getTopLayout().toData();
cardTagWidth.setValue(wCardMainBorderLayout.getTitleSize());
}
}

12
designer-realize/src/main/java/com/fr/design/actions/report/ReportWriteAttrAction.java

@ -3,6 +3,7 @@ package com.fr.design.actions.report;
import com.fr.design.actions.ReportComponentAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.DialogActionListener;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.WorkSheetDesigner;
@ -11,10 +12,15 @@ import com.fr.design.webattr.ReportWriteAttrPane;
import com.fr.general.IOUtils;
import com.fr.report.worksheet.WorkSheet;
import java.awt.Dimension;
/**
* ReportWriteAttrAction
*/
public class ReportWriteAttrAction extends ReportComponentAction<WorkSheetDesigner> {
public static final Dimension WINDOW_CUSTOM_SIZE = new Dimension(720, 600);
public ReportWriteAttrAction(WorkSheetDesigner t) {
super(t);
this.setMenuKeySet(KeySetUtils.REPORT_WRITE);
@ -49,7 +55,7 @@ public class ReportWriteAttrAction extends ReportComponentAction<WorkSheetDesign
}
};
BasicDialog dialog = reportWritePane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
DialogActionListener dialogActionListener = new DialogActionAdapter() {
@Override
public void doOk() {
isChange = true;
@ -67,7 +73,9 @@ public class ReportWriteAttrAction extends ReportComponentAction<WorkSheetDesign
public void doCancel() {
isChange = false;
}
});
};
BasicDialog dialog = reportWritePane.showWindowWithCustomSize(DesignerContext.getDesignerFrame(), dialogActionListener, WINDOW_CUSTOM_SIZE);
DesignerContext.setReportWritePane(dialog);
dialog.setVisible(true);

35
designer-realize/src/main/java/com/fr/design/actions/server/StyleListAction.java

@ -17,6 +17,7 @@ import com.fr.transaction.WorkerCallBack;
import com.fr.transaction.WorkerFacade;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
@ -24,6 +25,8 @@ import java.awt.event.ActionEvent;
* StyleList Action
*/
public class StyleListAction extends UpdateAction {
public static final Dimension WINDOW_CUSTOM_SIZE = new Dimension(710, 600);
public StyleListAction() {
this.setMenuKeySet(PREDEFINED_STYLES);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
@ -37,23 +40,23 @@ public class StyleListAction extends UpdateAction {
*
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final StyleManagerPane styleListPane = new StyleManagerPane();
final BasicDialog styleListDialog = styleListPane.showWindow(designerFrame);
styleListDialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
if (!styleListPane.isNamePermitted()) {
styleListDialog.setDoOKSucceed(false);
public void actionPerformed(ActionEvent evt) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final StyleManagerPane styleListPane = new StyleManagerPane();
final BasicDialog styleListDialog = styleListPane.showWindowWithCustomSize(designerFrame, null, WINDOW_CUSTOM_SIZE);
styleListDialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
if (!styleListPane.isNamePermitted()) {
styleListDialog.setDoOKSucceed(false);
}
Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) {
@Override
public void run() {
styleListPane.update(ServerPreferenceConfig.getInstance());
}
}.addCallBack(new CallBackAdaptor(){
@Override
Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) {
@Override
public void run() {
styleListPane.update(ServerPreferenceConfig.getInstance());
}
}.addCallBack(new CallBackAdaptor() {
@Override
public void afterCommit() {
DesignerContext.getDesignerBean("predefinedStyle").refreshBeanElement();
}

2
designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

@ -258,6 +258,7 @@ public class RichTextToolBar extends BasicPane{
boolean isSub = RichTextToolBar.this.subPane.isSelected();
MutableAttributeSet attr = new SimpleAttributeSet();
if (!isSub && RichTextToolBar.this.superPane.isSelected()) {
RichTextToolBar.this.superPane.setSelected(false);
StyleConstants.setSuperscript(attr, false);
}
// 调用setCharacterAttributes函数设置文本区选择文本的字体
@ -273,6 +274,7 @@ public class RichTextToolBar extends BasicPane{
// 调用setCharacterAttributes函数设置文本区选择文本的字体
MutableAttributeSet attr = new SimpleAttributeSet();
if (!isSuper && RichTextToolBar.this.subPane.isSelected()) {
RichTextToolBar.this.subPane.setSelected(false);
StyleConstants.setSubscript(attr, false);
}
StyleConstants.setSuperscript(attr, !isSuper);

4
designer-realize/src/main/java/com/fr/design/condition/HyperlinkPane.java

@ -15,6 +15,7 @@ import com.fr.report.cell.cellattr.highlight.HighlightAction;
import com.fr.report.cell.cellattr.highlight.HyperlinkHighlightAction;
import javax.swing.*;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -30,6 +31,7 @@ public class HyperlinkPane extends ConditionAttrSingleConditionPane<HighlightAct
protected UIButton hyperlinkButton;
protected HyperlinkGroupPane pane;
protected BasicDialog dialog;
private static final Dimension WINDOW_CUSTOM_SIZE = new Dimension(730, 600);
public HyperlinkPane(final ConditionAttributesPane conditionAttributesPane) {
super(conditionAttributesPane);
@ -39,7 +41,7 @@ public class HyperlinkPane extends ConditionAttrSingleConditionPane<HighlightAct
NameJavaScriptGroup nameHyperlinks = jsGroup;
pane = DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPaneNoPop(HyperlinkGroupPaneActionImpl.getInstance());
pane.populate(nameHyperlinks);
dialog = pane.showWindow(SwingUtilities.getWindowAncestor(conditionAttributesPane));
dialog = pane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(conditionAttributesPane), null, WINDOW_CUSTOM_SIZE);
dialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {

6
designer-realize/src/main/java/com/fr/design/condition/WidgetHighlightPane.java

@ -12,10 +12,12 @@ import com.fr.design.widget.WidgetManageCardPane;
import com.fr.design.widget.WidgetPane;
import com.fr.form.ui.*;
import com.fr.form.ui.TextArea;
import com.fr.report.cell.cellattr.highlight.HighlightAction;
import com.fr.report.cell.cellattr.highlight.WidgetHighlightAction;
import javax.swing.*;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -27,6 +29,7 @@ import java.awt.event.ActionListener;
public class WidgetHighlightPane extends ConditionAttrSingleConditionPane<HighlightAction> {
private static final int DIALOG_WIDTH = 700;
private static final int DIALOG_HEIGHT = 400;
private static final Dimension WINDOW_CUSTOM_SIZE = new Dimension(720, 600);
private Widget widget;
private UIComboBox box;
@ -45,8 +48,7 @@ public class WidgetHighlightPane extends ConditionAttrSingleConditionPane<Highli
}
};
widgetPane.populate(widget);
BasicDialog dialog = widgetPane.showWindow(
SwingUtilities.getWindowAncestor(conditionAttributesPane));
BasicDialog dialog = widgetPane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(conditionAttributesPane), null, WINDOW_CUSTOM_SIZE);
dialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
widget = widgetPane.update();

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

Loading…
Cancel
Save