Browse Source

Merge pull request #2424 in DESIGN/design from bugfix/10.0 to feature/10.0

* commit '1a7a439b1bed9d69d56c9d97eb750670fff48b65': (33 commits)
  REPORT-40147 表单双击tab标签会出现不应该有的设置
  CHART-15947 修改富文本编辑器参数显示
  REPORT-38537 部分面板显示不全
  修复一下ToolKit的导包问题和HistoryTemplateListPane的过时方法问题
  代码修改
  提到final
  REPORT-38618 【回归】表单-下方缩放缩小之后,拖入tab块,查看右侧边框线消失
  REPORT-40459 【回归】右侧属性面板富文本编辑按钮变短 【问题原因】实际上不是编辑按钮变短了,而是上面的两个Label变短了,在使用TableLayout.FILL的情况下,后面跟着的输入框还有UICombox变长了,而编辑按钮前面的占位空白Label是写死size的,没有保持一致,所以空白Label不变的情况下,编辑按钮显得短了 【改动方案】将占位Label的宽度修改为与前面自动计算宽度的两个Label一致,这样后面跟的东西宽度就都是一致的
  MOBILE-29490 【H5】10.4.80升级到10.4.90后,模板中有些内容显示不全
  MOBILE-29490 【H5】10.4.80升级到10.4.90后,模板中有些内容显示不全
  REPORT-39308 参数输入面板参数名显示不完整
  REPORT-38376 设计器目录树等树控件JDK11下显示不全
  删除多余的setDirty
  甘特图和框架图标签内容增加样式
  通用和自定义中都支持样式
  REPORT-40525 表单进行拖拽组件,来回切换模板,再拖拽,显示很有问题
  更新修改:之前在改REPORT-38534这个bug的时候,看到DesignState里面有个参数面板状态,以为不会干扰判断,刚才测试另一个bug发现参数面板这边,剪切复制按钮也是保持一直可用的,所以要增加一层判断,如果此时是WORK_SHEET状态,还需要判断是编辑报表块还是编辑参数面板,仅当编辑报表块时按钮不能置灰
  完善富文本组件样式
  REPORT-40458 【回归】设计器重启以后会卡住,面板除了菜单栏其他都动不了 【问题原因】editingTemplate没有判空,当时自己测试发现是不会出现null情况的,这个问题是因为安装了一个新引擎插件后,插件那边某个方法可能会在setCurrentEditingTemplate之前,调用checkCombineUp方法,此时getCurrentEditingTemplate会拿到null值,然后出现npe 【改动思路】增加判空
  上传多了,撤销一下
  ...
research/11.0
superman 4 years ago
parent
commit
d78d295b51
  1. 2
      designer-base/src/main/java/com/fr/design/constants/UIConstants.java
  2. 21
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java
  3. 11
      designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java
  4. 3
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java
  5. 23
      designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java
  6. 11
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  7. 12
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  8. 10
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  9. 2
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  10. 252
      designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java
  11. 27
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  12. 17
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelDetailPane.java
  13. 20
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelPane.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. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java
  22. 11
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java
  23. 57
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java
  24. 106
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java
  25. 48
      designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java
  26. 22
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.css
  27. 1
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
  28. 14
      designer-chart/src/main/resources/com/fr/design/editor/script/editor.js
  29. 2
      designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.model.js
  30. 3
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  31. 89
      designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java
  32. 21
      designer-form/src/main/java/com/fr/design/form/util/FormDesignerUtils.java
  33. 4
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  34. 19
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
  35. 14
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java
  36. 12
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java
  37. 19
      designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java

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

@ -37,7 +37,7 @@ public interface UIConstants {
public static final Image APPFIT_H3 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/H3.png"); public static final Image APPFIT_H3 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/H3.png");
public static final Image APPFIT_H4 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/H4.png"); public static final Image APPFIT_H4 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/H4.png");
public static final Border CELL_ATTR_ZEROBORDER = BorderFactory.createEmptyBorder(0, 0, 0, 0); public static final Border CELL_ATTR_ZEROBORDER = BorderFactory.createEmptyBorder(0, 1, 0, 0);
public static final Border CELL_ATTR_EMPTYBORDER = BorderFactory.createEmptyBorder(0, 10, 0, 0); public static final Border CELL_ATTR_EMPTYBORDER = BorderFactory.createEmptyBorder(0, 10, 0, 0);
public static final Border CELL_ATTR_PRESENTBORDER = BorderFactory.createEmptyBorder(0, 5, 0, 0); public static final Border CELL_ATTR_PRESENTBORDER = BorderFactory.createEmptyBorder(0, 5, 0, 0);
public static final Border CELL_ATTR_NORMALBORDER = BorderFactory.createEmptyBorder(0, 10, 0, 15); public static final Border CELL_ATTR_NORMALBORDER = BorderFactory.createEmptyBorder(0, 10, 0, 15);

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

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

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>

