zack
6 years ago
13 changed files with 380 additions and 74 deletions
@ -0,0 +1,22 @@ |
|||||||
|
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()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package com.fr.design.form.util; |
||||||
|
|
||||||
|
import com.fr.design.mainframe.FormDesigner; |
||||||
|
import com.fr.form.ui.container.WFitLayout; |
||||||
|
|
||||||
|
public class FormDesignerUtils { |
||||||
|
/** |
||||||
|
* body布局是否设置了手机重布局 |
||||||
|
* |
||||||
|
* @param designer |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static boolean isAppRelayout(FormDesigner designer) { |
||||||
|
return ((WFitLayout) designer.getRootComponent().toData()).isAppRelayout(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
package com.fr.design.widget.ui.designer; |
||||||
|
|
||||||
|
import com.fr.design.dialog.BasicPane; |
||||||
|
|
||||||
|
/** |
||||||
|
* 有些控件在不同终端需要对相同的属性分别进行设置,基础设置面板是一样的但是映射到控件上的属性又是不一样的,为了重用面板,这边加上xmltag做区分 |
||||||
|
*/ |
||||||
|
public abstract class XmlRelationedBasicPane extends BasicPane{ |
||||||
|
private String xmlTag; |
||||||
|
|
||||||
|
public XmlRelationedBasicPane(String xmlTag) { |
||||||
|
this.xmlTag = xmlTag; |
||||||
|
} |
||||||
|
|
||||||
|
public String getXmlTag() { |
||||||
|
return xmlTag; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,62 @@ |
|||||||
|
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()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,45 @@ |
|||||||
|
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; |
||||||
|
import com.fr.form.ui.RichStyleWidgetProvider; |
||||||
|
|
||||||
|
import java.awt.BorderLayout; |
||||||
|
|
||||||
|
/** |
||||||
|
* 只有内边距设置的高级设置 |
||||||
|
*/ |
||||||
|
public class MobileComponentAdvancePane extends XmlRelationedBasicPane { |
||||||
|
private PaddingBoundPane paddingBound; |
||||||
|
|
||||||
|
public MobileComponentAdvancePane(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); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return "ComponentAdvancePane"; |
||||||
|
} |
||||||
|
|
||||||
|
public void update(RichStyleWidgetProvider marginWidget) { |
||||||
|
FormBodyPaddingAttrMark attrMark = marginWidget.getWidgetAttrMark(getXmlTag()); |
||||||
|
attrMark = attrMark == null ? (FormBodyPaddingAttrMark) AttrMarkFactory.createAttrMark(getXmlTag()) : attrMark; |
||||||
|
attrMark.setPaddingMargin(paddingBound.updateBean()); |
||||||
|
marginWidget.addWidgetAttrMark(attrMark); |
||||||
|
} |
||||||
|
|
||||||
|
public void populate(RichStyleWidgetProvider marginWidget) { |
||||||
|
FormBodyPaddingAttrMark attrMark = marginWidget.getWidgetAttrMark(getXmlTag()); |
||||||
|
if (attrMark != null) { |
||||||
|
paddingBound.populateBean(attrMark.getPaddingMargin()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,71 @@ |
|||||||
|
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; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.utils.gui.UIComponentUtils; |
||||||
|
import com.fr.design.widget.FRWidgetFactory; |
||||||
|
import com.fr.design.widget.ui.designer.XmlRelationedBasicPane; |
||||||
|
import com.fr.form.ui.RichStyleWidgetProvider; |
||||||
|
|
||||||
|
import javax.swing.BorderFactory; |
||||||
|
import javax.swing.JPanel; |
||||||
|
import java.awt.BorderLayout; |
||||||
|
import java.awt.Component; |
||||||
|
|
||||||
|
/** |
||||||
|
* 只有组件间隔的布局设置 |
||||||
|
*/ |
||||||
|
public class MobileComponentLayoutIntervalPane extends XmlRelationedBasicPane { |
||||||
|
private UISpinner componentIntervel; |
||||||
|
|
||||||
|
public MobileComponentLayoutIntervalPane(String xmlTag) { |
||||||
|
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); |
||||||
|
|
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{intervalLabel, componentIntervelPane} |
||||||
|
}; |
||||||
|
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 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); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return "ComponentIntervelPane"; |
||||||
|
} |
||||||
|
|
||||||
|
public void update(RichStyleWidgetProvider marginWidget) { |
||||||
|
|
||||||
|
FormBodyPaddingAttrMark attrMark = marginWidget.getWidgetAttrMark(getXmlTag()); |
||||||
|
attrMark = attrMark == null ? (FormBodyPaddingAttrMark) AttrMarkFactory.createAttrMark(getXmlTag()) : attrMark; |
||||||
|
attrMark.setInterval((int) componentIntervel.getValue()); |
||||||
|
marginWidget.addWidgetAttrMark(attrMark); |
||||||
|
} |
||||||
|
|
||||||
|
public void populate(RichStyleWidgetProvider marginWidget) { |
||||||
|
FormBodyPaddingAttrMark attrMark = marginWidget.getWidgetAttrMark(getXmlTag()); |
||||||
|
if (attrMark != null) { |
||||||
|
componentIntervel.setValueWithoutEvent(attrMark.getInterval()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue