Browse Source

甘特图和框架图标签内容增加样式

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
934fb252eb
  1. 74
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartLabelContentPaneWithoutRichText.java
  2. 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;
} }

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