Browse Source

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

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

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

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

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.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
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 {
private TreeTableDataComboBox treeTableDataComboBox;
@ -61,6 +61,23 @@ public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previe
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);
treeTableDataComboBox.setPreferredSize(new Dimension(200, 25));
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);
}
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) {
this.minValue = minValue;
this.maxValue = maxValue;
@ -169,6 +165,13 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
fireStateChanged();
}
/**
* 设置Spinner内的数字输入框列数
* @param numberFieldColumns 输入框列数
*/
public void setNumberFieldColumns(int numberFieldColumns) {
textField.setColumns(numberFieldColumns);
}
public void setEnabled(boolean 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.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.RefreshableJTree;
import com.fr.design.i18n.Toolkit;
@ -14,13 +13,13 @@ import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext;
import javax.swing.BorderFactory;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
@ -79,14 +78,7 @@ public class EnvFileTree extends RefreshableJTree {
this.setIcon(null);
this.setText(PENDING.toString());
}
// 这里新建一个Label作为render是因为JTree在动态刷新的时候,节点上render画布的的宽度不会变,会使得一部分比较长的数据显示为"..."
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.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
this.setBackgroundNonSelectionColor(UIConstants.TREE_BACKGROUND);
this.setTextSelectionColor(Color.WHITE);
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) {
//Yvan: 检查当前是否为WORK_SHEET状态,因为只有WORK_SHEET中含有格式刷组件,此时是不需要进行checkComponentsByNames的
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getMenuState() == DesignState.WORK_SHEET) {
return;
JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
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.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
newNameLabel.setPreferredSize(new Dimension(118, 15));
//newNameLabel.setPreferredSize(new Dimension(118, 15));
// 重命名输入框
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.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.ParameterProvider;
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.ChangeListener;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
@ -37,31 +41,34 @@ import java.util.Map.Entry;
/**
* The dialog used to input parameter.
*
* @editor zhou
* @since 2012-3-26上午11:09:45
*/
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 java.util.Map<ValueEditorPane,String> editorNameMap; // Map<Editor, Name>
private FlowTableLayoutHelper flowTableLayoutHelper;
private boolean allowBlank = true;
/**
/**
* Constructor.
*/
public ParameterInputPane(ParameterProvider[] parameters) {
this.initComponents(parameters);
}
public ParameterInputPane(ParameterProvider[] parameters, boolean allowBlank) {
this.allowBlank = allowBlank;
this.initComponents(parameters);
}
public ParameterInputPane(ParameterProvider[] parameters, boolean allowBlank) {
this.allowBlank = allowBlank;
this.initComponents(parameters);
}
private void initComponents(ParameterProvider[] parameters) {
this.setLayout(new BorderLayout(0, 4));
@ -71,24 +78,24 @@ public class ParameterInputPane extends BasicPane {
this.add(new JScrollPane(contentPane), BorderLayout.CENTER);
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.
java.util.List<String> nameAddedList = new java.util.ArrayList<String>(); // alex:已经加到界面中去的参数名
if (parameters != null && parameters.length > 0) {
for (int i = 0; i < parameters.length; i++) {
ParameterProvider parameter = parameters[i];
// alex:已经在界面中的参数,不加了
if (nameAddedList.contains(parameter.getName())) {
continue;
}
if(parameter instanceof StoreProcedureParameter
&& ((StoreProcedureParameter) parameter).getSchema() == StoreProcedureConstants.OUT) {
continue;
}
continue;
}
if (parameter instanceof StoreProcedureParameter
&& ((StoreProcedureParameter) parameter).getSchema() == StoreProcedureConstants.OUT) {
continue;
}
final Object pv = parameter.getValue();
Editor[] editors = makeEditorByValue(pv);
@ -100,135 +107,140 @@ public class ParameterInputPane extends BasicPane {
editPane.setPreferredSize(new Dimension(180, editPane.getPreferredSize().height));
String parameterDisplayName = parameter.getName();
if(StringUtils.isNotBlank(parameter.getName())) {
parameterDisplayName = parameter.getName();
if (StringUtils.isNotBlank(parameter.getName())) {
parameterDisplayName = parameter.getName();
}
contentPane.add(flowTableLayoutHelper.createLabelFlowPane(parameterDisplayName + ":", editPane));
//add editor to parameter hashtable.
initTextListener(textF);
initTextListener(textF);
this.editorNameMap.put(textF, parameter.getName());
nameAddedList.add(parameter.getName());
}
}
}
@Override
public void addNotify() {
super.addNotify();
// windows 高DPI下,使用getPreferredSize必须在添加到容器之后,否则得到的数值不准确,因此先放到这调整大小
flowTableLayoutHelper.adjustLabelWidth();
}
protected void initTextListener(ValueEditorPane textF) {
textF.getCurrentEditor().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified();
}
});
}
private Editor[] makeEditorByValue(Object pv) {
Editor[] editors = {null};
if (pv instanceof Integer) {
editors[0] = new IntegerEditor();
} else if (pv instanceof Double || pv instanceof Float) {
editors[0] = new DoubleEditor();
} else if (pv instanceof Float) {
editors[0] = new FloatEditor();
} else if (pv instanceof Date) {
editors[0] = new DateEditor(true, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date"));
} else if (pv instanceof Boolean) {
editors[0] = new BooleanEditor();
} else if (pv instanceof BaseFormula) {
editors = ValueEditorPaneFactory.basicEditors();
} else {
editors[0] = new TextEditor();
}
return editors;
}
textF.getCurrentEditor().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified();
}
});
}
private Editor[] makeEditorByValue(Object pv) {
Editor[] editors = {null};
if (pv instanceof Integer) {
editors[0] = new IntegerEditor();
} else if (pv instanceof Double || pv instanceof Float) {
editors[0] = new DoubleEditor();
} else if (pv instanceof Float) {
editors[0] = new FloatEditor();
} else if (pv instanceof Date) {
editors[0] = new DateEditor(true, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Date"));
} else if (pv instanceof Boolean) {
editors[0] = new BooleanEditor();
} else if (pv instanceof BaseFormula) {
editors = ValueEditorPaneFactory.basicEditors();
} else {
editors[0] = new TextEditor();
}
return editors;
}
@Override
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
*/
public Map<String,Object> update() {
java.util.Map<String,Object> nameValueMap = new java.util.HashMap<String,Object>();
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();
nameValueMap.put(parameterName, editorStringValue);
}
return nameValueMap;
public Map<String, Object> update() {
java.util.Map<String, Object> nameValueMap = new java.util.HashMap<String, Object>();
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();
nameValueMap.put(parameterName, editorStringValue);
}
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
*/
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) {
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
public JPanel createLabelFlowPane(String text, JComponent comp) {
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
UILabel textLabel = new UILabel(text);
centerPane.add(textLabel);
textLabel.setHorizontalAlignment(SwingConstants.LEFT);
UILabel textLabel = new UILabel(text);
centerPane.add(textLabel);
textLabel.setHorizontalAlignment(SwingConstants.LEFT);
this.labelList.add(textLabel);
centerPane.add(comp);
this.labelList.add(textLabel);
centerPane.add(comp);
return centerPane;
}
return centerPane;
}
public void adjustLabelWidth() {
int maxWidth = 0;
public void adjustLabelWidth() {
int maxWidth = 0;
for (int i = 0; i < labelList.size(); i++) {
maxWidth = Math.max(maxWidth, labelList.get(i).getPreferredSize().width);
}
for (int i = 0; i < labelList.size(); i++) {
maxWidth = Math.max(maxWidth, labelList.get(i).getPreferredSize().width);
}
for (int i = 0; i < labelList.size(); i++) {
UILabel label = labelList.get(i);
for (int i = 0; i < labelList.size(); 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.setSize(labelDim);
label.setMinimumSize(labelDim);
}
}
label.setPreferredSize(labelDim);
label.setSize(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.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.start.ServerStarter;
import com.fr.workspace.WorkContext;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Desktop;
@ -31,7 +31,6 @@ import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
@ -83,6 +82,7 @@ public class DesignUtils {
/**
* 判断设计器端口是否被其他程序占用
* 尝试去通信无回应就是其他程序占用端口否则需要继续判断是否为设计器进程未关闭
*
* @return
*/
public static boolean isPortOccupied() {
@ -153,7 +153,7 @@ public class DesignUtils {
return;
}
try (Socket socket = new Socket("localhost", port)) {
clientSend(lines, socket);
clientSend(lines, socket);
} catch (Exception ignore) {
}
@ -189,10 +189,10 @@ public class DesignUtils {
DesignerEnvManager.getEnvManager().setCurrentEnv2Default();
ServerStarter.browserDemoURL();
} else if ("check".equals(line)) {
clientSend(new String[] {"response"}, socket);
clientSend(new String[]{"response"}, socket);
} else if ("end".equals(line)) {
DesignerExiter.getInstance().execute(); }
else if (StringUtils.isNotEmpty(line)) {
DesignerExiter.getInstance().execute();
} else if (StringUtils.isNotEmpty(line)) {
File f = new File(line);
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()) {
outputStream.write("reponse".getBytes(StandardCharsets.UTF_8));
outputStream.flush();
@ -285,13 +285,20 @@ public class DesignUtils {
return key.startsWith("TextField.") || key.startsWith("PasswordField.");
}
/**
* 获取当前系统语言下设计器用的默认字体
*
* @return 默认字体
*/
private static FRFont getCurrentLocaleFont() {
FRFont guiFRFont;
Locale defaultLocale = Locale.getDefault();
if (isDisplaySimSun(defaultLocale)) {
// JDK9 之后宋体在计算label中字母的空间上出现问题,暂时先用雅黑兼容,以后再统一字体
if (StableUtils.getMajorJavaVersion() >= 9 && OperatingSystem.isWindows()) {
guiFRFont = getNamedFont("Microsoft YaHei");
} else if (isDisplaySimSun(defaultLocale)) {
guiFRFont = getNamedFont("SimSun");
} else {
} else {
guiFRFont = getNamedFont("Dialog");
}

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

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

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

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

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

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

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.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.PiePlot4VanChart;
import com.fr.plugin.chart.area.VanChartAreaPlot;
import com.fr.plugin.chart.bubble.VanChartBubblePlot;
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.wordcloud.VanChartWordCloudPlot;
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.VanChartRefreshTooltipContentPane;
import com.fr.van.chart.designer.component.VanChartTooltipContentPane;
@ -76,7 +78,7 @@ import java.util.Set;
*/
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 {
autoAdjustLabelPlots.add(VanChartColumnPlot.class);
@ -89,12 +91,26 @@ public class PlotFactory {
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
*/
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 {
labelMap.put(VanChartColumnPlot.class, VanChartColumnPlotLabelPane.class);
labelMap.put(VanChartGaugePlot.class, VanChartGaugePlotLabelPane.class);
labelMap.put(VanChartScatterPlot.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.layout.TableLayout;
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.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.format.CategoryNameFormatPaneWithCheckBox;
@ -36,9 +37,11 @@ public class VanChartLabelContentPaneWithoutRichText extends BasicBeanPane<AttrT
//监控刷新时,自动数据点提示使用
private ChangedValueFormatPaneWithCheckBox changedValueFormatPane;
private ChangedPercentFormatPaneWithCheckBox changedPercentFormatPane;
private UIButtonGroup<Integer> styleButton;
private ChartTextAttrPane textAttrPane;
private JPanel centerPane;
private JPanel commonPanel;
private JPanel stylePanel;
private VanChartHtmlLabelPane htmlLabelPane;
private VanChartStylePane parent;
@ -85,7 +88,7 @@ public class VanChartLabelContentPaneWithoutRichText extends BasicBeanPane<AttrT
}
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_Custom")
});
@ -99,7 +102,7 @@ public class VanChartLabelContentPaneWithoutRichText extends BasicBeanPane<AttrT
commonPanel = createCommonPanel();
htmlLabelPane = createHtmlLabelPane();
htmlLabelPane.setParent(parent);
stylePanel = createTextStylePane();
centerPane = new JPanel(new CardLayout()) {
@Override
public Dimension getPreferredSize() {
@ -121,10 +124,63 @@ public class VanChartLabelContentPaneWithoutRichText extends BasicBeanPane<AttrT
new Component[]{null, centerPane},
};
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);
}
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() {
return Toolkit.i18nText("Fine-Design_Report_Text");
}
@ -237,7 +293,12 @@ public class VanChartLabelContentPaneWithoutRichText extends BasicBeanPane<AttrT
if (!attrTooltipContent.isCommon()) {
setDirty(false);
}
if (hasTextStylePane()) {
this.styleButton.setSelectedIndex(attrTooltipContent.isCustom() ? 1 : 0);
this.textAttrPane.populate(attrTooltipContent.getTextAttr());
}
checkCardPane();
checkStylePane();
}
protected void populateFormatPane(AttrTooltipContent attrTooltipContent) {
@ -265,6 +326,11 @@ public class VanChartLabelContentPaneWithoutRichText extends BasicBeanPane<AttrT
htmlLabelPane.update(attrTooltipContent.getHtmlLabel());
if (hasTextStylePane()) {
attrTooltipContent.setCustom(styleButton.getSelectedIndex() == 1);
attrTooltipContent.setTextAttr(this.textAttrPane.update());
}
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 editorPanel;
private JPanel htmlPanel;
private JPanel stylePanel;
private UIButtonGroup<Integer> styleButton;
private ChartTextAttrPane textAttrPane;
private VanChartHtmlLabelPane htmlLabelPane;
@ -202,6 +203,7 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
content.add(createButtonPane(), BorderLayout.NORTH);
content.add(centerPanel, BorderLayout.CENTER);
content.add(stylePanel, BorderLayout.SOUTH);
initContentListener();
@ -209,9 +211,10 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
}
private void initDetailPane() {
commonPanel = createCommonPanel();
commonPanel = createCommonFormatPanel();
editorPanel = createRichEditorPanel();
htmlPanel = createHtmlPane();
stylePanel = createCommonStylePane();
}
private void initCenterPane() {
@ -261,15 +264,6 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
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() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
@ -469,6 +463,8 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
} else {
cardLayout.show(centerPanel, Toolkit.i18nText("Fine-Design_Chart_Common"));
}
stylePanel.setVisible(content.getSelectedIndex() != 1);
}
protected void setCustomFormatterText() {
@ -608,7 +604,6 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
protected void populateRichText(AttrTooltipRichText tooltipRichText) {
if (tooltipRichText != null) {
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.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.gui.UIComponentUtils;
@ -30,20 +31,18 @@ public class VanChartBorderPane extends BasicPane {
protected void initComponents() {
currentLineCombo = new LineComboBox(CoreConstants.STRIKE_LINE_STYLE_ARRAY_4_CHART);
currentLineColorPane = new ColorSelectBox(100);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double[] columnSize = {f, e};
double[] rowSize = {p, p, p, p};
Component[][] components = getUseComponent();
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, getRowSize(), columnSize);
this.setLayout(new BorderLayout());
this.add(panel,BorderLayout.CENTER);
}
protected Component[][] getUseComponent() {
UILabel lineStyleLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Style"));
UILabel colorLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color"));
UILabel lineStyleLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Line_Style"));
UILabel colorLabel = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Color"));
return new Component[][]{
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 标题

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.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import javax.swing.JSeparator;
import java.awt.BorderLayout;
import java.awt.Component;
@ -19,6 +19,10 @@ public class VanChartBorderWithRadiusPane extends VanChartBorderPane {
private static final long serialVersionUID = -3937853702118283803L;
private UISpinner radius;
public UISpinner getRadius() {
return radius;
}
@Override
protected void initComponents() {
radius = new UISpinner(0,1000,1,0);
@ -31,11 +35,11 @@ public class VanChartBorderWithRadiusPane extends VanChartBorderPane {
return new Component[][]{
new Component[]{null,null},
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)
},
new Component[]{new UILabel(com.fr.design.i18n.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_Chart_Color")),currentLineColorPane},
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;
}
protected boolean hasTextStylePane() {
return false;
}
}

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

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

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

@ -22,7 +22,7 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe
}
protected double[] getLabelPaneRowSize(Plot plot, double p) {
if (hasLabelAlign(plot)) {
if (hasLabelAlignPane()) {
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) {
return TableLayoutHelper.createTableLayoutPane(comps, row, col);
// 仪表盘标签内无布局tab
protected JPanel getLabelLayoutPane(JPanel panel, String title) {
return 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) {
if (hasLabelAlign(plot)) {
if (hasLabelAlignPane()) {
return new Component[][]{
new Component[]{getDataLabelContentPane(), null},
@ -222,6 +223,10 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout();
}
protected boolean hasLabelAlignPane() {
return getGaugeStyle() == GaugeStyle.THERMOMETER;
}
public void populate(AttrLabelDetail 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;
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.AttrLabelDetail;
import com.fr.plugin.chart.gauge.VanChartGaugePlot;
import com.fr.plugin.chart.type.GaugeStyle;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.design.i18n.Toolkit;
import javax.swing.JPanel;
import java.awt.BorderLayout;
@ -18,6 +20,9 @@ import java.awt.BorderLayout;
public class VanChartGaugePlotLabelPane extends VanChartPlotLabelPane {
private static final long serialVersionUID = -322148616244458359L;
private UIButtonGroup<Integer> orientation;
private JPanel layoutPane;
private VanChartPlotLabelDetailPane gaugeValueLabelPane;
public VanChartGaugePlotLabelPane(Plot plot, VanChartStylePane parent) {
@ -41,23 +46,65 @@ public class VanChartGaugePlotLabelPane extends VanChartPlotLabelPane {
}
JPanel cateOrPercentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(cateTitle, getLabelDetailPane());
JPanel valuePane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(valueTitle, gaugeValueLabelPane);
layoutPane = createGaugeLabelLayoutPane();
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) {
super.populate(attr);
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() {
AttrLabel attrLabel = super.update();
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;
}
}

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.UIToggleButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.attr.plot.VanChartLabelPositionPlot;
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.van.chart.designer.PlotFactory;
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 javax.swing.JPanel;
@ -28,9 +29,6 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
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.
@ -42,9 +40,12 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
private UIButtonGroup<Integer> position;
private UIButtonGroup<Boolean> autoAdjust;
private UIButtonGroup<Integer> orientation;
private UIToggleButton tractionLine;
private ColorSelectBox backgroundColor;
private VanChartBorderWithShapePane borderPane;
private VanChartBackgroundWithOutImagePane backgroundPane;
private JPanel tractionLinePane;
private JPanel positionPane;
@ -100,15 +101,48 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) {
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[][]{
new Component[]{dataLabelContentPane,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) {
@ -123,6 +157,10 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
return plot instanceof VanChartLabelPositionPlot;
}
private boolean hasBorderAndBackground(Plot plot) {
return PlotFactory.hasBorderAndBackgroundPlotLabel(plot);
}
protected JPanel createTableLayoutPaneWithTitle(String title, JPanel panel) {
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(title, panel);
}
@ -157,8 +195,11 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
positionPane = new JPanel();
checkPositionPane(title);
panel.add(positionPane, BorderLayout.CENTER);
panel.add(positionPane, BorderLayout.NORTH);
if (hasLabelOrientationPane()) {
panel.add(createLabelOrientationPane(), BorderLayout.CENTER);
}
if (plot.isSupportLeadLine()) {
tractionLine = new UIToggleButton(Toolkit.i18nText("Fine-Design_Chart_Show_Guideline"));
@ -168,7 +209,25 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
} else if (PlotFactory.plotAutoAdjustLabelPosition(plot)) {
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) {
@ -205,13 +264,10 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
}
}
protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){
JPanel panel = TableLayoutHelper.createTableLayoutPane(comps,row,col);
return createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel);
return TableLayoutHelper.createTableLayoutPane(comps, row, col);
}
protected void initPositionListener() {
position.addChangeListener(new ChangeListener() {
@Override
@ -267,16 +323,25 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
if(position != null){
position.setSelectedItem(detail.getPosition());
}
if(orientation != null){
orientation.setSelectedIndex(detail.isHorizontal() ? 0 : 1);
}
if(tractionLine != null){
tractionLine.setSelected(detail.isShowGuidLine());
}
if(autoAdjust != null){
autoAdjust.setSelectedIndex(detail.isAutoAdjust() == true ? 0 : 1);
autoAdjust.setSelectedIndex(detail.isAutoAdjust() ? 0 : 1);
}
if(backgroundColor != null){
backgroundColor.setSelectObject(detail.getBackgroundColor());
}
if(borderPane != null){
borderPane.populate(detail.getBorder());
}
if(backgroundPane != null){
backgroundPane.populate(detail.getBackground());
}
checkAllUse();
}
@ -294,12 +359,21 @@ public class VanChartPlotLabelDetailPane extends BasicPane {
detail.setAutoAdjust(autoAdjust != null && autoAdjust.getSelectedItem());
if(orientation != null){
detail.setHorizontal(orientation.getSelectedIndex() == 0);
}
if(tractionLine != null){
detail.setShowGuidLine(tractionLine.isSelected() && detail.getPosition() == Constants.OUTSIDE);
}
if(backgroundColor != null){
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;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.map.designer.type.GEOJSONTreeHelper;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import com.fr.plugin.chart.map.server.CompatibleGEOJSONHelper;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
@ -15,7 +15,6 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import java.awt.Component;
import java.awt.Dimension;
import java.util.Enumeration;
/**
@ -23,7 +22,7 @@ import java.util.Enumeration;
*/
public class MapDataTree extends JTree {
public MapDataTree(TreeNode root){
public MapDataTree(TreeNode root) {
super();
this.setModel(model);
model.setRoot(root);
@ -49,54 +48,54 @@ public class MapDataTree extends JTree {
if (children.hasMoreElements()) {
DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement();
if(GEOJSONTreeHelper.getInstance().isSelectableTreeNode(child)){
if (GEOJSONTreeHelper.isSelectableTreeNode(child)) {
selectTreeNode(child, m_model);
}else{
} else {
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();
if (children.hasMoreElements()){
if (children.hasMoreElements()) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) children.nextElement();
selectTreeNode(node, m_model);
}
}
public void changeRootNode(TreeNode node){
public void changeRootNode(TreeNode node) {
DefaultTreeModel m_model = (DefaultTreeModel) this.getModel();
m_model.setRoot(node);
}
public String getSelectNodeJSONPath() {
if(this.getLastSelectedPathComponent() == null){
if (this.getLastSelectedPathComponent() == null) {
return StringUtils.EMPTY;
}
DefaultMutableTreeNode currentSel = (DefaultMutableTreeNode)this.getLastSelectedPathComponent();
DefaultMutableTreeNode currentSel = (DefaultMutableTreeNode) this.getLastSelectedPathComponent();
return CompatibleGEOJSONHelper.getJsonUrlByPathIncludeParam(currentSel.getUserObject().toString());
}
//根据路径精确查找
public DefaultMutableTreeNode setSelectNodePath(String jsonUrl) {
if(StringUtils.isEmpty(jsonUrl) || CompatibleGEOJSONHelper.isDeprecated(jsonUrl)){
if (StringUtils.isEmpty(jsonUrl) || CompatibleGEOJSONHelper.isDeprecated(jsonUrl)) {
return null;
}
DefaultTreeModel m_model = (DefaultTreeModel) this.getModel();
DefaultMutableTreeNode root = (DefaultMutableTreeNode) m_model.getRoot();
Enumeration<TreeNode> els = root.postorderEnumeration();
while(els.hasMoreElements()){
while (els.hasMoreElements()) {
DefaultMutableTreeNode el = (DefaultMutableTreeNode) els.nextElement();
if(el == null || el.getUserObject() == null){
if (el == null || el.getUserObject() == null) {
return null;
}
String dirPath = el.getUserObject().toString();
String url = CompatibleGEOJSONHelper.getJsonUrlByPathIncludeParam(dirPath);
String url = CompatibleGEOJSONHelper.getJsonUrlByPathIncludeParam(dirPath);
//先equals再valid原因:valid 远程下实时去服务器看有没有json文件
if (ComparatorUtils.equals(jsonUrl, url) && GEOJSONTreeHelper.isValidDirPath(dirPath)) {
selectTreeNode(el, m_model);
@ -115,14 +114,7 @@ public class MapDataTree extends JTree {
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) value;
String name = getPresentName(treeNode);
this.setText(name);
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.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
this.setBackgroundNonSelectionColor(UIConstants.NORMAL_BACKGROUND);
this.setForeground(UIConstants.FONT_COLOR);
this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE);
@ -131,25 +123,25 @@ public class MapDataTree extends JTree {
};
protected String getPresentName(DefaultMutableTreeNode treeNode) {
if(treeNode == null || treeNode.getUserObject() == null){
if (treeNode == null || treeNode.getUserObject() == null) {
return StringUtils.EMPTY;
}
return ChartGEOJSONHelper.getPresentNameWithPath(treeNode.getUserObject().toString());
}
//模糊搜索 深度优先.
public void search(String text){
if(StringUtils.isEmpty(text)){
public void search(String text) {
if (StringUtils.isEmpty(text)) {
return;
}
DefaultTreeModel m_model = (DefaultTreeModel) this.getModel();
DefaultMutableTreeNode root = (DefaultMutableTreeNode) m_model.getRoot();
Enumeration<TreeNode> els = root.postorderEnumeration();
while(els.hasMoreElements()){
while (els.hasMoreElements()) {
DefaultMutableTreeNode el = (DefaultMutableTreeNode) els.nextElement();
String path = el.getUserObject().toString();
String path = el.getUserObject().toString();
String fileName = ChartGEOJSONHelper.getPresentNameWithPath(path);
if (StringUtils.contains(fileName, text) && GEOJSONTreeHelper.isValidDirPath(path)) {
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);
TreePath treePath = new TreePath(nodes);
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"/>
<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="./rich_editor.css"/>
<script src="http://fanruan.design/fineui/2.0/fineui.js"></script>
<script src="https://fanruan.design/fineui/materials.bundle.min.js"></script>
</head>

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

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

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

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

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

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

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

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

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

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

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

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

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

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