Browse Source

Merging in latest from upstream (DESIGN/design:refs/heads/release/10.0)

* commit '8b5af0141b8e4361f51c53546368ddcebcb51655': (28 commits)
  REPORT-39308 参数输入面板参数名显示不完整
  REPORT-38376 设计器目录树等树控件JDK11下显示不全
  删除多余的setDirty
  甘特图和框架图标签内容增加样式
  通用和自定义中都支持样式
  REPORT-40525 表单进行拖拽组件,来回切换模板,再拖拽,显示很有问题
  更新修改:之前在改REPORT-38534这个bug的时候,看到DesignState里面有个参数面板状态,以为不会干扰判断,刚才测试另一个bug发现参数面板这边,剪切复制按钮也是保持一直可用的,所以要增加一层判断,如果此时是WORK_SHEET状态,还需要判断是编辑报表块还是编辑参数面板,仅当编辑报表块时按钮不能置灰
  完善富文本组件样式
  REPORT-40458 【回归】设计器重启以后会卡住,面板除了菜单栏其他都动不了 【问题原因】editingTemplate没有判空,当时自己测试发现是不会出现null情况的,这个问题是因为安装了一个新引擎插件后,插件那边某个方法可能会在setCurrentEditingTemplate之前,调用checkCombineUp方法,此时getCurrentEditingTemplate会拿到null值,然后出现npe 【改动思路】增加判空
  上传多了,撤销一下
  之前上传多了,撤销一下
  REPORT-40458 【回归】设计器重启以后会卡住,面板除了菜单栏其他都动不了 【问题原因】editingTemplate没有判空,当时自己测试发现是不会出现null情况的,这个问题是因为安装了一个新引擎插件后,插件那边某个方法可能会在setCurrentEditingTemplate之前,调用checkCombineUp方法,此时getCurrentEditingTemplate会拿到null值,然后出现npe 【改动思路】增加判空"
  标签边框增加形状
  REPORT-40458 【回归】设计器重启以后会卡住,面板除了菜单栏其他都动不了 【问题原因】editingTemplate没有判空,当时自己测试发现是不会出现null情况的,这个问题是因为安装了一个新引擎插件后,插件那边某个方法可能会在setCurrentEditingTemplate之前,调用checkCombineUp方法,此时getCurrentEditingTemplate会拿到null值,然后出现npe 【改动思路】增加判空
  REPORT-38762
  CHART-15905 更新修改方案:之前以为初始化了UINumberField之后,不能再改变列数了,刚测试了一下发现可以的,所以修改为添加了一个set方法,可以修改Spinner内的UINumberField的列数
  REPORT-39338 【回归】内置服务器启动进度条会先展示上次的进度再初始化 更新修改方案:不改变弹窗大小,将原本文字标签setPreferredSize注释掉,在FlowLayout布局下,标签大小会自适应,另外测试的时候发现在日语和韩语下文字显示不全,这是个以前就存在的问题,与产品和国际化同学沟通了,精简翻译,这次顺便一起改了 CHART-15905 最新的release插件,打开cpt空白,打开frm的,右侧面板打不开 【问题原因】之前改动的UISpinner,添加了一种传参为double、double、double、int的构造方法,与另一个原有的double、double、double、double冲突了,因为代码内很多地方都是传了四个int值进来,然后被绑定了新添加的那种构造方法 【改动思路】将新添加的构造方法传参修改为double、double、double、double、int,对第四个double值进行判断,如果等于Double.MIN_VALUE,就不做处理,否则正常设置为defaultValue
  REPORT-38376 JDK11下Label界面文字显示异常
  CHART-15704 试管型仪表盘标签面板的初始化时候,需要把所有组件都初始化
  标签增加边框和背景
  ...
feature/big-screen
Hades 4 years ago
parent
commit
54c5dd3978
  1. 21
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java
  2. 11
      designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java
  3. 3
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java
  4. 23
      designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java
  5. 11
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  6. 12
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  7. 10
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  8. 2
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  9. 252
      designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java
  10. 27
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  11. 17
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelDetailPane.java
  12. 20
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelPane.java
  13. 8
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java
  14. 20
      designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java
  15. 74
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPaneWithoutRichText.java
  16. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  17. 14
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPane.java
  18. 12
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java
  19. 58
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java
  20. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/label/GaugeLabelContentPane.java
  21. 75
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java
  22. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java
  23. 11
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java
  24. 57
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java
  25. 106
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java
  26. 48
      designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java
  27. 22
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.css
  28. 1
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
  29. 7
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  30. 89
      designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java
  31. 4
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  32. 59
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  33. 12
      designer-realize/src/main/java/com/fr/design/mainframe/JPolyWorkBook.java
  34. 14
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  35. 43
      designer-realize/src/main/java/com/fr/design/mainframe/PolySheetNameTabPane.java

21
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java

@ -1,21 +1,22 @@
package com.fr.design.data.datapane; package com.fr.design.data.datapane;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.general.NameObject;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.gui.itree.refreshabletree.UserObjectRefreshJTree; import com.fr.design.gui.itree.refreshabletree.UserObjectRefreshJTree;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.*; import java.awt.Color;
import java.awt.Component;
/** /**
* TableData Tree * TableData Tree
@ -31,6 +32,7 @@ public class TableDataTree extends UserObjectRefreshJTree<TableDataSourceOP> {
this.setCellRenderer(tableDataTreeCellRenderer); this.setCellRenderer(tableDataTreeCellRenderer);
this.setEditable(false); this.setEditable(false);
} }
// CellRenderer // CellRenderer
private DefaultTreeCellRenderer tableDataTreeCellRenderer = new DefaultTreeCellRenderer() { private DefaultTreeCellRenderer tableDataTreeCellRenderer = new DefaultTreeCellRenderer() {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -66,14 +68,7 @@ public class TableDataTree extends UserObjectRefreshJTree<TableDataSourceOP> {
this.setIcon(null); this.setIcon(null);
this.setText(PENDING.toString()); this.setText(PENDING.toString());
} }
// 这里新建一个Label作为render是因为JTree在动态刷新的时候,节点上render画布的的宽度不会变,会使得一部分比较长的数据显示为"..." this.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
UILabel label = new UILabel();
label.setText(getText());
label.setIcon(getIcon());
Dimension dim = label.getPreferredSize();
dim.height += 2;
this.setSize(dim);
this.setPreferredSize(dim);
this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND); this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND);
this.setTextSelectionColor(Color.WHITE); this.setTextSelectionColor(Color.WHITE);
this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE);
@ -152,7 +147,7 @@ public class TableDataTree extends UserObjectRefreshJTree<TableDataSourceOP> {
/* /*
* p:获得选中的NameObject = name + tabledata. * p:获得选中的NameObject = name + tabledata.
*/ */
public NameObject getSelectedNameObject() { public NameObject getSelectedNameObject() {
TreePath selectedTreePath = this.getSelectionPath(); TreePath selectedTreePath = this.getSelectionPath();
if (selectedTreePath == null) { if (selectedTreePath == null) {

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

@ -69,7 +69,16 @@ public class TreeTableDataComboBox extends UIComboBox {
} }
} }
} }
/**
* 带参刷新方法
* @param source 数据源数据集
*/
public void refresh(TableDataSource source) {
this.source = source;
refresh();
}
public void setSelectedTableDataByName(String name) { public void setSelectedTableDataByName(String name) {
TableDataWrapper tableDataWrapper; TableDataWrapper tableDataWrapper;
if (res_map.get(name) != null) { if (res_map.get(name) != null) {

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

@ -72,7 +72,8 @@ public class MaxMemRowCountPanel extends UIToolbar {
this.setBackground(UIConstants.NORMAL_BACKGROUND); this.setBackground(UIConstants.NORMAL_BACKGROUND);
switchCache = new UIComboBox(CACHE_LIST); switchCache = new UIComboBox(CACHE_LIST);
switchCache.addActionListener(switchStateL); switchCache.addActionListener(switchStateL);
numberSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 4); numberSpinner = new UISpinner(0, Integer.MAX_VALUE, 1);
numberSpinner.setNumberFieldColumns(4);
} }
private void showAllPanel() { private void showAllPanel() {

23
designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java

@ -26,14 +26,14 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.List; import java.util.List;
import javax.swing.*;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previewable, EditOrNewLabel.Editable { public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previewable, EditOrNewLabel.Editable {
private TreeTableDataComboBox treeTableDataComboBox; private TreeTableDataComboBox treeTableDataComboBox;
@ -61,6 +61,23 @@ public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previe
tdChange(); tdChange();
} }
}); });
// REPORT-38762 加一个展开监听事件,下拉框展开时刷新一下数据集
treeTableDataComboBox.addPopupMenuListener(new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
treeTableDataComboBox.refresh(DesignTableDataManager.getEditingTableDataSource());
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
}
@Override
public void popupMenuCanceled(PopupMenuEvent e) {
}
});
selectTreeDataPanel.add(treeTableDataComboBox); selectTreeDataPanel.add(treeTableDataComboBox);
treeTableDataComboBox.setPreferredSize(new Dimension(200, 25)); treeTableDataComboBox.setPreferredSize(new Dimension(200, 25));
treeTableDataComboBox.setSelectedIndex(-1); treeTableDataComboBox.setSelectedIndex(-1);

11
designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

@ -56,10 +56,6 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
textField.setValue(defaultValue); textField.setValue(defaultValue);
} }
public UISpinner(double minValue, double maxValue, double dierta, int numberFieldColumns) {
this.numberFieldColumns = numberFieldColumns;
init(minValue, maxValue, dierta);
}
private void init(double minValue, double maxValue, double dierta) { private void init(double minValue, double maxValue, double dierta) {
this.minValue = minValue; this.minValue = minValue;
this.maxValue = maxValue; this.maxValue = maxValue;
@ -169,6 +165,13 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
fireStateChanged(); fireStateChanged();
} }
/**
* 设置Spinner内的数字输入框列数
* @param numberFieldColumns 输入框列数
*/
public void setNumberFieldColumns(int numberFieldColumns) {
textField.setColumns(numberFieldColumns);
}
public void setEnabled(boolean flag) { public void setEnabled(boolean flag) {
super.setEnabled(flag); super.setEnabled(flag);

12
designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java

@ -2,7 +2,6 @@ package com.fr.design.gui.itree.filetree;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.gui.itree.refreshabletree.RefreshableJTree; import com.fr.design.gui.itree.refreshabletree.RefreshableJTree;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -14,13 +13,13 @@ import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.BorderFactory;
import javax.swing.JTree; import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -79,14 +78,7 @@ public class EnvFileTree extends RefreshableJTree {
this.setIcon(null); this.setIcon(null);
this.setText(PENDING.toString()); this.setText(PENDING.toString());
} }
// 这里新建一个Label作为render是因为JTree在动态刷新的时候,节点上render画布的的宽度不会变,会使得一部分比较长的数据显示为"..." this.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
UILabel label = new UILabel();
label.setText(getText());
label.setIcon(getIcon());
this.setSize(label.getPreferredSize());
Dimension dim = label.getPreferredSize();
dim.height += 2;
this.setPreferredSize(dim);
this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND); this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND);
this.setTextSelectionColor(Color.WHITE); this.setTextSelectionColor(Color.WHITE);
this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE);

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

