Browse Source

bugfix

research/10.0
zack 6 years ago
parent
commit
9498f198bc
  1. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  2. 22
      designer-form/src/main/java/com/fr/design/designer/properties/mobile/BodyFitMobilePropertyUI.java
  3. 12
      designer-form/src/main/java/com/fr/design/form/util/FormDesignerUtils.java
  4. 62
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyFitMobileDefinePane.java
  5. 40
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java
  6. 17
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileWidgetDefinePane.java
  7. 20
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java

4
designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java

@ -5,7 +5,7 @@ import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter;
import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.mobile.BodyFitMobilePropertyUI;
import com.fr.design.designer.properties.mobile.BodyMobilePropertyUI;
import com.fr.design.form.layout.FRFitLayout;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.mainframe.FormArea;
@ -1207,7 +1207,7 @@ public class XWFitLayout extends XLayoutContainer {
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[]{ new BodyFitMobilePropertyUI(this)};
return new WidgetPropertyUIProvider[]{ new BodyMobilePropertyUI(this)};
}
@Override

22
designer-form/src/main/java/com/fr/design/designer/properties/mobile/BodyFitMobilePropertyUI.java

@ -1,22 +0,0 @@
package com.fr.design.designer.properties.mobile;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.dialog.BasicPane;
import com.fr.design.widget.ui.designer.mobile.BodyFitMobileDefinePane;
/**
* 自适应对应body对应的移动端属性
*/
public class BodyFitMobilePropertyUI extends BodyMobilePropertyUI {
public BodyFitMobilePropertyUI(XLayoutContainer xwFitLayout) {
super(xwFitLayout);
}
@Override
public BasicPane createWidgetAttrPane() {
return new BodyFitMobileDefinePane(getxCreator());
}
}

12
designer-form/src/main/java/com/fr/design/form/util/FormDesignerUtils.java

@ -13,4 +13,16 @@ public class FormDesignerUtils {
public static boolean isAppRelayout(FormDesigner designer) {
return ((WFitLayout) designer.getRootComponent().toData()).isAppRelayout();
}
/**
* body布局是否设置了绝对布局
*
* @param designer
* @return
*/
public static boolean isBodyAbsolute(FormDesigner designer) {
WFitLayout root = ((WFitLayout) designer.getRootComponent().toData());
return root.getBodyLayoutType() == com.fr.form.ui.container.WBodyLayoutType.ABSOLUTE;
}
}

62
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyFitMobileDefinePane.java

@ -1,62 +0,0 @@
package com.fr.design.widget.ui.designer.mobile;
import com.fr.base.iofile.attr.FormBodyPaddingAttrMark;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.FormDesigner;
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.MobileComponentLayoutIntervalPane;
import com.fr.form.ui.RichStyleWidgetProvider;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* Created by plough on 2018/2/1.
*/
public class BodyFitMobileDefinePane extends BodyMobileDefinePane {
private MobileComponentAdvancePane advancePane;
private MobileComponentLayoutIntervalPane intervalPane;
public BodyFitMobileDefinePane(XCreator xCreator) {
super(xCreator);
}
@Override
public void initPropertyGroups(Object source) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
setDesigner(WidgetPropertyPane.getInstance().getEditingFormDesigner());
this.add(createNorthPane(), BorderLayout.NORTH);
this.add(getMobileWidgetListPane(), BorderLayout.CENTER);
this.repaint();
}
private JPanel createNorthPane() {
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
advancePane = new MobileComponentAdvancePane(FormBodyPaddingAttrMark.XML_TAG);
intervalPane = new MobileComponentLayoutIntervalPane(FormBodyPaddingAttrMark.XML_TAG);
holder.add(getMobilePropertyPane(), BorderLayout.NORTH);
//高级
holder.add(advancePane, BorderLayout.CENTER);
//布局
holder.add(intervalPane, BorderLayout.SOUTH);
return holder;
}
@Override
public void populate(FormDesigner designer) {
super.populate(designer);
advancePane.populate((RichStyleWidgetProvider) getBodyCreator().toData());
intervalPane.populate((RichStyleWidgetProvider) getBodyCreator().toData());
}
@Override
public void update() {
super.update();
advancePane.update((RichStyleWidgetProvider) getBodyCreator().toData());
intervalPane.update((RichStyleWidgetProvider) getBodyCreator().toData());
}
}

40
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java

