diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index 99a0d9bf48..efab3fc66e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -12,10 +12,8 @@ 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; @@ -60,8 +58,6 @@ 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; @@ -71,20 +67,8 @@ 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; // 分页 @@ -230,16 +214,17 @@ 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[] rowSize = {p, p, p, p}; + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p, p}; double[] colSize = {f, COMBO_WIDTH}; - int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; JPanel fileNamePane = createNormal(); fileNamePane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); @@ -248,96 +233,21 @@ public class CellOtherSetPane extends AbstractCellAttrPane { UIComponentUtils.setLineWrap(showContentLabel); UILabel toolTipLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip")); - 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)); - } - } - }); + JPanel toolTipTextFieldWrapper = new JPanel(new BorderLayout()); + toolTipTextFieldWrapper.add(tooltipTextField, BorderLayout.NORTH); Component[][] components = new Component[][]{ new Component[]{showContentLabel, UIComponentUtils.wrapWithBorderLayoutPane(showContent)}, new Component[]{fileNamePane, null}, // 选择"用下载连接显示二进制内容"时,会显示这一行的面板 - new Component[]{toolTipLabel, tooltipButtonGroup}, // “自定义”or"单元格值" - new Component[]{null, tooltipPane} // 选择“自定义”时显示这一行 + new Component[]{toolTipLabel, toolTipTextFieldWrapper} }; JPanel showContentPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, colSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); - showContentPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 6, 0)); + showContentPane.setBorder(BorderFactory.createEmptyBorder(6, 0, 12, 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) { - 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)); - } - noAutoRadioButton.setSelected(true); - } - } - }); - 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); @@ -461,11 +371,6 @@ 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")); } @@ -524,40 +429,7 @@ 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()) { - showPartComboBox.setSelectedIndex(0); - showCharNums.setValue(cellGUIAttr.getShowCharNums()); - } else { - showPartComboBox.setSelectedIndex(1); - } - 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 { - showPartComboBox.setSelectedIndex(0); - showCharNums.setValue(cellGUIAttr.getShowCharNums()); - textOverflowTypeComboBox.setSelectedIndex(0); - textOverflowCheckBox.setSelected(false); - } + tooltipTextField.setText(cellGUIAttr.getTooltipText()); CellPageAttr cellPageAttr = cellElement.getCellPageAttr(); // 分页 if (cellPageAttr == null) { cellPageAttr = new CellPageAttr(); @@ -649,18 +521,7 @@ 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); @@ -668,18 +529,6 @@ 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);