@ -746,10 +746,14 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*/ */
public void checkCombineUp(boolean flag, ArrayList<String> al) { public void checkCombineUp(boolean flag, ArrayList<String> al) {
//Yvan: 检查当前是否为WORK_SHEET状态,因为只有WORK_SHEET中含有格式刷组件,此时是不需要进行checkComponentsByNames的 //Yvan: 检查当前是否为WORK_SHEET状态,因为只有WORK_SHEET中含有格式刷组件,此时是不需要进行checkComponentsByNames的
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getMenuState() == DesignState.WORK_SHEET) { JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
return; if (jTemplate != null) {
// 第一个条件满足后还需要添加一重判断,判断是编辑报表块还是参数面板,编辑报表块时则直接return
if (jTemplate.getMenuState() == DesignState.WORK_SHEET && !jTemplate.isUpMode()) {
return;
}
combineUp.checkComponentsByNames(flag, al);
} }
combineUp.checkComponentsByNames(flag, al);
} }
/** /**

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

@ -556,7 +556,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
); );
newNameLabel.setHorizontalAlignment(SwingConstants.RIGHT); newNameLabel.setHorizontalAlignment(SwingConstants.RIGHT);
newNameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); newNameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
newNameLabel.setPreferredSize(new Dimension(118, 15)); //newNameLabel.setPreferredSize(new Dimension(118, 15));
// 重命名输入框 // 重命名输入框
nameField = new UITextField(oldName); nameField = new UITextField(oldName);

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

@ -20,14 +20,18 @@ import com.fr.design.editor.editor.TextEditor;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.Iterator; import java.util.Iterator;
@ -37,31 +41,34 @@ import java.util.Map.Entry;
/** /**
* The dialog used to input parameter. * The dialog used to input parameter.
*
* @editor zhou * @editor zhou
* @since 2012-3-26上午11:09:45 * @since 2012-3-26上午11:09:45
*/ */
public class ParameterInputPane extends BasicPane { public class ParameterInputPane extends BasicPane {
/** /**
* *
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// alex:保存编辑器对应的参数的名字
private java.util.Map<ValueEditorPane, String> editorNameMap; // Map<Editor, Name>
private boolean allowBlank = true;
// alex:保存编辑器对应的参数的名字 private FlowTableLayoutHelper flowTableLayoutHelper;
private java.util.Map<ValueEditorPane,String> editorNameMap; // Map<Editor, Name>
private boolean allowBlank = true; /**
/**
* Constructor. * Constructor.
*/ */
public ParameterInputPane(ParameterProvider[] parameters) { public ParameterInputPane(ParameterProvider[] parameters) {
this.initComponents(parameters); this.initComponents(parameters);
} }
public ParameterInputPane(ParameterProvider[] parameters, boolean allowBlank) { public ParameterInputPane(ParameterProvider[] parameters, boolean allowBlank) {
this.allowBlank = allowBlank; this.allowBlank = allowBlank;
this.initComponents(parameters); this.initComponents(parameters);
} }
private void initComponents(ParameterProvider[] parameters) { private void initComponents(ParameterProvider[] parameters) {
this.setLayout(new BorderLayout(0, 4)); this.setLayout(new BorderLayout(0, 4));
@ -71,24 +78,24 @@ public class ParameterInputPane extends BasicPane {
this.add(new JScrollPane(contentPane), BorderLayout.CENTER); this.add(new JScrollPane(contentPane), BorderLayout.CENTER);
contentPane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameters") + ":")); contentPane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameters") + ":"));
FlowTableLayoutHelper flowTableLayoutHelper = new FlowTableLayoutHelper(); flowTableLayoutHelper = new FlowTableLayoutHelper();
editorNameMap = new java.util.HashMap<ValueEditorPane, String>();
editorNameMap = new java.util.HashMap<ValueEditorPane,String>();
//Parameter list. //Parameter list.
java.util.List<String> nameAddedList = new java.util.ArrayList<String>(); // alex:已经加到界面中去的参数名 java.util.List<String> nameAddedList = new java.util.ArrayList<String>(); // alex:已经加到界面中去的参数名
if (parameters != null && parameters.length > 0) { if (parameters != null && parameters.length > 0) {
for (int i = 0; i < parameters.length; i++) { for (int i = 0; i < parameters.length; i++) {
ParameterProvider parameter = parameters[i]; ParameterProvider parameter = parameters[i];
// alex:已经在界面中的参数,不加了 // alex:已经在界面中的参数,不加了
if (nameAddedList.contains(parameter.getName())) { if (nameAddedList.contains(parameter.getName())) {
continue; continue;
} }
if(parameter instanceof StoreProcedureParameter if (parameter instanceof StoreProcedureParameter
&& ((StoreProcedureParameter) parameter).getSchema() == StoreProcedureConstants.OUT) { && ((StoreProcedureParameter) parameter).getSchema() == StoreProcedureConstants.OUT) {
continue; continue;
} }
final Object pv = parameter.getValue(); final Object pv = parameter.getValue();
Editor[] editors = makeEditorByValue(pv); Editor[] editors = makeEditorByValue(pv);
@ -100,135 +107,140 @@ public class ParameterInputPane extends BasicPane {
editPane.setPreferredSize(new Dimension(180, editPane.getPreferredSize().height)); editPane.setPreferredSize(new Dimension(180, editPane.getPreferredSize().height));
String parameterDisplayName = parameter.getName(); String parameterDisplayName = parameter.getName();
if(StringUtils.isNotBlank(parameter.getName())) { if (StringUtils.isNotBlank(parameter.getName())) {
parameterDisplayName = parameter.getName(); parameterDisplayName = parameter.getName();
} }
contentPane.add(flowTableLayoutHelper.createLabelFlowPane(parameterDisplayName + ":", editPane)); contentPane.add(flowTableLayoutHelper.createLabelFlowPane(parameterDisplayName + ":", editPane));
//add editor to parameter hashtable. //add editor to parameter hashtable.
initTextListener(textF); initTextListener(textF);
this.editorNameMap.put(textF, parameter.getName()); this.editorNameMap.put(textF, parameter.getName());
nameAddedList.add(parameter.getName()); nameAddedList.add(parameter.getName());
} }
} }
}
@Override
public void addNotify() {
super.addNotify();
// windows 高DPI下,使用getPreferredSize必须在添加到容器之后,否则得到的数值不准确,因此先放到这调整大小
flowTableLayoutHelper.adjustLabelWidth(); flowTableLayoutHelper.adjustLabelWidth();
} }
protected void initTextListener(ValueEditorPane textF) { protected void initTextListener(ValueEditorPane textF) {
textF.getCurrentEditor().addChangeListener(new ChangeListener() { textF.getCurrentEditor().addChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(); HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified();
} }
}); });
} }
private Editor[] makeEditorByValue(Object pv) { private Editor[] makeEditorByValue(Object pv) {
Editor[] editors = {null}; Editor[] editors = {null};
if (pv instanceof Integer) { if (pv instanceof Integer) {
editors[0] = new IntegerEditor(); editors[0] = new IntegerEditor();
} else if (pv instanceof Double || pv instanceof Float) { } else if (pv instanceof Double || pv instanceof Float) {
editors[0] = new DoubleEditor(); editors[0] = new DoubleEditor();
} else if (pv instanceof Float) { } else if (pv instanceof Float) {
editors[0] = new FloatEditor(); editors[0] = new FloatEditor();
} else if (pv instanceof Date) { } else if (pv instanceof Date) {
editors[0] = new DateEditor(true, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date")); editors[0] = new DateEditor(true, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date"));
} else if (pv instanceof Boolean) { } else if (pv instanceof Boolean) {
editors[0] = new BooleanEditor(); editors[0] = new BooleanEditor();
} else if (pv instanceof BaseFormula) { } else if (pv instanceof BaseFormula) {
editors = ValueEditorPaneFactory.basicEditors(); editors = ValueEditorPaneFactory.basicEditors();
} else { } else {
editors[0] = new TextEditor(); editors[0] = new TextEditor();
} }
return editors; return editors;
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameters"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameters");
} }
/** /**
* Update * Update
*/ */
public Map<String,Object> update() { public Map<String, Object> update() {
java.util.Map<String,Object> nameValueMap = new java.util.HashMap<String,Object>(); java.util.Map<String, Object> nameValueMap = new java.util.HashMap<String, Object>();
Iterator<Entry<ValueEditorPane, String>> entryIt = this.editorNameMap.entrySet().iterator(); Iterator<Entry<ValueEditorPane, String>> entryIt = this.editorNameMap.entrySet().iterator();
while(entryIt.hasNext()) { while (entryIt.hasNext()) {
java.util.Map.Entry<ValueEditorPane, String> entry = entryIt.next(); java.util.Map.Entry<ValueEditorPane, String> entry = entryIt.next();
ValueEditorPane editor = entry.getKey(); ValueEditorPane editor = entry.getKey();
String parameterName = entry.getValue(); String parameterName = entry.getValue();
Object editorStringValue = editor.update(); Object editorStringValue = editor.update();
nameValueMap.put(parameterName, editorStringValue); nameValueMap.put(parameterName, editorStringValue);
} }
return nameValueMap; return nameValueMap;
}
public void checkValid() throws Exception {
if (!allowBlank) {
boolean valid = true;
String error = "";
Iterator<Entry<ValueEditorPane, String>> entryIt = this.editorNameMap.entrySet().iterator();
while (entryIt.hasNext()) {
java.util.Map.Entry<ValueEditorPane, String> entry = entryIt.next();
ValueEditorPane editor = entry.getKey();
String parameterName = entry.getValue();
Object editorStringValue = editor.update();
if (editorStringValue == null || StringUtils.isEmpty(Utils.objectToString(editorStringValue))) {
valid = false;
error += parameterName + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Not_Null_Des") + "\n";
}
}
if (!valid) {
throw new Exception(error);
}
}
} }
public void checkValid() throws Exception {
if (!allowBlank) {
boolean valid = true;
String error = "";
Iterator<Entry<ValueEditorPane, String>> entryIt = this.editorNameMap.entrySet().iterator();
while (entryIt.hasNext()) {
java.util.Map.Entry<ValueEditorPane, String> entry = entryIt.next();
ValueEditorPane editor = entry.getKey();
String parameterName = entry.getValue();
Object editorStringValue = editor.update();
if (editorStringValue == null || StringUtils.isEmpty(Utils.objectToString(editorStringValue))) {
valid = false;
error += parameterName + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Not_Null_Des") + "\n";
}
}
if (!valid) {
throw new Exception(error);
}
}
}
/** /**
* The class help to flowlayout components * The class help to flowlayout components
*/ */
private static class FlowTableLayoutHelper { private static class FlowTableLayoutHelper {
private List<UILabel> labelList = new ArrayList<UILabel>(); private List<UILabel> labelList = new ArrayList<UILabel>();
public FlowTableLayoutHelper() { public FlowTableLayoutHelper() {
} }
public JPanel createLabelFlowPane(String text, JComponent comp) { public JPanel createLabelFlowPane(String text, JComponent comp) {
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
UILabel textLabel = new UILabel(text); UILabel textLabel = new UILabel(text);
centerPane.add(textLabel); centerPane.add(textLabel);
textLabel.setHorizontalAlignment(SwingConstants.LEFT); textLabel.setHorizontalAlignment(SwingConstants.LEFT);
this.labelList.add(textLabel); this.labelList.add(textLabel);
centerPane.add(comp); centerPane.add(comp);
return centerPane; return centerPane;
} }
public void adjustLabelWidth() { public void adjustLabelWidth() {
int maxWidth = 0; int maxWidth = 0;
for (int i = 0; i < labelList.size(); i++) { for (int i = 0; i < labelList.size(); i++) {
maxWidth = Math.max(maxWidth, labelList.get(i).getPreferredSize().width); maxWidth = Math.max(maxWidth, labelList.get(i).getPreferredSize().width);
} }
for (int i = 0; i < labelList.size(); i++) { for (int i = 0; i < labelList.size(); i++) {
UILabel label = labelList.get(i); UILabel label = labelList.get(i);
Dimension labelDim = new Dimension(maxWidth, label.getPreferredSize().height); Dimension labelDim = new Dimension(maxWidth, label.getPreferredSize().height);
label.setPreferredSize(labelDim); label.setPreferredSize(labelDim);
label.setSize(labelDim); label.setSize(labelDim);
label.setMinimumSize(labelDim); label.setMinimumSize(labelDim);
} }
} }
} }
} }

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