@ -1,5 +1,6 @@
package com.fr.design.widget.ui.designer.mobile;
import com.fr.base.iofile.attr.FormBodyPaddingAttrMark;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
@ -10,6 +11,9 @@ 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.MobileComponentLayoutIntervalPane;
import com.fr.form.ui.RichStyleWidgetProvider;
import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WSortLayout;
@ -26,6 +30,8 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
private AttributeChangeListener changeListener;
private UICheckBox appRelayoutCheck;
private MobileWidgetListPane mobileWidgetListPane;
private MobileComponentAdvancePane advancePane;
private MobileComponentLayoutIntervalPane intervalPane;
public BodyMobileDefinePane(XCreator xCreator) {
this.bodyCreator = xCreator;
@ -51,7 +57,7 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
public void initPropertyGroups(Object source) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
this.add(getMobilePropertyPane(), BorderLayout.NORTH);
this.add(createNorthPane(), BorderLayout.NORTH);
this.add(getMobileWidgetListPane(), BorderLayout.CENTER);
this.repaint();
}
@ -80,6 +86,24 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Order"), 280, 20, panelWrapper);
}
private JPanel createNorthPane() {
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
holder.add(getMobilePropertyPane(), BorderLayout.NORTH);
advancePane = new MobileComponentAdvancePane(FormBodyPaddingAttrMark.XML_TAG);
intervalPane = new MobileComponentLayoutIntervalPane(FormBodyPaddingAttrMark.XML_TAG);
//高级
holder.add(advancePane, BorderLayout.CENTER);
//布局
holder.add(intervalPane, BorderLayout.SOUTH);
advancePane.setVisible(!shouldHidePadding(designer));
intervalPane.setVisible(!shouldHidePadding(designer));
return holder;
}
private void bindListeners2Widgets() {
reInitAllListeners();
this.changeListener = new AttributeChangeListener() {
@ -117,12 +141,26 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
// 数据 populate 完成后,再设置监听
this.bindListeners2Widgets();
this.addAttributeChangeListener(changeListener);
advancePane.populate((RichStyleWidgetProvider) getBodyCreator().toData());
intervalPane.populate((RichStyleWidgetProvider) getBodyCreator().toData());
}
@Override
public void update() {
boolean appRelayout = appRelayoutCheck.isSelected();
setAppRelayout(appRelayoutCheck.isSelected());
boolean appPaddingVisible = appRelayout || !FormDesignerUtils.isBodyAbsolute(designer);
advancePane.setVisible(appPaddingVisible);
intervalPane.setVisible(appPaddingVisible);
mobileWidgetListPane.updateToDesigner();
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
if (advancePane.isVisible()) {
advancePane.update((RichStyleWidgetProvider) getBodyCreator().toData());
}
if (intervalPane.isVisible()) {
intervalPane.update((RichStyleWidgetProvider) getBodyCreator().toData());
}
}
}

17
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileWidgetDefinePane.java

@ -1,5 +1,6 @@
package com.fr.design.widget.ui.designer.mobile;
import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.mainframe.FormDesigner;
@ -7,10 +8,10 @@ import javax.swing.*;
/**
* 所有移动端需要拓展的属性面板均继承此类
*
* <p>
* Created by fanglei on 2017/8/8.
*/
public abstract class MobileWidgetDefinePane extends AbstractAttrNoScrollPane{
public abstract class MobileWidgetDefinePane extends AbstractAttrNoScrollPane {
//初始化panel数据再repaint
public abstract void initPropertyGroups(Object source);
@ -28,11 +29,21 @@ public abstract class MobileWidgetDefinePane extends AbstractAttrNoScrollPane{
// 暂不需要此方法
@Override
protected void initContentPane() {}
protected void initContentPane() {
}
// 暂不需要此方法
@Override
protected JPanel createContentPane() {
return new JPanel();
}
/**
* 绝对布局且不勾选手机重布局 的时候不支持边距设置
*
* @return
*/
public boolean shouldHidePadding(FormDesigner designer) {
return !FormDesignerUtils.isAppRelayout(designer) && FormDesignerUtils.isBodyAbsolute(designer);
}
}

20
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java

@ -4,7 +4,6 @@ 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.form.util.FormDesignerUtils;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
@ -16,8 +15,6 @@ 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.MobileComponentLayoutIntervalPane;
import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
@ -63,7 +60,7 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{label, templateStyleEditor}, {new UILabel()}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_LARGE);
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
holder.add(jPanel, BorderLayout.NORTH);
if (!shouldHidePadding()) {
if (!shouldHidePadding(designer)) {
advancePane = new MobileComponentAdvancePane(FormTabPaddingAttrMark.XML_TAG);
intervalPane = new MobileComponentLayoutIntervalPane(FormTabPaddingAttrMark.XML_TAG);
//高级
@ -100,19 +97,4 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
intervalPane.update((WCardTagLayout) xCreator.toData());
}
}
// body是否是绝对布局
private boolean isBodyAbsoluteRelayout() {
WFitLayout root = ((WFitLayout) designer.getRootComponent().toData());
return root.getBodyLayoutType() == WBodyLayoutType.ABSOLUTE;
}
/**
* 绝对布局且不勾选手机重布局 的时候不支持边距设置
*
* @return
*/
private boolean shouldHidePadding() {
return !FormDesignerUtils.isAppRelayout(designer) && isBodyAbsoluteRelayout();
}
}

Loading…
Cancel
Save