Browse Source

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

feature/big-screen
Yuan.Wang 4 years ago
parent
commit
61179451ab
  1. 1
      designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java
  2. 75
      designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java
  3. 257
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java
  4. 11
      designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java
  5. 10
      designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java
  6. 37
      designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java
  7. 16
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  8. 8
      designer-realize/src/main/java/com/fr/grid/IntelliElements.java

1
designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomDataPane.java

@ -27,6 +27,7 @@ public class VanChartCustomDataPane extends ChartDataPane {
} }
contentsTabPane = new VanChartCustomPlotDataContentsTabPane((VanChartCustomPlot)chart.getPlot(), VanChartCustomDataPane.this, listener); contentsTabPane = new VanChartCustomPlotDataContentsTabPane((VanChartCustomPlot)chart.getPlot(), VanChartCustomDataPane.this, listener);
contentsTabPane.setSupportCellData(isSupportCellData());
content.add(contentsTabPane, BorderLayout.CENTER); content.add(contentsTabPane, BorderLayout.CENTER);
return content; return content;

75
designer-chart/src/main/java/com/fr/van/chart/custom/VanChartCustomPlotDataContentsTabPane.java

@ -22,14 +22,25 @@ import java.util.Map;
* Created by Fangjie on 2016/4/29. * Created by Fangjie on 2016/4/29.
*/ */
public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, ChartCollection> { public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, ChartCollection> {
private boolean supportCellData;
public VanChartCustomPlotDataContentsTabPane(VanChartCustomPlot plot, VanChartCustomDataPane parent, AttributeChangeListener listener) { public VanChartCustomPlotDataContentsTabPane(VanChartCustomPlot plot, VanChartCustomDataPane parent, AttributeChangeListener listener) {
super(plot, parent, listener); super(plot, parent, listener);
} }
public boolean isSupportCellData() {
return supportCellData;
}
public void setSupportCellData(boolean supportCellData) {
this.supportCellData = supportCellData;
}
@Override @Override
protected void initTabTitle() { protected void initTabTitle() {
if (plot == null){ if (plot == null) {
return; return;
} }
@ -49,7 +60,7 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
@Override @Override
protected List<JPanel> initPaneList() { protected List<JPanel> initPaneList() {
if (plot == null){ if (plot == null) {
return null; return null;
} }
@ -57,9 +68,10 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); List<VanChartPlot> customPlotList = plot.getCustomPlotList();
for (int i = 0; i < customPlotList.size(); i++){ for (int i = 0; i < customPlotList.size(); i++) {
//根据不同的plot创建不同的数据配置界面 //根据不同的plot创建不同的数据配置界面
ChartDataPane contentPane = new VanChartDataPane(listener); ChartDataPane contentPane = new VanChartDataPane(listener);
contentPane.setSupportCellData(supportCellData);
paneList.add(contentPane); paneList.add(contentPane);
} }
@ -67,42 +79,38 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
} }
@Override @Override
public void populateBean(ChartCollection chartCollection){ public void populateBean(ChartCollection chartCollection) {
plot = (VanChartCustomPlot) chartCollection.getSelectedChart().getPlot(); plot = (VanChartCustomPlot) chartCollection.getSelectedChart().getPlot();
if (paneList == null){ paneList = initPaneList();
paneList = initPaneList();
}
if (paneList != null){
try {
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); relayoutWhenListChange();
try {
List<VanChartPlot> customPlotList = plot.getCustomPlotList();
for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++) {
//將plot包裝起来,主要是为了获取dataDefinition
ChartCollection cloneCollection = (ChartCollection) chartCollection.clone();
//设置collection的plot for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++) {
cloneCollection.getSelectedChart().setPlot(customPlotList.get(i)); //將plot包裝起来,主要是为了获取dataDefinition
ChartCollection cloneCollection = (ChartCollection) chartCollection.clone();
//获取definitionMap中的dataDefinition //设置collection的plot
TopDefinitionProvider definition = chartCollection.getSelectedChart().getFilterDefinition(); cloneCollection.getSelectedChart().setPlot(customPlotList.get(i));
TopDefinitionProvider dataDefinition = null;
if (definition != null && definition instanceof CustomDefinition) {
Map<CustomPlotType, TopDefinitionProvider> definitionProviderMap = ((CustomDefinition)definition).getDefinitionProviderMap();
dataDefinition = definitionProviderMap.get(CustomPlotFactory.getCustomType(customPlotList.get(i)));
}
cloneCollection.getSelectedChart().setFilterDefinition(dataDefinition);
((ChartDataPane) paneList.get(i)).populate(cloneCollection); //获取definitionMap中的dataDefinition
TopDefinitionProvider definition = chartCollection.getSelectedChart().getFilterDefinition();
TopDefinitionProvider dataDefinition = null;
if (definition != null && definition instanceof CustomDefinition) {
Map<CustomPlotType, TopDefinitionProvider> definitionProviderMap = ((CustomDefinition) definition).getDefinitionProviderMap();
dataDefinition = definitionProviderMap.get(CustomPlotFactory.getCustomType(customPlotList.get(i)));
} }
}catch (Exception e){ cloneCollection.getSelectedChart().setFilterDefinition(dataDefinition);
return;
((ChartDataPane) paneList.get(i)).populate(cloneCollection);
} }
} catch (Exception e) {
return;
} }
} }
@ -112,8 +120,8 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
} }
@Override @Override
public void updateBean(ChartCollection collection){ public void updateBean(ChartCollection collection) {
if (paneList == null || plot == null){ if (paneList == null || plot == null) {
return; return;
} }
try { try {
@ -146,7 +154,7 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
customDefinition.setDefinitionProviderMap(definitionMap); customDefinition.setDefinitionProviderMap(definitionMap);
collection.getSelectedChart().setFilterDefinition(customDefinition); collection.getSelectedChart().setFilterDefinition(customDefinition);
}catch (Exception e){ } catch (Exception e) {
return; return;
} }
} }
@ -168,10 +176,11 @@ public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTab
/** /**
* 返回绑定的属性事件. * 返回绑定的属性事件.
* @param listener 增加监听 *
* @param listener 增加监听
*/ */
public void addAttributeChangeListener(AttributeChangeListener listener) { public void addAttributeChangeListener(AttributeChangeListener listener) {
for (int i = 0; i < paneList.size(); i++){ for (int i = 0; i < paneList.size(); i++) {
((ChartDataPane) paneList.get(i)).addAttributeChangeListener(listener); ((ChartDataPane) paneList.get(i)).addAttributeChangeListener(listener);
} }
} }

