Browse Source

REPORT-14668 设计器语言切换成英文后的显示问题

bugfix/10.0
plough 5 years ago
parent
commit
5ea5f0e205
  1. 60
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

60
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -17,6 +17,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.general.ComparatorUtils;
import com.fr.report.cell.DefaultTemplateCellElement;
@ -51,6 +52,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private static final int HEAD_WDITH = 290;
private static final int HEAD_HEIGTH = 24;
private static final int COMBO_WIDTH = 154;
private static final int BUTTON_GROUP_WIDTH = 140;
// normal
private UIButtonGroup autoshrik;
@ -81,7 +83,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private UIRadioButton[] adjustRadioButtons;
// 插入行策略
private UIButtonGroup insertRowPolicy;
private UIButtonGroup insertRowPolicyButtonGroup;
private ValueEditorPane valueEditor;
private CardLayout insertRowLayout;
private JPanel insertRowPane;
@ -147,7 +149,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
private void initInsertRowPolicyPane() {
// 插入行策略
insertRowPolicy = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_NULL"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Estate_Default_Text"),
insertRowPolicyButtonGroup = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_NULL"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Estate_Default_Text"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_COPY")});
defaultValuePane = new JPanel(new BorderLayout(4, 0));
valueEditor = ValueEditorPaneFactory.createBasicValueEditorPane();
@ -157,10 +159,10 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
insertRowPane.add(new JPanel(), "none");
insertRowPane.add(defaultValuePane, "content");
insertRowPane.setPreferredSize(new Dimension(0, 0));
insertRowPolicy.addChangeListener(new ChangeListener() {
insertRowPolicyButtonGroup.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (insertRowPolicy.getSelectedIndex() == 1) {
if (insertRowPolicyButtonGroup.getSelectedIndex() == 1) {
insertRowPane.setPreferredSize(new Dimension(100, 20));
insertRowLayout.show(insertRowPane, "content");
} else {
@ -169,16 +171,33 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
}
}
});
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize1 = {p, p};
double[] columnSize1 = {p, f};
int[][] rowCount1 = {{1, 1}, {1, 1}};
Component[][] components1 = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy"), SwingConstants.LEFT), insertRowPolicy},
new Component[]{null, insertRowPane},
};
insertRowPolicyPane = TableLayoutHelper.createGapTableLayoutPane(components1, rowSize1, columnSize1, rowCount1, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
UILabel insertRowPolicyLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy", SwingConstants.LEFT));
UIComponentUtils.setLineWrap(insertRowPolicyLabel);
// 如果右侧需要很宽的空间,就用3行1列的布局
if (insertRowPolicyButtonGroup.getPreferredSize().getWidth() > BUTTON_GROUP_WIDTH) {
double[] rowSize = {p, p, p};
double[] columnSize = {f};
Component[][] components = new Component[][] {
new Component[]{insertRowPolicyLabel},
new Component[]{insertRowPolicyButtonGroup},
new Component[]{insertRowPane},
};
insertRowPolicyPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
} else {
double[] rowSize = {p, p};
double[] columnSize = {f, BUTTON_GROUP_WIDTH};
Component[][] components = new Component[][] {
new Component[]{insertRowPolicyLabel, insertRowPolicyButtonGroup},
new Component[]{null, insertRowPane},
};
insertRowPolicyPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM);
}
}
private JPanel seniorUpPane() {
@ -200,13 +219,14 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
fileNamePane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0));
UILabel showContentLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Content"), SwingConstants.LEFT);
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);
Component[][] components = new Component[][]{
new Component[]{showContentLabel, showContent},
new Component[]{showContentLabel, UIComponentUtils.wrapWithBorderLayoutPane(showContent)},
new Component[]{fileNamePane, null}, // 选择"用下载连接显示二进制内容"时,会显示这一行的面板
new Component[]{toolTipLabel, toolTipTextFieldWrapper}
};
@ -323,7 +343,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
pageAfterColumnCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Page_After_Column"));
canBreakOnPaginateCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellPage_Can_Break_On_Paginate"));
repeatCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellPage_Repeat_Content_When_Paging"));
insertRowPolicy.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy"));
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"));
}
@ -395,16 +415,16 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
cellInsertPolicyAttr = new CellInsertPolicyAttr();
}
if (ComparatorUtils.equals(CellInsertPolicyAttr.INSERT_POLICY_COPY, cellInsertPolicyAttr.getInsertPolicy())) {
insertRowPolicy.setSelectedIndex(2);
insertRowPolicyButtonGroup.setSelectedIndex(2);
} else if (ComparatorUtils.equals(CellInsertPolicyAttr.INSERT_POLICY_DEFAULT, cellInsertPolicyAttr.getInsertPolicy())) {
insertRowPolicy.setSelectedIndex(1);
insertRowPolicyButtonGroup.setSelectedIndex(1);
Object defaultValue = cellInsertPolicyAttr.getDefaultInsertValue();
this.valueEditor.populate(defaultValue);
} else {
insertRowPolicy.setSelectedIndex(0);
insertRowPolicyButtonGroup.setSelectedIndex(0);
this.valueEditor.populate(StringUtils.EMPTY);
}
if (insertRowPolicy.getSelectedIndex() == 1) {
if (insertRowPolicyButtonGroup.getSelectedIndex() == 1) {
insertRowPane.setPreferredSize(new Dimension(100, 20));
insertRowLayout.show(insertRowPane, "content");
} else {
@ -521,9 +541,9 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
// 插入
CellInsertPolicyAttr cellInsertPolicyAttr = new CellInsertPolicyAttr();
if (insertRowPolicy.getSelectedIndex() == 2) {
if (insertRowPolicyButtonGroup.getSelectedIndex() == 2) {
cellInsertPolicyAttr.setInsertPolicy(CellInsertPolicyAttr.INSERT_POLICY_COPY);
} else if (insertRowPolicy.getSelectedIndex() == 1) {
} else if (insertRowPolicyButtonGroup.getSelectedIndex() == 1) {
cellInsertPolicyAttr.setInsertPolicy(CellInsertPolicyAttr.INSERT_POLICY_DEFAULT);
Object value = valueEditor.update();
cellInsertPolicyAttr.setDefaultInsertValue(value);

Loading…
Cancel
Save