14
designer-chart/src/main/resources/com/fr/design/editor/script/editor.js

@ -107,6 +107,16 @@
_cleanHtml: function (value) { _cleanHtml: function (value) {
var editorService = BI.Services.getService("bi.service.design.chart.common.editor"); var editorService = BI.Services.getService("bi.service.design.chart.common.editor");
var dimensionIds = this.options.dimensionIds;
var dataIdMap = {};
for (var i = 0, len = dimensionIds.length; i < len; i++) {
var dimensionId = dimensionIds[i];
var key = BI.keys(dimensionId)[0];
dataIdMap[key] = dimensionId[key];
}
var result = BI.replaceAll(value, "<p></p>", ""); var result = BI.replaceAll(value, "<p></p>", "");
// 去掉image的src属性,因为数据太大了 // 去掉image的src属性,因为数据太大了
result = value.replaceAll("<img.*?>", function (imageStr) { result = value.replaceAll("<img.*?>", function (imageStr) {
@ -117,6 +127,10 @@
return; return;
} }
str += " " + key + "=\"" + value + "\""; str += " " + key + "=\"" + value + "\"";
if (key === "alt" && dataIdMap[value]) {
str += " " + "data-id" + "=\"" + dataIdMap[value] + "\"";
}
}); });
return str + " />"; return str + " />";

2
designer-chart/src/main/resources/com/fr/design/editor/script/insertcombo/combo.insert_param.model.js

@ -21,7 +21,7 @@
return { return {
type: "bi.design.chart.common.editor.search", type: "bi.design.chart.common.editor.search",
text: key, text: key,
value: dId[key] value: key
}; };
}); });
} }

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

