From d1b2e791e487dc66577fa19883dc9e27daaf0ea0 Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 21 Aug 2019 15:37:54 +0800 Subject: [PATCH] REPORT-19462 --- .../gui/icombocheckbox/UICheckListPopup.java | 51 +++++++--- .../gui/icombocheckbox/UIComboCheckBox.java | 27 +++++- .../designer/mobile/BodyMobileDefinePane.java | 40 +++++--- .../mobile/TabMobileWidgetDefinePane.java | 19 ++-- .../component/MobileComponentFrozenPane.java | 92 +++++++++++++++++++ .../MobileComponentLayoutIntervalPane.java | 18 +--- ...ne.java => MobileComponentMarginPane.java} | 10 +- 7 files changed, 200 insertions(+), 57 deletions(-) create mode 100644 designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java rename designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/{MobileComponentAdvancePane.java => MobileComponentMarginPane.java} (77%) diff --git a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java index a0f4420743..b0b57f29c3 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java @@ -7,12 +7,25 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.icon.IconPathConstants; import com.fr.design.layout.FRGUIPaneFactory; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; +import com.fr.general.IOUtils; + +import javax.swing.JCheckBox; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Map; public class UICheckListPopup extends UIPopupMenu { private List listeners = new ArrayList(); @@ -66,10 +79,10 @@ public class UICheckListPopup extends UIPopupMenu { } addSelectListener(); - jScrollPane.setPreferredSize(new Dimension(200, checkBoxList.size() * CHECKBOX_HEIGHT + 10)); + jScrollPane.setPreferredSize(new Dimension(130, checkBoxList.size() * CHECKBOX_HEIGHT + 10)); //超过1页的数量时显示滚动条 if (checkBoxList.size() > maxDisplayNumber) { - jScrollPane.setPreferredSize(new Dimension(200, maxDisplayNumber * CHECKBOX_HEIGHT)); + jScrollPane.setPreferredSize(new Dimension(130, maxDisplayNumber * CHECKBOX_HEIGHT)); } checkboxPane.repaint(); jScrollPane.repaint(); @@ -77,11 +90,11 @@ public class UICheckListPopup extends UIPopupMenu { private void addOneCheckValue(Object checkValue) { JPanel checkPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - checkPane.setPreferredSize(new Dimension(185, CHECKBOX_HEIGHT)); + checkPane.setPreferredSize(new Dimension(120, CHECKBOX_HEIGHT)); final JCheckBox temp = createCheckbox(); final UILabel label = new UILabel(checkValue.toString()); label.setBackground(Color.WHITE); - label.setPreferredSize(new Dimension(156, 20)); + label.setPreferredSize(new Dimension(80, 20)); checkPane.setBackground(Color.WHITE); checkPane.add(temp); checkPane.add(label); @@ -95,8 +108,8 @@ public class UICheckListPopup extends UIPopupMenu { JCheckBox checkBox = new JCheckBox(); checkBox.setPreferredSize(new Dimension(20, 20)); checkBox.setBackground(Color.WHITE); - checkBox.setIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_NORMAL)); - checkBox.setSelectedIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_SELECTED)); + checkBox.setIcon(IOUtils.readIcon(IconPathConstants.CHECKBOX_NORMAL)); + checkBox.setSelectedIcon(IOUtils.readIcon(IconPathConstants.CHECKBOX_SELECTED)); return checkBox; } @@ -109,10 +122,12 @@ public class UICheckListPopup extends UIPopupMenu { */ private void addMouseListener(final JCheckBox checkBox, final UILabel label) { label.addMouseListener(new MouseAdapter() { + @Override public void mouseExited(MouseEvent e) { label.setBackground(Color.WHITE); } + @Override public void mouseEntered(MouseEvent e) { label.setOpaque(true); label.setBackground(mouseEnteredColor); @@ -133,6 +148,7 @@ public class UICheckListPopup extends UIPopupMenu { JCheckBox checkBox = checkBoxList.get(i); if (i == 0) { checkBox.addItemListener(new ItemListener() { + @Override public void itemStateChanged(ItemEvent e) { //全选checkbox事件 doSelectAll(checkBoxList.get(0).isSelected()); @@ -140,6 +156,7 @@ public class UICheckListPopup extends UIPopupMenu { }); } else { checkBox.addItemListener(new ItemListener() { + @Override public void itemStateChanged(ItemEvent e) { //do半选判断放在commit事件里 commit(); @@ -157,8 +174,17 @@ public class UICheckListPopup extends UIPopupMenu { private void doSelectAll(boolean isSelected) { for (int i = 1; i < checkBoxList.size(); i++) { //全选和反全选都不考虑全选按钮本身 - if (!SELECT_ALL.equals(checkBoxList.get(i).getText())) + if (!SELECT_ALL.equals(checkBoxList.get(i).getText())) { checkBoxList.get(i).setSelected(isSelected); + } + } + } + + public void setSelectedValue(Map selectedValues) { + List allValue = Arrays.asList(values); + for (Object value : selectedValues.keySet()) { + int index = allValue.indexOf(value); + checkBoxList.get(index + 1).setSelected(selectedValues.get(value)); } } @@ -214,8 +240,9 @@ public class UICheckListPopup extends UIPopupMenu { } public void addActionListener(ActionListener listener) { - if (!listeners.contains(listener)) + if (!listeners.contains(listener)) { listeners.add(listener); + } } public void removeActionListener(ActionListener listener) { diff --git a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java index 11cfeb6fe4..e570ee515d 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java @@ -11,14 +11,23 @@ import com.fr.design.icon.IconPathConstants; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.FontMetrics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.List; +import java.util.Map; /** * 设计器下拉复选框组件 @@ -125,7 +134,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam private UITextField createEditor() { UITextField editor = new UITextField(); editor.setEditable(false); - editor.setPreferredSize(new Dimension(180, 20)); + editor.setPreferredSize(new Dimension(110, 20)); addPopupListener(editor); return editor; @@ -138,6 +147,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam */ private void addPopupListener(Component component) { component.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { togglePopup(); } @@ -166,6 +176,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam private class PopupAction implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals(UICheckListPopup.COMMIT_EVENT)) { selectedValues = popup.getSelectedValues(); @@ -292,13 +303,15 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam } public void addActionListener(ActionListener listener) { - if (!listeners.contains(listener)) + if (!listeners.contains(listener)) { listeners.add(listener); + } } public void removeActionListener(ActionListener listener) { - if (listeners.contains(listener)) + if (listeners.contains(listener)) { listeners.remove(listener); + } } protected void fireActionPerformed(ActionEvent e) { @@ -307,6 +320,10 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam } } + public void setSelectedValues(Map map) { + popup.setSelectedValue(map); + } + /** * 简单的测试demo * @param args diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java index b91e1d7b68..bfd0ea7ea7 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java @@ -11,7 +11,8 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.MobileWidgetListPane; import com.fr.design.mainframe.WidgetPropertyPane; -import com.fr.design.widget.ui.designer.mobile.component.MobileComponentAdvancePane; +import com.fr.design.widget.ui.designer.mobile.component.MobileComponentFrozenPane; +import com.fr.design.widget.ui.designer.mobile.component.MobileComponentMarginPane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane; import com.fr.form.ui.RichStyleWidgetProvider; import com.fr.form.ui.container.WFitLayout; @@ -30,8 +31,11 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane { private AttributeChangeListener changeListener; private UICheckBox appRelayoutCheck; private MobileWidgetListPane mobileWidgetListPane; - private MobileComponentAdvancePane advancePane; + private MobileComponentMarginPane marginPane; private MobileComponentLayoutIntervalPane intervalPane; + private MobileComponentFrozenPane frozenPane; + private UIExpandablePane advancePane; + private UIExpandablePane layoutPane; public BodyMobileDefinePane(XCreator xCreator) { this.bodyCreator = xCreator; @@ -89,16 +93,23 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane { private JPanel createNorthPane() { JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane(); holder.add(getMobilePropertyPane(), BorderLayout.NORTH); - - advancePane = new MobileComponentAdvancePane(FormBodyPaddingAttrMark.XML_TAG); + marginPane = new MobileComponentMarginPane(FormBodyPaddingAttrMark.XML_TAG); intervalPane = new MobileComponentLayoutIntervalPane(FormBodyPaddingAttrMark.XML_TAG); + frozenPane = new MobileComponentFrozenPane(); + JPanel wrapLayoutPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + wrapLayoutPane.add(intervalPane, BorderLayout.NORTH); + wrapLayoutPane.add(frozenPane, BorderLayout.CENTER); + advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, marginPane); + layoutPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, wrapLayoutPane); //高级 holder.add(advancePane, BorderLayout.CENTER); //布局 - holder.add(intervalPane, BorderLayout.SOUTH); + holder.add(layoutPane, BorderLayout.SOUTH); - advancePane.setVisible(!shouldHidePadding(designer)); - intervalPane.setVisible(!shouldHidePadding(designer)); + boolean flag = !shouldHidePadding(designer); + advancePane.setVisible(flag); + layoutPane.setVisible(flag); + frozenPane.setVisible(appRelayoutCheck.isSelected()); return holder; } @@ -137,13 +148,12 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane { public void populate(FormDesigner designer) { this.designer = designer; appRelayoutCheck.setSelected(FormDesignerUtils.isAppRelayout(designer)); - // 数据 populate 完成后,再设置监听 this.bindListeners2Widgets(); this.addAttributeChangeListener(changeListener); - - advancePane.populate((RichStyleWidgetProvider) getBodyCreator().toData()); + marginPane.populate((RichStyleWidgetProvider) getBodyCreator().toData()); intervalPane.populate((RichStyleWidgetProvider) getBodyCreator().toData()); + frozenPane.populate(designer.getSelectionModel().getSelection().getSelectedCreator()); } @Override @@ -152,15 +162,19 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane { setAppRelayout(appRelayoutCheck.isSelected()); boolean appPaddingVisible = appRelayout || !FormDesignerUtils.isBodyAbsolute(designer); advancePane.setVisible(appPaddingVisible); - intervalPane.setVisible(appPaddingVisible); + layoutPane.setVisible(appPaddingVisible); + frozenPane.setVisible(appRelayout); mobileWidgetListPane.updateToDesigner(); designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); if (advancePane.isVisible()) { - advancePane.update((RichStyleWidgetProvider) getBodyCreator().toData()); + marginPane.update((RichStyleWidgetProvider) getBodyCreator().toData()); } - if (intervalPane.isVisible()) { + if (layoutPane.isVisible()) { intervalPane.update((RichStyleWidgetProvider) getBodyCreator().toData()); } + if (appRelayout) { + frozenPane.update(designer.getSelectionModel().getSelection().getSelectedCreator()); + } } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java index 8a795b8873..5cf7f74f78 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java @@ -4,6 +4,7 @@ import com.fr.base.iofile.attr.FormTabPaddingAttrMark; import com.fr.design.constants.LayoutConstants; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; +import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; @@ -13,7 +14,7 @@ import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor; import com.fr.design.mainframe.widget.accessibles.MobileTemplateStylePane; -import com.fr.design.widget.ui.designer.mobile.component.MobileComponentAdvancePane; +import com.fr.design.widget.ui.designer.mobile.component.MobileComponentMarginPane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.general.cardtag.mobile.MobileTemplateStyle; @@ -27,7 +28,7 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { private FormDesigner designer; // 当前设计器 private AccessibleTemplateStyleEditor templateStyleEditor; private AttributeChangeListener changeListener; - private MobileComponentAdvancePane advancePane; + private MobileComponentMarginPane marginPane; private MobileComponentLayoutIntervalPane intervalPane; public TabMobileWidgetDefinePane(XCreator xCreator) { @@ -61,12 +62,14 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane(); holder.add(jPanel, BorderLayout.NORTH); if (!shouldHidePadding(designer)) { - advancePane = new MobileComponentAdvancePane(FormTabPaddingAttrMark.XML_TAG); + marginPane = new MobileComponentMarginPane(FormTabPaddingAttrMark.XML_TAG); intervalPane = new MobileComponentLayoutIntervalPane(FormTabPaddingAttrMark.XML_TAG); + UIExpandablePane advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, marginPane); + UIExpandablePane layoutPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, intervalPane); //高级 holder.add(advancePane, BorderLayout.CENTER); //布局 - holder.add(intervalPane, BorderLayout.SOUTH); + holder.add(layoutPane, BorderLayout.SOUTH); } this.add(holder, BorderLayout.NORTH); @@ -78,8 +81,8 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { // 数据 populate 完成后,再设置监听 this.bindListeners2Widgets(); this.addAttributeChangeListener(changeListener); - if (advancePane != null) {//业务层面可以写成shouldHidePadding但是这样写应该性能差点 - advancePane.populate((WCardTagLayout) xCreator.toData()); + if (marginPane != null) {//业务层面可以写成shouldHidePadding但是这样写应该性能差点 + marginPane.populate((WCardTagLayout) xCreator.toData()); } if (intervalPane != null) { intervalPane.populate((WCardTagLayout) xCreator.toData()); @@ -90,8 +93,8 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane { public void update() { ((WCardTagLayout) xCreator.toData()).setMobileTemplateStyle((MobileTemplateStyle) templateStyleEditor.getValue()); DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来 - if (advancePane != null) { - advancePane.update((WCardTagLayout) xCreator.toData()); + if (marginPane != null) { + marginPane.update((WCardTagLayout) xCreator.toData()); } if (intervalPane != null) { intervalPane.update((WCardTagLayout) xCreator.toData()); diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java new file mode 100644 index 0000000000..0d5ce4b711 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java @@ -0,0 +1,92 @@ +package com.fr.design.widget.ui.designer.mobile.component; + +import com.fr.design.designer.IntervalConstants; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.icombocheckbox.UIComboCheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.FRWidgetFactory; +import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WSortLayout; +import com.fr.stable.ArrayUtils; + +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * @author Hades + * @date 2019/8/14 + */ +public class MobileComponentFrozenPane extends BasicPane { + + private UIComboCheckBox uiComboCheckBox; + + public MobileComponentFrozenPane() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + UILabel frozenLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Frozen")); + uiComboCheckBox = new UIComboCheckBox(initData()); + JPanel wrapJPanel = UIComponentUtils.wrapWithBorderLayoutPane(uiComboCheckBox); + Component[][] components = new Component[][]{ + new Component[]{frozenLabel, wrapJPanel} + }; + JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + centerPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 10, 0)); + JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane(); + holder.add(centerPane, BorderLayout.NORTH); + this.add(holder, BorderLayout.NORTH); + } + + private String[] initData() { + FormDesigner designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + XCreator selectedCreator = designer.getSelectionModel().getSelection().getSelectedCreator(); + Widget selectedModel = selectedCreator != null ? selectedCreator.toData() : null; + + if (selectedModel == null || !selectedModel.acceptType(WSortLayout.class)) { + return ArrayUtils.EMPTY_STRING_ARRAY; + } + + List widgetList = ((WSortLayout) selectedModel).getNonContainerWidgetList(); + return widgetList.toArray(new String[0]); + } + + public void update(XCreator xCreator) { + List selected = new ArrayList<>(); + WSortLayout wSortLayout = ((WSortLayout) xCreator.toData()); + Object[] values = uiComboCheckBox.getSelectedValues(); + for (Object widgetName : values) { + selected.add((String) widgetName); + } + wSortLayout.updateFrozenWidgets(selected); + } + + public void populate(XCreator xCreator) { + WSortLayout wSortLayout = ((WSortLayout) xCreator.toData()); + List all = wSortLayout.getNonContainerWidgetList(); + List selected = wSortLayout.getFrozenWidgets(); + Map map = new LinkedHashMap<>(); + for (String value : selected) { + map.put(value, true); + } + all.removeAll(selected); + for (String value : all) { + map.put(value, false); + } + uiComboCheckBox.setSelectedValues(map); + } + + @Override + protected String title4PopupWindow() { + return "ComponentFrozenPane"; + } +} diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentLayoutIntervalPane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentLayoutIntervalPane.java index 5a565373d9..169b014a0a 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentLayoutIntervalPane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentLayoutIntervalPane.java @@ -3,7 +3,6 @@ package com.fr.design.widget.ui.designer.mobile.component; import com.fr.base.iofile.attr.AttrMarkFactory; import com.fr.base.iofile.attr.FormBodyPaddingAttrMark; import com.fr.design.designer.IntervalConstants; -import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.FRGUIPaneFactory; @@ -29,24 +28,17 @@ public class MobileComponentLayoutIntervalPane extends XmlRelationedBasicPane { super(xmlTag); this.setLayout(FRGUIPaneFactory.createBorderLayout()); UILabel intervalLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Interval")); - - double f = TableLayout.FILL; - double p = TableLayout.PREFERRED; - double[] rowSize = {p, p}; - double[] columnSize = {p, f}; - int[][] rowCount = {{1, 1}, {1, 1}}; componentIntervel = new UISpinner(0, Integer.MAX_VALUE, 1, FormBodyPaddingAttrMark.DEFAULT_SIZE); - JPanel componentIntervelPane = UIComponentUtils.wrapWithBorderLayoutPane(componentIntervel); + JPanel componentIntervalPane = UIComponentUtils.wrapWithBorderLayoutPane(componentIntervel); Component[][] components = new Component[][]{ - new Component[]{intervalLabel, componentIntervelPane} + new Component[]{intervalLabel, componentIntervalPane} }; - 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)); + JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); + centerPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 10, 0)); JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane(); holder.add(centerPane, BorderLayout.NORTH); - UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, holder); - this.add(layoutExpandablePane, BorderLayout.NORTH); + this.add(holder, BorderLayout.NORTH); } @Override diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentAdvancePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentMarginPane.java similarity index 77% rename from designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentAdvancePane.java rename to designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentMarginPane.java index f94d579079..7a1bb34eee 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentAdvancePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentMarginPane.java @@ -2,7 +2,6 @@ package com.fr.design.widget.ui.designer.mobile.component; import com.fr.base.iofile.attr.AttrMarkFactory; import com.fr.base.iofile.attr.FormBodyPaddingAttrMark; -import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.widget.ui.designer.XmlRelationedBasicPane; import com.fr.design.widget.ui.designer.component.PaddingBoundPane; @@ -13,20 +12,19 @@ import java.awt.BorderLayout; /** * 只有内边距设置的高级设置 */ -public class MobileComponentAdvancePane extends XmlRelationedBasicPane { +public class MobileComponentMarginPane extends XmlRelationedBasicPane { private PaddingBoundPane paddingBound; - public MobileComponentAdvancePane(String xmlTag) { + public MobileComponentMarginPane(String xmlTag) { super(xmlTag); this.setLayout(FRGUIPaneFactory.createBorderLayout()); paddingBound = new PaddingBoundPane(FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE); - UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, paddingBound); - this.add(advanceExpandablePane, BorderLayout.NORTH); + this.add(paddingBound, BorderLayout.NORTH); } @Override protected String title4PopupWindow() { - return "ComponentAdvancePane"; + return "ComponentMarginPane"; } public void update(RichStyleWidgetProvider marginWidget) {