|
|
|
@ -12,7 +12,10 @@ import com.fr.design.gui.ibutton.UIRadioButton;
|
|
|
|
|
import com.fr.design.gui.icheckbox.UICheckBox; |
|
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
import com.fr.design.gui.ispinner.UISpinner; |
|
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
import com.fr.design.layout.VerticalFlowLayout; |
|
|
|
@ -30,8 +33,7 @@ import com.fr.report.cell.cellattr.CellPageAttr;
|
|
|
|
|
import com.fr.report.elementcase.TemplateElementCase; |
|
|
|
|
import com.fr.stable.Constants; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
import java.awt.Color; |
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
|
import javax.swing.ButtonGroup; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
@ -40,6 +42,7 @@ import javax.swing.event.ChangeEvent;
|
|
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.CardLayout; |
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
import java.awt.Insets; |
|
|
|
@ -57,6 +60,8 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
|
|
|
|
|
private static final int HEAD_HEIGTH = 24; |
|
|
|
|
private static final int COMBO_WIDTH = 154; |
|
|
|
|
private static final int BUTTON_GROUP_WIDTH = 140; |
|
|
|
|
private static final double f = TableLayout.FILL; |
|
|
|
|
private static final double p = TableLayout.PREFERRED; |
|
|
|
|
// normal
|
|
|
|
|
private UIButtonGroup autoshrik; |
|
|
|
|
|
|
|
|
@ -66,8 +71,20 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
|
|
|
|
|
|
|
|
|
|
private UIComboBox showContent; |
|
|
|
|
|
|
|
|
|
//内容提示
|
|
|
|
|
private UIButtonGroup tooltipButtonGroup; |
|
|
|
|
private CardLayout tooltipLayout; |
|
|
|
|
private JPanel tooltipPane; |
|
|
|
|
private UITextField tooltipTextField; |
|
|
|
|
|
|
|
|
|
//文本超出时隐藏
|
|
|
|
|
private UICheckBox textOverflowCheckBox; |
|
|
|
|
private UIComboBox showPartComboBox; |
|
|
|
|
private CardLayout showPartLayout; |
|
|
|
|
private JPanel showPartPane; |
|
|
|
|
private UISpinner showCharNums; |
|
|
|
|
private UIComboBox textOverflowTypeComboBox; |
|
|
|
|
|
|
|
|
|
private UITextField fileNameTextField; |
|
|
|
|
|
|
|
|
|
// 分页
|
|
|
|
@ -213,17 +230,16 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
|
|
|
|
|
private JPanel seniorUpPane() { |
|
|
|
|
JPanel pane = new JPanel(new BorderLayout()); |
|
|
|
|
// TODO: 方法之间的耦合还比较严重。现在必须先执行 createShowContentPane,再执行 createSeniorCheckPane。否则出现 npe。
|
|
|
|
|
pane.add(createTextOverflowPane(), BorderLayout.SOUTH); |
|
|
|
|
pane.add(createShowContentPane(), BorderLayout.CENTER); |
|
|
|
|
pane.add(createSeniorCheckPane(), BorderLayout.NORTH); |
|
|
|
|
return pane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel createShowContentPane() { |
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double[] rowSize = {p, p, p}; |
|
|
|
|
double[] rowSize = {p, p, p, p}; |
|
|
|
|
double[] colSize = {f, COMBO_WIDTH}; |
|
|
|
|
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; |
|
|
|
|
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
|
|
|
|
|
|
|
|
|
JPanel fileNamePane = createNormal(); |
|
|
|
|
fileNamePane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); |
|
|
|
@ -232,21 +248,98 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
|
|
|
|
|
UIComponentUtils.setLineWrap(showContentLabel); |
|
|
|
|
UILabel toolTipLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip")); |
|
|
|
|
|
|
|
|
|
JPanel toolTipTextFieldWrapper = new JPanel(new BorderLayout()); |
|
|
|
|
toolTipTextFieldWrapper.add(tooltipTextField, BorderLayout.NORTH); |
|
|
|
|
tooltipLayout = new CardLayout(); |
|
|
|
|
tooltipPane = new JPanel(tooltipLayout); |
|
|
|
|
tooltipPane.add(new JPanel(), "none"); |
|
|
|
|
tooltipPane.add(tooltipTextField, "content"); |
|
|
|
|
tooltipPane.setPreferredSize(new Dimension(0, 0)); |
|
|
|
|
tooltipButtonGroup = new UIButtonGroup(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Custom"), Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_CellValue")}); |
|
|
|
|
tooltipButtonGroup.addChangeListener(new ChangeListener() { |
|
|
|
|
@Override |
|
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
|
if (tooltipButtonGroup.getSelectedIndex() == 0) { |
|
|
|
|
tooltipPane.setPreferredSize(new Dimension(154, 20)); |
|
|
|
|
tooltipLayout.show(tooltipPane, "content"); |
|
|
|
|
} else { |
|
|
|
|
tooltipLayout.show(tooltipPane, "none"); |
|
|
|
|
tooltipPane.setPreferredSize(new Dimension(0, 0)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
Component[][] components = new Component[][]{ |
|
|
|
|
new Component[]{showContentLabel, UIComponentUtils.wrapWithBorderLayoutPane(showContent)}, |
|
|
|
|
new Component[]{fileNamePane, null}, // 选择"用下载连接显示二进制内容"时,会显示这一行的面板
|
|
|
|
|
new Component[]{toolTipLabel, toolTipTextFieldWrapper} |
|
|
|
|
new Component[]{toolTipLabel, tooltipButtonGroup}, // “自定义”or"单元格值"
|
|
|
|
|
new Component[]{null, tooltipPane} // 选择“自定义”时显示这一行
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
JPanel showContentPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, colSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); |
|
|
|
|
showContentPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 12, 0)); |
|
|
|
|
showContentPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 6, 0)); |
|
|
|
|
|
|
|
|
|
return showContentPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel createTextOverflowPane() { |
|
|
|
|
showPartLayout = new CardLayout(); |
|
|
|
|
showPartPane = new JPanel(showPartLayout); |
|
|
|
|
showCharNums = new UISpinner(0, Integer.MAX_VALUE, 1, 10); |
|
|
|
|
JPanel showPartNumPane = new JPanel(new BorderLayout(4, 0)); |
|
|
|
|
showPartNumPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums")), BorderLayout.WEST); |
|
|
|
|
showPartNumPane.add(showCharNums, BorderLayout.CENTER); |
|
|
|
|
showPartPane.add(new JPanel(), "none"); |
|
|
|
|
showPartPane.add(showPartNumPane, "content"); |
|
|
|
|
showPartComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_CharNum"), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_CellWidth")}); |
|
|
|
|
showPartComboBox.addItemListener(new ItemListener() { |
|
|
|
|
@Override |
|
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
|
if (showPartComboBox.getSelectedIndex() == 0) { |
|
|
|
|
showPartPane.setPreferredSize(new Dimension(70, 20)); |
|
|
|
|
showPartLayout.show(showPartPane, "content"); |
|
|
|
|
} else { |
|
|
|
|
showPartLayout.show(showPartPane, "none"); |
|
|
|
|
showPartPane.setPreferredSize(new Dimension(0, 0)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
textOverflowTypeComboBox = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Ellipsis"), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_NoneSymbol")}); |
|
|
|
|
UILabel showPartLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart") + ":"); |
|
|
|
|
UILabel hideTypeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType") + ":"); |
|
|
|
|
Component[][] textOverflowComponents = new Component[][]{ |
|
|
|
|
new Component[]{showPartLabel, showPartComboBox, showPartPane}, |
|
|
|
|
new Component[]{hideTypeLabel, textOverflowTypeComboBox, null} |
|
|
|
|
}; |
|
|
|
|
JPanel textOverflowComPane = TableLayoutHelper.createTableLayoutPane(textOverflowComponents, new double[]{p, p}, new double[]{p, f, p}); |
|
|
|
|
textOverflowComPane.setVisible(false); |
|
|
|
|
textOverflowCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow")); |
|
|
|
|
textOverflowCheckBox.addItemListener(new ItemListener() { |
|
|
|
|
@Override |
|
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
|
textOverflowComPane.setVisible(e.getStateChange() == ItemEvent.SELECTED); |
|
|
|
|
if (e.getStateChange() == ItemEvent.SELECTED) { |
|
|
|
|
noAutoRadioButton.setSelected(true); |
|
|
|
|
textOverflowComPane.setVisible(true); |
|
|
|
|
if (showPartComboBox.getSelectedIndex() == 0) { |
|
|
|
|
showPartLayout.show(showPartPane, "content"); |
|
|
|
|
} else { |
|
|
|
|
showPartLayout.show(showPartPane, "none"); |
|
|
|
|
showPartPane.setPreferredSize(new Dimension(0, 0)); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
textOverflowComPane.setVisible(false); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
JPanel dynamicPaneWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
dynamicPaneWrapper.add(textOverflowComPane); |
|
|
|
|
JPanel textOverflowPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
textOverflowPane.add(textOverflowCheckBox, BorderLayout.NORTH); |
|
|
|
|
textOverflowPane.add(dynamicPaneWrapper, BorderLayout.CENTER); |
|
|
|
|
textOverflowPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0)); |
|
|
|
|
return textOverflowPane; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel createSeniorCheckPane() { |
|
|
|
|
previewCellContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); |
|
|
|
|
printAndExportContent.setBorder(UIConstants.CELL_ATTR_ZEROBORDER); |
|
|
|
@ -370,6 +463,11 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
|
|
|
|
|
insertRowPolicyButtonGroup.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy")); |
|
|
|
|
valueEditor.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy")); |
|
|
|
|
pageFixedRowDataCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Page_Fixed_Row_Cell")); |
|
|
|
|
tooltipButtonGroup.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Button_Group")); |
|
|
|
|
textOverflowCheckBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow")); |
|
|
|
|
showPartComboBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart")); |
|
|
|
|
showCharNums.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums")); |
|
|
|
|
textOverflowTypeComboBox.setGlobalName(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -428,7 +526,38 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
|
|
|
|
|
} else { |
|
|
|
|
showContent.setSelectedItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); |
|
|
|
|
} |
|
|
|
|
if (cellGUIAttr.isCustomTooltip()) { |
|
|
|
|
tooltipButtonGroup.setSelectedIndex(0); |
|
|
|
|
tooltipTextField.setText(cellGUIAttr.getTooltipText()); |
|
|
|
|
} else { |
|
|
|
|
tooltipButtonGroup.setSelectedIndex(1); |
|
|
|
|
} |
|
|
|
|
if (tooltipButtonGroup.getSelectedIndex() == 0) { |
|
|
|
|
tooltipPane.setPreferredSize(new Dimension(100, 20)); |
|
|
|
|
tooltipLayout.show(tooltipPane, "content"); |
|
|
|
|
} else { |
|
|
|
|
tooltipLayout.show(tooltipPane, "none"); |
|
|
|
|
tooltipPane.setPreferredSize(new Dimension(0, 0)); |
|
|
|
|
} |
|
|
|
|
tooltipPane.setVisible(true); |
|
|
|
|
if (cellGUIAttr.isHideTextWhenOverflow()) { |
|
|
|
|
textOverflowCheckBox.setSelected(true); |
|
|
|
|
if (cellGUIAttr.isShowCharNum()) { |
|
|
|
|
showPartLayout.show(showPartPane, "content"); |
|
|
|
|
showCharNums.setValue(cellGUIAttr.getShowCharNums()); |
|
|
|
|
} else { |
|
|
|
|
showPartLayout.show(showPartPane, "none"); |
|
|
|
|
showPartPane.setPreferredSize(new Dimension(0, 0)); |
|
|
|
|
} |
|
|
|
|
showPartPane.setVisible(true); |
|
|
|
|
if (cellGUIAttr.isTextOverflowEllipsis()) { |
|
|
|
|
textOverflowTypeComboBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Ellipsis")); |
|
|
|
|
} else { |
|
|
|
|
textOverflowTypeComboBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_NoneSymbol")); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
textOverflowCheckBox.setSelected(false); |
|
|
|
|
} |
|
|
|
|
CellPageAttr cellPageAttr = cellElement.getCellPageAttr(); // 分页
|
|
|
|
|
if (cellPageAttr == null) { |
|
|
|
|
cellPageAttr = new CellPageAttr(); |
|
|
|
@ -520,7 +649,18 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
|
|
|
|
|
cellGUIAttr.setFileName(fileNameTextField.getText()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip_Button_Group"))) { |
|
|
|
|
cellGUIAttr.setCustomTooltip(tooltipButtonGroup.getSelectedIndex() == 0); |
|
|
|
|
if (tooltipButtonGroup.getSelectedIndex() == 0) { |
|
|
|
|
if (tooltipTextField.getText() == null || tooltipTextField.getText().trim().length() <= 0) { |
|
|
|
|
cellGUIAttr.setTooltipText(fieldName); |
|
|
|
|
} else { |
|
|
|
|
cellGUIAttr.setTooltipText(tooltipTextField.getText()); |
|
|
|
|
} |
|
|
|
|
} else if (tooltipButtonGroup.getSelectedIndex() == 1) { |
|
|
|
|
cellGUIAttr.setTooltipText("=$$$"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip"))) { |
|
|
|
|
if (tooltipTextField.getText() == null || tooltipTextField.getText().trim().length() <= 0) { |
|
|
|
|
cellGUIAttr.setTooltipText(fieldName); |
|
|
|
@ -528,6 +668,18 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
|
|
|
|
|
cellGUIAttr.setTooltipText(tooltipTextField.getText()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideWhenOverflow"))) { |
|
|
|
|
cellGUIAttr.setHideTextWhenOverflow(textOverflowCheckBox.isSelected()); |
|
|
|
|
} |
|
|
|
|
if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_ShowPart"))) { |
|
|
|
|
cellGUIAttr.setShowCharNum(showPartComboBox.getSelectedIndex() == 0); |
|
|
|
|
} |
|
|
|
|
if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_Nums"))) { |
|
|
|
|
cellGUIAttr.setShowCharNums((int) showCharNums.getValue()); |
|
|
|
|
} |
|
|
|
|
if (ComparatorUtils.equals(getGlobalName(), Toolkit.i18nText("Fine-Design_Report_CellWrite_TextOverflow_HideType"))) { |
|
|
|
|
cellGUIAttr.setTextOverflowEllipsis(textOverflowTypeComboBox.getSelectedIndex() == 0); |
|
|
|
|
} |
|
|
|
|
// 如果与默认的CellGUIAttr相同,就不用保存这个属性了
|
|
|
|
|
if (ComparatorUtils.equals(cellGUIAttr, CellGUIAttr.DEFAULT_CELLGUIATTR)) { |
|
|
|
|
cellElement.setCellGUIAttr(cellNullGUIAttr); |
|
|
|
|