Browse Source

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

feature/big-screen
Henry.Wang 4 years ago
parent
commit
d396af842c
  1. 2
      designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java
  2. 2
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  3. 73
      designer-base/src/main/java/com/fr/design/formula/FormulaTextField.java
  4. 23
      designer-base/src/main/java/com/fr/design/formula/SortFormulaPane.java
  5. 45
      designer-base/src/main/java/com/fr/design/gui/itextfield/DictionaryTextField.java
  6. 18
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java
  7. 4
      designer-chart/src/main/java/com/fr/van/chart/box/data/report/BoxPlotReportDataContentPane.java
  8. 3
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableDataContentPane.java
  9. 6
      designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java
  10. 74
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHeatValueColorPane.java
  11. 153
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java
  12. 53
      designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java
  13. 131
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java
  14. 173
      designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java
  15. 22
      designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java
  16. 15
      designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java
  17. 21
      designer-chart/src/main/java/com/fr/van/chart/range/component/GradualLegendPane.java
  18. 12
      designer-chart/src/main/java/com/fr/van/chart/range/component/LegendLabelFormatPane.java
  19. 11
      designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java
  20. 45
      designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java
  21. 4
      designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java
  22. 10
      designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java
  23. BIN
      designer-chart/src/main/resources/com/fr/van/chart/box.images/box.png
  24. 87
      designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java
  25. 72
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  26. 4
      pom.xml

2
designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java vendored

@ -1,6 +1,6 @@
package com.fr.design.env; package com.fr.design.env;
import com.fr.cluster.engine.remote.ClusterOperator; import com.fr.cluster.engine.rpc.remote.ClusterOperator;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.base.operator.common.CommonOperator; import com.fr.base.operator.common.CommonOperator;
import com.fr.rpc.ExceptionHandler; import com.fr.rpc.ExceptionHandler;

2
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -226,6 +226,8 @@ public class TemplateTreePane extends JPanel implements FileOperations {
*/ */
@Override @Override
public void refresh() { public void refresh() {
// 刷新远程文件夹权限
NodeAuthProcessor.getInstance().refresh();
reportletsTree.refresh(); reportletsTree.refresh();
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_File_Tree_Refresh_Successfully") + "!"); FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_File_Tree_Refresh_Successfully") + "!");
} }

73
designer-base/src/main/java/com/fr/design/formula/FormulaTextField.java

@ -0,0 +1,73 @@
package com.fr.design.formula;
import com.fr.base.BaseFormula;
import com.fr.design.gui.itextfield.DictionaryTextField;
import com.fr.stable.StringUtils;
import javax.swing.text.Document;
/**
* 公式展示时使用
* 展示 String.
* 但实际保存的是 BaseFormula
* 从而保留公式的形态
*
* created by Harrison on 2020/08/03
**/
public class FormulaTextField extends DictionaryTextField<BaseFormula> {
private static final BaseFormula EMPTY_FORMULA = BaseFormula.createFormulaBuilder().build("=");
public FormulaTextField() {
}
public FormulaTextField(int columns) {
super(columns);
}
public FormulaTextField(String text, int columns, BaseFormula value) {
super(text, columns, value);
}
public FormulaTextField(String text, BaseFormula value) {
super(text, value);
}
public FormulaTextField(Document doc, String text, int columns, BaseFormula value) {
super(doc, text, columns, value);
}
@Override
public BaseFormula getValue() {
if (this.value == null) {
this.value = createDefault();
}
return this.value;
}
/**
* 设置值时会将展示的公式值一同设置进去
*
* @param value 公式值
*/
@Override
public void setValue(BaseFormula value) {
this.value = value;
if (this.value == null) {
this.value = createDefault();
}
setText(this.value.getPureContent());
}
private BaseFormula createDefault() {
String text = getText();
if (StringUtils.isNotEmpty(text)) {
return BaseFormula.createFormulaBuilder().build(text);
} else {
return EMPTY_FORMULA;
}
}
}

23
designer-base/src/main/java/com/fr/design/formula/SortFormulaPane.java

@ -7,12 +7,13 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.SortOrderComboBox; import com.fr.design.gui.icombobox.SortOrderComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.JComponent;
import javax.swing.*; import javax.swing.JPanel;
import java.awt.*; import javax.swing.SwingUtilities;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -20,7 +21,7 @@ public abstract class SortFormulaPane extends JPanel {
protected static final String InsetText = " "; protected static final String InsetText = " ";
protected SortOrderComboBox sortOrderComboBox; protected SortOrderComboBox sortOrderComboBox;
protected UITextField sortFormulaTextField; protected FormulaTextField sortFormulaTextField;
// 屏蔽掉“自定义比较规则”和“选择”按钮,只显示公式输入文本和公式按钮 // 屏蔽掉“自定义比较规则”和“选择”按钮,只显示公式输入文本和公式按钮
protected UIButton sortFormulaTextFieldButton; protected UIButton sortFormulaTextFieldButton;
@ -35,7 +36,7 @@ public abstract class SortFormulaPane extends JPanel {
} }
}); });
sortFormulaTextField = new UITextField(16); sortFormulaTextField = new FormulaTextField(16);
//Lance:添加一公式编辑器按钮 //Lance:添加一公式编辑器按钮
sortFormulaTextFieldButton = new UIButton("..."); sortFormulaTextFieldButton = new UIButton("...");
sortFormulaTextFieldButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula") + "..."); sortFormulaTextFieldButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula") + "...");
@ -55,17 +56,15 @@ public abstract class SortFormulaPane extends JPanel {
public abstract void formulaAction(); public abstract void formulaAction();
public void showFormulaDialog(String[] displayNames) { public void showFormulaDialog(String[] displayNames) {
String text = sortFormulaTextField.getText(); BaseFormula value = sortFormulaTextField.getValue();
final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula();
formulaPane.populate(BaseFormula.createFormulaBuilder().build(text), new CustomVariableResolver(displayNames, true)); formulaPane.populate(value, new CustomVariableResolver(displayNames, true));
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(SortFormulaPane.this), formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(SortFormulaPane.this),
new DialogActionAdapter() { new DialogActionAdapter() {
public void doOk() { public void doOk() {
BaseFormula fm = formulaPane.update(); BaseFormula fm = formulaPane.update();
if (fm.getContent().length() <= 1) { if (fm != null) {
sortFormulaTextField.setText(""); sortFormulaTextField.setValue(fm);
} else {
sortFormulaTextField.setText(fm.getContent().substring(1));
} }
} }
}).setVisible(true); }).setVisible(true);

45
designer-base/src/main/java/com/fr/design/gui/itextfield/DictionaryTextField.java

@ -0,0 +1,45 @@
package com.fr.design.gui.itextfield;
import javax.swing.text.Document;
/**
* 文字 ui.
* 保存实际值展示值
* 允许实际值和展示值不同
*
* created by Harrison on 2020/08/03
**/
public class DictionaryTextField<T> extends UITextField {
protected T value;
public DictionaryTextField() {
}
public DictionaryTextField(int columns) {
super(columns);
}
public DictionaryTextField(String text, int columns, T value) {
super(text, columns);
this.value = value;
}
public DictionaryTextField(String text, T value) {
super(text);
this.value = value;
}
public DictionaryTextField(Document doc, String text, int columns, T value) {
super(doc, text, columns);
this.value = value;
}
public T getValue() {
return value;
}
public void setValue(T value) {
this.value = value;
}
}

18
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java

@ -18,7 +18,6 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorControlWindow; import com.fr.design.style.color.ColorControlWindow;
import com.fr.design.style.color.ColorSelectBox; import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
@ -29,6 +28,8 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants; 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.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -40,8 +41,6 @@ import java.awt.LayoutManager;
import java.awt.Point; import java.awt.Point;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
public class UIColorPickerPane extends BasicPane implements UIObserver { public class UIColorPickerPane extends BasicPane implements UIObserver {
private static final int MARGIN_TOP = 7; private static final int MARGIN_TOP = 7;
@ -635,7 +634,7 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
@Override @Override
public void layoutContainer(Container parent) { public void layoutContainer(Container parent) {
upControlPane.setBounds(MARGIN_LEFT, MARGIN_TOP, UPCONTROLPANE_WIDTH, upControlPane.getPreferredSize().height); upControlPane.setBounds(getBoundX(), getBoundY(), getBoundWidth(), upControlPane.getPreferredSize().height);
colorGroup.setBounds(COLORGROUP_MARGIN_LEFT, 2 * MARGIN_TOP + upControlPane.getPreferredSize().height + LAYOUR_DET, colorGroup.getPreferredSize().width, colorGroup.getPreferredSize().height + upControlPane.getPreferredSize().height); colorGroup.setBounds(COLORGROUP_MARGIN_LEFT, 2 * MARGIN_TOP + upControlPane.getPreferredSize().height + LAYOUR_DET, colorGroup.getPreferredSize().width, colorGroup.getPreferredSize().height + upControlPane.getPreferredSize().height);
textGroup.setBounds(colorGroup.getPreferredSize().width + COLORGROUP_MARGIN_LEFT, MARGIN_TOP + upControlPane.getPreferredSize().height + LAYOUR_DET, textGroup.getPreferredSize().width, textGroup.getPreferredSize().height); textGroup.setBounds(colorGroup.getPreferredSize().width + COLORGROUP_MARGIN_LEFT, MARGIN_TOP + upControlPane.getPreferredSize().height + LAYOUR_DET, textGroup.getPreferredSize().width, textGroup.getPreferredSize().height);
} }
@ -646,6 +645,17 @@ public class UIColorPickerPane extends BasicPane implements UIObserver {
} }
}; };
protected int getBoundX() {
return MARGIN_LEFT;
}
protected int getBoundY() {
return MARGIN_TOP;
}
protected int getBoundWidth() {
return UPCONTROLPANE_WIDTH;
}
/** /**
*刷新颜色选取器 *刷新颜色选取器

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

@ -37,13 +37,14 @@ public class BoxPlotReportDataContentPane extends AbstractReportDataContentPane
this.add(createSeriesPane(parent), BorderLayout.CENTER); this.add(createSeriesPane(parent), BorderLayout.CENTER);
initDataTypeListener(); initDataTypeListener();
checkDataPaneVisible();
} }
private JPanel createDataTypePane() { private JPanel createDataTypePane() {
JPanel pane = new JPanel(new BorderLayout(4, 0)); JPanel pane = new JPanel(new BorderLayout(4, 0));
pane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); pane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground()));
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Type")); UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Form"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
String[] names = new String[]{ String[] names = new String[]{
@ -52,6 +53,7 @@ public class BoxPlotReportDataContentPane extends AbstractReportDataContentPane
}; };
dataType = new UIButtonGroup(names); dataType = new UIButtonGroup(names);
dataType.setSelectedIndex(0);
dataType.setPreferredSize(new Dimension(100, 20)); dataType.setPreferredSize(new Dimension(100, 20));
pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null})); pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null}));

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

@ -54,7 +54,7 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
JPanel pane = new JPanel(new BorderLayout(4, 0)); JPanel pane = new JPanel(new BorderLayout(4, 0));
pane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); pane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground()));
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Type")); UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Data_Form"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
String[] names = new String[]{ String[] names = new String[]{
@ -63,6 +63,7 @@ public class BoxPlotTableDataContentPane extends AbstractTableDataContentPane {
}; };
dataType = new UIButtonGroup(names); dataType = new UIButtonGroup(names);
dataType.setSelectedIndex(0);
dataType.setPreferredSize(new Dimension(100, 20)); dataType.setPreferredSize(new Dimension(100, 20));
pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null})); pane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{dataType, null, null, label, null}));

6
designer-chart/src/main/java/com/fr/van/chart/bubble/VanChartBubbleSeriesPane.java

@ -2,8 +2,8 @@ package com.fr.van.chart.bubble;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.chartglyph.ConditionAttr;
import com.fr.design.i18n.Toolkit;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
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.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
@ -12,7 +12,7 @@ import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble;
import com.fr.van.chart.bubble.component.VanChartBubblePane; import com.fr.van.chart.bubble.component.VanChartBubblePane;
import com.fr.van.chart.custom.component.VanChartCustomAxisConditionPane; import com.fr.van.chart.custom.component.VanChartCustomAxisConditionPane;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import com.fr.van.chart.designer.style.series.VanChartColorValueSeriesPane;
import com.fr.van.chart.designer.style.series.VanChartStackedAndAxisListControlPane; import com.fr.van.chart.designer.style.series.VanChartStackedAndAxisListControlPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -22,7 +22,7 @@ import java.awt.Component;
/** /**
* Created by Mitisky on 16/3/31. * Created by Mitisky on 16/3/31.
*/ */
public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane { public class VanChartBubbleSeriesPane extends VanChartColorValueSeriesPane {
private static final long serialVersionUID = 5595016643808487932L; private static final long serialVersionUID = 5595016643808487932L;
private VanChartBubblePane bubblePane; private VanChartBubblePane bubblePane;

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

@ -0,0 +1,74 @@
package com.fr.van.chart.designer.component;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent;
import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.designer.style.axis.component.MinMaxValuePaneWithOutTick;
import com.fr.van.chart.range.component.GradualIntervalConfigPane;
import com.fr.van.chart.range.component.GradualLegendPane;
import com.fr.van.chart.range.component.LegendGradientBar;
import com.fr.van.chart.range.component.SectionIntervalConfigPaneWithOutNum;
import com.fr.van.chart.range.component.SectionLegendPane;
import java.awt.Component;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-08-04
*/
public class VanChartHeatValueColorPane extends VanChartValueColorPane {
public VanChartHeatValueColorPane(VanChartStylePane parent) {
super(parent);
}
protected GradualLegendPane createGradualLegendPane() {
return new GradualLegendPane() {
@Override
protected GradualIntervalConfigPane createGradualIntervalConfigPane() {
return new GradualIntervalConfigPane() {
@Override
protected Component[][] getPaneComponents(MinMaxValuePaneWithOutTick minMaxValuePane, ColorSelectBoxWithOutTransparent colorSelectBox, UINumberDragPane numberDragPane, LegendGradientBar legendGradientBar) {
return new Component[][]{
new Component[]{minMaxValuePane, null},
new Component[]{new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), numberDragPane},
new Component[]{null, legendGradientBar}
};
}
};
}
};
}
protected SectionLegendPane createSectionLegendPane() {
return new SectionLegendPane(getVanChartStylePane()) {
@Override
protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) {
return new SectionIntervalConfigPaneWithOutNum(parent) {
private static final int WIDTH = 227;
@Override
protected int getBoundX() {
return 0;
}
@Override
protected int getBoundY() {
return 0;
}
@Override
protected int getBoundWidth() {
return WIDTH;
}
};
}
};
}
}

153
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartValueColorPane.java

@ -0,0 +1,153 @@
package com.fr.van.chart.designer.component;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.PaneTitleConstants;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.range.VanChartRangeLegend;
import com.fr.plugin.chart.type.LegendType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.range.component.GradualLegendPane;
import com.fr.van.chart.range.component.SectionLegendPane;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-08-03
*/
public class VanChartValueColorPane extends BasicPane {
//颜色类型切换按钮
private UIButtonGroup<LegendType> valueColorTypeButton;
//连续渐变面板
private GradualLegendPane gradualLegendPane;
//区域渐变面板
private SectionLegendPane sectionLegendPane;
private VanChartStylePane parent;
private JPanel rangeLegendPane;
public VanChartValueColorPane(VanChartStylePane parent) {
this.parent = parent;
initComponents();
}
public VanChartStylePane getVanChartStylePane() {
return parent;
}
public void initComponents() {
valueColorTypeButton = createLegendTypeButton();
valueColorTypeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkCardPane();
}
});
valueColorTypeButton.setSelectedIndex(0);
UILabel label = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Color_Type"));
Component[][] labelComponent = new Component[][]{
new Component[]{label, valueColorTypeButton},
};
JPanel legendTypeButtonWithTilePane = TableLayout4VanChartHelper.createGapTableLayoutPane(labelComponent);
legendTypeButtonWithTilePane.setBorder(BorderFactory.createEmptyBorder(10,0,0,0));
//渐变色图例面板
gradualLegendPane = createGradualLegendPane();
//区域段图例面板
sectionLegendPane = createSectionLegendPane();
rangeLegendPane = new JPanel(new CardLayout()) {
@Override
public Dimension getPreferredSize() {
if (valueColorTypeButton.getSelectedItem() == LegendType.GRADUAL) {
return gradualLegendPane.getPreferredSize();
} else {
return sectionLegendPane.getPreferredSize();
}
}
};
rangeLegendPane.add(gradualLegendPane, LegendType.GRADUAL.getStringType());
rangeLegendPane.add(sectionLegendPane, LegendType.SECTION.getStringType());
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] col = {f};
double[] row = {p, p};
Component[][] components = new Component[][]{
new Component[]{legendTypeButtonWithTilePane},
new Component[]{rangeLegendPane}
};
JPanel tableLayoutPane = TableLayoutHelper.createTableLayoutPane(components, row, col);
this.setLayout(new BorderLayout());
this.add(tableLayoutPane, BorderLayout.CENTER);
}
private void checkCardPane() {
CardLayout cardLayout = (CardLayout) rangeLegendPane.getLayout();
cardLayout.show(rangeLegendPane, valueColorTypeButton.getSelectedItem().getStringType());
this.validate();
this.repaint();
}
private UIButtonGroup<LegendType> createLegendTypeButton() {
return new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Continuous_Gradient"),
Toolkit.i18nText("Fine-Design_Chart_Area_Gradient")
}, new LegendType[]{LegendType.GRADUAL, LegendType.SECTION});
}
protected GradualLegendPane createGradualLegendPane() {
return new GradualLegendPane();
}
protected SectionLegendPane createSectionLegendPane() {
return new SectionLegendPane(parent);
}
/**
* 标题
*
* @return 标题
*/
public String title4PopupWindow() {
return PaneTitleConstants.CHART_STYLE_SERIES_TITLE;
}
public void updateBean(VanChartRangeLegend legend) {
LegendType legendType = valueColorTypeButton.getSelectedItem();
legend.setLegendType(legendType);
if (legendType == LegendType.GRADUAL) {
gradualLegendPane.update(legend.getGradualLegend());
} else if (legendType == LegendType.SECTION) {
sectionLegendPane.update(legend.getSectionLegend());
}
}
public void populateBean(VanChartRangeLegend legend) {
//范围图例部分
if (legend.getLegendType() != LegendType.ORDINARY) {
valueColorTypeButton.setSelectedItem(legend.getLegendType());
}
gradualLegendPane.populate(legend.getGradualLegend());
sectionLegendPane.populate(legend.getSectionLegend());
checkCardPane();
}
}

