Browse Source

Pull request #2408: CHART-15510 调整标签样式面板

Merge in DESIGN/design from ~QINGHUI.LIU/design:release/10.0 to release/10.0

* commit 'fd5bb24b8794ed777279c917ed62563a16424f2c':
  删除多余的setDirty
  甘特图和框架图标签内容增加样式
  通用和自定义中都支持样式
feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
332b310570
  1. 74
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPaneWithoutRichText.java
  2. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  3. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/component/label/GaugeLabelContentPane.java

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

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

Loading…
Cancel
Save