Browse Source

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

feature/big-screen
Yvan 4 years ago
parent
commit
3f1244356e
  1. 19
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java
  2. 9
      designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataComboBox.java
  3. 23
      designer-base/src/main/java/com/fr/design/gui/frpane/JTreeAutoBuildPane.java
  4. 12
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  5. 34
      designer-base/src/main/java/com/fr/design/parameter/ParameterInputPane.java
  6. 17
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelDetailPane.java
  7. 20
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartColumnPlotLabelPane.java
  8. 20
      designer-chart/src/main/java/com/fr/van/chart/designer/PlotFactory.java
  9. 74
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPaneWithoutRichText.java
  10. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  11. 14
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderPane.java
  12. 12
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithRadiusPane.java
  13. 58
      designer-chart/src/main/java/com/fr/van/chart/designer/component/border/VanChartBorderWithShapePane.java
  14. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/label/GaugeLabelContentPane.java
  15. 5
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java
  16. 57
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugePlotLabelPane.java
  17. 100
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java
  18. 44
      designer-chart/src/main/java/com/fr/van/chart/drillmap/designer/data/comp/MapDataTree.java
  19. 22
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.css
  20. 1
      designer-chart/src/main/resources/com/fr/design/editor/rich_editor.html
  21. 11
      designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java
  22. 4
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

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

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

@ -70,6 +70,15 @@ 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) {

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

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

34
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,6 +41,7 @@ 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
*/ */
@ -47,10 +52,12 @@ public class ParameterInputPane extends BasicPane {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// alex:保存编辑器对应的参数的名字 // alex:保存编辑器对应的参数的名字
private java.util.Map<ValueEditorPane,String> editorNameMap; // Map<Editor, Name> private java.util.Map<ValueEditorPane, String> editorNameMap; // Map<Editor, Name>
private boolean allowBlank = true; private boolean allowBlank = true;
private FlowTableLayoutHelper flowTableLayoutHelper;
/** /**
* Constructor. * Constructor.
*/ */
@ -71,9 +78,9 @@ 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:已经加到界面中去的参数名
@ -85,7 +92,7 @@ public class ParameterInputPane extends BasicPane {
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;
} }
@ -100,7 +107,7 @@ 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));
@ -112,7 +119,12 @@ public class ParameterInputPane extends BasicPane {
nameAddedList.add(parameter.getName()); nameAddedList.add(parameter.getName());
} }
} }
}
@Override
public void addNotify() {
super.addNotify();
// windows 高DPI下,使用getPreferredSize必须在添加到容器之后,否则得到的数值不准确,因此先放到这调整大小
flowTableLayoutHelper.adjustLabelWidth(); flowTableLayoutHelper.adjustLabelWidth();
} }
@ -153,12 +165,12 @@ public class ParameterInputPane extends BasicPane {
/** /**
* 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();

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

5
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) {

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

100
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[][]{ return new Component[][]{
new Component[]{dataLabelContentPane,null} 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());
}
} }
} }

44
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,50 +48,50 @@ 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();
@ -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,22 +123,22 @@ 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();
@ -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>

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

@ -3,14 +3,13 @@ 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 {
@ -34,13 +33,7 @@ public class ComponentTreeCellRenderer extends DefaultTreeCellRenderer {
setIcon(icon); setIcon(icon);
} }
} }
UILabel label = new UILabel(); this.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
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);
return this; return this;
} }

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(

Loading…
Cancel
Save