53
designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java

@ -1,22 +1,6 @@
package com.fr.van.chart.designer.style; package com.fr.van.chart.designer.style;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.i18n.Toolkit;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent;
import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula;
import com.fr.plugin.chart.type.LegendType;
import com.fr.van.chart.designer.style.axis.component.MinMaxValuePaneWithOutTick;
import com.fr.van.chart.range.component.GradualIntervalConfigPane;
import com.fr.van.chart.range.component.GradualLegendPane;
import com.fr.van.chart.range.component.LegendGradientBar;
import com.fr.van.chart.range.component.SectionIntervalConfigPaneWithOutNum;
import com.fr.van.chart.range.component.SectionLegendPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.Component;
/** /**
* Created by Mitisky on 16/10/20. * Created by Mitisky on 16/10/20.
@ -35,41 +19,4 @@ public class HeatMapRangeLegendPane extends VanChartRangeLegendPane {
protected JPanel createCommonLegendPane(){ protected JPanel createCommonLegendPane(){
return this.createLegendPaneWithoutHighlight(); return this.createLegendPaneWithoutHighlight();
} }
@Override
protected UIButtonGroup<LegendType> createLegendTypeButton(){
return new UIButtonGroup<LegendType>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"),
Toolkit.i18nText("Fine-Design_Chart_Legend_Section")
}, new LegendType[]{LegendType.GRADUAL, LegendType.SECTION});
}
@Override
protected GradualLegendPane createGradualLegendPane() {
return new GradualLegendPane(){
@Override
protected GradualIntervalConfigPane createGradualIntervalConfigPane() {
return new GradualIntervalConfigPane(){
@Override
protected Component[][] getPaneComponents(MinMaxValuePaneWithOutTick minMaxValuePane, ColorSelectBoxWithOutTransparent colorSelectBox, UINumberDragPane numberDragPane, LegendGradientBar legendGradientBar) {
return new Component[][]{
new Component[]{minMaxValuePane, null},
new Component[]{new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), numberDragPane},
new Component[]{null, legendGradientBar}
};
}
};
}
};
}
@Override
protected SectionLegendPane createSectionLegendPane() {
return new SectionLegendPane(this.getLegendPaneParent()) {
@Override
protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) {
return new SectionIntervalConfigPaneWithOutNum(parent);
}
};
}
} }

131
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartRangeLegendPane.java

@ -1,24 +1,18 @@
package com.fr.van.chart.designer.style; package com.fr.van.chart.designer.style;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.plugin.chart.attr.VanChartLegend; import com.fr.plugin.chart.attr.VanChartLegend;
import com.fr.plugin.chart.range.SectionLegend;
import com.fr.plugin.chart.range.VanChartRangeLegend; import com.fr.plugin.chart.range.VanChartRangeLegend;
import com.fr.plugin.chart.type.LegendType; import com.fr.plugin.chart.type.LegendType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.range.component.LegendLabelFormatPane;
import com.fr.van.chart.range.component.GradualLegendPane;
import com.fr.van.chart.range.component.SectionLegendPane;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/** /**
@ -28,87 +22,63 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
private static final long serialVersionUID = 1614283200308877353L; private static final long serialVersionUID = 1614283200308877353L;
//散点图不同类型面板容器,容器布局管理 //散点图不同类型面板容器,容器布局管理
private JPanel rangeLegendPane; private JPanel rangeLabelPane;
//图例切换按钮
private UIButtonGroup<LegendType> legendTypeButton;
//普通图例面板(因为普通图例没有新内容,故而为空) //普通图例面板(因为普通图例没有新内容,故而为空)
private JPanel ordinaryLegendPane; private JPanel ordinaryLabelPane;
//渐变色图例面板
private GradualLegendPane gradualLegendPane; private LegendLabelFormatPane gradualLabelFormPane;
//区域段图例面板
private SectionLegendPane sectionLegendPane; private LegendLabelFormatPane sectionLabelFormPane;
private LegendType legendType;
public VanChartRangeLegendPane() { public VanChartRangeLegendPane() {
super(); super();
} }
public VanChartRangeLegendPane(VanChartStylePane parent) { public VanChartRangeLegendPane(VanChartStylePane parent) {
super(parent); super(parent);
} }
private JPanel createRangeLegendPane() {
//普通图例面板 private JPanel createRangeLabelPane() {
ordinaryLegendPane = new JPanel(); ordinaryLabelPane = new JPanel();
//渐变色图例面板 gradualLabelFormPane = new LegendLabelFormatPane();
gradualLegendPane = createGradualLegendPane(); gradualLabelFormPane.setParentPane(this.getLegendPaneParent());
gradualLegendPane.setParentPane(this.getLegendPaneParent()); sectionLabelFormPane = new LegendLabelFormatPane() {
//区域段图例面板 @Override
sectionLegendPane = createSectionLegendPane(); protected void checkCustomLabelText() {
sectionLegendPane.setParentPane(this.getLegendPaneParent()); setCustomFormatterText(SectionLegend.DEFAULT_LABEL_FUNCTION);
}
};
sectionLabelFormPane.setParentPane(this.getLegendPaneParent());
JPanel panel = new JPanel(new CardLayout()) { JPanel panel = new JPanel(new CardLayout()) {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
if(legendTypeButton.getSelectedItem() == LegendType.ORDINARY){ if (legendType == LegendType.ORDINARY) {
return new Dimension(ordinaryLegendPane.getWidth(), 0); return new Dimension(ordinaryLabelPane.getWidth(), 0);
} else if (legendTypeButton.getSelectedItem() == LegendType.GRADUAL){ } else if (legendType == LegendType.GRADUAL) {
return gradualLegendPane.getPreferredSize(); return gradualLabelFormPane.getPreferredSize();
} else { } else {
return sectionLegendPane.getPreferredSize(); return sectionLabelFormPane.getPreferredSize();
} }
} }
}; };
panel.add(ordinaryLegendPane, LegendType.ORDINARY.getStringType()); panel.add(ordinaryLabelPane, LegendType.ORDINARY.getStringType());
panel.add(gradualLegendPane, LegendType.GRADUAL.getStringType()); panel.add(gradualLabelFormPane, LegendType.GRADUAL.getStringType());
panel.add(sectionLegendPane, LegendType.SECTION.getStringType()); panel.add(sectionLabelFormPane, LegendType.SECTION.getStringType());
return panel; return panel;
} }
protected GradualLegendPane createGradualLegendPane() {
return new GradualLegendPane();
}
protected SectionLegendPane createSectionLegendPane() {
return new SectionLegendPane(this.getLegendPaneParent());
}
private JPanel createTableLayoutPaneWithTitle(String title, Component component) {
return TableLayout4VanChartHelper.createGapTableLayoutPane(title, component);
}
protected UIButtonGroup<LegendType> createLegendTypeButton(){
return new UIButtonGroup<LegendType>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Legend_Ordinary"),
Toolkit.i18nText("Fine-Design_Chart_Legend_Gradual"),
Toolkit.i18nText("Fine-Design_Chart_Legend_Section")
}, new LegendType[]{LegendType.ORDINARY, LegendType.GRADUAL, LegendType.SECTION});
}
protected JPanel createCommonLegendPane() { protected JPanel createCommonLegendPane() {
return super.createLegendPane(); return super.createLegendPane();
} }
@Override @Override
protected JPanel createLegendPane() { protected JPanel createLegendPane() {
legendTypeButton = createLegendTypeButton(); rangeLabelPane = createRangeLabelPane();
initLegendTypeButtonListener();
JPanel legendTypeButtonWithTilePane = createTableLayoutPaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Legend_Form"), legendTypeButton);
legendTypeButtonWithTilePane.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
rangeLegendPane = createRangeLegendPane();
//不包含新内容的普通面板内容 //不包含新内容的普通面板内容
JPanel commonLegendPane = this.createCommonLegendPane(); JPanel commonLegendPane = this.createCommonLegendPane();
@ -116,28 +86,17 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] col = {f}; double[] col = {f};
double[] row = {p, p, p, p}; double[] row = {p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{legendTypeButtonWithTilePane}, new Component[]{rangeLabelPane},
new Component[]{rangeLegendPane},
new Component[]{commonLegendPane} new Component[]{commonLegendPane}
}; };
return TableLayoutHelper.createTableLayoutPane(components, row, col); return TableLayoutHelper.createTableLayoutPane(components, row, col);
} }
private void initLegendTypeButtonListener() {
legendTypeButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkCardPane();
checkLayoutPaneVisible();
}
});
}
private void checkCardPane() { private void checkCardPane() {
CardLayout cardLayout = (CardLayout) rangeLegendPane.getLayout(); CardLayout cardLayout = (CardLayout) rangeLabelPane.getLayout();
cardLayout.show(rangeLegendPane, legendTypeButton.getSelectedItem().getStringType()); cardLayout.show(rangeLabelPane, legendType.getStringType());
} }
@Override @Override
@ -151,14 +110,13 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
protected boolean isVisibleLayoutPane() { protected boolean isVisibleLayoutPane() {
return super.isVisibleLayoutPane() && legendTypeButton.getSelectedItem() != LegendType.GRADUAL; return super.isVisibleLayoutPane() && legendType != LegendType.GRADUAL;
} }
private void checkHighlightVisible() { private void checkHighlightVisible() {
JPanel highlightPane = this.getHighlightPane(); JPanel highlightPane = this.getHighlightPane();
if (highlightPane != null) { if (highlightPane != null) {
LegendType legendType = legendTypeButton.getSelectedItem();
highlightPane.setVisible(legendType != LegendType.GRADUAL); highlightPane.setVisible(legendType != LegendType.GRADUAL);
} }
} }
@ -172,26 +130,21 @@ public class VanChartRangeLegendPane extends VanChartPlotLegendPane {
VanChartRangeLegend scatterLegend = (VanChartRangeLegend) legend; VanChartRangeLegend scatterLegend = (VanChartRangeLegend) legend;
//范围图例部分 //范围图例部分
LegendType legendType = legendTypeButton.getSelectedItem();
scatterLegend.setLegendType(legendType);
if (legendType == LegendType.GRADUAL) { if (legendType == LegendType.GRADUAL) {
gradualLegendPane.update(scatterLegend.getGradualLegend()); gradualLabelFormPane.update(scatterLegend.getGradualLegend().getLegendLabelFormat());
} else if (legendType == LegendType.SECTION) { } else if (legendType == LegendType.SECTION) {
sectionLegendPane.update(scatterLegend.getSectionLegend()); sectionLabelFormPane.update(scatterLegend.getSectionLegend().getLegendLabelFormat());
} }
this.checkHighlightVisible();
} }
@Override @Override
public void populateBean(VanChartLegend legend) { public void populateBean(VanChartLegend legend) {
VanChartRangeLegend scatterLegend = (VanChartRangeLegend) legend; VanChartRangeLegend scatterLegend = (VanChartRangeLegend) legend;
legendType = scatterLegend.getLegendType();
if (scatterLegend != null) { if (scatterLegend != null) {
//范围图例部分 //范围图例部分
legendTypeButton.setSelectedItem(scatterLegend.getLegendType()); gradualLabelFormPane.populate(scatterLegend.getGradualLegend().getLegendLabelFormat());
gradualLegendPane.populate(scatterLegend.getGradualLegend()); sectionLabelFormPane.populate(scatterLegend.getSectionLegend().getLegendLabelFormat());
sectionLegendPane.populate(scatterLegend.getSectionLegend());
super.populateBean(scatterLegend); super.populateBean(scatterLegend);
} }
checkAllUse(); checkAllUse();

173
designer-chart/src/main/java/com/fr/van/chart/designer/style/series/VanChartColorValueSeriesPane.java

@ -0,0 +1,173 @@
package com.fr.van.chart.designer.style.series;
import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.plugin.chart.range.VanChartRangeLegend;
import com.fr.plugin.chart.type.LegendType;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane;
import com.fr.van.chart.designer.component.VanChartValueColorPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author Bjorn
* @version 10.0
* Created by Bjorn on 2020-08-03
*/
public abstract class VanChartColorValueSeriesPane extends VanChartAbstractPlotSeriesPane {
//颜色划分切换
private UIButtonGroup<String> colorDivideButton;
private VanChartValueColorPane vanChartValueColorPane;
private JPanel colorDividePane;
public VanChartColorValueSeriesPane(ChartStylePane parent, Plot plot) {
super(parent, plot);
}
public VanChartValueColorPane getVanChartValueColorPane() {
return vanChartValueColorPane;
}
public void setVanChartValueColorPane(VanChartValueColorPane vanChartValueColorPane) {
this.vanChartValueColorPane = vanChartValueColorPane;
}
//获取颜色面板
protected JPanel getColorPane() {
JPanel panel = new JPanel(new BorderLayout());
JPanel colorChoosePane = createColorChoosePane();
if (colorChoosePane != null) {
panel.add(colorChoosePane, BorderLayout.CENTER);
}
stylePane = createStylePane();
setColorPaneContent(panel);
JPanel colorPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel);
panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));
return panel.getComponentCount() == 0 ? null : colorPane;
}
protected JPanel createColorChoosePane() {
vanChartFillStylePane = getVanChartFillStylePane();
if (vanChartFillStylePane != null) {
JPanel divideButtonPane = initDivideButtonPane();
vanChartValueColorPane = new VanChartValueColorPane((VanChartStylePane) parentPane);
colorDividePane = new JPanel(new CardLayout()) {
@Override
public Dimension getPreferredSize() {
if (colorDivideButton.getSelectedIndex() == 0) {
return vanChartFillStylePane.getPreferredSize();
} else {
return vanChartValueColorPane.getPreferredSize();
}
}
};
colorDividePane.add(vanChartFillStylePane, "series");
colorDividePane.add(vanChartValueColorPane, "value");
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] col = {f};
double[] row = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{divideButtonPane},
new Component[]{colorDividePane}
};
return TableLayoutHelper.createCommonTableLayoutPane(components, row, col, 0);
}
return null;
}
private JPanel initDivideButtonPane() {
colorDivideButton = new UIButtonGroup<>(new String[]{
Toolkit.i18nText("Fine-Design_Chart_Series"),
Toolkit.i18nText("Fine-Design_Chart_Use_Value")
}, new String[]{"series", "value"});
colorDivideButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkCardPane();
}
});
colorDivideButton.setSelectedIndex(0);
UILabel label = FRWidgetFactory.createLineWrapLabel(Toolkit.i18nText("Fine-Design_Chart_Color_Divide"));
Component[][] labelComponent = new Component[][]{
new Component[]{label, colorDivideButton},
};
JPanel gapTableLayoutPane = TableLayout4VanChartHelper.createGapTableLayoutPane(labelComponent);
gapTableLayoutPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
return gapTableLayoutPane;
}
private void checkCardPane() {
CardLayout cardLayout = (CardLayout) colorDividePane.getLayout();
cardLayout.show(colorDividePane, colorDivideButton.getSelectedItem());
colorDividePane.validate();
colorDividePane.repaint();
}
//风格
protected VanChartBeautyPane createStylePane() {
return null;
}
/**
* 保存 系列界面的属性到Plot
*/
public void updateBean(Plot plot) {
if (plot == null) {
return;
}
super.updateBean(plot);
if (colorDivideButton != null) {
VanChartRangeLegend legend = (VanChartRangeLegend) plot.getLegend();
int selectedIndex = colorDivideButton.getSelectedIndex();
if (selectedIndex == 0) {
legend.setLegendType(LegendType.ORDINARY);
} else {
vanChartValueColorPane.updateBean(legend);
}
}
}
/**
* 更新Plot的属性到系列界面
*/
public void populateBean(Plot plot) {
if (plot == null) {
return;
}
super.populateBean(plot);
if (colorDivideButton != null) {
VanChartRangeLegend legend = (VanChartRangeLegend) plot.getLegend();
LegendType legendType = legend.getLegendType();
if (legendType == LegendType.ORDINARY) {
colorDivideButton.setSelectedIndex(0);
} else {
colorDivideButton.setSelectedIndex(1);
}
vanChartValueColorPane.populateBean(legend);
checkCardPane();
}
}
}