@ -15,6 +15,7 @@ import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.cardlayout.XCardSwitchButton;
import com.fr.design.designer.creator.cardlayout.XWCardLayout; import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
@ -111,7 +112,7 @@ public class SelectionModel {
if (comp != designer.getRootComponent() && comp != designer.getParaComponent()) { if (comp != designer.getRootComponent() && comp != designer.getParaComponent()) {
XCreator parentContainer = (XCreator) comp.getParent(); XCreator parentContainer = (XCreator) comp.getParent();
if (parentContainer != null) { if (parentContainer != null) {
comp = parentContainer.isDedicateContainer() ? parentContainer : comp; comp = parentContainer.isDedicateContainer() || comp instanceof XCardSwitchButton ? parentContainer : comp;
} }
} }
if (selection.removeSelectedCreator(comp) || selection.addSelectedCreator(comp)) { if (selection.removeSelectedCreator(comp) || selection.addSelectedCreator(comp)) {

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

21
designer-form/src/main/java/com/fr/design/form/util/FormDesignerUtils.java

@ -1,5 +1,8 @@
package com.fr.design.form.util; package com.fr.design.form.util;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
@ -8,6 +11,7 @@ import com.fr.design.mainframe.template.info.ComponentCreateOperate;
import com.fr.design.mainframe.template.info.ComponentDeleteOperate; import com.fr.design.mainframe.template.info.ComponentDeleteOperate;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import java.awt.Container;
public class FormDesignerUtils { public class FormDesignerUtils {
@ -46,4 +50,21 @@ public class FormDesignerUtils {
jTemplate.getProcessInfo().updateTemplateOperationInfo(new ComponentDeleteOperate(widget)); jTemplate.getProcessInfo().updateTemplateOperationInfo(new ComponentDeleteOperate(widget));
} }
/**
* 判断当前UI组件是否在绝对画布块中
*
* @param xCreator
* @return
*/
public static boolean isInAbsoluteLayout(XCreator xCreator) {
Container parent = xCreator.getParent();
while (parent != null) {
if (parent instanceof XWAbsoluteLayout && !(parent instanceof XWAbsoluteBodyLayout)) {
return true;
}
parent = parent.getParent();
}
return false;
}
} }

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(

19
designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java

@ -22,10 +22,12 @@ import com.fr.form.main.parameter.FormParameterUI;
import com.fr.page.WatermarkPainter; import com.fr.page.WatermarkPainter;
import com.fr.report.core.ReportUtils; import com.fr.report.core.ReportUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
@ -41,6 +43,8 @@ import java.util.ArrayList;
*/ */
public class FormDesignerUI extends ComponentUI { public class FormDesignerUI extends ComponentUI {
private static final Color DESIGNER_BORDER_COLOR = new Color(198, 198, 198);
// 当前的设计器 // 当前的设计器
private FormDesigner designer; private FormDesigner designer;
private SelectionModel selectionModel; private SelectionModel selectionModel;
@ -90,7 +94,7 @@ public class FormDesignerUI extends ComponentUI {
designer.getDrawLineHelper().drawAuxiliaryLine(g); designer.getDrawLineHelper().drawAuxiliaryLine(g);
return; return;
} }
paintBorder(g);
paintSelection(g); paintSelection(g);
if (DesignerMode.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
@ -275,6 +279,19 @@ public class FormDesignerUI extends ComponentUI {
clipg.dispose(); clipg.dispose();
} }
public void paintBorder(Graphics g) {
Rectangle bounds = designer.getTopContainer().getBounds();
bounds.x = -designer.getHorizontalScaleValue();
bounds.y = -designer.getVerticalScaleValue();
Graphics clipg = g.create();
clipg.clipRect(bounds.x, bounds.y, bounds.width, bounds.height);
Color oldColor = g.getColor();
g.setColor(DESIGNER_BORDER_COLOR);
GraphHelper.draw(g, bounds, Constants.LINE_THIN);
clipg.dispose();
g.setColor(oldColor);
}
/** /**
* 画出当前选择拖拽状态框 * 画出当前选择拖拽状态框
* *

14
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java

@ -24,6 +24,7 @@ import com.fr.design.mainframe.mobile.ui.MobileCollapsedStylePane;
import com.fr.design.mainframe.mobile.ui.MobileComboBoxDialogEditor; import com.fr.design.mainframe.mobile.ui.MobileComboBoxDialogEditor;
import com.fr.form.ui.BaseChartEditor; import com.fr.form.ui.BaseChartEditor;
import com.fr.form.ui.ChartEditor; import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.mobile.MobileCollapsedStyle; import com.fr.form.ui.mobile.MobileCollapsedStyle;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -201,9 +202,20 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
MobileCollapsedStyle style = ((ChartEditor) xCreator.toData()).getMobileCollapsedStyle(); MobileCollapsedStyle style = ((ChartEditor) xCreator.toData()).getMobileCollapsedStyle();
this.mobileCollapsedStyleEditor.setStyle(style); this.mobileCollapsedStyleEditor.setStyle(style);
fix(style);
this.mobileCollapsedStyleEditor.setSelected(style.isCollapsedWork()); this.mobileCollapsedStyleEditor.setSelected(style.isCollapsedWork());
} }
/**
* 根据组件当前位置修正下属性
*
* @param style
*/
private void fix(MobileCollapsedStyle style) {
style.setCollapsedWork(style.isCollapsedWork() && !FormDesignerUtils.isInAbsoluteLayout(xCreator));
}
@Override @Override
public void update() { public void update() {
ChartMobileAttrProvider mobileAttr = ((BaseChartEditor)xCreator.toData()).getMobileAttr(); ChartMobileAttrProvider mobileAttr = ((BaseChartEditor)xCreator.toData()).getMobileAttr();
@ -219,7 +231,7 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
MobileCollapsedStyle style = this.mobileCollapsedStyleEditor.getStyle(); MobileCollapsedStyle style = this.mobileCollapsedStyleEditor.getStyle();
if (style != null) { if (style != null) {
((ChartEditor) xCreator.toData()).setMobileCollapsedStyle(style); ((ChartEditor) xCreator.toData()).setMobileCollapsedStyle(style);
style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom()); style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom() && !FormDesignerUtils.isInAbsoluteLayout(xCreator));
} }
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来 DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
} }

12
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java

@ -176,9 +176,19 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
this.allowFullCheckBox.setSelected(elementCaseEditor.isAllowFullScreen()); this.allowFullCheckBox.setSelected(elementCaseEditor.isAllowFullScreen());
this.functionalWhenUnactivatedCheckBox.setSelected(!elementCaseEditor.isFunctionalWhenUnactivated()); this.functionalWhenUnactivatedCheckBox.setSelected(!elementCaseEditor.isFunctionalWhenUnactivated());
this.mobileCollapsedStyleEditor.setStyle(elementCaseEditor.getMobileCollapsedStyle()); this.mobileCollapsedStyleEditor.setStyle(elementCaseEditor.getMobileCollapsedStyle());
fix(elementCaseEditor.getMobileCollapsedStyle());
this.mobileCollapsedStyleEditor.setSelected(elementCaseEditor.getMobileCollapsedStyle().isCollapsedWork()); this.mobileCollapsedStyleEditor.setSelected(elementCaseEditor.getMobileCollapsedStyle().isCollapsedWork());
} }
/**
* 根据组件当前位置修正下属性
*
* @param style
*/
private void fix(MobileCollapsedStyle style) {
style.setCollapsedWork(style.isCollapsedWork() && !FormDesignerUtils.isInAbsoluteLayout(xCreator));
}
@Override @Override
public void update() { public void update() {
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来 DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
@ -207,7 +217,7 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
} }
MobileCollapsedStyle style = this.mobileCollapsedStyleEditor.getStyle(); MobileCollapsedStyle style = this.mobileCollapsedStyleEditor.getStyle();
if (style != null) { if (style != null) {
style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom()); style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom() && !FormDesignerUtils.isInAbsoluteLayout(xCreator));
((ElementCaseEditor) xCreator.toData()).setMobileCollapsedStyle(style); ((ElementCaseEditor) xCreator.toData()).setMobileCollapsedStyle(style);
} }
} }

