Browse Source

REPORT-14057 10.0日文国际化问题处理=>表单body自适应显示不全

bugfix/10.0
plough 6 years ago
parent
commit
1c4cb53655
  1. 26
      designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java
  2. 22
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

26
designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java

@ -1,8 +1,13 @@
package com.fr.design.utils.gui; package com.fr.design.utils.gui;
import com.fr.design.gui.core.UITextComponent; import com.fr.design.gui.core.UITextComponent;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/** /**
* 包含 UI 组件相关的工具方法 * 包含 UI 组件相关的工具方法
* Created by plough on 2019/1/11. * Created by plough on 2019/1/11.
@ -48,4 +53,25 @@ public class UIComponentUtils {
} }
comp.setText(prefix + comp.getText()); comp.setText(prefix + comp.getText());
} }
/**
* 将一个组件包装到 BorderLayout 布局的面板中
* @param comp待包装的组件
* @param layoutConstraint添加的方向 BorderLayout.NORTH
* @return 包装好的 JPanel
*/
public static JPanel wrapWithBorderLayoutPane(JComponent comp, String layoutConstraint) {
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
panel.add(comp, layoutConstraint);
return panel;
}
/**
* 将一个组件包装到 BorderLayout 布局的面板中
* @param comp待包装的组件
* @return 包装好的 JPanel布局方向为 BorderLayout.NORTH
*/
public static JPanel wrapWithBorderLayoutPane(JComponent comp) {
return wrapWithBorderLayoutPane(comp, BorderLayout.NORTH);
}
} }

22
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java

@ -24,9 +24,9 @@ import com.fr.design.mainframe.FormSelectionUtils;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor;
import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.ui.designer.AbstractDataModify; import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane; import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.main.Form;
import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteBodyLayout; import com.fr.form.ui.container.WAbsoluteBodyLayout;
@ -35,7 +35,6 @@ import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.core.ReportUtils; import com.fr.report.core.ReportUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -49,6 +48,7 @@ import java.awt.Dimension;
* Created by ibm on 2017/8/2. * Created by ibm on 2017/8/2.
*/ */
public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> { public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
private static final int ADAPT_LABEL_MAX_WIDTH = 80;
private XWFitLayout xWFitLayout; private XWFitLayout xWFitLayout;
private WFitLayout wFitLayout; private WFitLayout wFitLayout;
private UIComboBox layoutComboBox; private UIComboBox layoutComboBox;
@ -95,19 +95,31 @@ public class FRFitLayoutDefinePane extends AbstractDataModify<WFitLayout> {
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
layoutComboBox = initUIComboBox(FRLayoutTypeItems.ITEMS); layoutComboBox = initUIComboBox(FRLayoutTypeItems.ITEMS);
adaptComboBox = initUIComboBox(FRFitConstraintsItems.ITEMS); adaptComboBox = initUIComboBox(FRFitConstraintsItems.ITEMS);
JPanel adaptComboBoxPane = UIComponentUtils.wrapWithBorderLayoutPane(adaptComboBox);
componentIntervel = new UISpinner(0, Integer.MAX_VALUE, 1, 0); componentIntervel = new UISpinner(0, Integer.MAX_VALUE, 1, 0);
JPanel componentIntervelPane = UIComponentUtils.wrapWithBorderLayoutPane(componentIntervel);
UILabel adaptLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Scale"));
UIComponentUtils.setLineWrap(adaptLabel);
UILabel intervalLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Interval"));
UIComponentUtils.setLineWrap(intervalLabel);
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p}; double[] rowSize = {p, p};
double[] columnSize = {p, f}; double adaptLabelColumnWidth = adaptLabel.getPreferredSize().width > ADAPT_LABEL_MAX_WIDTH ? ADAPT_LABEL_MAX_WIDTH : p;
double[] columnSize = {adaptLabelColumnWidth, f};
int[][] rowCount = {{1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}};
JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ JPanel northPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout_Type")), layoutComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout_Type")), layoutComboBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
northPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0)); northPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0));
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Scale")), adaptComboBox}, new Component[]{adaptLabel, adaptComboBoxPane},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Interval")), componentIntervel} new Component[]{intervalLabel, componentIntervelPane}
}; };
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
centerPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 0, 0)); centerPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 0, 0));

Loading…
Cancel
Save