22
designer-chart/src/main/java/com/fr/van/chart/heatmap/designer/style/VanChartHeatMapSeriesPane.java

@ -6,12 +6,16 @@ import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
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.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.ChartStylePane; import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot; import com.fr.plugin.chart.heatmap.VanChartHeatMapPlot;
import com.fr.plugin.chart.range.VanChartRangeLegend;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartFillStylePane; import com.fr.van.chart.designer.component.VanChartFillStylePane;
import com.fr.van.chart.designer.component.VanChartHeatValueColorPane;
import com.fr.van.chart.designer.style.VanChartStylePane;
import com.fr.van.chart.map.VanChartMapSeriesPane; import com.fr.van.chart.map.VanChartMapSeriesPane;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -91,6 +95,7 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane {
double[] col = {f}; double[] col = {f};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createHeatColorPane()},
new Component[]{createHeatPointStylePane()}, new Component[]{createHeatPointStylePane()},
new Component[]{createOpacityPane()} new Component[]{createOpacityPane()}
}; };
@ -98,6 +103,21 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane {
return TableLayoutHelper.createTableLayoutPane(components, row, col); return TableLayoutHelper.createTableLayoutPane(components, row, col);
} }
private JPanel createHeatColorPane() {
setVanChartValueColorPane(new VanChartHeatValueColorPane((VanChartStylePane) parentPane));
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] row = {p};
double[] col = {f};
Component[][] components = new Component[][]{
new Component[]{getVanChartFillStylePane()},
};
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Fine-Design_Chart_Color"), panel);
}
private JPanel createHeatPointStylePane() { private JPanel createHeatPointStylePane() {
radius = new UISpinner(0, Double.MAX_VALUE, 1, 30); radius = new UISpinner(0, Double.MAX_VALUE, 1, 30);
blur = new UISpinner(0, 100, 1, 30); blur = new UISpinner(0, 100, 1, 30);
@ -152,6 +172,7 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane {
blur.setValue(heatMapPlot.getBlur()); blur.setValue(heatMapPlot.getBlur());
maxOpacity.populateBean(heatMapPlot.getMaxOpacity()); maxOpacity.populateBean(heatMapPlot.getMaxOpacity());
minOpacity.populateBean(heatMapPlot.getMinOpacity()); minOpacity.populateBean(heatMapPlot.getMinOpacity());
getVanChartValueColorPane().populateBean((VanChartRangeLegend) plot.getLegend());
} }
} }
@ -169,6 +190,7 @@ public class VanChartHeatMapSeriesPane extends VanChartMapSeriesPane {
heatMapPlot.setBlur(blur.getValue()); heatMapPlot.setBlur(blur.getValue());
heatMapPlot.setMaxOpacity(maxOpacity.updateBean()); heatMapPlot.setMaxOpacity(maxOpacity.updateBean());
heatMapPlot.setMinOpacity(minOpacity.updateBean()); heatMapPlot.setMinOpacity(minOpacity.updateBean());
getVanChartValueColorPane().updateBean((VanChartRangeLegend) plot.getLegend());
} }
} }