@ -19,10 +19,10 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.CommonCodeUtils; import com.fr.stable.CommonCodeUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.start.ServerStarter; import com.fr.start.ServerStarter;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
import java.awt.Desktop; import java.awt.Desktop;
@ -31,7 +31,6 @@ import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
@ -83,6 +82,7 @@ public class DesignUtils {
/** /**
* 判断设计器端口是否被其他程序占用 * 判断设计器端口是否被其他程序占用
* 尝试去通信无回应就是其他程序占用端口否则需要继续判断是否为设计器进程未关闭 * 尝试去通信无回应就是其他程序占用端口否则需要继续判断是否为设计器进程未关闭
*
* @return * @return
*/ */
public static boolean isPortOccupied() { public static boolean isPortOccupied() {
@ -153,7 +153,7 @@ public class DesignUtils {
return; return;
} }
try (Socket socket = new Socket("localhost", port)) { try (Socket socket = new Socket("localhost", port)) {
clientSend(lines, socket); clientSend(lines, socket);
} catch (Exception ignore) { } catch (Exception ignore) {
} }
@ -189,10 +189,10 @@ public class DesignUtils {
DesignerEnvManager.getEnvManager().setCurrentEnv2Default(); DesignerEnvManager.getEnvManager().setCurrentEnv2Default();
ServerStarter.browserDemoURL(); ServerStarter.browserDemoURL();
} else if ("check".equals(line)) { } else if ("check".equals(line)) {
clientSend(new String[] {"response"}, socket); clientSend(new String[]{"response"}, socket);
} else if ("end".equals(line)) { } else if ("end".equals(line)) {
DesignerExiter.getInstance().execute(); } DesignerExiter.getInstance().execute();
else if (StringUtils.isNotEmpty(line)) { } else if (StringUtils.isNotEmpty(line)) {
File f = new File(line); File f = new File(line);
String path = f.getAbsolutePath(); String path = f.getAbsolutePath();
@ -219,7 +219,7 @@ public class DesignUtils {
} }
public static void responseToClient(Socket socket) { public static void responseToClient(Socket socket) {
try (OutputStream outputStream = socket.getOutputStream()) { try (OutputStream outputStream = socket.getOutputStream()) {
outputStream.write("reponse".getBytes(StandardCharsets.UTF_8)); outputStream.write("reponse".getBytes(StandardCharsets.UTF_8));
outputStream.flush(); outputStream.flush();
@ -285,13 +285,20 @@ public class DesignUtils {
return key.startsWith("TextField.") || key.startsWith("PasswordField."); return key.startsWith("TextField.") || key.startsWith("PasswordField.");
} }
/**
* 获取当前系统语言下设计器用的默认字体
*
* @return 默认字体
*/
private static FRFont getCurrentLocaleFont() { private static FRFont getCurrentLocaleFont() {
FRFont guiFRFont; FRFont guiFRFont;
Locale defaultLocale = Locale.getDefault(); Locale defaultLocale = Locale.getDefault();
// JDK9 之后宋体在计算label中字母的空间上出现问题,暂时先用雅黑兼容,以后再统一字体
if (isDisplaySimSun(defaultLocale)) { if (StableUtils.getMajorJavaVersion() >= 9 && OperatingSystem.isWindows()) {
guiFRFont = getNamedFont("Microsoft YaHei");
} else if (isDisplaySimSun(defaultLocale)) {
guiFRFont = getNamedFont("SimSun"); guiFRFont = getNamedFont("SimSun");
} else { } else {
guiFRFont = getNamedFont("Dialog"); guiFRFont = getNamedFont("Dialog");
} }

17
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelDetailPane.java

@ -0,0 +1,17 @@
package com.fr.van.chart.column;
import com.fr.chart.chartattr.Plot;
import com.fr.plugin.chart.column.VanChartColumnPlot;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.label.VanChartPlotLabelDetailPane;
public class VanChartColumnPlotLabelDetailPane extends VanChartPlotLabelDetailPane {
public VanChartColumnPlotLabelDetailPane(Plot plot, VanChartStylePane parent) {
super(plot, parent);
}
protected boolean hasLabelOrientationPane() {
return !((VanChartColumnPlot) this.getPlot()).isBar();
}
}

20
designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelPane.java

@ -0,0 +1,20 @@
package com.fr.van.chart.column;
import com.fr.chart.chartattr.Plot;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.label.VanChartPlotLabelPane;
import java.awt.BorderLayout;
public class VanChartColumnPlotLabelPane extends VanChartPlotLabelPane {
public VanChartColumnPlotLabelPane(Plot plot, VanChartStylePane parent) {
super(plot, parent);
}
protected void createLabelPane() {
VanChartColumnPlotLabelDetailPane labelDetailPane = new VanChartColumnPlotLabelDetailPane(getPlot(), getParentPane());
setLabelDetailPane(labelDetailPane);
getLabelPane().add(labelDetailPane, BorderLayout.CENTER);
}
}

8
designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java

@ -6,18 +6,19 @@ import com.fr.data.condition.ListCondition;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.LiteConditionPane; import com.fr.design.condition.LiteConditionPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.plugin.chart.base.AttrSeriesStackAndAxis; import com.fr.plugin.chart.base.AttrSeriesStackAndAxis;
import com.fr.van.chart.designer.style.series.VanChartSeriesConditionPane; import com.fr.van.chart.designer.style.series.VanChartSeriesConditionPane;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -46,10 +47,13 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<Condi
//配置界面 //配置界面
JPanel deployPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel deployPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(deployPane);
deployPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Deploy") + ":", null)); deployPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Deploy") + ":", null));
deployPane.add(createDeployPane()); deployPane.add(createDeployPane());
UIScrollPane scrollPane = new UIScrollPane(deployPane);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
this.add(scrollPane);
//条件界面 //条件界面
JPanel conditionPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel conditionPane = FRGUIPaneFactory.createBorderLayout_L_Pane();

20
designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java

@ -7,6 +7,7 @@ import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.style.FormatPane; import com.fr.design.gui.style.FormatPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.area.VanChartAreaPlot; import com.fr.plugin.chart.area.VanChartAreaPlot;
import com.fr.plugin.chart.bubble.VanChartBubblePlot; import com.fr.plugin.chart.bubble.VanChartBubblePlot;
import com.fr.plugin.chart.column.VanChartColumnPlot; import com.fr.plugin.chart.column.VanChartColumnPlot;
@ -23,6 +24,7 @@ import com.fr.plugin.chart.structure.VanChartStructurePlot;
import com.fr.plugin.chart.treemap.VanChartTreeMapPlot; import com.fr.plugin.chart.treemap.VanChartTreeMapPlot;
import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot; import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot;
import com.fr.van.chart.bubble.force.VanChartBubbleRefreshTooltipPane; import com.fr.van.chart.bubble.force.VanChartBubbleRefreshTooltipPane;
import com.fr.van.chart.column.VanChartColumnPlotLabelPane;
import com.fr.van.chart.designer.component.VanChartLabelContentPane; import com.fr.van.chart.designer.component.VanChartLabelContentPane;
import com.fr.van.chart.designer.component.VanChartRefreshTooltipContentPane; import com.fr.van.chart.designer.component.VanChartRefreshTooltipContentPane;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane; import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
@ -76,7 +78,7 @@ import java.util.Set;
*/ */
public class PlotFactory { public class PlotFactory {
private static Set<Class<? extends Plot>> autoAdjustLabelPlots = new HashSet<Class<? extends Plot>>(); private static Set<Class<? extends Plot>> autoAdjustLabelPlots = new HashSet<>();
static { static {
autoAdjustLabelPlots.add(VanChartColumnPlot.class); autoAdjustLabelPlots.add(VanChartColumnPlot.class);
@ -89,12 +91,26 @@ public class PlotFactory {
return autoAdjustLabelPlots.contains(plot.getClass()); return autoAdjustLabelPlots.contains(plot.getClass());
} }
private static Set<Class<? extends Plot>> borderAndBackgroundLabelPlots = new HashSet<>();
static {
borderAndBackgroundLabelPlots.add(PiePlot4VanChart.class);
borderAndBackgroundLabelPlots.add(VanChartColumnPlot.class);
borderAndBackgroundLabelPlots.add(VanChartLinePlot.class);
borderAndBackgroundLabelPlots.add(VanChartAreaPlot.class);
}
public static boolean hasBorderAndBackgroundPlotLabel(Plot plot) {
return borderAndBackgroundLabelPlots.contains(plot.getClass());
}
/** /**
* 标签Map * 标签Map
*/ */
private static Map<Class<? extends Plot>, Class<? extends VanChartPlotLabelPane>> labelMap = new HashMap<Class<? extends Plot>, Class<? extends VanChartPlotLabelPane>>(); private static Map<Class<? extends Plot>, Class<? extends VanChartPlotLabelPane>> labelMap = new HashMap<>();
static { static {
labelMap.put(VanChartColumnPlot.class, VanChartColumnPlotLabelPane.class);
labelMap.put(VanChartGaugePlot.class, VanChartGaugePlotLabelPane.class); labelMap.put(VanChartGaugePlot.class, VanChartGaugePlotLabelPane.class);
labelMap.put(VanChartScatterPlot.class, VanChartScatterPlotLabelPane.class); labelMap.put(VanChartScatterPlot.class, VanChartScatterPlotLabelPane.class);
labelMap.put(VanChartBubblePlot.class, VanChartScatterPlotLabelPane.class); labelMap.put(VanChartBubblePlot.class, VanChartScatterPlotLabelPane.class);

74
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPaneWithoutRichText.java

@ -6,6 +6,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.plugin.chart.base.AttrTooltipContent; import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox; import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
@ -36,9 +37,11 @@ public class VanChartLabelContentPaneWithoutRichText extends BasicBeanPane<AttrT
//监控刷新时,自动数据点提示使用 //监控刷新时,自动数据点提示使用
private ChangedValueFormatPaneWithCheckBox changedValueFormatPane; private ChangedValueFormatPaneWithCheckBox changedValueFormatPane;
private ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane; private ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane;
private UIButtonGroup<Integer> styleButton;
private ChartTextAttrPane textAttrPane;
private JPanel centerPane; private JPanel centerPane;
private JPanel commonPanel; private JPanel commonPanel;
private JPanel stylePanel;
private VanChartHtmlLabelPane htmlLabelPane; private VanChartHtmlLabelPane htmlLabelPane;
private VanChartStylePane parent; private VanChartStylePane parent;
@ -85,7 +88,7 @@ public class VanChartLabelContentPaneWithoutRichText extends BasicBeanPane<AttrT
} }
private JPanel createLabelContentPane() { private JPanel createLabelContentPane() {
content = new UIButtonGroup<Integer>(new String[]{ content = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Common"), Toolkit.i18nText("Fine-Design_Chart_Common"),
Toolkit.i18nText("Fine-Design_Chart_Custom") Toolkit.i18nText("Fine-Design_Chart_Custom")
}); });
@ -99,7 +102,7 @@ public class VanChartLabelContentPaneWithoutRichText extends BasicBeanPane<AttrT
commonPanel = createCommonPanel(); commonPanel = createCommonPanel();
htmlLabelPane = createHtmlLabelPane(); htmlLabelPane = createHtmlLabelPane();
htmlLabelPane.setParent(parent); htmlLabelPane.setParent(parent);
stylePanel = createTextStylePane();
centerPane = new JPanel(new CardLayout()) { centerPane = new JPanel(new CardLayout()) {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
@ -121,10 +124,63 @@ public class VanChartLabelContentPaneWithoutRichText extends BasicBeanPane<AttrT
new Component[]{null, centerPane}, new Component[]{null, centerPane},
}; };
initContentListener(); initContentListener();
JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column); JPanel paramsPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column);
JPanel contentPane = new JPanel(new BorderLayout());
contentPane.add(paramsPanel, BorderLayout.CENTER);
contentPane.add(stylePanel, BorderLayout.SOUTH);
return getLabelContentPane(contentPane); return getLabelContentPane(contentPane);
} }
protected boolean hasTextStylePane() {
return true;
}
private JPanel createTextStylePane() {
styleButton = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Automatic"),
Toolkit.i18nText("Fine-Design_Chart_Custom")
});
textAttrPane = new ChartTextAttrPane() {
protected Component[][] getComponents(JPanel buttonPane) {
return new Component[][]{
new Component[]{null, null},
new Component[]{null, getFontNameComboBox()},
new Component[]{null, buttonPane}
};
}
};
JPanel buttonPane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Widget_Style"), styleButton);
JPanel stylePanel = new JPanel(new BorderLayout());
stylePanel.add(buttonPane, BorderLayout.CENTER);
stylePanel.add(textAttrPane, BorderLayout.SOUTH);
initStyleButtonListener();
return stylePanel;
}
private void initStyleButtonListener() {
styleButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkStylePane();
}
});
}
private void checkStylePane() {
if (hasTextStylePane()) {
stylePanel.setVisible(true);
textAttrPane.setVisible(styleButton.getSelectedIndex() == 1);
} else {
stylePanel.setVisible(false);
}
}
protected String getLabelContentTitle() { protected String getLabelContentTitle() {
return Toolkit.i18nText("Fine-Design_Report_Text"); return Toolkit.i18nText("Fine-Design_Report_Text");
} }
@ -237,7 +293,12 @@ public class VanChartLabelContentPaneWithoutRichText extends BasicBeanPane<AttrT
if (!attrTooltipContent.isCommon()) { if (!attrTooltipContent.isCommon()) {
setDirty(false); setDirty(false);
} }
if (hasTextStylePane()) {
this.styleButton.setSelectedIndex(attrTooltipContent.isCustom() ? 1 : 0);
this.textAttrPane.populate(attrTooltipContent.getTextAttr());
}
checkCardPane(); checkCardPane();
checkStylePane();
} }
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) { protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
@ -265,6 +326,11 @@ public class VanChartLabelContentPaneWithoutRichText extends BasicBeanPane<AttrT
htmlLabelPane.update(attrTooltipContent.getHtmlLabel()); htmlLabelPane.update(attrTooltipContent.getHtmlLabel());
if (hasTextStylePane()) {
attrTooltipContent.setCustom(styleButton.getSelectedIndex() == 1);
attrTooltipContent.setTextAttr(this.textAttrPane.update());
}
return attrTooltipContent; return attrTooltipContent;
} }

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