19
designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java

@ -3,11 +3,12 @@ package com.fr.quickeditor;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iscrollbar.UIScrollBar; import com.fr.design.gui.iscrollbar.UIScrollBar;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.CellElementPropertyPane; import com.fr.design.mainframe.CellElementPropertyPane;
@ -48,7 +49,7 @@ import java.util.ArrayList;
*/ */
public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> { public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
protected static final Dimension LABEL_DIMENSION = new Dimension(60, 20); protected static final Dimension LABEL_DIMENSION = new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Report_Insert_Cell_Element")), 20);
protected static final int VGAP = 10, HGAP = 8, VGAP_INNER = 3; protected static final int VGAP = 10, HGAP = 8, VGAP_INNER = 3;
/** /**
@ -165,7 +166,7 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
columnRowTextField.setText(columnRow.toString()); columnRowTextField.setText(columnRow.toString());
cellElement = tc.getEditingElementCase().getTemplateCellElement(cs.getColumn(), cs.getRow()); cellElement = tc.getEditingElementCase().getTemplateCellElement(cs.getColumn(), cs.getRow());
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate != null) { if (jTemplate != null) {
comboBox.removeActionListener(comboBoxActionListener); comboBox.removeActionListener(comboBoxActionListener);
comboBox.removeAllItems(); comboBox.removeAllItems();
@ -208,10 +209,10 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
private JPanel initTopContent() { private JPanel initTopContent() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {GraphHelper.getWidth(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Insert_Cell_Element")), f}; double[] columnSize = {GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Report_Insert_Cell_Element")), f};
double[] rowSize = {p, p}; double[] rowSize = {p, p};
UILabel cellLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell")); UILabel cellLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Cell"));
UILabel insertContentLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Insert_Cell_Element")); UILabel insertContentLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Report_Insert_Cell_Element"));
initCellElementEditComboBox(); initCellElementEditComboBox();
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{cellLabel, columnRowTextField = initColumnRowTextField()}, new Component[]{cellLabel, columnRowTextField = initColumnRowTextField()},
@ -263,7 +264,7 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
* 初始化添加按钮 * 初始化添加按钮
*/ */
private void initCellElementEditComboBox() { private void initCellElementEditComboBox() {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate == null) { if (jTemplate == null) {
comboBox = new UIComboBox(); comboBox = new UIComboBox();
return; return;
@ -304,8 +305,8 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
ColumnRow columnRowEdit = ColumnRow.valueOf(columnRowTextField.getText()); ColumnRow columnRowEdit = ColumnRow.valueOf(columnRowTextField.getText());
// barry:检查输入是否正确 // barry:检查输入是否正确
if (!ColumnRow.validate(columnRowEdit)) { if (!ColumnRow.validate(columnRowEdit)) {
Object[] options = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK")}; Object[] options = {Toolkit.i18nText("Fine-Design_Report_OK")};
JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Please_Input_Letters+Numbers(A1,AA1,A11....)"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Warning"), JOptionPane.showOptionDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Please_Input_Letters+Numbers(A1,AA1,A11....)"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Warning"),
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);
// 重新选中当前的selection,把columnRowTextField // 重新选中当前的selection,把columnRowTextField
tc.setSelection(tc.getSelection()); tc.setSelection(tc.getSelection());

Loading…
Cancel
Save