15
designer-chart/src/main/java/com/fr/van/chart/map/VanChartMapSeriesPane.java

@ -31,7 +31,7 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.border.VanChartBorderWithAlphaPane; import com.fr.van.chart.designer.component.border.VanChartBorderWithAlphaPane;
import com.fr.van.chart.designer.component.marker.VanChartImageMarkerPane; import com.fr.van.chart.designer.component.marker.VanChartImageMarkerPane;
import com.fr.van.chart.designer.other.VanChartInteractivePane; import com.fr.van.chart.designer.other.VanChartInteractivePane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import com.fr.van.chart.designer.style.series.VanChartColorValueSeriesPane;
import com.fr.van.chart.designer.style.series.VanChartEffectPane; import com.fr.van.chart.designer.style.series.VanChartEffectPane;
import com.fr.van.chart.map.designer.style.series.VanChartMapScatterMarkerPane; import com.fr.van.chart.map.designer.style.series.VanChartMapScatterMarkerPane;
import com.fr.van.chart.map.line.VanChartCurvePane; import com.fr.van.chart.map.line.VanChartCurvePane;
@ -52,7 +52,7 @@ import java.awt.event.ItemListener;
* Created by Mitisky on 16/5/4. * Created by Mitisky on 16/5/4.
* 地图-系列界面 * 地图-系列界面
*/ */
public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane { public class VanChartMapSeriesPane extends VanChartColorValueSeriesPane {
private static final String AREA_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Region"); private static final String AREA_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Region");
private static final String POINT_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Point"); private static final String POINT_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Point");
private static final String LINE_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Flow"); private static final String LINE_STRING = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Flow");
@ -164,8 +164,9 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane {
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
mapType = ((VanChartMapPlot) plot).getAllLayersMapType(); mapType = ((VanChartMapPlot) plot).getAllLayersMapType();
if (mapType == MapType.CUSTOM || mapType == MapType.DRILL_CUSTOM) { if (mapType == MapType.CUSTOM || mapType == MapType.DRILL_CUSTOM) {
vanChartFillStylePane = getVanChartFillStylePane(); JPanel pane = createColorChoosePane();
panel.add(vanChartFillStylePane, BorderLayout.NORTH); pane.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
panel.add(pane, BorderLayout.NORTH);
} }
panel.add(getContentInPlotType(), BorderLayout.CENTER); panel.add(getContentInPlotType(), BorderLayout.CENTER);
return panel; return panel;
@ -177,9 +178,9 @@ public class VanChartMapSeriesPane extends VanChartAbstractPlotSeriesPane {
stylePane = createStylePane(); stylePane = createStylePane();
mapType = ((VanChartMapPlot) plot).getAllLayersMapType(); mapType = ((VanChartMapPlot) plot).getAllLayersMapType();
if (mapType != MapType.CUSTOM && mapType != MapType.DRILL_CUSTOM) { if (mapType != MapType.CUSTOM && mapType != MapType.DRILL_CUSTOM) {
vanChartFillStylePane = getVanChartFillStylePane(); JPanel pane = createColorChoosePane();
if (vanChartFillStylePane != null) { if (pane != null) {
panel.add(vanChartFillStylePane, BorderLayout.NORTH); panel.add(pane, BorderLayout.NORTH);
} }
} }
setColorPaneContent(panel, paneType); setColorPaneContent(panel, paneType);

21
designer-chart/src/main/java/com/fr/van/chart/range/component/GradualLegendPane.java

@ -2,10 +2,7 @@ package com.fr.van.chart.range.component;
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.plugin.chart.range.GradualLegend; import com.fr.plugin.chart.range.GradualLegend;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -15,29 +12,21 @@ public class GradualLegendPane extends JPanel{
private static final long serialVersionUID = 1614283200308877353L; private static final long serialVersionUID = 1614283200308877353L;
private GradualIntervalConfigPane intervalConfigPane; private GradualIntervalConfigPane intervalConfigPane;
private LegendLabelFormatPane labelFormPane;
public GradualLegendPane() { public GradualLegendPane() {
initComponents(); initComponents();
} }
public void setParentPane(VanChartStylePane parent) {
labelFormPane.setParentPane(parent);
}
private void initComponents() { private void initComponents() {
intervalConfigPane = createGradualIntervalConfigPane(); intervalConfigPane = createGradualIntervalConfigPane();
JPanel intervalConfigPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Section_Config"),intervalConfigPane);
labelFormPane = new LegendLabelFormatPane();
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] col = {f}; double[] col = {f};
double[] row = {p, p, p, p}; double[] row = {p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null}, new Component[]{intervalConfigPane},
new Component[]{intervalConfigPaneWithTitle},
new Component[]{labelFormPane},
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col);
@ -53,17 +42,11 @@ public class GradualLegendPane extends JPanel{
if (intervalConfigPane != null) { if (intervalConfigPane != null) {
intervalConfigPane.populate(gradualLegend.getGradualIntervalConfig()); intervalConfigPane.populate(gradualLegend.getGradualIntervalConfig());
} }
if (labelFormPane != null) {
labelFormPane.populate(gradualLegend.getLegendLabelFormat());
}
} }
public void update(GradualLegend gradualLegend) { public void update(GradualLegend gradualLegend) {
if (intervalConfigPane != null) { if (intervalConfigPane != null) {
intervalConfigPane.update(gradualLegend.getGradualIntervalConfig()); intervalConfigPane.update(gradualLegend.getGradualIntervalConfig());
} }
if (labelFormPane != null) {
labelFormPane.update(gradualLegend.getLegendLabelFormat());
}
} }
} }

12
designer-chart/src/main/java/com/fr/van/chart/range/component/LegendLabelFormatPane.java