@ -73,6 +73,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
private JPanel commonPanel; private JPanel commonPanel;
private JPanel editorPanel; private JPanel editorPanel;
private JPanel htmlPanel; private JPanel htmlPanel;
private JPanel stylePanel;
private UIButtonGroup<Integer> styleButton; private UIButtonGroup<Integer> styleButton;
private ChartTextAttrPane textAttrPane; private ChartTextAttrPane textAttrPane;
private VanChartHtmlLabelPane htmlLabelPane; private VanChartHtmlLabelPane htmlLabelPane;
@ -202,6 +203,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
content.add(createButtonPane(), BorderLayout.NORTH); content.add(createButtonPane(), BorderLayout.NORTH);
content.add(centerPanel, BorderLayout.CENTER); content.add(centerPanel, BorderLayout.CENTER);
content.add(stylePanel, BorderLayout.SOUTH);
initContentListener(); initContentListener();
@ -209,9 +211,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
} }
private void initDetailPane() { private void initDetailPane() {
commonPanel = createCommonPanel(); commonPanel = createCommonFormatPanel();
editorPanel = createRichEditorPanel(); editorPanel = createRichEditorPanel();
htmlPanel = createHtmlPane(); htmlPanel = createHtmlPane();
stylePanel = createCommonStylePane();
} }
private void initCenterPane() { private void initCenterPane() {
@ -261,15 +264,6 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column); return TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, column);
} }
private JPanel createCommonPanel() {
JPanel common = new JPanel(new BorderLayout());
common.add(createCommonFormatPanel(), BorderLayout.CENTER);
common.add(createCommonStylePane(), BorderLayout.SOUTH);
return common;
}
protected JPanel createCommonFormatPanel() { protected JPanel createCommonFormatPanel() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
@ -469,6 +463,8 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
} else { } else {
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Common")); cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Common"));
} }
stylePanel.setVisible(content.getSelectedIndex() != 1);
} }
protected void setCustomFormatterText() { protected void setCustomFormatterText() {
@ -608,7 +604,6 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
protected void populateRichText(AttrTooltipRichText tooltipRichText) { protected void populateRichText(AttrTooltipRichText tooltipRichText) {
if (tooltipRichText != null) { if (tooltipRichText != null) {
updateLocalRichText(tooltipRichText.getContent(), tooltipRichText.isAuto()); updateLocalRichText(tooltipRichText.getContent(), tooltipRichText.isAuto());
setDirty(false);
} }
} }

14
designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPane.java

@ -6,6 +6,7 @@ import com.fr.chart.chartglyph.GeneralInfo;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
@ -30,20 +31,18 @@ public class VanChartBorderPane extends BasicPane {
protected void initComponents() { protected void initComponents() {
currentLineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART); currentLineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART);
currentLineColorPane = new ColorSelectBox(100); currentLineColorPane = new ColorSelectBox(100);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] rowSize = {p, p, p, p};
Component[][] components = getUseComponent(); Component[][] components = getUseComponent();
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, getRowSize(), columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER); this.add(panel,BorderLayout.CENTER);
} }
protected Component[][] getUseComponent() { protected Component[][] getUseComponent() {
UILabel lineStyleLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")); UILabel lineStyleLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style"));
UILabel colorLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")); UILabel colorLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Color"));
return new Component[][]{ return new Component[][]{
new Component[]{null,null}, new Component[]{null,null},
@ -52,6 +51,11 @@ public class VanChartBorderPane extends BasicPane {
}; };
} }
protected double[] getRowSize() {
double p = TableLayout.PREFERRED;
return new double[]{p, p, p, p};
}
/** /**
* 标题 * 标题
* @return 标题 * @return 标题

12
designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java

@ -4,10 +4,10 @@ import com.fr.chart.base.AttrBorder;
import com.fr.chart.chartglyph.GeneralInfo; import com.fr.chart.chartglyph.GeneralInfo;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import javax.swing.JSeparator; import javax.swing.JSeparator;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
@ -19,6 +19,10 @@ public class VanChartBorderWithRadiusPane extends VanChartBorderPane {
private static final long serialVersionUID = -3937853702118283803L; private static final long serialVersionUID = -3937853702118283803L;
private UISpinner radius; private UISpinner radius;
public UISpinner getRadius() {
return radius;
}
@Override @Override
protected void initComponents() { protected void initComponents() {
radius = new UISpinner(0,1000,1,0); radius = new UISpinner(0,1000,1,0);
@ -31,11 +35,11 @@ public class VanChartBorderWithRadiusPane extends VanChartBorderPane {
return new Component[][]{ return new Component[][]{
new Component[]{null,null}, new Component[]{null,null},
new Component[]{ new Component[]{
FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style")), FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")),
UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo) UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo)
}, },
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),currentLineColorPane}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")),currentLineColorPane},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius")),radius} new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Radius")),radius}
} ; } ;
} }

58
designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java

@ -0,0 +1,58 @@
package com.fr.van.chart.designer.component.border;
import com.fr.chart.base.AttrBorder;
import com.fr.chart.chartglyph.Marker;
import com.fr.chart.chartglyph.MarkerFactory;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.xcombox.MarkerComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.base.AttrBorderWithShape;
import com.fr.plugin.chart.marker.type.MarkerType;
import java.awt.Component;
public class VanChartBorderWithShapePane extends VanChartBorderWithRadiusPane {
private MarkerComboBox shapePane;
protected void initComponents() {
shapePane = new MarkerComboBox(MarkerFactory.getLabelShapeMarkers());
super.initComponents();
}
protected Component[][] getUseComponent() {
return new Component[][]{
new Component[]{null, null},
new Component[]{FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style")),
UIComponentUtils.wrapWithBorderLayoutPane(currentLineCombo)},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Color")), currentLineColorPane},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Shape")),
UIComponentUtils.wrapWithBorderLayoutPane(shapePane)},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Radius")), getRadius()}
};
}
protected double[] getRowSize() {
double p = TableLayout.PREFERRED;
return new double[]{p, p, p, p, p};
}
public void populate(AttrBorder border) {
super.populate(border);
if (border instanceof AttrBorderWithShape) {
shapePane.setSelectedMarker((Marker.createMarker(((AttrBorderWithShape) border).getShape())));
}
}
public void update(AttrBorder border) {
super.update(border);
if (border instanceof AttrBorderWithShape) {
((AttrBorderWithShape) border).setShape(MarkerType.parse(shapePane.getSelectedMarkder().getMarkerType()));
}
}
}

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

@ -24,4 +24,7 @@ public class GaugeLabelContentPane extends VanChartLabelContentPaneWithoutRichTe
return contentPane; return contentPane;
} }
protected boolean hasTextStylePane() {
return false;
}
} }

75
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java

@ -8,7 +8,6 @@ import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; import com.fr.plugin.chart.attr.plot.VanChartAxisPlot;
@ -18,6 +17,8 @@ import javax.swing.BorderFactory;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
@ -29,8 +30,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
/** /**
* 坐标轴-上方按钮界面 * 坐标轴-上方按钮界面
@ -41,9 +40,12 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
private static final int B_W = 56; private static final int B_W = 56;
private static final int B_H = 21; private static final int B_H = 21;
private static final int COL_COUNT = 3; private static final int COL_COUNT = 3;
private static final int MAX_COUNT = 20;
private UIButton addButton; private UIButton addButton;
private UIPopupMenu popupMenu; private UIPopupMenu popupMenu;
private UIMenuItem itemX;
private UIMenuItem itemY;
private List<ChartAxisButton> indexList_X = new ArrayList<ChartAxisButton>(); private List<ChartAxisButton> indexList_X = new ArrayList<ChartAxisButton>();
private List<ChartAxisButton> indexList_Y = new ArrayList<ChartAxisButton>(); private List<ChartAxisButton> indexList_Y = new ArrayList<ChartAxisButton>();
@ -51,7 +53,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
private VanChartAxisPane parent; private VanChartAxisPane parent;
public VanChartAxisButtonPane(VanChartAxisPane vanChartAxisPane){ public VanChartAxisButtonPane(VanChartAxisPane vanChartAxisPane) {
this.parent = vanChartAxisPane; this.parent = vanChartAxisPane;
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
@ -66,6 +68,20 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 10, 0)); buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 10, 0));
this.add(buttonPane, BorderLayout.CENTER); this.add(buttonPane, BorderLayout.CENTER);
itemX = new UIMenuItem(VanChartAttrHelper.X_AXIS_PREFIX);
itemX.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addXAxis();
}
});
itemY = new UIMenuItem(VanChartAttrHelper.Y_AXIS_PREFIX);
itemY.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addYAxis();
}
});
addButton.addActionListener(addListener); addButton.addActionListener(addListener);
} }
@ -92,12 +108,12 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
pane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); pane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
buttonPane.add(pane); buttonPane.add(pane);
} }
if(pane != null) { if (pane != null) {
pane.add(indexList_Y.get(i)); pane.add(indexList_Y.get(i));
} }
} }
if(popupMenu != null){ if (popupMenu != null) {
popupMenu.setVisible(false); popupMenu.setVisible(false);
} }
@ -114,19 +130,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
indexList_X.clear(); indexList_X.clear();
indexList_Y.clear(); indexList_Y.clear();
List<VanChartAxis> xList = plot.getXAxisList(); List<VanChartAxis> xList = plot.getXAxisList();
for(VanChartAxis axis : xList){ for (VanChartAxis axis : xList) {
ChartAxisButton x = new ChartAxisButton(plot.getXAxisName(axis)); ChartAxisButton x = new ChartAxisButton(plot.getXAxisName(axis));
x.setToolTipText(plot.getXAxisName(axis)); x.setToolTipText(plot.getXAxisName(axis));
indexList_X.add(x); indexList_X.add(x);
} }
List<VanChartAxis> yList = plot.getYAxisList(); List<VanChartAxis> yList = plot.getYAxisList();
for(VanChartAxis axis : yList){ for (VanChartAxis axis : yList) {
ChartAxisButton y = new ChartAxisButton(plot.getYAxisName(axis)); ChartAxisButton y = new ChartAxisButton(plot.getYAxisName(axis));
y.setToolTipText(plot.getYAxisName(axis)); y.setToolTipText(plot.getYAxisName(axis));
indexList_Y.add(y); indexList_Y.add(y);
} }
if(indexList_X.isEmpty()){ if (indexList_X.isEmpty()) {
this.removeAll(); this.removeAll();
} else { } else {
indexList_X.get(0).setSelected(true); indexList_X.get(0).setSelected(true);
@ -143,7 +159,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
return null; return null;
} }
public String getNewChartName(List<ChartAxisButton> existList, String prefix){ public String getNewChartName(List<ChartAxisButton> existList, String prefix) {
int count = existList.size() + 1; int count = existList.size() + 1;
while (true) { while (true) {
String name_test = prefix + count; String name_test = prefix + count;
@ -165,31 +181,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
ActionListener addListener = new ActionListener() { ActionListener addListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if(popupMenu == null){ popupMenu = new UIPopupMenu();
popupMenu = new UIPopupMenu(); if (indexList_X.size() < MAX_COUNT) {
UIMenuItem item_x = new UIMenuItem(VanChartAttrHelper.X_AXIS_PREFIX); popupMenu.add(itemX);
item_x.addActionListener(new ActionListener() { }
@Override if (indexList_Y.size() < MAX_COUNT) {
public void actionPerformed(ActionEvent e) { popupMenu.add(itemY);
addXAxis();
}
});
UIMenuItem item_y = new UIMenuItem(VanChartAttrHelper.Y_AXIS_PREFIX);
item_y.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addYAxis();
}
});
popupMenu.add(item_x);
popupMenu.add(item_y);
} }
popupMenu.setVisible(true); popupMenu.setVisible(true);
GUICoreUtils.showPopupMenu(popupMenu, addButton, addButton.getWidth() - popupMenu.getPreferredSize().width, addButton.getY() - 1 + addButton.getHeight()); GUICoreUtils.showPopupMenu(popupMenu, addButton, addButton.getWidth() - popupMenu.getPreferredSize().width, addButton.getY() - 1 + addButton.getHeight());
} }
}; };
private void addXAxis(){ private void addXAxis() {
String name = getNewChartName(indexList_X, VanChartAttrHelper.X_AXIS_PREFIX); String name = getNewChartName(indexList_X, VanChartAttrHelper.X_AXIS_PREFIX);
ChartAxisButton button = new ChartAxisButton(name); ChartAxisButton button = new ChartAxisButton(name);
@ -199,7 +203,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
layoutPane(); layoutPane();
} }
private void addYAxis(){ private void addYAxis() {
String name = getNewChartName(indexList_Y, VanChartAttrHelper.Y_AXIS_PREFIX); String name = getNewChartName(indexList_Y, VanChartAttrHelper.Y_AXIS_PREFIX);
ChartAxisButton button = new ChartAxisButton(name); ChartAxisButton button = new ChartAxisButton(name);
@ -216,9 +220,10 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
private class AddButton extends UIButton { private class AddButton extends UIButton {
public AddButton(Icon icon){ public AddButton(Icon icon) {
super(icon); super(icon);
} }
/** /**
* 组件是否需要响应添加的观察者事件 * 组件是否需要响应添加的观察者事件
* *
@ -277,19 +282,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
} }
private void noSelected() { private void noSelected() {
for(ChartAxisButton button : indexList_X){ for (ChartAxisButton button : indexList_X) {
button.setSelected(false); button.setSelected(false);
} }
for(ChartAxisButton button : indexList_Y){ for (ChartAxisButton button : indexList_Y) {
button.setSelected(false); button.setSelected(false);
} }
} }
private void checkMoveOn(boolean moveOn) { private void checkMoveOn(boolean moveOn) {
for(ChartAxisButton button : indexList_X){ for (ChartAxisButton button : indexList_X) {
button.isMoveOn = false; button.isMoveOn = false;
} }
for(ChartAxisButton button : indexList_Y){ for (ChartAxisButton button : indexList_Y) {
button.isMoveOn = false; button.isMoveOn = false;
} }

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java

@ -22,7 +22,7 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe
} }
protected double[] getLabelPaneRowSize(Plot plot, double p) { protected double[] getLabelPaneRowSize(Plot plot, double p) {
if (hasLabelAlign(plot)) { if (hasLabelAlignPane()) {
return new double[]{p, p, p, p}; return new double[]{p, p, p, p};
} }

11
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java

@ -114,8 +114,9 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
}; };
} }
protected JPanel getLabelPositionPane(Component[][] comps, double[] row, double[] col) { // 仪表盘标签内无布局tab
return TableLayoutHelper.createTableLayoutPane(comps, row, col); protected JPanel getLabelLayoutPane(JPanel panel, String title) {
return panel;
} }
protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) { protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) {
@ -123,7 +124,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
} }
protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) {
if (hasLabelAlign(plot)) { if (hasLabelAlignPane()) {
return new Component[][]{ return new Component[][]{
new Component[]{getDataLabelContentPane(), null}, new Component[]{getDataLabelContentPane(), null},
@ -222,6 +223,10 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout(); return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout();
} }
protected boolean hasLabelAlignPane() {
return getGaugeStyle() == GaugeStyle.THERMOMETER;
}
public void populate(AttrLabelDetail detail) { public void populate(AttrLabelDetail detail) {
super.populate(detail); super.populate(detail);

57
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java

@ -1,13 +1,15 @@
package com.fr.van.chart.designer.style.label; package com.fr.van.chart.designer.style.label;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.chart.attr.GaugeDetailStyle;
import com.fr.plugin.chart.base.AttrLabel; import com.fr.plugin.chart.base.AttrLabel;
import com.fr.plugin.chart.base.AttrLabelDetail;
import com.fr.plugin.chart.gauge.VanChartGaugePlot; import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.GaugeStyle; import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.design.i18n.Toolkit;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -18,6 +20,9 @@ import java.awt.BorderLayout;
public class VanChartGaugePlotLabelPane extends VanChartPlotLabelPane { public class VanChartGaugePlotLabelPane extends VanChartPlotLabelPane {
private static final long serialVersionUID = -322148616244458359L; private static final long serialVersionUID = -322148616244458359L;
private UIButtonGroup<Integer> orientation;
private JPanel layoutPane;
private VanChartPlotLabelDetailPane gaugeValueLabelPane; private VanChartPlotLabelDetailPane gaugeValueLabelPane;
public VanChartGaugePlotLabelPane(Plot plot, VanChartStylePane parent) { public VanChartGaugePlotLabelPane(Plot plot, VanChartStylePane parent) {
@ -41,23 +46,65 @@ public class VanChartGaugePlotLabelPane extends VanChartPlotLabelPane {
} }
JPanel cateOrPercentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(cateTitle, getLabelDetailPane()); JPanel cateOrPercentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(cateTitle, getLabelDetailPane());
JPanel valuePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(valueTitle, gaugeValueLabelPane); JPanel valuePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(valueTitle, gaugeValueLabelPane);
layoutPane = createGaugeLabelLayoutPane();
getLabelPane().add(cateOrPercentPane, BorderLayout.NORTH); getLabelPane().add(cateOrPercentPane, BorderLayout.NORTH);
getLabelPane().add(valuePane, BorderLayout.SOUTH); getLabelPane().add(valuePane, BorderLayout.CENTER);
getLabelPane().add(layoutPane, BorderLayout.SOUTH);
checkLayoutPaneVisible();
}
private void checkLayoutPaneVisible() {
layoutPane.setVisible(showLayoutPane());
}
private boolean showLayoutPane() {
VanChartGaugePlot plot = (VanChartGaugePlot) this.getPlot();
GaugeDetailStyle gaugeDetailStyle = plot.getGaugeDetailStyle();
return plot.getGaugeStyle() == GaugeStyle.THERMOMETER && gaugeDetailStyle != null && gaugeDetailStyle.isHorizontalLayout();
}
// 试管仪表盘横行布局时,正常标签外增加布局tab,同时控制百分比和值标签的文本方向
private JPanel createGaugeLabelLayoutPane() {
orientation = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"),
Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"),
});
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Text_Orientation"), orientation);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel);
} }
public void populate(AttrLabel attr) { public void populate(AttrLabel attr) {
super.populate(attr); super.populate(attr);
if(gaugeValueLabelPane != null && attr != null){ if(gaugeValueLabelPane != null && attr != null){
gaugeValueLabelPane.populate(attr.getGaugeValueLabelDetail()); AttrLabelDetail labelDetail = attr.getGaugeValueLabelDetail();
gaugeValueLabelPane.populate(labelDetail);
orientation.setSelectedIndex(labelDetail.isHorizontal() ? 0 : 1);
checkLayoutPaneVisible();
} }
} }
public AttrLabel update() { public AttrLabel update() {
AttrLabel attrLabel = super.update(); AttrLabel attrLabel = super.update();
if(gaugeValueLabelPane != null && attrLabel != null){ if(gaugeValueLabelPane != null && attrLabel != null){
gaugeValueLabelPane.update(attrLabel.getGaugeValueLabelDetail()); AttrLabelDetail defaultLabelDetail = attrLabel.getAttrLabelDetail();
AttrLabelDetail valueLabelDetail = attrLabel.getGaugeValueLabelDetail();
gaugeValueLabelPane.update(valueLabelDetail);
boolean horizontal = orientation.getSelectedIndex() == 0;
defaultLabelDetail.setHorizontal(horizontal);
valueLabelDetail.setHorizontal(horizontal);
} }
return attrLabel; return attrLabel;
} }
} }

106
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java

@ -7,12 +7,11 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.attr.plot.VanChartLabelPositionPlot; import com.fr.plugin.chart.attr.plot.VanChartLabelPositionPlot;
import com.fr.plugin.chart.base.AttrLabelDetail; import com.fr.plugin.chart.base.AttrLabelDetail;
@ -20,6 +19,8 @@ import com.fr.plugin.chart.base.AttrTooltipContent;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.van.chart.designer.PlotFactory; import com.fr.van.chart.designer.PlotFactory;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutImagePane;
import com.fr.van.chart.designer.component.border.VanChartBorderWithShapePane;
import com.fr.van.chart.designer.style.VanChartStylePane; import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -28,9 +29,6 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
* Created by Mitisky on 15/12/7. * Created by Mitisky on 15/12/7.
@ -42,9 +40,12 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
private UIButtonGroup<Integer> position; private UIButtonGroup<Integer> position;
private UIButtonGroup<Boolean> autoAdjust; private UIButtonGroup<Boolean> autoAdjust;
private UIButtonGroup<Integer> orientation;
private UIToggleButton tractionLine; private UIToggleButton tractionLine;
private ColorSelectBox backgroundColor; private ColorSelectBox backgroundColor;
private VanChartBorderWithShapePane borderPane;
private VanChartBackgroundWithOutImagePane backgroundPane;
private JPanel tractionLinePane; private JPanel tractionLinePane;
private JPanel positionPane; private JPanel positionPane;
@ -100,15 +101,48 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) {
if(hasLabelPosition(plot)){ if(hasLabelPosition(plot)){
// 仅饼图、柱形图、条形图、折线图、面积图含有边框和背景
if (hasBorderAndBackground(plot)) {
return new Component[][]{
new Component[]{dataLabelContentPane,null},
new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), plot), null},
new Component[]{createLabelBorderPane(), null},
new Component[]{createLabelBackgroundPane(), null}
};
}
return new Component[][]{ return new Component[][]{
new Component[]{dataLabelContentPane,null}, new Component[]{dataLabelContentPane,null},
new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), plot), null} new Component[]{createLabelPositionPane(Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), plot), null}
}; };
} else {
return new Component[][]{
new Component[]{dataLabelContentPane,null}
};
} }
return new Component[][]{
new Component[]{dataLabelContentPane,null}
};
}
private JPanel createLabelBorderPane() {
borderPane = new VanChartBorderWithShapePane();
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Border"), borderPane);
}
private JPanel createLabelBackgroundPane() {
backgroundPane = new VanChartBackgroundWithOutImagePane(){
protected Component[][] getPaneComponents() {
return new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Fill")), typeComboBox},
new Component[]{null, centerPane},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Report_Alpha")), transparent},
};
}
};
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Background"), backgroundPane);
} }
protected double[] getLabelStyleRowSize(double p) { protected double[] getLabelStyleRowSize(double p) {
@ -123,6 +157,10 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
return plot instanceof VanChartLabelPositionPlot; return plot instanceof VanChartLabelPositionPlot;
} }
private boolean hasBorderAndBackground(Plot plot) {
return PlotFactory.hasBorderAndBackgroundPlotLabel(plot);
}
protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) { protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) {
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel);
} }
@ -157,8 +195,11 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
positionPane = new JPanel(); positionPane = new JPanel();
checkPositionPane(title); checkPositionPane(title);
panel.add(positionPane, BorderLayout.CENTER); panel.add(positionPane, BorderLayout.NORTH);
if (hasLabelOrientationPane()) {
panel.add(createLabelOrientationPane(), BorderLayout.CENTER);
}
if (plot.isSupportLeadLine()) { if (plot.isSupportLeadLine()) {
tractionLine = new UIToggleButton(Toolkit.i18nText("Fine-Design_Chart_Show_Guideline")); tractionLine = new UIToggleButton(Toolkit.i18nText("Fine-Design_Chart_Show_Guideline"));
@ -168,7 +209,25 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
} else if (PlotFactory.plotAutoAdjustLabelPosition(plot)) { } else if (PlotFactory.plotAutoAdjustLabelPosition(plot)) {
panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Auto_Adjust"), autoAdjust), BorderLayout.SOUTH); panel.add(TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Auto_Adjust"), autoAdjust), BorderLayout.SOUTH);
} }
return panel;
return getLabelLayoutPane(panel, Toolkit.i18nText("Fine-Design_Form_Attr_Layout"));
}
protected JPanel getLabelLayoutPane(JPanel panel, String title) {
return createTableLayoutPaneWithTitle(title, panel);
}
protected boolean hasLabelOrientationPane() {
return false;
}
private JPanel createLabelOrientationPane() {
orientation = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"),
Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"),
});
return TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Text_Orientation"), orientation);
} }
protected void checkPositionPane(String title) { protected void checkPositionPane(String title) {
@ -205,13 +264,10 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
} }
} }
protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){ protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){
JPanel panel = TableLayoutHelper.createTableLayoutPane(comps,row,col); return TableLayoutHelper.createTableLayoutPane(comps, row, col);
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel);
} }
protected void initPositionListener() { protected void initPositionListener() {
position.addChangeListener(new ChangeListener() { position.addChangeListener(new ChangeListener() {
@Override @Override
@ -267,16 +323,25 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
if(position != null){ if(position != null){
position.setSelectedItem(detail.getPosition()); position.setSelectedItem(detail.getPosition());
} }
if(orientation != null){
orientation.setSelectedIndex(detail.isHorizontal() ? 0 : 1);
}
if(tractionLine != null){ if(tractionLine != null){
tractionLine.setSelected(detail.isShowGuidLine()); tractionLine.setSelected(detail.isShowGuidLine());
} }
if(autoAdjust != null){ if(autoAdjust != null){
autoAdjust.setSelectedIndex(detail.isAutoAdjust() == true ? 0 : 1); autoAdjust.setSelectedIndex(detail.isAutoAdjust() ? 0 : 1);
} }
if(backgroundColor != null){ if(backgroundColor != null){
backgroundColor.setSelectObject(detail.getBackgroundColor()); backgroundColor.setSelectObject(detail.getBackgroundColor());
} }
if(borderPane != null){
borderPane.populate(detail.getBorder());
}
if(backgroundPane != null){
backgroundPane.populate(detail.getBackground());
}
checkAllUse(); checkAllUse();
} }
@ -294,12 +359,21 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
detail.setAutoAdjust(autoAdjust != null && autoAdjust.getSelectedItem()); detail.setAutoAdjust(autoAdjust != null && autoAdjust.getSelectedItem());
if(orientation != null){
detail.setHorizontal(orientation.getSelectedIndex() == 0);
}
if(tractionLine != null){ if(tractionLine != null){
detail.setShowGuidLine(tractionLine.isSelected() && detail.getPosition() == Constants.OUTSIDE); detail.setShowGuidLine(tractionLine.isSelected() && detail.getPosition() == Constants.OUTSIDE);
} }
if(backgroundColor != null){ if(backgroundColor != null){
detail.setBackgroundColor(backgroundColor.getSelectObject()); detail.setBackgroundColor(backgroundColor.getSelectObject());
} }
if(borderPane != null){
borderPane.update(detail.getBorder());
}
if(backgroundPane != null){
backgroundPane.update(detail.getBackground());
}
} }
} }

48
designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java

@ -1,13 +1,13 @@
package com.fr.van.chart.drillmap.designer.data.comp; package com.fr.van.chart.drillmap.designer.data.comp;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper; import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper; import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper; import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JTree; import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeCellRenderer;
@ -15,7 +15,6 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.util.Enumeration; import java.util.Enumeration;
/** /**
@ -23,7 +22,7 @@ import java.util.Enumeration;
*/ */
public class MapDataTree extends JTree { public class MapDataTree extends JTree {
public MapDataTree(TreeNode root){ public MapDataTree(TreeNode root) {
super(); super();
this.setModel(model); this.setModel(model);
model.setRoot(root); model.setRoot(root);
@ -49,54 +48,54 @@ public class MapDataTree extends JTree {
if (children.hasMoreElements()) { if (children.hasMoreElements()) {
DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement(); DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement();
if(GEOJSONTreeHelper.getInstance().isSelectableTreeNode(child)){ if (GEOJSONTreeHelper.isSelectableTreeNode(child)) {
selectTreeNode(child, m_model); selectTreeNode(child, m_model);
}else{ } else {
setFirstChildTreeNode(child, m_model); setFirstChildTreeNode(child, m_model);
} }
} }
} }
private void setFirstChildTreeNode(DefaultMutableTreeNode parent, DefaultTreeModel m_model){ private void setFirstChildTreeNode(DefaultMutableTreeNode parent, DefaultTreeModel m_model) {
Enumeration<TreeNode> children = parent.children(); Enumeration<TreeNode> children = parent.children();
if (children.hasMoreElements()){ if (children.hasMoreElements()) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) children.nextElement(); DefaultMutableTreeNode node = (DefaultMutableTreeNode) children.nextElement();
selectTreeNode(node, m_model); selectTreeNode(node, m_model);
} }
} }
public void changeRootNode(TreeNode node){ public void changeRootNode(TreeNode node) {
DefaultTreeModel m_model = (DefaultTreeModel) this.getModel(); DefaultTreeModel m_model = (DefaultTreeModel) this.getModel();
m_model.setRoot(node); m_model.setRoot(node);
} }
public String getSelectNodeJSONPath() { public String getSelectNodeJSONPath() {
if(this.getLastSelectedPathComponent() == null){ if (this.getLastSelectedPathComponent() == null) {
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
DefaultMutableTreeNode currentSel = (DefaultMutableTreeNode)this.getLastSelectedPathComponent(); DefaultMutableTreeNode currentSel = (DefaultMutableTreeNode) this.getLastSelectedPathComponent();
return CompatibleGEOJSONHelper.getJsonUrlByPathIncludeParam(currentSel.getUserObject().toString()); return CompatibleGEOJSONHelper.getJsonUrlByPathIncludeParam(currentSel.getUserObject().toString());
} }
//根据路径精确查找 //根据路径精确查找
public DefaultMutableTreeNode setSelectNodePath(String jsonUrl) { public DefaultMutableTreeNode setSelectNodePath(String jsonUrl) {
if(StringUtils.isEmpty(jsonUrl) || CompatibleGEOJSONHelper.isDeprecated(jsonUrl)){ if (StringUtils.isEmpty(jsonUrl) || CompatibleGEOJSONHelper.isDeprecated(jsonUrl)) {
return null; return null;
} }
DefaultTreeModel m_model = (DefaultTreeModel) this.getModel(); DefaultTreeModel m_model = (DefaultTreeModel) this.getModel();
DefaultMutableTreeNode root = (DefaultMutableTreeNode) m_model.getRoot(); DefaultMutableTreeNode root = (DefaultMutableTreeNode) m_model.getRoot();
Enumeration<TreeNode> els = root.postorderEnumeration(); Enumeration<TreeNode> els = root.postorderEnumeration();
while(els.hasMoreElements()){ while (els.hasMoreElements()) {
DefaultMutableTreeNode el = (DefaultMutableTreeNode) els.nextElement(); DefaultMutableTreeNode el = (DefaultMutableTreeNode) els.nextElement();
if(el == null || el.getUserObject() == null){ if (el == null || el.getUserObject() == null) {
return null; return null;
} }
String dirPath = el.getUserObject().toString(); String dirPath = el.getUserObject().toString();
String url = CompatibleGEOJSONHelper.getJsonUrlByPathIncludeParam(dirPath); String url = CompatibleGEOJSONHelper.getJsonUrlByPathIncludeParam(dirPath);
//先equals再valid原因:valid 远程下实时去服务器看有没有json文件 //先equals再valid原因:valid 远程下实时去服务器看有没有json文件
if (ComparatorUtils.equals(jsonUrl, url) && GEOJSONTreeHelper.isValidDirPath(dirPath)) { if (ComparatorUtils.equals(jsonUrl, url) && GEOJSONTreeHelper.isValidDirPath(dirPath)) {
selectTreeNode(el, m_model); selectTreeNode(el, m_model);
@ -115,14 +114,7 @@ public class MapDataTree extends JTree {
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) value; DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) value;
String name = getPresentName(treeNode); String name = getPresentName(treeNode);
this.setText(name); this.setText(name);
this.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
UILabel label = new UILabel();
label.setText(getText());
label.setIcon(getIcon());
this.setSize(label.getPreferredSize());
Dimension dim = label.getPreferredSize();
dim.height += 2;
this.setPreferredSize(dim);
this.setBackgroundNonSelectionColor(UIConstants.NORMAL_BACKGROUND); this.setBackgroundNonSelectionColor(UIConstants.NORMAL_BACKGROUND);
this.setForeground(UIConstants.FONT_COLOR); this.setForeground(UIConstants.FONT_COLOR);
this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE);
@ -131,25 +123,25 @@ public class MapDataTree extends JTree {
}; };
protected String getPresentName(DefaultMutableTreeNode treeNode) { protected String getPresentName(DefaultMutableTreeNode treeNode) {
if(treeNode == null || treeNode.getUserObject() == null){ if (treeNode == null || treeNode.getUserObject() == null) {
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
return ChartGEOJSONHelper.getPresentNameWithPath(treeNode.getUserObject().toString()); return ChartGEOJSONHelper.getPresentNameWithPath(treeNode.getUserObject().toString());
} }
//模糊搜索 深度优先. //模糊搜索 深度优先.
public void search(String text){ public void search(String text) {
if(StringUtils.isEmpty(text)){ if (StringUtils.isEmpty(text)) {
return; return;
} }
DefaultTreeModel m_model = (DefaultTreeModel) this.getModel(); DefaultTreeModel m_model = (DefaultTreeModel) this.getModel();
DefaultMutableTreeNode root = (DefaultMutableTreeNode) m_model.getRoot(); DefaultMutableTreeNode root = (DefaultMutableTreeNode) m_model.getRoot();
Enumeration<TreeNode> els = root.postorderEnumeration(); Enumeration<TreeNode> els = root.postorderEnumeration();
while(els.hasMoreElements()){ while (els.hasMoreElements()) {
DefaultMutableTreeNode el = (DefaultMutableTreeNode) els.nextElement(); DefaultMutableTreeNode el = (DefaultMutableTreeNode) els.nextElement();
String path = el.getUserObject().toString(); String path = el.getUserObject().toString();
String fileName = ChartGEOJSONHelper.getPresentNameWithPath(path); String fileName = ChartGEOJSONHelper.getPresentNameWithPath(path);
if (StringUtils.contains(fileName, text) && GEOJSONTreeHelper.isValidDirPath(path)) { if (StringUtils.contains(fileName, text) && GEOJSONTreeHelper.isValidDirPath(path)) {
selectTreeNode(el, m_model); selectTreeNode(el, m_model);
@ -158,7 +150,7 @@ public class MapDataTree extends JTree {
} }
} }
public void selectTreeNode(DefaultMutableTreeNode node, DefaultTreeModel m_model){ public void selectTreeNode(DefaultMutableTreeNode node, DefaultTreeModel m_model) {
TreeNode[] nodes = m_model.getPathToRoot(node); TreeNode[] nodes = m_model.getPathToRoot(node);
TreePath treePath = new TreePath(nodes); TreePath treePath = new TreePath(nodes);
setSelectionPath(treePath); setSelectionPath(treePath);

22
designer-chart/src/main/resources/com/fr/design/editor/rich_editor.css

@ -0,0 +1,22 @@
.editor-insert-param-inactivated-font .b-font {
*zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#xe6ea;');
}
.editor-insert-param-inactivated-font .b-font:before {
content: "\e6ea";
color: inherit;
}
.editor-insert-param-inactivated-font.disabled .b-font:before {
content: "\e6ea";
color: inherit;
}
.editor-insert-param-active-font .b-font {
*zoom: expression( this.runtimeStyle['zoom'] = '1',this.innerHTML = '&#xe6ea;');
}
.editor-insert-param-active-font .b-font:before {
content: "\e6ea";
color: #23beef;
}
.editor-insert-param-active-font.disabled .b-font:before {
content: "\e6ea";
color: #23beef;
}

1
designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html

@ -4,6 +4,7 @@
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title></title> <title></title>
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css"/> <link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css"/>
<link rel="stylesheet" type="text/css" href="./rich_editor.css"/>
<script src="http://fanruan.design/fineui/2.0/fineui.js"></script> <script src="http://fanruan.design/fineui/2.0/fineui.js"></script>
<script src="https://fanruan.design/fineui/materials.bundle.min.js"></script> <script src="https://fanruan.design/fineui/materials.bundle.min.js"></script>
</head> </head>

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

@ -345,17 +345,16 @@ public class XCreatorUtils {
} }
/** /**
* 获取组件的最顶层XMainBorderLayout,没有则返回null * 获取组件的上一层的XMainBorderLayout,没有则返回null
* */ * */
@Nullable @Nullable
public static XWCardMainBorderLayout getTopXMainBorderLayout(Container creator) { public static XWCardMainBorderLayout getTopXMainBorderLayout(Container creator) {
XWCardMainBorderLayout result = null;
while (creator != null) { while (creator != null) {
if (creator instanceof XWCardMainBorderLayout) { if (creator instanceof XWCardMainBorderLayout) {
result = (XWCardMainBorderLayout) creator; return (XWCardMainBorderLayout) creator;
} }
creator = creator.getParent(); creator = creator.getParent();
} }
return result; return null;
} }
} }

89
designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java

@ -3,60 +3,53 @@ package com.fr.design.designer.treeview;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.gui.ilable.UILabel;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JTree; import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeCellRenderer;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
public class ComponentTreeCellRenderer extends DefaultTreeCellRenderer { public class ComponentTreeCellRenderer extends DefaultTreeCellRenderer {
public ComponentTreeCellRenderer() { public ComponentTreeCellRenderer() {
} }
@Override @Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
boolean leaf, int row, boolean hasFocus) { boolean leaf, int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
if (value instanceof XCreator) { if (value instanceof XCreator) {
String name = ((XCreator) value).toData().getWidgetName(); String name = ((XCreator) value).toData().getWidgetName();
setText(name); setText(name);
Icon icon = null; Icon icon = null;
try { try {
icon = XCreatorUtils.getCreatorIcon((XCreator) value); icon = XCreatorUtils.getCreatorIcon((XCreator) value);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().info("{} has not icon or has been deleted", name); FineLoggerFactory.getLogger().info("{} has not icon or has been deleted", name);
} }
if (icon != null) { if (icon != null) {
setIcon(icon); setIcon(icon);
} }
} }
UILabel label = new UILabel(); this.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
label.setText(getText()); this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND);
label.setIcon(getIcon()); return this;
Dimension dim = label.getPreferredSize(); }
dim.height += 2;
this.setSize(dim); @Override
this.setPreferredSize(dim); public Icon getClosedIcon() {
this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND); return getIcon();
return this; }
}
@Override
@Override public Icon getLeafIcon() {
public Icon getClosedIcon() { return getIcon();
return getIcon(); }
}
@Override
@Override public Icon getOpenIcon() {
public Icon getLeafIcon() { return getIcon();
return getIcon(); }
} }
@Override
public Icon getOpenIcon() {
return getIcon();
}
}

4
designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

@ -177,8 +177,8 @@ public class EditingMouseListener extends MouseInputAdapter {
if (designer.isDrawLineMode()) { if (designer.isDrawLineMode()) {
designer.updateDrawLineMode(e); designer.updateDrawLineMode(e);
} else { } else {
int relativeX = Math.max(0, designer.getRelativeX(e.getX())); int relativeX = Math.max(0, e.getX());
int relativeY = Math.max(0, designer.getRelativeY(e.getY())); int relativeY = Math.max(0, e.getY());
if (selectionModel.hasSelectionComponent() if (selectionModel.hasSelectionComponent()
&& selectionModel.getSelection().getRelativeBounds().contains( && selectionModel.getSelection().getRelativeBounds().contains(

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

@ -842,26 +842,61 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
if (shouldContinue) { if (shouldContinue) {
continue; continue;
} }
//如果组件为XWCardMainBorderLayout的子组件,直接从XWCardMainBorderLayout中去找 //获取当前组件父组件相对于rootComponent或者paraComponent的距离
XWCardMainBorderLayout borderLayout = XCreatorUtils.getTopXMainBorderLayout(creator); int relativeParentX = getRelativeParentX(creator.getParent());
if (borderLayout != null) { int relativeParentY = getRelativeParentY(creator.getParent());
return xCreatorAt(x, y, borderLayout, null);
//如果不是布局容器,直接进行对比
if (!(creator instanceof XLayoutContainer)) {
int newX = x - relativeParentX - creator.getX();
int newY = y - relativeParentY - creator.getY();
Rectangle rect = ComponentUtils.computeVisibleRect(creator);
// 判断是否处于交叉区域
if (isIntersectArea(newX, newY, rect)) {
return creator;
}
} }
//如果是布局容器,从布局容器向下找
if (creator instanceof XLayoutContainer) { if (creator instanceof XLayoutContainer) {
return xCreatorAt(x, y, creator, null); XCreator result = xCreatorAt(x - relativeParentX, y - relativeParentY, creator, null);
if (result != null) {
return result;
}
} }
x -= creator.getX();
y -= creator.getY(); //最后,如果组件为Tab容器中的子组件,再从Tab容器中去找
Rectangle rect = ComponentUtils.computeVisibleRect(creator); XWCardMainBorderLayout borderLayout = XCreatorUtils.getTopXMainBorderLayout(creator);
// 判断是否处于交叉区域 if (borderLayout != null) {
if (!isIntersectArea(x, y, rect)) { relativeParentX = getRelativeParentX(borderLayout.getParent());
continue; relativeParentY = getRelativeParentY(borderLayout.getParent());
return xCreatorAt(x - relativeParentX, y - relativeParentY, borderLayout, null);
} }
return creator;
} }
return null; return null;
} }
/**
* 获取当前组件相对于rootComponent或者paraComponent的横向距离
*/
private int getRelativeParentX(Container container) {
return returnZero(container) ? 0 : container.getX() + getRelativeParentX(container.getParent());
}
/**
* 获取当前组件相对于rootComponent或者paraComponent的纵向距离
*/
private int getRelativeParentY(Container container) {
return returnZero(container) ? 0 : container.getY() + getRelativeParentY(container.getParent());
}
private boolean returnZero(Container container) {
return !(container instanceof XLayoutContainer)
|| container == rootComponent
|| (paraComponent != null && container == paraComponent);
}
/** /**
* 刷新顶层组件 * 刷新顶层组件
* */ * */

12
designer-realize/src/main/java/com/fr/design/mainframe/JPolyWorkBook.java

@ -1,6 +1,4 @@
/**
*
*/
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.design.mainframe.template.info.JPolyWorkBookProcessInfo; import com.fr.design.mainframe.template.info.JPolyWorkBookProcessInfo;
@ -13,7 +11,6 @@ import com.fr.report.poly.PolyWorkSheet;
* 聚合报表Book, 跟WorkBook区别在于不能放入WorkSheet. * 聚合报表Book, 跟WorkBook区别在于不能放入WorkSheet.
* *
* @author neil * @author neil
*
* @date: 2015-2-5-上午8:58:39 * @date: 2015-2-5-上午8:58:39
*/ */
public class JPolyWorkBook extends JWorkBook { public class JPolyWorkBook extends JWorkBook {
@ -32,15 +29,12 @@ public class JPolyWorkBook extends JWorkBook {
* 创建sheet名称tab面板 * 创建sheet名称tab面板
* *
* @param reportCompositeX 当前组件对象 * @param reportCompositeX 当前组件对象
*
* @return sheet名称tab面板 * @return sheet名称tab面板
*
* @date 2015-2-5-上午11:42:12 * @date 2015-2-5-上午11:42:12
*
*/ */
@Override @Override
public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite reportCompositeX){ public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite reportCompositeX) {
return new PolySheetNameTabPane(reportCompositeX); return new SheetNameTabPane(reportCompositeX);
} }
@Override @Override

14
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -208,13 +208,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
} }
}; };
reportComposite.addTargetModifiedListener(new TargetModifiedListener() { reportComposite.addTargetModifiedListener(e -> JWorkBook.this.fireTargetModified());
@Override
public void targetModified(TargetModifiedEvent e) {
JWorkBook.this.fireTargetModified();
}
});
reportComposite.setParentContainer(centerPane); reportComposite.setParentContainer(centerPane);
return centerPane; return centerPane;
@ -241,11 +235,11 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/** /**
* 判断sheet权限 * 判断sheet权限
* *
* @param rolsName 角色 * @param rolesName 角色
*/ */
@Override @Override
public void judgeSheetAuthority(String rolsName) { public void judgeSheetAuthority(String rolesName) {
boolean isCovered = reportComposite.getEditingTemplateReport().getWorkSheetPrivilegeControl().checkInvisible(rolsName); boolean isCovered = reportComposite.getEditingTemplateReport().getWorkSheetPrivilegeControl().checkInvisible(rolesName);
centerPane.setSheeetCovered(isCovered); centerPane.setSheeetCovered(isCovered);
centerPane.refreshContainer(); centerPane.refreshContainer();
} }

43
designer-realize/src/main/java/com/fr/design/mainframe/PolySheetNameTabPane.java

@ -1,35 +1,38 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.Graphics2D;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import java.awt.Graphics2D;
/** /**
* 获取 * 获取
* *
* @date 2015-2-5-上午10:19:17 * @date 2015-2-5-上午10:19:17
* * @deprecated 让聚合报表也可以新建普通报表sheet, 逻辑和普通报表保持一致, 弃用此个性化设置
*/ */
public class PolySheetNameTabPane extends SheetNameTabPane{ @Deprecated
public class PolySheetNameTabPane extends SheetNameTabPane {
/**
* 构造函数 /**
*/ * 构造函数
public PolySheetNameTabPane(ReportComponentComposite reportCompositeX) { */
super(reportCompositeX); public PolySheetNameTabPane(ReportComponentComposite reportCompositeX) {
} super(reportCompositeX);
}
protected void paintAddButton(Graphics2D g2d){
ADD_POLY_SHEET.paintIcon(this, g2d, iconLocation, 3); protected void paintAddButton(Graphics2D g2d) {
ADD_POLY_SHEET.paintIcon(this, g2d, iconLocation, 3);
} }
protected void firstInsertActionPerformed(){ protected void firstInsertActionPerformed() {
new PolyReportInsertAction().actionPerformed(null); new PolyReportInsertAction().actionPerformed(null);
} }
protected void addInsertGridShortCut(MenuDef def){ protected void addInsertGridShortCut(MenuDef def) {
} }
} }
Loading…
Cancel
Save