|
|
@ -12,8 +12,9 @@ import com.fr.design.gui.ibutton.UIButtonGroup; |
|
|
|
import com.fr.design.gui.ibutton.UIToggleButton; |
|
|
|
import com.fr.design.gui.ibutton.UIToggleButton; |
|
|
|
import com.fr.design.gui.icombobox.LineComboBox; |
|
|
|
import com.fr.design.gui.icombobox.LineComboBox; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
import com.fr.design.gui.ispinner.UISpinner; |
|
|
|
import com.fr.design.gui.style.FormatPane; |
|
|
|
import com.fr.design.gui.style.FormatPane; |
|
|
|
|
|
|
|
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.PaneTitleConstants; |
|
|
|
import com.fr.design.mainframe.chart.PaneTitleConstants; |
|
|
@ -22,11 +23,13 @@ import com.fr.design.style.color.ColorSelectBox; |
|
|
|
import com.fr.design.utils.gui.UIComponentUtils; |
|
|
|
import com.fr.design.utils.gui.UIComponentUtils; |
|
|
|
import com.fr.design.widget.FRWidgetFactory; |
|
|
|
import com.fr.design.widget.FRWidgetFactory; |
|
|
|
import com.fr.plugin.chart.attr.axis.VanChartAxis; |
|
|
|
import com.fr.plugin.chart.attr.axis.VanChartAxis; |
|
|
|
|
|
|
|
import com.fr.plugin.chart.base.OverlapHandleType; |
|
|
|
import com.fr.plugin.chart.base.VanChartConstants; |
|
|
|
import com.fr.plugin.chart.base.VanChartConstants; |
|
|
|
import com.fr.plugin.chart.type.AxisTickLineType; |
|
|
|
import com.fr.plugin.chart.type.AxisTickLineType; |
|
|
|
import com.fr.stable.Constants; |
|
|
|
import com.fr.stable.Constants; |
|
|
|
import com.fr.stable.CoreConstants; |
|
|
|
import com.fr.stable.CoreConstants; |
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
|
|
|
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
|
|
|
import com.fr.van.chart.designer.component.VanChartHtmlLabelPane; |
|
|
|
import com.fr.van.chart.designer.component.VanChartHtmlLabelPane; |
|
|
|
import com.fr.van.chart.designer.style.VanChartStylePane; |
|
|
|
import com.fr.van.chart.designer.style.VanChartStylePane; |
|
|
@ -36,6 +39,8 @@ import javax.swing.BorderFactory; |
|
|
|
import javax.swing.Icon; |
|
|
|
import javax.swing.Icon; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.SwingConstants; |
|
|
|
import javax.swing.SwingConstants; |
|
|
|
|
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
|
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.CardLayout; |
|
|
|
import java.awt.CardLayout; |
|
|
|
import java.awt.Component; |
|
|
|
import java.awt.Component; |
|
|
@ -58,10 +63,14 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> { |
|
|
|
protected UIButtonGroup showLabel; |
|
|
|
protected UIButtonGroup showLabel; |
|
|
|
protected ChartTextAttrPane labelTextAttrPane; |
|
|
|
protected ChartTextAttrPane labelTextAttrPane; |
|
|
|
protected UINumberDragPane labelTextRotation; |
|
|
|
protected UINumberDragPane labelTextRotation; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private UIButtonGroup<OverlapHandleType> overlapHandleTypeGroup; |
|
|
|
protected UIButtonGroup<Integer> labelGapStyle; |
|
|
|
protected UIButtonGroup<Integer> labelGapStyle; |
|
|
|
protected UITextField labelGapValue; |
|
|
|
protected UISpinner labelGapValue; |
|
|
|
protected JPanel labelPanel; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected JPanel labelPanel; |
|
|
|
|
|
|
|
private JPanel labelGapStylePane; |
|
|
|
|
|
|
|
private JPanel labelGapValuePane; |
|
|
|
|
|
|
|
|
|
|
|
protected LineComboBox axisLineStyle; |
|
|
|
protected LineComboBox axisLineStyle; |
|
|
|
protected ColorSelectBox axisLineColor; |
|
|
|
protected ColorSelectBox axisLineColor; |
|
|
@ -77,7 +86,6 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> { |
|
|
|
protected FormatPane valueFormat; |
|
|
|
protected FormatPane valueFormat; |
|
|
|
protected JPanel centerPane; |
|
|
|
protected JPanel centerPane; |
|
|
|
private VanChartHtmlLabelPane htmlLabelPane; |
|
|
|
private VanChartHtmlLabelPane htmlLabelPane; |
|
|
|
private JPanel labelGapValuePane; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public VanChartBaseAxisPane(){ |
|
|
|
public VanChartBaseAxisPane(){ |
|
|
|
this(true); |
|
|
|
this(true); |
|
|
@ -164,32 +172,22 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected JPanel createLabelPane(double[] row, double[] col){ |
|
|
|
protected JPanel createLabelPane(double[] row, double[] col){ |
|
|
|
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
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(); |
|
|
|
|
|
|
|
|
|
|
|
labelTextRotation = new UINumberDragPane(-ROTATION_MAX,ROTATION_MAX); |
|
|
|
JPanel rotationPane = createLabelRotationPane(col); |
|
|
|
labelGapStyle = new UIButtonGroup<Integer>(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Automatic"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Fixed")}); |
|
|
|
JPanel overlapPane = createLabelOverlapPane(); |
|
|
|
labelGapValue = new UITextField(); |
|
|
|
|
|
|
|
Component[][] gapComponents = new Component[][]{ |
|
|
|
|
|
|
|
new Component[]{ |
|
|
|
|
|
|
|
FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TextRotation")), |
|
|
|
|
|
|
|
UIComponentUtils.wrapWithBorderLayoutPane(labelTextRotation) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Label_Interval")), labelGapStyle}, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(gapComponents, row, col); |
|
|
|
|
|
|
|
labelGapValuePane= TableLayout4VanChartHelper.createGapTableLayoutPane(com.fr.design.i18n.Toolkit.i18nText(""),labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); |
|
|
|
|
|
|
|
JPanel gapPanel = new JPanel(new BorderLayout()); |
|
|
|
|
|
|
|
gapPanel.add(panel, BorderLayout.CENTER); |
|
|
|
|
|
|
|
gapPanel.add(labelGapValuePane, BorderLayout.SOUTH); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
new Component[]{labelTextAttrPane, null}, |
|
|
|
new Component[]{labelTextAttrPane, null}, |
|
|
|
new Component[]{gapPanel,null}, |
|
|
|
new Component[]{rotationPane, null}, |
|
|
|
|
|
|
|
new Component[]{overlapPane, 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, new double[]{p, p, p}, 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 |
|
|
@ -197,16 +195,61 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> { |
|
|
|
checkLabelPane(); |
|
|
|
checkLabelPane(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
JPanel jPanel = new JPanel(new BorderLayout()); |
|
|
|
|
|
|
|
jPanel.add(showLabelPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
jPanel.add(labelPanel, BorderLayout.CENTER); |
|
|
|
|
|
|
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, jPanel); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel createLabelRotationPane(double[] col) { |
|
|
|
|
|
|
|
labelTextRotation = new UINumberDragPane(-ROTATION_MAX, ROTATION_MAX); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Component[][] gapComponents = new Component[][]{ |
|
|
|
|
|
|
|
new Component[]{ |
|
|
|
|
|
|
|
FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TextRotation")), |
|
|
|
|
|
|
|
UIComponentUtils.wrapWithBorderLayoutPane(labelTextRotation) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
return TableLayout4VanChartHelper.createGapTableLayoutPane(gapComponents, new double[]{TableLayout.PREFERRED}, col); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private JPanel createLabelOverlapPane() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
labelGapStyle = new UIButtonGroup<Integer>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Automatic"), Toolkit.i18nText("Fine-Design_Chart_Fixed")}); |
|
|
|
|
|
|
|
labelGapStylePane = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Label_Interval"), labelGapStyle, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
labelGapValue = new UISpinner(0, Integer.MAX_VALUE, 1, 1); |
|
|
|
|
|
|
|
labelGapValuePane = TableLayout4VanChartHelper.createGapTableLayoutPane(StringUtils.EMPTY, labelGapValue, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel panel = new JPanel(new BorderLayout(0, 0)); |
|
|
|
|
|
|
|
addOverlapGroupButton(panel); |
|
|
|
|
|
|
|
panel.add(labelGapStylePane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
panel.add(labelGapValuePane, BorderLayout.SOUTH); |
|
|
|
|
|
|
|
|
|
|
|
labelGapStyle.addActionListener(new ActionListener() { |
|
|
|
labelGapStyle.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
checkLabelGapValuePane(); |
|
|
|
checkLabelGapValuePane(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
JPanel jPanel = new JPanel(new BorderLayout()); |
|
|
|
|
|
|
|
jPanel.add(showLabelPane, BorderLayout.NORTH); |
|
|
|
return panel; |
|
|
|
jPanel.add(labelPanel, BorderLayout.CENTER); |
|
|
|
} |
|
|
|
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(PaneTitleConstants.CHART_STYLE_LABEL_TITLE, jPanel); |
|
|
|
|
|
|
|
|
|
|
|
protected void addOverlapGroupButton(JPanel panel) { |
|
|
|
|
|
|
|
overlapHandleTypeGroup = new UIButtonGroup<OverlapHandleType>(new String[]{Toolkit.i18nText("Fine-Design_Chart_Label_OverlapAbbreviate"), Toolkit.i18nText("Fine-Design_Chart_Label_OverlapInterval")}, |
|
|
|
|
|
|
|
new OverlapHandleType[]{OverlapHandleType.ABBREVIATE, OverlapHandleType.INTERVAL}); |
|
|
|
|
|
|
|
JPanel north = TableLayout4VanChartHelper.createGapTableLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Label_WhenOverlap"), overlapHandleTypeGroup, TableLayout4VanChartHelper.SECOND_EDIT_AREA_WIDTH); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
panel.add(north, BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
overlapHandleTypeGroup.addChangeListener(new ChangeListener() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
|
|
|
|
checkLabelGapAndStylePane(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected ChartTextAttrPane getChartTextAttrPane(){ |
|
|
|
protected ChartTextAttrPane getChartTextAttrPane(){ |
|
|
@ -362,14 +405,27 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> { |
|
|
|
labelPanel.setVisible(enabled); |
|
|
|
labelPanel.setVisible(enabled); |
|
|
|
} |
|
|
|
} |
|
|
|
if(enabled){ |
|
|
|
if(enabled){ |
|
|
|
checkLabelGapValuePane(); |
|
|
|
checkLabelGapAndStylePane(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void checkLabelGapAndStylePane() { |
|
|
|
|
|
|
|
if (overlapHandleTypeGroup != null && labelGapStylePane != null) { |
|
|
|
|
|
|
|
boolean visible = overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
labelGapStylePane.setVisible(visible); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
checkLabelGapValuePane(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void checkLabelGapValuePane() { |
|
|
|
protected void checkLabelGapValuePane() { |
|
|
|
if(labelGapValuePane != null && labelGapStyle != null){ |
|
|
|
if (labelGapValuePane != null && labelGapStyle != null) { |
|
|
|
labelGapValuePane.setVisible(labelGapStyle.getSelectedIndex() == 1); |
|
|
|
boolean visible = labelGapStyle.getSelectedIndex() == 1; |
|
|
|
|
|
|
|
if (overlapHandleTypeGroup != null) { |
|
|
|
|
|
|
|
visible = visible && overlapHandleTypeGroup.getSelectedItem() == OverlapHandleType.INTERVAL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
labelGapValuePane.setVisible(visible); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -452,11 +508,14 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> { |
|
|
|
if(labelTextRotation != null){ |
|
|
|
if(labelTextRotation != null){ |
|
|
|
labelTextRotation.populateBean((double)labelTextAttr.getRotation()); |
|
|
|
labelTextRotation.populateBean((double)labelTextAttr.getRotation()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (overlapHandleTypeGroup != null) { |
|
|
|
|
|
|
|
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){ |
|
|
|
labelGapValue.setText(axis.getLabelNumber().getContent()); |
|
|
|
labelGapValue.setValue(axis.getIntervalNumber()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -568,15 +627,14 @@ public class VanChartBaseAxisPane extends FurtherBasicBeanPane<VanChartAxis> { |
|
|
|
if(labelTextRotation != null){ |
|
|
|
if(labelTextRotation != null){ |
|
|
|
labelTextAttr.setRotation(labelTextRotation.updateBean().intValue()); |
|
|
|
labelTextAttr.setRotation(labelTextRotation.updateBean().intValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (overlapHandleTypeGroup != null) { |
|
|
|
|
|
|
|
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){ |
|
|
|
if(axis.isAutoLabelGap()){ |
|
|
|
axis.setIntervalNumber((int) labelGapValue.getValue()); |
|
|
|
axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("1")); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build(labelGapValue.getText())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|