@ -36,11 +36,19 @@ public class LegendLabelFormatPane extends JPanel{
public LegendLabelFormatPane() { public LegendLabelFormatPane() {
labelFormatStyle = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common"), labelFormatStyle = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")}); com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")});
labelFormat = new FormatPaneWithOutFont(); labelFormat = new FormatPaneWithOutFont() {
@Override
protected Component[][] getComponent(JPanel fontPane, JPanel centerPane, JPanel typePane) {
typePane.setBorder(BorderFactory.createEmptyBorder());
return new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format"), SwingConstants.LEFT), typePane},
new Component[]{null, centerPane},
};
}
};
htmlLabelPane = new VanChartHtmlLabelPaneWithOutWidthAndHeight(); htmlLabelPane = new VanChartHtmlLabelPaneWithOutWidthAndHeight();
htmlLabelPane.setBorder(BorderFactory.createEmptyBorder(0, (int) TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL, 0, 0)); htmlLabelPane.setBorder(BorderFactory.createEmptyBorder(0, (int) TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH + TableLayout4VanChartHelper.COMPONENT_INTERVAL, 0, 0));
centerPane = new JPanel(new CardLayout()) { centerPane = new JPanel(new CardLayout()) {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {

11
designer-chart/src/main/java/com/fr/van/chart/range/component/SectionIntervalConfigPaneWithOutNum.java

@ -5,9 +5,7 @@ import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.Component; import java.awt.Component;
@ -38,15 +36,6 @@ public class SectionIntervalConfigPaneWithOutNum extends MapColorPickerPaneWithF
}); });
} }
@Override
protected JPanel getUpControlPane(Component[][] components) {
double e = TableLayout4VanChartHelper.EDIT_AREA_WIDTH;
double d = TableLayout4VanChartHelper.DESCRIPTION_AREA_WIDTH;
double[] columnSize = {d, e};
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, getRowSIze(), columnSize);
return panel;
}
private void setRegionVisible(boolean visible) { private void setRegionVisible(boolean visible) {
getRegionNumPane().setVisible(visible); getRegionNumPane().setVisible(visible);
numLabel.setVisible(visible); numLabel.setVisible(visible);

45
designer-chart/src/main/java/com/fr/van/chart/range/component/SectionLegendPane.java

@ -5,8 +5,6 @@ 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.series.MapColorPickerPaneWithFormula; import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula;
import com.fr.plugin.chart.range.SectionLegend; import com.fr.plugin.chart.range.SectionLegend;
import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -16,7 +14,6 @@ public class SectionLegendPane extends JPanel{
private static final long serialVersionUID = 1614283200308877353L; private static final long serialVersionUID = 1614283200308877353L;
private MapColorPickerPaneWithFormula intervalConfigPane; private MapColorPickerPaneWithFormula intervalConfigPane;
private LegendLabelFormatPane labelFormPane;
private AbstractAttrNoScrollPane parent; private AbstractAttrNoScrollPane parent;
public SectionLegendPane(AbstractAttrNoScrollPane parent) { public SectionLegendPane(AbstractAttrNoScrollPane parent) {
@ -24,28 +21,15 @@ public class SectionLegendPane extends JPanel{
initComponents(); initComponents();
} }
public void setParentPane(VanChartStylePane parent){
labelFormPane.setParentPane(parent);
}
private void initComponents() { private void initComponents() {
intervalConfigPane = createSectionIntervalConfigPane(this.parent); intervalConfigPane = createSectionIntervalConfigPane(this.parent);
JPanel intervalConfigPaneWithTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Section_Config"), intervalConfigPane);
labelFormPane = new LegendLabelFormatPane(){
@Override
protected void checkCustomLabelText() {
setCustomFormatterText(SectionLegend.DEFAULT_LABEL_FUNCTION);
}
};
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] col = {f}; double[] col = {f};
double[] row = {p, p, p}; double[] row = {p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null}, new Component[]{intervalConfigPane},
new Component[]{intervalConfigPaneWithTitle},
new Component[]{labelFormPane},
}; };
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, row, col);
@ -55,24 +39,35 @@ public class SectionLegendPane extends JPanel{
} }
protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) { protected MapColorPickerPaneWithFormula createSectionIntervalConfigPane(AbstractAttrNoScrollPane parent) {
return new SectionIntervalConfigPane(parent); return new SectionIntervalConfigPane(parent) {
private static final int WIDTH = 225;
@Override
protected int getBoundX() {
return 0;
}
@Override
protected int getBoundY() {
return 0;
}
@Override
protected int getBoundWidth() {
return WIDTH;
}
};
} }
public void populate(SectionLegend sectionLegend) { public void populate(SectionLegend sectionLegend) {
if (intervalConfigPane != null) { if (intervalConfigPane != null) {
intervalConfigPane.populateBean(sectionLegend.getMapHotAreaColor()); intervalConfigPane.populateBean(sectionLegend.getMapHotAreaColor());
} }
if (labelFormPane != null) {
labelFormPane.populate(sectionLegend.getLegendLabelFormat());
}
} }
public void update(SectionLegend sectionLegend) { public void update(SectionLegend sectionLegend) {
if (intervalConfigPane != null) { if (intervalConfigPane != null) {
intervalConfigPane.updateBean(sectionLegend.getMapHotAreaColor()); intervalConfigPane.updateBean(sectionLegend.getMapHotAreaColor());
} }
if (labelFormPane != null) {
labelFormPane.update(sectionLegend.getLegendLabelFormat());
}
} }
} }

4
designer-chart/src/main/java/com/fr/van/chart/scatter/VanChartScatterSeriesPane.java

@ -13,7 +13,7 @@ import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartLineTypePane; import com.fr.van.chart.designer.component.VanChartLineTypePane;
import com.fr.van.chart.designer.component.VanChartMarkerPane; import com.fr.van.chart.designer.component.VanChartMarkerPane;
import com.fr.van.chart.designer.component.marker.VanChartCommonMarkerPane; import com.fr.van.chart.designer.component.marker.VanChartCommonMarkerPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; import com.fr.van.chart.designer.style.series.VanChartColorValueSeriesPane;
import com.fr.van.chart.designer.style.series.VanChartStackedAndAxisListControlPane; import com.fr.van.chart.designer.style.series.VanChartStackedAndAxisListControlPane;
import com.fr.van.chart.scatter.component.VanChartScatterLineTypePane; import com.fr.van.chart.scatter.component.VanChartScatterLineTypePane;
@ -24,7 +24,7 @@ import java.awt.Component;
/** /**
* 散点图的系列界面 * 散点图的系列界面
*/ */
public class VanChartScatterSeriesPane extends VanChartAbstractPlotSeriesPane { public class VanChartScatterSeriesPane extends VanChartColorValueSeriesPane {
private static final long serialVersionUID = 5595016643808487932L; private static final long serialVersionUID = 5595016643808487932L;
public VanChartScatterSeriesPane(ChartStylePane parent, Plot plot) { public VanChartScatterSeriesPane(ChartStylePane parent, Plot plot) {

10
designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java

@ -18,8 +18,7 @@ import com.fr.general.IOUtils;
import com.fr.plugin.chart.wordcloud.CloudShapeType; import com.fr.plugin.chart.wordcloud.CloudShapeType;
import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot; import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot;
import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.TableLayout4VanChartHelper;
import com.fr.van.chart.designer.component.VanChartBeautyPane; import com.fr.van.chart.designer.style.series.VanChartColorValueSeriesPane;
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
@ -34,7 +33,7 @@ import java.awt.event.ItemListener;
/** /**
* Created by Mitisky on 16/11/29. * Created by Mitisky on 16/11/29.
*/ */
public class VanChartWordCloudSeriesPane extends VanChartAbstractPlotSeriesPane { public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane {
private static final String AUTO_FONT_SIZE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Auto"); private static final String AUTO_FONT_SIZE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Auto");
private static final String CUSTOM_FONT_SIZE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Define_Size"); private static final String CUSTOM_FONT_SIZE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Define_Size");
private static final double MAX_ROTATION = 90; private static final double MAX_ROTATION = 90;
@ -228,9 +227,4 @@ public class VanChartWordCloudSeriesPane extends VanChartAbstractPlotSeriesPane
} }
} }
} }
@Override
protected VanChartBeautyPane createStylePane() {
return null;
}
} }

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 918 B

After

Width:  |  Height:  |  Size: 1.6 KiB

87
designer-realize/src/main/java/com/fr/design/dscolumn/DSColumnAdvancedPane.java

