Browse Source

Pull request #7712: 无jira 解决冲突 合并一个打包版本

Merge in DESIGN/design from ~HOKY.HE/design-hoky:feature/x to feature/x

* commit 'cffbb3a0b68bad88e5305169204303e136e1ed95':
  无jira 合并一个打包版本
feature/x
Hoky.He 3 years ago
parent
commit
1dd411bc20
  1. 109
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java

109
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java

@ -7,27 +7,38 @@ import com.fr.base.theme.TemplateTheme;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.properties.items.FRLayoutTypeItems;
import com.fr.design.designer.properties.items.Item;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.fit.common.TemplateTool;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UIAutoChangeLineLabel;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.style.FollowingThemePane;
import com.fr.design.gui.xpane.LayoutStylePane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.accessibles.AccessibleBodyWatermarkEditor;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.design.widget.ui.designer.component.WidgetBoundPane;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout;
import com.fr.general.act.BorderPacker;
import com.fr.report.core.ReportUtils;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
import static javax.swing.JOptionPane.OK_OPTION;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
@ -36,10 +47,15 @@ import static javax.swing.JOptionPane.WARNING_MESSAGE;
* Created by ibm on 2017/8/2.
*/
public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
private static final int MAX_LABEL_WIDTH = 80;
protected FollowingThemePane themePane;
private LayoutStylePane stylePane;
private AccessibleBodyWatermarkEditor watermarkEditor;
private WidgetBoundPane boundPane;
private UIComboBox layoutCombox;
private WBodyLayoutType layoutType = WBodyLayoutType.ABSOLUTE;
public FRAbsoluteBodyLayoutDefinePane(XCreator xCreator) {
super(xCreator);
@ -48,8 +64,20 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
boundPane = new WidgetBoundPane(creator);
if (!TemplateTool.isCurrentEditingNewJForm()) {
this.add(boundPane, BorderLayout.NORTH);
}
JPanel panel1 = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.add(panel1, BorderLayout.CENTER);
UIExpandablePane scalePane = new UIExpandablePane(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Area_Scaling"),
280, 20,
createAreaScalePane()
);
panel1.add(scalePane, BorderLayout.NORTH);
UIExpandablePane advancedPane = new UIExpandablePane(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"),
280, 20,
@ -87,15 +115,41 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W3, IntervalConstants.INTERVAL_L1);
watermarkPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0));
advancedContentPane.add(watermarkPane, BorderLayout.CENTER);
UIAutoChangeLineLabel tip = new UIAutoChangeLineLabel(Toolkit.i18nText("Fine-Design_Form_Body_Layout_Setting_Tip"), 216);
tip.setForeground(Color.lightGray);
advancedContentPane.add(tip, BorderLayout.SOUTH);
return advancedContentPane;
}
@Override
public void doLayout() {
super.doLayout();
public JPanel createAreaScalePane() {
initLayoutComboBox();
UILabel layoutTypeLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout_Type"));
UILabel scaleModeLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Scaling_Mode"));
Component[][] components = TemplateTool.isCurrentEditingNewJForm() ? new Component[][]{
{layoutTypeLabel, layoutCombox}
} : new Component[][]{
{layoutTypeLabel, layoutCombox},
{scaleModeLabel}
};
JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(components,
TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
contentPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0));
JPanel containerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
containerPane.add(contentPane, BorderLayout.CENTER);
containerPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
return containerPane;
}
public void initLayoutComboBox() {
Item[] items = FRLayoutTypeItems.ITEMS;
DefaultComboBoxModel model = new DefaultComboBoxModel();
for (Item item : items) {
model.addElement(item);
}
layoutCombox = new UIComboBox(model);
layoutCombox.setSelectedIndex(1);
}
@Override
@ -104,16 +158,51 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
}
public void populateSubPane(WAbsoluteLayout ob) {
layoutCombox.setSelectedIndex(1);
themePane.supportFollowingTheme(ob.supportThemed());
themePane.setFollowingTheme(ob.isBorderStyleFollowingTheme());
stylePane.populateBean((LayoutBorderStyle) ob.getBorderStyle());
boundPane.populate();
//从全局读取水印
watermarkEditor.setValue(ReportUtils.getWatermarkAttrFromTemplateAndGlobal(getCurrentIOFile()));
}
public WAbsoluteBodyLayout updateSubPane() {
WAbsoluteBodyLayout layout = (WAbsoluteBodyLayout) creator.toData();
boundPane.update();
Item item = (Item) layoutCombox.getSelectedItem();
Object value = item.getValue();
int state = 0;
if (value instanceof Integer) {
state = (Integer) value;
}
if (layoutType == WBodyLayoutType.ABSOLUTE) {
((XWFitLayout) creator.getBackupParent()).toData().resetStyle();
if (state == WBodyLayoutType.FIT.getTypeValue()) {
XWFitLayout xwFitLayout = ((XWFitLayout) creator.getBackupParent());
int selVal = FineJOptionPane.showConfirmDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Form_Layout_Switch_Tip"),
Toolkit.i18nText("Fine-Design_Basic_Alert"),
OK_CANCEL_OPTION,
WARNING_MESSAGE
);
if (OK_OPTION == selVal) {
xwFitLayout.switch2FitBodyLayout(creator);
WFitLayout wFitLayout = xwFitLayout.toData();
// 切换布局类型时,保留body背景样式
if (wFitLayout != null) {
wFitLayout.setBorderStyleFollowingTheme(layout.isBorderStyleFollowingTheme());
wFitLayout.setBorderStyle(layout.getBorderStyle());
}
copyLayoutAttr(layout, xwFitLayout.toData());
} else {
this.layoutCombox.setSelectedIndex(1);
}
copyLayoutAttr(layout, xwFitLayout.toData());
xwFitLayout.refreshStylePreviewEffect();
}
}
layout.setBorderStyleFollowingTheme(themePane.isFollowingTheme());
layout.setBorderStyle(stylePane.updateBean());
updateWatermark();
@ -138,4 +227,4 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane {
}
}
}
Loading…
Cancel
Save