|
|
|
@ -2,11 +2,13 @@ package com.fr.design.module;
|
|
|
|
|
|
|
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
|
import com.fr.base.ChartEmptyDataStyleConf; |
|
|
|
|
import com.fr.base.Style; |
|
|
|
|
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
|
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
|
|
|
|
import com.fr.design.gui.ibutton.UIRadioButton; |
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
import com.fr.design.style.background.image.ImageFileChooser; |
|
|
|
|
import com.fr.design.style.background.image.ImagePreviewPane; |
|
|
|
@ -14,7 +16,7 @@ import com.fr.design.utils.ImageUtils;
|
|
|
|
|
import com.fr.design.utils.gui.GUICoreUtils; |
|
|
|
|
import com.fr.general.GeneralContext; |
|
|
|
|
import com.fr.general.IOUtils; |
|
|
|
|
|
|
|
|
|
import com.fr.stable.Constants; |
|
|
|
|
import com.fr.stable.CoreGraphHelper; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
@ -24,6 +26,7 @@ import javax.swing.JFileChooser;
|
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.JScrollPane; |
|
|
|
|
import javax.swing.SwingWorker; |
|
|
|
|
import java.io.File; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.awt.Dimension; |
|
|
|
@ -32,7 +35,6 @@ import java.awt.GridLayout;
|
|
|
|
|
import java.awt.Image; |
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
import java.io.File; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Created by mengao on 2017/11/23. |
|
|
|
@ -47,8 +49,10 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private UIButtonGroup emptyData; |
|
|
|
|
private UILabel imageContent; |
|
|
|
|
private UIButtonGroup imageData; |
|
|
|
|
private UIRadioButton defaultRadioButton; |
|
|
|
|
private UIRadioButton customRadioButton; |
|
|
|
|
private UIRadioButton adjustRadioButton; |
|
|
|
|
private UIButton selectPictureButton; |
|
|
|
|
|
|
|
|
|
private ImagePreviewPane previewPane; |
|
|
|
@ -72,7 +76,7 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel creatNorthPane() { |
|
|
|
|
emptyData = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Close")}); |
|
|
|
|
emptyData = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Open"), Toolkit.i18nText("Fine-Design_Chart_Close")}); |
|
|
|
|
emptyData.setSelectedIndex(0); |
|
|
|
|
emptyData.setPreferredSize(new Dimension(WIDTH, HEIGHT)); |
|
|
|
|
emptyData.addActionListener(new ActionListener() { |
|
|
|
@ -83,8 +87,24 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
UILabel promptContent = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Tip_Content")); |
|
|
|
|
JPanel northPane = GUICoreUtils.createFlowPane(new Component[]{promptContent, emptyData}, FlowLayout.LEFT, TEN, 0); |
|
|
|
|
imageData = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Chart_Mode_Auto"), Toolkit.i18nText("Fine-Design_Chart_Mode_Custom")}); |
|
|
|
|
imageData.setSelectedIndex(0); |
|
|
|
|
imageData.setPreferredSize(new Dimension(WIDTH, HEIGHT)); |
|
|
|
|
imageData.addActionListener(new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
emptyDataImage = null; |
|
|
|
|
checkIsCustom(); |
|
|
|
|
repaintPreviewPane(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
UILabel promptContent = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Tip_Content")); |
|
|
|
|
imageContent = new UILabel(Toolkit.i18nText("Fine-Design_Report_Image")); |
|
|
|
|
JPanel emptyPane = GUICoreUtils.createFlowPane(new Component[]{promptContent, emptyData}, FlowLayout.LEFT, TEN, 0); |
|
|
|
|
JPanel imagePane = GUICoreUtils.createFlowPane(new Component[]{imageContent, imageData}, FlowLayout.LEFT, TEN, 0); |
|
|
|
|
imagePane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); |
|
|
|
|
JPanel northPane = GUICoreUtils.createFlowPane(new Component[]{emptyPane, imagePane}, FlowLayout.LEFT, 0, 0); |
|
|
|
|
northPane.setBorder(BorderFactory.createEmptyBorder(0, FIVE, 0, 0)); |
|
|
|
|
return northPane; |
|
|
|
|
} |
|
|
|
@ -96,7 +116,7 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
|
|
|
|
|
JPanel previewContainerPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
|
|
|
|
centerPane.add(previewContainerPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
JPanel previewOwnerPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); |
|
|
|
|
JPanel previewOwnerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Basic_Preview")); |
|
|
|
|
previewOwnerPane.setLayout(new BorderLayout()); |
|
|
|
|
previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER); |
|
|
|
|
previewContainerPane.add(initSelectFilePane(), BorderLayout.EAST); |
|
|
|
@ -116,25 +136,27 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
|
|
|
|
|
|
|
|
|
|
selectFilePane.setBorder(BorderFactory.createEmptyBorder(TEN, FIVE, 0, THIRTY)); |
|
|
|
|
|
|
|
|
|
defaultRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); |
|
|
|
|
customRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Custom")); |
|
|
|
|
defaultRadioButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Report_Default")); |
|
|
|
|
adjustRadioButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Report_Image_Adjust")); |
|
|
|
|
ButtonGroup buttonGroup = new ButtonGroup(); |
|
|
|
|
defaultRadioButton.setSelected(true); |
|
|
|
|
buttonGroup.add(defaultRadioButton); |
|
|
|
|
buttonGroup.add(customRadioButton); |
|
|
|
|
buttonGroup.add(adjustRadioButton); |
|
|
|
|
defaultRadioButton.setEnabled(false); |
|
|
|
|
adjustRadioButton.setEnabled(false); |
|
|
|
|
|
|
|
|
|
defaultRadioButton.addActionListener(getLayoutActionListener()); |
|
|
|
|
customRadioButton.addActionListener(getLayoutActionListener()); |
|
|
|
|
|
|
|
|
|
JPanel jp = new JPanel(new GridLayout(3, 1, 0, TEN)); |
|
|
|
|
jp.add(defaultRadioButton); |
|
|
|
|
jp.add(customRadioButton); |
|
|
|
|
adjustRadioButton.addActionListener(getLayoutActionListener()); |
|
|
|
|
|
|
|
|
|
selectPictureButton = new UIButton( |
|
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Background_Image_Select")); |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Background_Image_Select")); |
|
|
|
|
selectPictureButton.setEnabled(false); |
|
|
|
|
selectPictureButton.addActionListener(getSelectPictureActionListener()); |
|
|
|
|
jp.add(selectPictureButton); |
|
|
|
|
|
|
|
|
|
JPanel jp = new JPanel(new GridLayout(3, 1, 0, TEN)); |
|
|
|
|
jp.add(selectPictureButton); |
|
|
|
|
jp.add(defaultRadioButton); |
|
|
|
|
jp.add(adjustRadioButton); |
|
|
|
|
|
|
|
|
|
selectFilePane.add(jp, BorderLayout.NORTH); |
|
|
|
|
return selectFilePane; |
|
|
|
@ -142,10 +164,8 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
|
|
|
|
|
|
|
|
|
|
private ActionListener getLayoutActionListener() { |
|
|
|
|
return new ActionListener() { |
|
|
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
|
emptyDataImage = null; |
|
|
|
|
checkCustomImage(); |
|
|
|
|
setImageStyle(); |
|
|
|
|
repaintPreviewPane(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
@ -188,17 +208,30 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
|
|
|
|
|
|
|
|
|
|
private void checkEmptyDataStyle() { |
|
|
|
|
boolean b = emptyData.getSelectedIndex() == 0; |
|
|
|
|
defaultRadioButton.setVisible(b); |
|
|
|
|
adjustRadioButton.setVisible(b); |
|
|
|
|
selectPictureButton.setVisible(b); |
|
|
|
|
imageContent.setVisible(b); |
|
|
|
|
imageData.setVisible(b); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkIsCustom() { |
|
|
|
|
boolean b = imageData.getSelectedIndex() == 1; |
|
|
|
|
defaultRadioButton.setEnabled(b); |
|
|
|
|
customRadioButton.setEnabled(b); |
|
|
|
|
adjustRadioButton.setEnabled(b); |
|
|
|
|
selectPictureButton.setEnabled(b); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkCustomImage() { |
|
|
|
|
selectPictureButton.setVisible(customRadioButton.isSelected()); |
|
|
|
|
private void setImageStyle() { |
|
|
|
|
if (adjustRadioButton.isSelected()) { |
|
|
|
|
previewPane.setImageStyle(Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST)); |
|
|
|
|
} else { |
|
|
|
|
previewPane.setImageStyle(Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void repaintPreviewPane() { |
|
|
|
|
emptyDataImage = customRadioButton.isSelected() ? emptyDataImage : DEFAULT_EMPTY_DATA_IMAGE; |
|
|
|
|
emptyDataImage = imageData.getSelectedIndex() == 1 ? emptyDataImage : DEFAULT_EMPTY_DATA_IMAGE; |
|
|
|
|
previewPane.setImage(emptyData.getSelectedIndex() == 0 ? emptyDataImage : null); |
|
|
|
|
previewPane.repaint(); |
|
|
|
|
} |
|
|
|
@ -215,12 +248,14 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
|
|
|
|
|
|
|
|
|
|
public void populateBean() { |
|
|
|
|
ChartEmptyDataStyleConf manager = ChartEmptyDataStyleConf.getInstance(); |
|
|
|
|
emptyData.setSelectedIndex(manager.isOpenEmptyDataStyle() == true ? 0 : 1); |
|
|
|
|
customRadioButton.setSelected(manager.isCustomEmptyDataStyle()); |
|
|
|
|
emptyData.setSelectedIndex(manager.isOpenEmptyDataStyle() ? 0 : 1); |
|
|
|
|
imageData.setSelectedIndex(manager.isCustomEmptyDataStyle() ? 1 : 0); |
|
|
|
|
adjustRadioButton.setSelected(manager.isAdjust()); |
|
|
|
|
emptyDataImage = manager.getEmptyDataImage(); |
|
|
|
|
|
|
|
|
|
checkEmptyDataStyle(); |
|
|
|
|
checkCustomImage(); |
|
|
|
|
checkIsCustom(); |
|
|
|
|
setImageStyle(); |
|
|
|
|
repaintPreviewPane(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -228,7 +263,8 @@ public class ChartEmptyDataStylePane extends AbstractAttrNoScrollPane {
|
|
|
|
|
ChartEmptyDataStyleConf manager = ChartEmptyDataStyleConf.getInstance(); |
|
|
|
|
|
|
|
|
|
manager.setOpenEmptyDataStyle(emptyData.getSelectedIndex() == 0); |
|
|
|
|
manager.setCustomEmptyDataStyle(customRadioButton.isSelected()); |
|
|
|
|
manager.setCustomEmptyDataStyle(imageData.getSelectedIndex() == 1); |
|
|
|
|
manager.setAdjust(adjustRadioButton.isSelected()); |
|
|
|
|
manager.setEmptyDataImage(emptyDataImage); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|