@ -7,6 +7,7 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.CustomVariableResolver; import com.fr.design.formula.CustomVariableResolver;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.FormulaTextField;
import com.fr.design.formula.SortFormulaPane; import com.fr.design.formula.SortFormulaPane;
import com.fr.design.formula.UIFormula; import com.fr.design.formula.UIFormula;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -25,8 +26,17 @@ import com.fr.report.cell.cellattr.CellExpandAttr;
import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.cellattr.core.group.SelectCount; import com.fr.report.cell.cellattr.core.group.SelectCount;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.Box;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -221,7 +231,7 @@ public class DSColumnAdvancedPane extends BasicPane {
return; return;
} }
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value == null || !(value instanceof DSColumn)) { if (!(value instanceof DSColumn)) {
return; return;
} }
@ -238,7 +248,7 @@ public class DSColumnAdvancedPane extends BasicPane {
this.cellElement = cellElement; this.cellElement = cellElement;
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value == null || !(value instanceof DSColumn)) { if (!(value instanceof DSColumn)) {
return; return;
} }
DSColumn dSColumn = (DSColumn) value; DSColumn dSColumn = (DSColumn) value;
@ -246,8 +256,8 @@ public class DSColumnAdvancedPane extends BasicPane {
int sort = dSColumn.getOrder(); int sort = dSColumn.getOrder();
this.sortOrderComboBox.setSortOrder(new SortOrder(sort)); this.sortOrderComboBox.setSortOrder(new SortOrder(sort));
String sortFormula = dSColumn.getSortFormula(); BaseFormula sortFormulaObject = dSColumn.getSortFormulaObject();
sortFormulaTextField.setText(sortFormula); sortFormulaTextField.setValue(sortFormulaObject);
} }
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
@ -263,15 +273,7 @@ public class DSColumnAdvancedPane extends BasicPane {
dSColumn.setOrder(this.sortOrderComboBox.getSortOrder().getOrder()); dSColumn.setOrder(this.sortOrderComboBox.getSortOrder().getOrder());
//lance:sort formula //lance:sort formula
String sText = null; dSColumn.setSortFormulaObject(sortFormulaTextField.getValue());
if (!(sortFormulaTextField.getText() == null || sortFormulaTextField.getText().trim().equals("") || sortFormulaTextField.getText().trim().equals("$$$"))) {
sText = new String(sortFormulaTextField.getText());
}
if (!(sText == null || sText.length() < 1)) {
dSColumn.setSortFormula(sText);
} else {
dSColumn.setSortFormula(null);
}
} }
} }
@ -367,9 +369,9 @@ public class DSColumnAdvancedPane extends BasicPane {
int selectCountType = selectCount.getType(); int selectCountType = selectCount.getType();
this.selectCountComboBox.setSelectedIndex(selectCountType); this.selectCountComboBox.setSelectedIndex(selectCountType);
if (selectCountType == TOP.getValue()) { if (selectCountType == TOP.getValue()) {
this.topFormulaPane.populate(selectCount.getFormulaCount()); this.topFormulaPane.populateFormula(selectCount.getFormulaObject());
} else if (selectCountType == BOTTOM.getValue()) { } else if (selectCountType == BOTTOM.getValue()) {
this.bottomFormulaPane.populate(selectCount.getFormulaCount()); this.bottomFormulaPane.populateFormula(selectCount.getFormulaObject());
} else if (selectCountType == SPECIFY.getValue()) { } else if (selectCountType == SPECIFY.getValue()) {
this.serialTextField.setText(selectCount.getSerial()); this.serialTextField.setText(selectCount.getSerial());
} }
@ -395,9 +397,9 @@ public class DSColumnAdvancedPane extends BasicPane {
dSColumn.setSelectCount(selectCount); dSColumn.setSelectCount(selectCount);
selectCount.setType(selectCountSelectIndex); selectCount.setType(selectCountSelectIndex);
if (selectCountSelectIndex == TOP.getValue()) { if (selectCountSelectIndex == TOP.getValue()) {
selectCount.setFormulaCount(this.topFormulaPane.getFormulaText()); selectCount.setFormulaObject(this.topFormulaPane.getFormula());
} else if (selectCountSelectIndex == BOTTOM.getValue()) { } else if (selectCountSelectIndex == BOTTOM.getValue()) {
selectCount.setFormulaCount(this.bottomFormulaPane.getFormulaText()); selectCount.setFormulaObject(this.bottomFormulaPane.getFormula());
} else if (selectCountSelectIndex == SPECIFY.getValue()) { } else if (selectCountSelectIndex == SPECIFY.getValue()) {
selectCount.setSerial(this.serialTextField.getText()); selectCount.setSerial(this.serialTextField.getText());
} }
@ -407,19 +409,19 @@ public class DSColumnAdvancedPane extends BasicPane {
private static class JFormulaField extends JPanel { private static class JFormulaField extends JPanel {
private CellElement cellElement; private CellElement cellElement;
private UITextField formulaTextField; private FormulaTextField formulaTextField;
private String defaultValue; private BaseFormula defaultFormula;
public JFormulaField(String defaultValue) { public JFormulaField(String defaultValue) {
this.defaultValue = defaultValue; this.defaultFormula = BaseFormula.createFormulaBuilder().build(defaultValue);
this.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); this.setLayout(FRGUIPaneFactory.createBoxFlowLayout());
UILabel bottomLabel = new UILabel("="); UILabel bottomLabel = new UILabel("=");
bottomLabel.setFont(new Font("Dialog", Font.BOLD, 12)); bottomLabel.setFont(new Font("Dialog", Font.BOLD, 12));
this.add(bottomLabel); this.add(bottomLabel);
formulaTextField = new UITextField(24); formulaTextField = new FormulaTextField(24);
this.add(formulaTextField); this.add(formulaTextField);
formulaTextField.setText(defaultValue); formulaTextField.setValue(defaultFormula);
UIButton bottomFrmulaButton = new UIButton("..."); UIButton bottomFrmulaButton = new UIButton("...");
this.add(bottomFrmulaButton); this.add(bottomFrmulaButton);
@ -440,15 +442,24 @@ public class DSColumnAdvancedPane extends BasicPane {
return this.formulaTextField.getText(); return this.formulaTextField.getText();
} }
public void populateFormula(BaseFormula baseFormula) {
this.formulaTextField.setValue(baseFormula);
this.formulaTextField.setText(baseFormula.getPureContent());
}
public BaseFormula getFormula() {
return this.formulaTextField.getValue();
}
private ActionListener formulaButtonActionListener = new ActionListener() { private ActionListener formulaButtonActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build();
String text = formulaTextField.getText(); BaseFormula valueFormula = formulaTextField.getValue();
if (text == null || text.length() <= 0) { if (valueFormula == null) {
valueFormula.setContent(defaultValue); valueFormula = BaseFormula.createFormulaBuilder().build();
} else {
valueFormula.setContent(text);
} }
final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula();
@ -457,7 +468,7 @@ public class DSColumnAdvancedPane extends BasicPane {
return; return;
} }
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value == null || !(value instanceof DSColumn)) { if (!(value instanceof DSColumn)) {
return; return;
} }
DSColumn dsColumn = (DSColumn) value; DSColumn dsColumn = (DSColumn) value;
@ -470,9 +481,9 @@ public class DSColumnAdvancedPane extends BasicPane {
public void doOk() { public void doOk() {
BaseFormula valueFormula = formulaPane.update(); BaseFormula valueFormula = formulaPane.update();
if (valueFormula.getContent().length() <= 1) { if (valueFormula.getContent().length() <= 1) {
formulaTextField.setText(defaultValue); formulaTextField.setValue(defaultFormula);
} else { } else {
formulaTextField.setText(valueFormula.getContent().substring(1)); formulaTextField.setValue(valueFormula);
} }
} }
}).setVisible(true); }).setVisible(true);
@ -503,12 +514,12 @@ public class DSColumnAdvancedPane extends BasicPane {
DSColumn dSColumn = (DSColumn) value; DSColumn dSColumn = (DSColumn) value;
//formula //formula
String valueFormula = dSColumn.getResult(); BaseFormula valueFormula = dSColumn.getResultObject();
if (valueFormula == null) { if (valueFormula == null) {
valueFormula = "$$$"; valueFormula = BaseFormula.createFormulaBuilder().build("$$$");
} }
formulaField.populateElement(cellElement); formulaField.populateElement(cellElement);
formulaField.populate(valueFormula); formulaField.populateFormula(valueFormula);
} }
public void update(CellElement cellElement) { public void update(CellElement cellElement) {
@ -516,13 +527,13 @@ public class DSColumnAdvancedPane extends BasicPane {
return; return;
} }
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value == null || !(value instanceof DSColumn)) { if (!(value instanceof DSColumn)) {
return; return;
} }
DSColumn dSColumn = (DSColumn) (cellElement.getValue()); DSColumn dSColumn = (DSColumn) (cellElement.getValue());
//formula //formula
dSColumn.setResult(this.formulaField.getFormulaText()); dSColumn.setResultObject(this.formulaField.getFormula());
} }
} }