257
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/VanChartBaseAxisPane.java

@ -54,11 +54,13 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
private static final long serialVersionUID = -5717246802333308973L; private static final long serialVersionUID = -5717246802333308973L;
private static final double ROTATION_MAX = 90.0; private static final double ROTATION_MAX = 90.0;
protected UIButtonGroup showTitle;
protected TinyFormulaPane titleContent; protected TinyFormulaPane titleContent;
protected UIButtonGroup<Integer> titleAlignPane; protected UIButtonGroup<Integer> titleAlignPane;
protected UIToggleButton titleUseHtml; protected UIToggleButton titleUseHtml;
protected ChartTextAttrPane titleTextAttrPane; protected ChartTextAttrPane titleTextAttrPane;
protected UINumberDragPane titleTextRotation; protected UINumberDragPane titleTextRotation;
protected JPanel titlePane;
protected UIButtonGroup showLabel; protected UIButtonGroup showLabel;
protected ChartTextAttrPane labelTextAttrPane; protected ChartTextAttrPane labelTextAttrPane;
@ -96,11 +98,11 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
protected JPanel centerPane; protected JPanel centerPane;
private VanChartHtmlLabelPane htmlLabelPane; private VanChartHtmlLabelPane htmlLabelPane;
public VanChartBaseAxisPane(){ public VanChartBaseAxisPane() {
this(true); this(true);
} }
public VanChartBaseAxisPane(boolean isXAxis){ public VanChartBaseAxisPane(boolean isXAxis) {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(createContentPane(isXAxis), BorderLayout.CENTER); this.add(createContentPane(isXAxis), BorderLayout.CENTER);
} }
@ -108,12 +110,13 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
public void setParentPane(VanChartStylePane parent) { public void setParentPane(VanChartStylePane parent) {
htmlLabelPane.setParent(parent); htmlLabelPane.setParent(parent);
} }
protected void reLayoutPane(boolean isXAxis){
protected void reLayoutPane(boolean isXAxis) {
this.removeAll(); this.removeAll();
this.add(createContentPane(isXAxis), BorderLayout.CENTER); this.add(createContentPane(isXAxis), BorderLayout.CENTER);
} }
protected JPanel createContentPane(boolean isXAxis){ protected JPanel createContentPane(boolean isXAxis) {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
@ -121,7 +124,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
double s = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; double s = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
double[] columnSize = {f, e}; double[] columnSize = {f, e};
double[] column = {f, s}; double[] column = {f, s};
double[] rowSize = {p, p, p, p, p, p, p,p}; double[] rowSize = {p, p, p, p, p, p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{createTitlePane(new double[]{p, p, p, p, p, p}, columnSize, isXAxis), null}, new Component[]{createTitlePane(new double[]{p, p, p, p, p, p}, columnSize, isXAxis), null},
new Component[]{createLabelPane(new double[]{p, p}, column), null}, new Component[]{createLabelPane(new double[]{p, p}, column), null},
@ -131,39 +134,52 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
new Component[]{createValueStylePane(), null}, new Component[]{createValueStylePane(), null},
}; };
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
} }
protected JPanel createTitlePane(double[] row, double[] col, boolean isXAxis){ protected JPanel createTitlePane(double[] row, double[] col, boolean isXAxis) {
showTitle = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Use_Show"), Toolkit.i18nText("Fine-Design_Chart_Hidden")});
titleAlignPane = isXAxis ? getXAxisTitleAlignPane() : getYAxisTitleAlignPane(); titleAlignPane = isXAxis ? getXAxisTitleAlignPane() : getYAxisTitleAlignPane();
titleAlignPane.setSelectedItem(Constants.CENTER); titleAlignPane.setSelectedItem(Constants.CENTER);
titleContent = new TinyFormulaPane(); titleContent = new TinyFormulaPane();
titleUseHtml = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Html")); titleUseHtml = new UIToggleButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Html"));
UIComponentUtils.setLineWrap(titleUseHtml); UIComponentUtils.setLineWrap(titleUseHtml);
titleTextAttrPane = new ChartTextAttrPane(); titleTextAttrPane = new ChartTextAttrPane();
titleTextRotation = new UINumberDragPane(-ROTATION_MAX,ROTATION_MAX); titleTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX);
if(isXAxis){ if (isXAxis) {
titleTextRotation.populateBean(0.0); titleTextRotation.populateBean(0.0);
} else { } else {
titleTextRotation.populateBean(-ROTATION_MAX); titleTextRotation.populateBean(-ROTATION_MAX);
} }
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")),titleContent}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Content")), titleContent},
new Component[]{null,titleUseHtml}, new Component[]{null, titleUseHtml},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position")),titleAlignPane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position")), titleAlignPane},
new Component[]{titleTextAttrPane,null}, new Component[]{titleTextAttrPane, null},
new Component[]{ new Component[]{
FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TextRotation")), FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TextRotation")),
UIComponentUtils.wrapWithBorderLayoutPane(titleTextRotation) UIComponentUtils.wrapWithBorderLayoutPane(titleTextRotation)
}, },
}; };
titlePane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); JPanel showTitlePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Axis_Title"), showTitle);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_TITLE_TITLE, panel); showTitle.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkTitlePane();
}
});
JPanel jPanel = new JPanel(new BorderLayout());
jPanel.add(showTitlePane, BorderLayout.NORTH);
jPanel.add(titlePane, BorderLayout.CENTER);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_TITLE_TITLE, jPanel);
} }
private UIButtonGroup<Integer> getXAxisTitleAlignPane(){ private UIButtonGroup<Integer> getXAxisTitleAlignPane() {
Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")};
@ -171,7 +187,8 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
return new UIButtonGroup<Integer>(alignmentIconArray, alignment); return new UIButtonGroup<Integer>(alignmentIconArray, alignment);
} }
private UIButtonGroup<Integer> getYAxisTitleAlignPane(){
private UIButtonGroup<Integer> getYAxisTitleAlignPane() {
Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal.png"), Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png")}; BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png")};
@ -180,7 +197,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
return new UIButtonGroup<Integer>(alignmentIconArray, alignment); return new UIButtonGroup<Integer>(alignmentIconArray, alignment);
} }
protected JPanel createLabelPane(double[] row, double[] col){ protected JPanel createLabelPane(double[] row, double[] col) {
showLabel = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Show"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hidden")}); showLabel = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Show"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Hidden")});
labelTextAttrPane = getChartTextAttrPane(); labelTextAttrPane = getChartTextAttrPane();
@ -205,9 +222,9 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
new Component[]{gapPanel, null}, new Component[]{gapPanel, null},
}; };
JPanel showLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label"),showLabel); JPanel showLabelPane = TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label"), showLabel);
labelPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); labelPanel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
labelPanel.setBorder(BorderFactory.createEmptyBorder(0,10,0,0)); labelPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
showLabel.addActionListener(new ActionListener() { showLabel.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -308,11 +325,11 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
} }
protected ChartTextAttrPane getChartTextAttrPane(){ protected ChartTextAttrPane getChartTextAttrPane() {
return new ChartTextAttrPane(){ return new ChartTextAttrPane() {
@Override @Override
protected JPanel getContentPane (JPanel buttonPane) { protected JPanel getContentPane(JPanel buttonPane) {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH; double e = TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH;
@ -324,10 +341,10 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
}; };
} }
protected JPanel createLineStylePane(double[] row, double[] col){ protected JPanel createLineStylePane(double[] row, double[] col) {
axisLineStyle = createLineComboBox(); axisLineStyle = createLineComboBox();
axisLineColor = new ColorSelectBox(100); axisLineColor = new ColorSelectBox(100);
String[] strings = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}; String[] strings = new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")};
AxisTickLineType[] values = new AxisTickLineType[]{AxisTickLineType.TICK_LINE_OUTSIDE, AxisTickLineType.TICK_LINE_NONE}; AxisTickLineType[] values = new AxisTickLineType[]{AxisTickLineType.TICK_LINE_OUTSIDE, AxisTickLineType.TICK_LINE_NONE};
mainTick = new UIButtonGroup<AxisTickLineType>(strings, values); mainTick = new UIButtonGroup<AxisTickLineType>(strings, values);
secondTick = new UIButtonGroup<AxisTickLineType>(strings, values); secondTick = new UIButtonGroup<AxisTickLineType>(strings, values);
@ -342,15 +359,15 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
protected Component[][] getLineStylePaneComponents() { protected Component[][] getLineStylePaneComponents() {
return new Component[][]{ return new Component[][]{
new Component[]{null,null} , new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Type")),axisLineStyle} , new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Type")), axisLineStyle},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")),axisLineColor}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Color")), axisLineColor},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Main_Graduation_Line")),mainTick}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Main_Graduation_Line")), mainTick},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Second_Graduation_Line")),secondTick}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Second_Graduation_Line")), secondTick},
}; };
} }
protected JPanel createAxisPositionPane(double[] row, double[] col, boolean isXAxis){ protected JPanel createAxisPositionPane(double[] row, double[] col, boolean isXAxis) {
position = new UIButtonGroup<Integer>(getAxisPositionNameArray(isXAxis), getAxisPositionValueArray(isXAxis)); position = new UIButtonGroup<Integer>(getAxisPositionNameArray(isXAxis), getAxisPositionValueArray(isXAxis));
reversed = new UIButtonGroup<Boolean>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_On"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false}); reversed = new UIButtonGroup<Boolean>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_On"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Off")}, new Boolean[]{true, false});
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
@ -359,30 +376,30 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Position")), FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Position")),
UIComponentUtils.wrapWithBorderLayoutPane(position) UIComponentUtils.wrapWithBorderLayoutPane(position)
}, },
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_AxisReversed")),reversed}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_AxisReversed")), reversed},
} ; };
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col); JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, row, col);
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), panel); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Position"), panel);
} }
private String[] getAxisPositionNameArray(boolean isXAxis){ private String[] getAxisPositionNameArray(boolean isXAxis) {
if(isXAxis){ if (isXAxis) {
return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Top"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Bottom"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Vertical_Zero")}; return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Top"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Bottom"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Vertical_Zero")};
} else { } else {
return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Right"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Vertical_Zero")}; return new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Left"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout_Right"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Vertical_Zero")};
} }
} }
private Integer[] getAxisPositionValueArray(boolean isXAxis){ private Integer[] getAxisPositionValueArray(boolean isXAxis) {
if(isXAxis){ if (isXAxis) {
return new Integer[]{VanChartConstants.AXIS_TOP, VanChartConstants.AXIS_BOTTOM, VanChartConstants.AXIS_VERTICAL_ZERO}; return new Integer[]{VanChartConstants.AXIS_TOP, VanChartConstants.AXIS_BOTTOM, VanChartConstants.AXIS_VERTICAL_ZERO};
} else { } else {
return new Integer[]{VanChartConstants.AXIS_LEFT, VanChartConstants.AXIS_RIGHT, VanChartConstants.AXIS_VERTICAL_ZERO}; return new Integer[]{VanChartConstants.AXIS_LEFT, VanChartConstants.AXIS_RIGHT, VanChartConstants.AXIS_VERTICAL_ZERO};
} }
} }
protected JPanel createDisplayStrategy(){ protected JPanel createDisplayStrategy() {
//区域显示策略 恢复用注释。删除到return,即除了注释的代码都删除。 //区域显示策略 恢复用注释。删除到return,即除了注释的代码都删除。
maxProportion = new UISpinner(0, 100, 1, 30); maxProportion = new UISpinner(0, 100, 1, 30);
axisLimitSize = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")}); axisLimitSize = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Limit"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Not_Limit")});
@ -408,7 +425,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
// return limitPane; // return limitPane;
} }
protected JPanel createValueStylePane(){ protected JPanel createValueStylePane() {
valueFormatStyle = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common"), valueFormatStyle = 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")});
@ -418,19 +435,19 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
htmlLabelPane = new VanChartHtmlLabelPane(); htmlLabelPane = new VanChartHtmlLabelPane();
centerPane = new JPanel(new CardLayout()); centerPane = new JPanel(new CardLayout());
centerPane.add(valueFormat,com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common")); centerPane.add(valueFormat, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common"));
centerPane.add(htmlLabelPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")); centerPane.add(htmlLabelPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom"));
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {p,f}; double[] columnSize = {p, f};
double[] rowSize = {p,p,p}; double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{null,null}, new Component[]{null, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Format"), SwingConstants.LEFT), valueFormatStyle}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Axis_Label_Format"), SwingConstants.LEFT), valueFormatStyle},
new Component[]{null, centerPane}, new Component[]{null, centerPane},
}; };
JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components,rowSize,columnSize); JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize);
valueFormatStyle.addActionListener(new ActionListener() { valueFormatStyle.addActionListener(new ActionListener() {
@ -443,12 +460,12 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Format"), contentPane); return TableLayout4VanChartHelper.createExpandablePaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Format"), contentPane);
} }
protected FormatPane createFormatPane(){ protected FormatPane createFormatPane() {
return new FormatPane(){ return new FormatPane() {
protected Component[][] getComponent (JPanel fontPane, JPanel centerPane, JPanel typePane) { protected Component[][] getComponent(JPanel fontPane, JPanel centerPane, JPanel typePane) {
typePane.setBorder(BorderFactory.createEmptyBorder()); typePane.setBorder(BorderFactory.createEmptyBorder());
return new Component[][]{ return new Component[][]{
new Component[]{typePane,null}, new Component[]{typePane, null},
new Component[]{centerPane, null}, new Component[]{centerPane, null},
}; };
} }
@ -462,6 +479,7 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
protected void checkAllUse() { protected void checkAllUse() {
checkCardPane(); checkCardPane();
checkLabelPane(); checkLabelPane();
checkTitlePane();
//区域显示策略 恢复用注释。删除下面一行。 //区域显示策略 恢复用注释。删除下面一行。
checkMaxProPortionUse(); checkMaxProPortionUse();
@ -480,10 +498,10 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
} }
protected void checkCardPane() { protected void checkCardPane() {
if(centerPane != null && valueFormatStyle != null){ if (centerPane != null && valueFormatStyle != null) {
CardLayout cardLayout = (CardLayout) centerPane.getLayout(); CardLayout cardLayout = (CardLayout) centerPane.getLayout();
if (valueFormatStyle.getSelectedIndex() == 1) { if (valueFormatStyle.getSelectedIndex() == 1) {
cardLayout.show(centerPane,com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom")); cardLayout.show(centerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Custom"));
} else { } else {
cardLayout.show(centerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common")); cardLayout.show(centerPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Common"));
} }
@ -491,12 +509,12 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
} }
protected void checkLabelPane() { protected void checkLabelPane() {
if(showLabel != null){ if (showLabel != null) {
boolean enabled = showLabel.getSelectedIndex() == 0; boolean enabled = showLabel.getSelectedIndex() == 0;
if(labelPanel != null){ if (labelPanel != null) {
labelPanel.setVisible(enabled); labelPanel.setVisible(enabled);
} }
if(enabled){ if (enabled) {
//轴标签缩略间隔显示 恢复用注释。下面1行删除。 //轴标签缩略间隔显示 恢复用注释。下面1行删除。
checkLabelGapValuePane(); checkLabelGapValuePane();
//轴标签缩略间隔显示 恢复用注释。取消注释。 //轴标签缩略间隔显示 恢复用注释。取消注释。
@ -505,6 +523,12 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
} }
} }
protected void checkTitlePane() {
if (showTitle != null && titlePane != null) {
titlePane.setVisible(showTitle.getSelectedIndex() == 0);
}
}
private void checkLabelGapAndStylePane() { private void checkLabelGapAndStylePane() {
if (overlapHandleTypeGroup != null && labelGapStylePane != null) { if (overlapHandleTypeGroup != null && labelGapStylePane != null) {
boolean visible = overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL; boolean visible = overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL;
@ -528,28 +552,31 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
/** /**
* 是否是指定类型 * 是否是指定类型
*
* @param ob 对象 * @param ob 对象
* @return 是否是指定类型 * @return 是否是指定类型
*/ */
public boolean accept(Object ob){ public boolean accept(Object ob) {
return false; return false;
} }
/** /**
* title应该是一个属性不只是对话框的标题时用到与其他组件结合时也会用得到 * title应该是一个属性不只是对话框的标题时用到与其他组件结合时也会用得到
*
* @return 绥化狂标题 * @return 绥化狂标题
*/ */
@Override @Override
public String title4PopupWindow(){ public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Axis"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Category_Axis");
} }
/** /**
* 重置 * 重置
*/ */
public void reset(){ public void reset() {
} }
@Override @Override
public void populateBean(VanChartAxis axis) { public void populateBean(VanChartAxis axis) {
populateTitle(axis); populateTitle(axis);
@ -568,50 +595,53 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
} }
//标题 //标题
private void populateTitle(VanChartAxis axis){ private void populateTitle(VanChartAxis axis) {
if (showTitle != null) {
showTitle.setSelectedIndex(axis.isShowAxisTitle() ? 0 : 1);
}
Title axisTitle = axis.getTitle(); Title axisTitle = axis.getTitle();
if(axisTitle != null){ if (axisTitle != null) {
if (axisTitle.getTextObject() instanceof BaseFormula && titleContent != null) { if (axisTitle.getTextObject() instanceof BaseFormula && titleContent != null) {
titleContent.populateBean(((BaseFormula) axisTitle.getTextObject()).getContent()); titleContent.populateBean(((BaseFormula) axisTitle.getTextObject()).getContent());
} else if(titleContent != null){ } else if (titleContent != null) {
titleContent.populateBean(Utils.objectToString(axisTitle.getTextObject())); titleContent.populateBean(Utils.objectToString(axisTitle.getTextObject()));
} }
if(titleAlignPane != null){ if (titleAlignPane != null) {
titleAlignPane.setSelectedItem(axisTitle.getPosition()); titleAlignPane.setSelectedItem(axisTitle.getPosition());
} }
if(titleTextAttrPane != null){ if (titleTextAttrPane != null) {
titleTextAttrPane.populate(axisTitle.getTextAttr()); titleTextAttrPane.populate(axisTitle.getTextAttr());
} }
if(titleUseHtml != null){ if (titleUseHtml != null) {
titleUseHtml.setSelected(axis.isTitleUseHtml()); titleUseHtml.setSelected(axis.isTitleUseHtml());
} }
if(titleTextRotation != null){ if (titleTextRotation != null) {
titleTextRotation.populateBean((double)axisTitle.getTextAttr().getRotation()); titleTextRotation.populateBean((double) axisTitle.getTextAttr().getRotation());
} }
} }
} }
//标签 //标签
private void populateLabel(VanChartAxis axis){ private void populateLabel(VanChartAxis axis) {
if(showLabel != null){ if (showLabel != null) {
showLabel.setSelectedIndex(axis.isShowAxisLabel() ? 0 : 1); showLabel.setSelectedIndex(axis.isShowAxisLabel() ? 0 : 1);
} }
TextAttr labelTextAttr = axis.getTextAttr(); TextAttr labelTextAttr = axis.getTextAttr();
if(labelTextAttrPane != null){ if (labelTextAttrPane != null) {
labelTextAttrPane.populate(labelTextAttr); labelTextAttrPane.populate(labelTextAttr);
} }
if(labelTextRotation != null){ if (labelTextRotation != null) {
labelTextRotation.populateBean((double)labelTextAttr.getRotation()); labelTextRotation.populateBean((double) labelTextAttr.getRotation());
} }
//轴标签缩略间隔显示 恢复用注释。取消注释。 //轴标签缩略间隔显示 恢复用注释。取消注释。
// if (overlapHandleTypeGroup != null) { // if (overlapHandleTypeGroup != null) {
// overlapHandleTypeGroup.setSelectedItem(axis.getOverlapHandleType()); // overlapHandleTypeGroup.setSelectedItem(axis.getOverlapHandleType());
// } // }
if(labelGapStyle != null){ if (labelGapStyle != null) {
labelGapStyle.setSelectedIndex(axis.isAutoLabelGap() ? 0 : 1); labelGapStyle.setSelectedIndex(axis.isAutoLabelGap() ? 0 : 1);
} }
if(labelGapValue != null){ if (labelGapValue != null) {
//轴标签缩略间隔显示 恢复用注释。下面1行删除。 //轴标签缩略间隔显示 恢复用注释。下面1行删除。
labelGapValue.setText(axis.getLabelNumber().getContent()); labelGapValue.setText(axis.getLabelNumber().getContent());
//轴标签缩略间隔显示 恢复用注释。取消注释。 //轴标签缩略间隔显示 恢复用注释。取消注释。
@ -620,30 +650,30 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
} }
//轴线样式 //轴线样式
private void populateLineStyle(VanChartAxis axis){ private void populateLineStyle(VanChartAxis axis) {
if(axisLineStyle != null){ if (axisLineStyle != null) {
axisLineStyle.setSelectedLineStyle(axis.getAxisStyle()); axisLineStyle.setSelectedLineStyle(axis.getAxisStyle());
} }
if(axisLineColor != null){ if (axisLineColor != null) {
axisLineColor.setSelectObject(axis.getAxisColor()); axisLineColor.setSelectObject(axis.getAxisColor());
} }
if(mainTick != null){ if (mainTick != null) {
mainTick.setSelectedItem(axis.getMainTickLine()); mainTick.setSelectedItem(axis.getMainTickLine());
} }
if(secondTick != null){ if (secondTick != null) {
secondTick.setSelectedItem(axis.getSecTickLine()); secondTick.setSelectedItem(axis.getSecTickLine());
} }
} }
//位置 //位置
private void populatePosition(VanChartAxis axis){ private void populatePosition(VanChartAxis axis) {
if(position != null){ if (position != null) {
position.setSelectedItem(axis.getPosition()); position.setSelectedItem(axis.getPosition());
if(position.getSelectedItem() == null){ if (position.getSelectedItem() == null) {
position.setSelectedIndex(1); position.setSelectedIndex(1);
} }
} }
if(reversed != null){ if (reversed != null) {
reversed.setSelectedIndex(axis.hasAxisReversed() == true ? 0 : 1); reversed.setSelectedIndex(axis.hasAxisReversed() == true ? 0 : 1);
} }
} }
@ -666,13 +696,13 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
//格式 //格式
protected void populateFormat(VanChartAxis axis) { protected void populateFormat(VanChartAxis axis) {
if(valueFormatStyle != null){ if (valueFormatStyle != null) {
valueFormatStyle.setSelectedIndex(axis.isCommonValueFormat() ? 0 : 1); valueFormatStyle.setSelectedIndex(axis.isCommonValueFormat() ? 0 : 1);
} }
if(valueFormat != null){ if (valueFormat != null) {
valueFormat.populateBean(axis.getFormat()); valueFormat.populateBean(axis.getFormat());
} }
if(htmlLabelPane != null){ if (htmlLabelPane != null) {
htmlLabelPane.populate(axis.getHtmlLabel()); htmlLabelPane.populate(axis.getHtmlLabel());
} }
} }
@ -690,15 +720,19 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
updateFormat(axis); updateFormat(axis);
} }
//标题 //标题
private void updateTitle(VanChartAxis axis){ private void updateTitle(VanChartAxis axis) {
if (showTitle != null) {
axis.setShowAxisTitle(showTitle.getSelectedIndex() == 0);
}
Title axisTitle = axis.getTitle(); Title axisTitle = axis.getTitle();
if(axisTitle == null){ if (axisTitle == null) {
axisTitle = new Title(); axisTitle = new Title();
axis.setTitle(axisTitle); axis.setTitle(axisTitle);
} }
if(titleContent != null){ if (titleContent != null) {
String titleString = titleContent.updateBean(); String titleString = titleContent.updateBean();
Object titleObj; Object titleObj;
if (StableUtils.maybeFormula(titleString)) { if (StableUtils.maybeFormula(titleString)) {
@ -708,42 +742,42 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
} }
axisTitle.setTextObject(titleObj); axisTitle.setTextObject(titleObj);
} }
if(titleAlignPane != null){ if (titleAlignPane != null) {
axisTitle.setPosition(titleAlignPane.getSelectedItem()); axisTitle.setPosition(titleAlignPane.getSelectedItem());
} }
TextAttr textAttr = axisTitle.getTextAttr(); TextAttr textAttr = axisTitle.getTextAttr();
if(titleTextAttrPane != null){ if (titleTextAttrPane != null) {
titleTextAttrPane.update(textAttr); titleTextAttrPane.update(textAttr);
} }
if(titleUseHtml != null){ if (titleUseHtml != null) {
axis.setTitleUseHtml(titleUseHtml.isSelected()); axis.setTitleUseHtml(titleUseHtml.isSelected());
} }
if(titleTextRotation != null){ if (titleTextRotation != null) {
textAttr.setRotation(titleTextRotation.updateBean().intValue()); textAttr.setRotation(titleTextRotation.updateBean().intValue());
} }
} }
//标签 //标签
private void updateLabel(VanChartAxis axis){ private void updateLabel(VanChartAxis axis) {
if(showLabel != null){ if (showLabel != null) {
axis.setShowAxisLabel(showLabel.getSelectedIndex() == 0); axis.setShowAxisLabel(showLabel.getSelectedIndex() == 0);
} }
TextAttr labelTextAttr = axis.getTextAttr(); TextAttr labelTextAttr = axis.getTextAttr();
if(labelTextAttrPane != null){ if (labelTextAttrPane != null) {
labelTextAttrPane.update(labelTextAttr); labelTextAttrPane.update(labelTextAttr);
} }
if(labelTextRotation != null){ if (labelTextRotation != null) {
labelTextAttr.setRotation(labelTextRotation.updateBean().intValue()); labelTextAttr.setRotation(labelTextRotation.updateBean().intValue());
} }
//轴标签缩略间隔显示 恢复用注释。取消注释。 //轴标签缩略间隔显示 恢复用注释。取消注释。
// if (overlapHandleTypeGroup != null) { // if (overlapHandleTypeGroup != null) {
// axis.setOverlapHandleType(overlapHandleTypeGroup.getSelectedItem()); // axis.setOverlapHandleType(overlapHandleTypeGroup.getSelectedItem());
// } // }
if(labelGapStyle != null){ if (labelGapStyle != null) {
axis.setAutoLabelGap(labelGapStyle.getSelectedIndex() == 0); axis.setAutoLabelGap(labelGapStyle.getSelectedIndex() == 0);
} }
if(labelGapValue != null){ if (labelGapValue != null) {
//轴标签缩略间隔显示 恢复用注释。下面5行删除。 //轴标签缩略间隔显示 恢复用注释。下面5行删除。
if (axis.isAutoLabelGap()) { if (axis.isAutoLabelGap()) {
axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("1")); axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("1"));
@ -756,33 +790,33 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
} }
//轴线样式 //轴线样式
private void updateLineStyle(VanChartAxis axis){ private void updateLineStyle(VanChartAxis axis) {
if(axisLineStyle != null){ if (axisLineStyle != null) {
axis.setAxisStyle(axisLineStyle.getSelectedLineStyle()); axis.setAxisStyle(axisLineStyle.getSelectedLineStyle());
} }
if(axisLineColor != null){ if (axisLineColor != null) {
axis.setAxisColor(axisLineColor.getSelectObject()); axis.setAxisColor(axisLineColor.getSelectObject());
} }
if(mainTick != null){ if (mainTick != null) {
axis.setMainTickLine(mainTick.getSelectedItem()); axis.setMainTickLine(mainTick.getSelectedItem());
} }
if(secondTick != null){ if (secondTick != null) {
axis.setSecTickLine(secondTick.getSelectedItem()); axis.setSecTickLine(secondTick.getSelectedItem());
} }
} }
//位置 //位置
private void updatePosition(VanChartAxis axis){ private void updatePosition(VanChartAxis axis) {
if(position != null){ if (position != null) {
axis.setPosition(position.getSelectedItem()); axis.setPosition(position.getSelectedItem());
} }
if(reversed != null){ if (reversed != null) {
axis.setAxisReversed(reversed.getSelectedItem()); axis.setAxisReversed(reversed.getSelectedItem());
} }
} }
//显示策略 //显示策略
private void updateDisplayStrategy(VanChartAxis axis){ private void updateDisplayStrategy(VanChartAxis axis) {
//区域显示策略 恢复用注释。下面6行删除。 //区域显示策略 恢复用注释。下面6行删除。
if (axisLimitSize != null) { if (axisLimitSize != null) {
axis.setLimitSize(axisLimitSize.getSelectedIndex() == 0); axis.setLimitSize(axisLimitSize.getSelectedIndex() == 0);
@ -797,29 +831,30 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> {
} }
protected void updateFormat(VanChartAxis axis) { protected void updateFormat(VanChartAxis axis) {
if(valueFormatStyle != null){ if (valueFormatStyle != null) {
axis.setCommonValueFormat(valueFormatStyle.getSelectedIndex() == 0); axis.setCommonValueFormat(valueFormatStyle.getSelectedIndex() == 0);
} }
if(valueFormat != null){ if (valueFormat != null) {
axis.setFormat(valueFormat.update()); axis.setFormat(valueFormat.update());
} }
if(htmlLabelPane != null){ if (htmlLabelPane != null) {
htmlLabelPane.update(axis.getHtmlLabel()); htmlLabelPane.update(axis.getHtmlLabel());
} }
} }
/** /**
* X坐标轴不同类型切换,new一个新的 * X坐标轴不同类型切换,new一个新的
*
* @param axisName 坐标轴名称 * @param axisName 坐标轴名称
* @return 新的axis * @return 新的axis
*/ */
public VanChartAxis updateBean(String axisName, int position){ public VanChartAxis updateBean(String axisName, int position) {
VanChartAxis axis = new VanChartAxis(axisName, position); VanChartAxis axis = new VanChartAxis(axisName, position);
this.updateBean(axis); this.updateBean(axis);
return axis; return axis;
} }
public VanChartAxis updateBean(){ public VanChartAxis updateBean() {
return null; return null;
} }
} }

11
designer-realize/src/main/java/com/fr/design/actions/columnrow/ColumnRowSizingAction.java

@ -13,6 +13,7 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.fun.ReportLengthUNITProvider; import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.design.unit.UnitConvertUtil; import com.fr.design.unit.UnitConvertUtil;
import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.report.elementcase.ElementCase; import com.fr.report.elementcase.ElementCase;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -39,8 +40,8 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction
return ColumnRowSizingAction.this.title4UnitInputPane(); return ColumnRowSizingAction.this.title4UnitInputPane();
} }
}; };
UNIT len = getShowLen(report, cs); final UNIT oldLen = getShowLen(report, cs);
populateNumberDialog(uPane, len); populateNumberDialog(uPane, oldLen);
final CellSelection finalCS = cs; final CellSelection finalCS = cs;
uPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { uPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@ -51,8 +52,10 @@ public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction
float newHeight = (float) uPane.update(); float newHeight = (float) uPane.update();
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit();
ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType); ReportLengthUNITProvider lengthUNIT = UnitConvertUtil.parseLengthUNIT(unitType);
UNIT len = lengthUNIT.float2UNIT(newHeight); UNIT newLen = lengthUNIT.float2UNIT(newHeight);
updateAction(report, len, finalCS); if (!ComparatorUtils.equals(oldLen, newLen)) {
updateAction(report, newLen, finalCS);
}
} catch (ValueNotChangeException e) { } catch (ValueNotChangeException e) {
// nothing // nothing
} }

10
designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

@ -256,8 +256,11 @@ public class RichTextToolBar extends BasicPane{
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
boolean isSub = RichTextToolBar.this.subPane.isSelected(); boolean isSub = RichTextToolBar.this.subPane.isSelected();
// 调用setCharacterAttributes函数设置文本区选择文本的字体
MutableAttributeSet attr = new SimpleAttributeSet(); MutableAttributeSet attr = new SimpleAttributeSet();
if (!isSub && RichTextToolBar.this.superPane.isSelected()) {
StyleConstants.setSuperscript(attr, false);
}
// 调用setCharacterAttributes函数设置文本区选择文本的字体
StyleConstants.setSubscript(attr, !isSub); StyleConstants.setSubscript(attr, !isSub);
setCharacterAttributes(RichTextToolBar.this.textPane, attr, false); setCharacterAttributes(RichTextToolBar.this.textPane, attr, false);
} }
@ -269,6 +272,9 @@ public class RichTextToolBar extends BasicPane{
boolean isSuper = RichTextToolBar.this.superPane.isSelected(); boolean isSuper = RichTextToolBar.this.superPane.isSelected();
// 调用setCharacterAttributes函数设置文本区选择文本的字体 // 调用setCharacterAttributes函数设置文本区选择文本的字体
MutableAttributeSet attr = new SimpleAttributeSet(); MutableAttributeSet attr = new SimpleAttributeSet();
if (!isSuper && RichTextToolBar.this.subPane.isSelected()) {
StyleConstants.setSubscript(attr, false);
}
StyleConstants.setSuperscript(attr, !isSuper); StyleConstants.setSuperscript(attr, !isSuper);
setCharacterAttributes(RichTextToolBar.this.textPane, attr, false); setCharacterAttributes(RichTextToolBar.this.textPane, attr, false);
} }
@ -402,7 +408,7 @@ public class RichTextToolBar extends BasicPane{
bold.setSelected(isBold); bold.setSelected(isBold);
italic.setSelected(isItalic); italic.setSelected(isItalic);
underline.setSelected(isUnderline); underline.setSelected(isUnderline);
subPane.setSelected(isSubscript); subPane.setSelected(isSuperscript ? false : isSubscript);
superPane.setSelected(isSuperscript); superPane.setSelected(isSuperscript);
//为什么字体名称, 大小, 颜色, 不需要去判断是否全相同呢 //为什么字体名称, 大小, 颜色, 不需要去判断是否全相同呢
//因为如果全相同, 则设置为第一个字符的样式, 如果不全相同, 那么默认也设置成第一个字符的样式. //因为如果全相同, 则设置为第一个字符的样式, 如果不全相同, 那么默认也设置成第一个字符的样式.

37
designer-realize/src/main/java/com/fr/design/report/PageSetupPane.java

@ -19,25 +19,20 @@ import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import javax.swing.BorderFactory; import javax.swing.*;
import javax.swing.Box;
import javax.swing.ButtonGroup;
import javax.swing.Icon;
import com.fr.design.gui.ispinner.ColumnRowSpinner;
import com.fr.page.PaperSettingProvider; import com.fr.page.PaperSettingProvider;
import com.fr.page.ReportSettingsProvider; import com.fr.page.ReportSettingsProvider;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.text.NumberFormatter;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Margin; import com.fr.base.Margin;
@ -72,6 +67,7 @@ public class PageSetupPane extends BasicPane {
private PagePane pagePane; private PagePane pagePane;
private OtherPane otherPane; private OtherPane otherPane;
private UILabel zeroMarginWarn; private UILabel zeroMarginWarn;
private static final String E = "E";
public PageSetupPane() { public PageSetupPane() {
this.initComponents(); this.initComponents();
@ -212,6 +208,13 @@ public class PageSetupPane extends BasicPane {
((JSpinner.DefaultEditor) paperWidthSpinner.getEditor()).getTextField().setColumns(7); ((JSpinner.DefaultEditor) paperWidthSpinner.getEditor()).getTextField().setColumns(7);
paperHeightSpinner = new UIBasicSpinner(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0)); paperHeightSpinner = new UIBasicSpinner(new SpinnerNumberModel(0.0, 0.0, Double.MAX_VALUE, 1.0));
((JSpinner.DefaultEditor) paperHeightSpinner.getEditor()).getTextField().setColumns(7); ((JSpinner.DefaultEditor) paperHeightSpinner.getEditor()).getTextField().setColumns(7);
JFormattedTextField txt = ((JSpinner.NumberEditor) paperWidthSpinner.getEditor()).getTextField();
((NumberFormatter) txt.getFormatter()).setAllowsInvalid(false);
txt = ((JSpinner.NumberEditor) paperHeightSpinner.getEditor()).getTextField();
((NumberFormatter) txt.getFormatter()).setAllowsInvalid(false);
unitLabel = new UnitFieldPane.UnitLabel(Constants.UNIT_MM, paperHeightSpinner.getPreferredSize().height); unitLabel = new UnitFieldPane.UnitLabel(Constants.UNIT_MM, paperHeightSpinner.getPreferredSize().height);
String[] inch = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH")}; String[] inch = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH")};
@ -738,8 +741,8 @@ public class PageSetupPane extends BasicPane {
return; return;
} }
// 最大2000,以免画的时候超边 // 最大2000,以免画的时候超边
this.paper_width = Math.min(paper_width, 2000); this.paper_width = Math.min(paper_width, Double.MAX_VALUE);
this.paper_height = Math.min(paper_height, 2000); this.paper_height = Math.min(paper_height, Double.MAX_VALUE);
this.paper_orientation = paper_orientation; this.paper_orientation = paper_orientation;
length_scale = !useLocale ? NUM_3 : NUM_POINT_3; length_scale = !useLocale ? NUM_3 : NUM_POINT_3;
} }
@ -766,22 +769,28 @@ public class PageSetupPane extends BasicPane {
FontMetrics fm = g2d.getFontMetrics(); FontMetrics fm = g2d.getFontMetrics();
// 横向的长度 // 横向的长度
String w_str = "" + paper_width; String w_str = "" + paper_width;
if (w_str.indexOf(CoreConstants.DOT) > 0) { if (!w_str.contains(E) && w_str.indexOf(CoreConstants.DOT) > 0) {
w_str = w_str.substring(0, w_str.indexOf(CoreConstants.DOT) + 2); w_str = w_str.substring(0, w_str.indexOf(CoreConstants.DOT) + 2);
} }
int w_length = fm.stringWidth(w_str); int w_length = fm.stringWidth(w_str);
paint_width = Math.max(paint_width, w_length + 26); paint_width = Math.max(paint_width, w_length + 26);
// 纵向的长度 // 纵向的长度
String h_str = "" + paper_height; String h_str = "" + paper_height;
if (h_str.indexOf(".") > 0) { //使用科学计数法显示长度的时候,限制纵向显示长度为9位
h_str = h_str.substring(0, h_str.indexOf(".") + 2); if (h_str.contains(E)) {
String str1 = h_str.substring(h_str.indexOf(E));
String str2 = h_str.substring(0, 9 - str1.length());
h_str = str2 + str1;
} else if (h_str.indexOf(CoreConstants.DOT) > 0) {
h_str = h_str.substring(0, h_str.indexOf(CoreConstants.DOT) + 2);
} }
int h_length = fm.stringWidth(h_str); int h_length = fm.stringWidth(h_str);
paint_height = Math.max(paint_height, h_length + 26); paint_height = Math.max(paint_height, h_length + 26);
paint_height = Math.min(paint_height, 74);
double startX = (pane_width - paint_width) / 2; double startX = (pane_width - paint_width) / 2;
double startY = (pane_height - paint_height) / 2; double startY = (pane_height - paint_height) / 2;
g2d.translate(startX, startY); g2d.translate(startX, startY);
g2d = getG2d(paint_width, paint_height,g2d,w_str,h_str,w_length,h_length); g2d = getG2d(paint_width, paint_height, g2d, w_str, h_str, w_length, h_length);
if (paper_orientation == ReportConstants.PORTRAIT) { if (paper_orientation == ReportConstants.PORTRAIT) {
g2d.drawImage(img, (int) ((paint_width - img.getWidth(null)) / 2), g2d.drawImage(img, (int) ((paint_width - img.getWidth(null)) / 2),
(int) ((paint_height - img.getHeight(null)) / 2), null); (int) ((paint_height - img.getHeight(null)) / 2), null);

16
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -300,6 +300,8 @@ public class GridUI extends ComponentUI {
private int resolution; private int resolution;
private static final double THRESHOLD = 1.0E-4D;
DrawLineHelper(int startIndex, int endIndex, boolean showGridLine, DrawLineHelper(int startIndex, int endIndex, boolean showGridLine,
boolean showPaginateLine, DynamicUnitList sizeList, double paperPaintSize, boolean showPaginateLine, DynamicUnitList sizeList, double paperPaintSize,
List paginateLineList, int resolution) { List paginateLineList, int resolution) {
@ -342,7 +344,7 @@ public class GridUI extends ComponentUI {
} }
// paint paper margin line. // paint paper margin line.
if (showPaginateLine && paperSumSize >= paperPaintSize) { if (showPaginateLine && paperSumSize - paperPaintSize > THRESHOLD) {
paginateLineList.add(getPaginateLine2D((int) sumSize)); paginateLineList.add(getPaginateLine2D((int) sumSize));
paperSumSize = tmpSize; paperSumSize = tmpSize;
} }
@ -497,8 +499,8 @@ public class GridUI extends ComponentUI {
paintCellElementRectangleList.add(this.tmpRectangle.clone()); paintCellElementRectangleList.add(this.tmpRectangle.clone());
double cellWidth = this.tmpRectangle.getWidth(); double cellWidth = this.tmpRectangle.getWidth();
double cellHeight = this.tmpRectangle.getHeight(); double cellHeight = this.tmpRectangle.getHeight();
// denny_Grid: 画Grid中单元格的内容(包括单元格的背景Content + Background), 不包括边框 // denny_Grid: 画Grid中单元格的内容(包括单元格的背景Content + Background), 不包括边框
painter.paintBackground(g2d, report, tmpCellElement, cellWidth - 1, cellHeight - 1); painter.paintBackground(g2d, report, tmpCellElement, cellWidth - 1, cellHeight - 1);
@ -625,10 +627,10 @@ public class GridUI extends ComponentUI {
tmpLine2D = (Line2D) paginateLineList.get(j);// 直接强制转换,因为List中肯定都是Line2D型的 tmpLine2D = (Line2D) paginateLineList.get(j);// 直接强制转换,因为List中肯定都是Line2D型的
for (int k = j + 1; k < paginateLineList.size(); k++) { for (int k = j + 1; k < paginateLineList.size(); k++) {
tmpLine2D2 = (Line2D) paginateLineList.get(k); tmpLine2D2 = (Line2D) paginateLineList.get(k);
if (AssistUtils.equals(tmpLine2D2.getX1() ,tmpLine2D.getX1()) if (AssistUtils.equals(tmpLine2D2.getX1(), tmpLine2D.getX1())
&& AssistUtils.equals(tmpLine2D2.getX2() , tmpLine2D.getX2()) && AssistUtils.equals(tmpLine2D2.getX2(), tmpLine2D.getX2())
&& AssistUtils.equals(tmpLine2D2.getY1() , tmpLine2D.getY1()) && AssistUtils.equals(tmpLine2D2.getY1(), tmpLine2D.getY1())
&& AssistUtils.equals(tmpLine2D2.getY2() , tmpLine2D.getY2())) { && AssistUtils.equals(tmpLine2D2.getY2(), tmpLine2D.getY2())) {
paginateLineList.remove(k); paginateLineList.remove(k);
} }
} }

8
designer-realize/src/main/java/com/fr/grid/IntelliElements.java

@ -194,8 +194,12 @@ public class IntelliElements {
TemplateCellElement newCellElement = new DefaultTemplateCellElement(colIndex, rowIndex); TemplateCellElement newCellElement = new DefaultTemplateCellElement(colIndex, rowIndex);
applyStyle(newCellElement, sourceCellElement);//style applyStyle(newCellElement, sourceCellElement);//style
if (sourceCellElement.getValue() instanceof DSColumn) { if (sourceCellElement.getValue() instanceof DSColumn) {
DSColumn dsColumn = (DSColumn) sourceCellElement.getValue(); try{
newCellElement.setValue(dsColumn); DSColumn dsColumn = (DSColumn)((DSColumn) sourceCellElement.getValue()).clone();
newCellElement.setValue(dsColumn);
}catch (CloneNotSupportedException e){
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
newCellElement.setCellExpandAttr(sourceCellElement.getCellExpandAttr()); newCellElement.setCellExpandAttr(sourceCellElement.getCellExpandAttr());
} else if (sourceCellElement.getValue() instanceof Number) { } else if (sourceCellElement.getValue() instanceof Number) {
newCellElement.setValue(processNumber((Number) sourceCellElement.getValue())); newCellElement.setValue(processNumber((Number) sourceCellElement.getValue()));

Loading…
Cancel
Save