72
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -12,6 +12,7 @@ import com.fr.design.dscolumn.SelectedDataColumnPane;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.formula.CustomVariableResolver; import com.fr.design.formula.CustomVariableResolver;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.FormulaTextField;
import com.fr.design.formula.UIFormula; import com.fr.design.formula.UIFormula;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
@ -645,6 +646,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/ */
public class ResultSetSortConfigPane extends JPanel { public class ResultSetSortConfigPane extends JPanel {
private static final String DEFAULT_VALUE = "="; private static final String DEFAULT_VALUE = "=";
private final BaseFormula DEFAULT_FORMULA = BaseFormula.createFormulaBuilder().build();
private JPanel contentPane; private JPanel contentPane;
private UIButtonGroup sortTypePane; private UIButtonGroup sortTypePane;
private JFormulaField formulaField; private JFormulaField formulaField;
@ -719,11 +721,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
centerPane.setPreferredSize(new Dimension(156, 20)); centerPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
} }
String sortFormula = dSColumn.getSortFormula(); BaseFormula baseFormula = dSColumn.getSortFormulaObject();
if (sortFormula != null && sortFormula.length() >= 1) { if (baseFormula == null) {
this.formulaField.populate(sortFormula); this.formulaField.populateFormula(DEFAULT_FORMULA);
} else { } else {
this.formulaField.populate(DEFAULT_VALUE); this.formulaField.populateFormula(baseFormula);
} }
} }
} }
@ -740,7 +742,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
if (value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) value; DSColumn dSColumn = (DSColumn) value;
dSColumn.setOrder(this.sortTypePane.getSelectedIndex()); dSColumn.setOrder(this.sortTypePane.getSelectedIndex());
dSColumn.setSortFormula(this.formulaField.getFormulaText()); dSColumn.setSortFormulaObject(this.formulaField.getFormula());
} }
} }
} }
@ -774,6 +776,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/ */
public class ResultSetFilterConfigPane extends JPanel { public class ResultSetFilterConfigPane extends JPanel {
private static final String DEFAULT_VALUE = "="; private static final String DEFAULT_VALUE = "=";
private final BaseFormula DEFAULT_FORMULA = BaseFormula.createFormulaBuilder().build(DEFAULT_VALUE);
private JPanel contentPane; private JPanel contentPane;
private UIComboBox rsComboBox; private UIComboBox rsComboBox;
@ -918,8 +921,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout(); CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout();
CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout(); CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout();
// 重置默认值 // 重置默认值
this.topFormulaPane.populate(DEFAULT_VALUE); this.topFormulaPane.populateFormula(DEFAULT_FORMULA);
this.bottomFormulaPane.populate(DEFAULT_VALUE); this.bottomFormulaPane.populateFormula(DEFAULT_FORMULA);
this.serialTextField.setText(StringUtils.EMPTY); this.serialTextField.setText(StringUtils.EMPTY);
if (selectCount != null) { if (selectCount != null) {
@ -927,7 +930,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
this.rsComboBox.setSelectedIndex(selectCountType); this.rsComboBox.setSelectedIndex(selectCountType);
switch (FilterTypeEnum.getFilterByValue(selectCountType)) { switch (FilterTypeEnum.getFilterByValue(selectCountType)) {
case TOP: case TOP:
this.topFormulaPane.populate(selectCount.getFormulaCount()); this.topFormulaPane.populateFormula(selectCount.getFormulaObject());
//前N个 //前N个
setCardPaneLayout.show(setCardPane, TOP.name()); setCardPaneLayout.show(setCardPane, TOP.name());
tipCardPaneLayout.show(tipCardPane, TOP.name()); tipCardPaneLayout.show(tipCardPane, TOP.name());
@ -938,7 +941,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0); TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
break; break;
case BOTTOM: case BOTTOM:
this.bottomFormulaPane.populate(selectCount.getFormulaCount()); this.bottomFormulaPane.populateFormula(selectCount.getFormulaObject());
//后N个 //后N个
setCardPaneLayout.show(setCardPane, BOTTOM.name()); setCardPaneLayout.show(setCardPane, BOTTOM.name());
tipCardPaneLayout.show(tipCardPane, BOTTOM.name()); tipCardPaneLayout.show(tipCardPane, BOTTOM.name());
@ -1019,9 +1022,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
dSColumn.setSelectCount(selectCount); dSColumn.setSelectCount(selectCount);
//noinspection Duplicates //noinspection Duplicates
if (selectedFilterIndex == TOP.getValue()) { if (selectedFilterIndex == TOP.getValue()) {
selectCount.setFormulaCount(this.topFormulaPane.getFormulaText()); selectCount.setFormulaObject(this.topFormulaPane.getFormula());
} else if (selectedFilterIndex == BOTTOM.getValue()) { } else if (selectedFilterIndex == BOTTOM.getValue()) {
selectCount.setFormulaCount(this.bottomFormulaPane.getFormulaText()); selectCount.setFormulaObject(this.bottomFormulaPane.getFormula());
} else if (selectedFilterIndex == SPECIFY.getValue()) { } else if (selectedFilterIndex == SPECIFY.getValue()) {
selectCount.setSerial(this.serialTextField.getText()); selectCount.setSerial(this.serialTextField.getText());
} }
@ -1060,14 +1063,15 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/ */
public class JFormulaField extends JPanel { public class JFormulaField extends JPanel {
private CellElement cellElement; private CellElement cellElement;
private UITextField formulaTextField; private FormulaTextField formulaTextField;
private String defaultValue; private BaseFormula defaultFormula;
public JFormulaField(String defaultValue) { public JFormulaField(String defaultValue) {
this.defaultValue = defaultValue; this.defaultFormula = BaseFormula.createFormulaBuilder().build(defaultValue);
formulaTextField = new UITextField(); formulaTextField = new FormulaTextField();
formulaTextField.setText(defaultValue); formulaTextField.setValue(defaultFormula);
JPanel textFieldPane = new JPanel(new BorderLayout()); JPanel textFieldPane = new JPanel(new BorderLayout());
textFieldPane.add(formulaTextField, BorderLayout.CENTER); textFieldPane.add(formulaTextField, BorderLayout.CENTER);
textFieldPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); textFieldPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
@ -1095,6 +1099,16 @@ public class CellDSColumnEditor extends CellQuickEditor {
return this.formulaTextField.getText().trim(); return this.formulaTextField.getText().trim();
} }
public void populateFormula(BaseFormula baseFormula) {
this.formulaTextField.setValue(baseFormula);
}
public BaseFormula getFormula() {
return this.formulaTextField.getValue();
}
/** /**
* 添加事件监听器 * 添加事件监听器
* *
@ -1114,16 +1128,14 @@ public class CellDSColumnEditor extends CellQuickEditor {
private ActionListener formulaButtonActionListener = new ActionListener() { private ActionListener formulaButtonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build();
String text = formulaTextField.getText(); BaseFormula valueFormula = formulaTextField.getValue();
if (text == null || text.length() <= 0) { if (valueFormula == null) {
valueFormula.setContent(defaultValue); valueFormula = BaseFormula.createFormulaBuilder().build();
} else {
valueFormula.setContent(text);
} }
final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula();
if (cellElement != null) { if (cellElement != null) {
Object value = cellElement.getValue(); final Object value = cellElement.getValue();
if (value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dsColumn = (DSColumn) value; DSColumn dsColumn = (DSColumn) value;
String[] displayNames = DesignTableDataManager.getSelectedColumnNames(DesignTableDataManager.getEditingTableDataSource(), dsColumn.getDSName()); String[] displayNames = DesignTableDataManager.getSelectedColumnNames(DesignTableDataManager.getEditingTableDataSource(), dsColumn.getDSName());
@ -1133,9 +1145,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
public void doOk() { public void doOk() {
BaseFormula valueFormula = formulaPane.update(); BaseFormula valueFormula = formulaPane.update();
if (valueFormula.getContent().length() <= 1) { if (valueFormula.getContent().length() <= 1) {
formulaTextField.setText(defaultValue); formulaTextField.setValue(defaultFormula);
} else { } else {
formulaTextField.setText(valueFormula.getContent()); formulaTextField.setValue(valueFormula);
} }
} }
}).setVisible(true); }).setVisible(true);
@ -1152,6 +1164,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
*/ */
public class CustomValuePane extends JPanel { public class CustomValuePane extends JPanel {
private static final String DEFAULT_VALUE = "=$$$"; private static final String DEFAULT_VALUE = "=$$$";
private final BaseFormula DEFAULT_FORMULA = BaseFormula.createFormulaBuilder().build(DEFAULT_VALUE);
private JFormulaField formulaField; private JFormulaField formulaField;
@ -1171,11 +1184,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
if (value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) value; DSColumn dSColumn = (DSColumn) value;
//formula //formula
String valueFormula = dSColumn.getResult(); BaseFormula valueFormula = dSColumn.getResultObject();
if (valueFormula != null) { if (valueFormula != null) {
formulaField.populate(valueFormula); formulaField.populateFormula(valueFormula);
} else { } else {
formulaField.populate(DEFAULT_VALUE); formulaField.populateFormula(DEFAULT_FORMULA);
} }
formulaField.populateElement(cellElement); formulaField.populateElement(cellElement);
@ -1188,8 +1201,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
Object value = cellElement.getValue(); Object value = cellElement.getValue();
if (value instanceof DSColumn) { if (value instanceof DSColumn) {
DSColumn dSColumn = (DSColumn) (cellElement.getValue()); DSColumn dSColumn = (DSColumn) (cellElement.getValue());
dSColumn.setResult(StringUtils.isEmpty(this.formulaField.getFormulaText()) ? dSColumn.setResultObject(this.formulaField.getFormula());
null : this.formulaField.getFormulaText());
} }
} }
} }

4
pom.xml

@ -28,8 +28,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version> <version>3.1</version>
<configuration> <configuration>
<source>1.7</source> <source>1.8</source>
<target>1.7</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

Loading…
Cancel
Save