From 1445ce99e009867a9bcd496a54e726bcd3094bc2 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 22 Jan 2018 09:22:10 +0800 Subject: [PATCH] =?UTF-8?q?MOBILE-6341=20=E3=80=909.2=E3=80=91FR9.0?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=94=AF=E6=8C=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8=E5=9B=BE=E8=A1=A8=E5=9D=97?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E8=87=AA=E9=80=82=E5=BA=94=E9=80=BB?= =?UTF-8?q?=E8=BE=91=3D>=E5=9B=BE=E8=A1=A8=E5=9D=97=E7=9A=84=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E8=AE=BE=E7=BD=AE=E7=95=8C=E9=9D=A2=3D>?= =?UTF-8?q?=E5=88=9D=E6=AD=A5=E6=A1=86=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/creator/XChartEditor.java | 7 + .../mobile/ChartEditorPropertyUI.java | 38 ++++ .../design/mainframe/WidgetPropertyPane.java | 3 + .../mobile/ChartEditorDefinePane.java | 163 ++++++++++++++++++ 4 files changed, 211 insertions(+) create mode 100644 designer_form/src/com/fr/design/designer/properties/mobile/ChartEditorPropertyUI.java create mode 100644 designer_form/src/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java diff --git a/designer_form/src/com/fr/design/designer/creator/XChartEditor.java b/designer_form/src/com/fr/design/designer/creator/XChartEditor.java index 260697355d..8a491e32d4 100644 --- a/designer_form/src/com/fr/design/designer/creator/XChartEditor.java +++ b/designer_form/src/com/fr/design/designer/creator/XChartEditor.java @@ -10,6 +10,9 @@ import com.fr.base.chart.BaseChartCollection; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.models.SelectionModel; +import com.fr.design.designer.properties.mobile.ChartEditorPropertyUI; +import com.fr.design.designer.properties.mobile.ElementCasePropertyUI; +import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.mainframe.*; @@ -278,4 +281,8 @@ public class XChartEditor extends XBorderStyleWidgetCreator { initStyle(); } + @Override + public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { + return new WidgetPropertyUIProvider[]{ new ChartEditorPropertyUI(this)}; + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/mobile/ChartEditorPropertyUI.java b/designer_form/src/com/fr/design/designer/properties/mobile/ChartEditorPropertyUI.java new file mode 100644 index 0000000000..320f51b319 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/mobile/ChartEditorPropertyUI.java @@ -0,0 +1,38 @@ +package com.fr.design.designer.properties.mobile; + +import com.fr.design.designer.creator.XChartEditor; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XElementCase; +import com.fr.design.dialog.BasicPane; +import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; +import com.fr.design.gui.itable.AbstractPropertyTable; +import com.fr.design.widget.ui.designer.mobile.ChartEditorDefinePane; +import com.fr.design.widget.ui.designer.mobile.ElementCaseDefinePane; +import com.fr.general.Inter; + +/** + * Created by plough on 2018/1/18. + */ +public class ChartEditorPropertyUI extends AbstractWidgetPropertyUIProvider { + + private XCreator xCreator; + + public ChartEditorPropertyUI(XChartEditor xChartEditor) { + this.xCreator = xChartEditor; + } + + @Override + public AbstractPropertyTable createWidgetAttrTable() { + return null; + } + + @Override + public BasicPane createWidgetAttrPane() { + return new ChartEditorDefinePane(xCreator); + } + + @Override + public String tableTitle() { + return Inter.getLocText("FR-Designer_Mobile-Attr"); + } +} diff --git a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java index 75a1bed357..eda8dcd917 100644 --- a/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java +++ b/designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java @@ -35,6 +35,8 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope private static final String PARA = "para"; private static final String BODY = "body"; + private static final int PADDING = 10; + private static final int PADDING_M = 12; private FormWidgetCardPane formWidgetCardPane; // 控件的属性表 private EventPropertyTable eventTable; // 控件的事件表 private List widgetPropertyTables; // 这个变量应该是保存控件拓展的属性tab @@ -224,6 +226,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) { MobileWidgetDefinePane extraPane = (MobileWidgetDefinePane) widgetAttrProvider.createWidgetAttrPane(); if (extraPane != null) { + extraPane.setBorder(BorderFactory.createEmptyBorder(PADDING, PADDING, PADDING, PADDING_M)); mobileExtraPropertyPanes.add(extraPane); wsp.add(extraPane); } diff --git a/designer_form/src/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java new file mode 100644 index 0000000000..492a2c62c4 --- /dev/null +++ b/designer_form/src/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java @@ -0,0 +1,163 @@ +package com.fr.design.widget.ui.designer.mobile; + +import com.fr.base.mobile.ChartMobileFitAttrState; +import com.fr.base.mobile.MobileFitAttrState; +import com.fr.design.constants.LayoutConstants; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.properties.items.Item; +import com.fr.design.foldablepane.UIExpandablePane; +import com.fr.design.gui.frpane.AttributeChangeListener; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.UIComboBox; +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.mainframe.DesignerContext; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.form.ui.ChartEditor; +import com.fr.form.ui.ElementCaseEditor; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by plough on 2018/1/18. + */ +public class ChartEditorDefinePane extends MobileWidgetDefinePane{ + private static final Item[] ITEMS = { + new Item(ChartMobileFitAttrState.AUTO.description(), ChartMobileFitAttrState.AUTO), + new Item(ChartMobileFitAttrState.AREA.description(), ChartMobileFitAttrState.AREA), + new Item(ChartMobileFitAttrState.GEOMETRIC.description(), ChartMobileFitAttrState.GEOMETRIC) + }; + + private XCreator xCreator; // 当前选中控件的xCreator + private FormDesigner designer; // 当前设计器 +// private UIComboBox hComboBox; // 横屏下拉框 + private UIComboBox vComboBox;// 竖屏下拉框 +// private UICheckBox heightRestrictCheckBox; // 手机显示限制高度复选框 + private UILabel maxHeightLabel; + private UISpinner maxHeightSpinner; // 最大高度Spinner + private AttributeChangeListener changeListener; + + public ChartEditorDefinePane (XCreator xCreator) { + this.xCreator = xCreator; + } + + @Override + protected void initContentPane() {} + + @Override + protected JPanel createContentPane() { + return null; + } + + @Override + public String getIconPath() { + return ""; + } + + @Override + public String title4PopupWindow() { + return "ChartEditor"; + } + + + @Override + public void initPropertyGroups(Object source) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); +// this.hComboBox = new UIComboBox(ITEMS); + this.vComboBox = new UIComboBox(ITEMS); +// this.heightRestrictCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Mobile-Height-Limit")); + this.maxHeightLabel = new UILabel(Inter.getLocText("FR-Designer_Mobile-Height-Percent"), SwingConstants.LEFT); + this.maxHeightSpinner = new UISpinner(0, 1, 0.01, 0.75); + maxHeightSpinner.setVisible(false); + maxHeightLabel.setVisible(false); + + Component[][] components = new Component[][]{ + new Component[] {new UILabel("放大逻辑", SwingConstants.LEFT), new UILabel("等比例自适应")}, + new Component[] {new UILabel("缩小逻辑", SwingConstants.LEFT), vComboBox}, + new Component[] {new UILabel("提示:系统根据模版自动匹配缩小逻辑"), null}, + new Component[] {maxHeightLabel, maxHeightSpinner} + }; + double f = TableLayout.FILL; + double p = TableLayout.PREFERRED; + double[] rowSize = {p, p, p, p}; + double[] columnSize = {p,f}; + int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}}; + final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 30, LayoutConstants.VGAP_LARGE); + panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); + final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane(); + panelWrapper.add(panel, BorderLayout.NORTH); + UIExpandablePane folderPane = new UIExpandablePane("图表自适应", 280, 20, panelWrapper); + this.add(folderPane, BorderLayout.NORTH); + this.bingListeners2Widgets(); + this.setGlobalNames(); + this.repaint(); + } + + private void bingListeners2Widgets() { + reInitAllListeners(); + this.changeListener = new AttributeChangeListener() { + @Override + public void attributeChange() { + update(); + } + }; + } + + /** + * 后台初始化所有事件. + */ + private void reInitAllListeners() { + initListener(this); + } + + @Override + public void populate(FormDesigner designer) { +// this.designer = designer; +// this.addAttributeChangeListener(changeListener); +// ChartEditor elementCaseEditor = (ChartEditor)xCreator.toData(); +// this.hComboBox.setSelectedItem(new Item (elementCaseEditor.getHorziontalAttr().description(), elementCaseEditor.getHorziontalAttr())); +// this.vComboBox.setSelectedItem(new Item (elementCaseEditor.getVerticalAttr().description(), elementCaseEditor.getVerticalAttr())); +// this.heightRestrictCheckBox.setSelected(elementCaseEditor.isHeightRestrict()); +// this.maxHeightLabel.setVisible(); +// this.maxHeightSpinner.setVisible(elementCaseEditor.isHeightRestrict()); +// this.maxHeightSpinner.setValue(elementCaseEditor.getHeightPercent()); + } + + @Override + public void update() { +// DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来 +// String globalName = this.getGlobalName(); +// switch (globalName) { +// case "hComboBox": +//// ((ChartEditor)xCreator.toData()).setHorziontalAttr(((MobileFitAttrState)((Item)hComboBox.getSelectedItem()).getValue())); +// break; +// case "vComboBox": +//// ((ChartEditor)xCreator.toData()).setVerticalAttr(((MobileFitAttrState)((Item)vComboBox.getSelectedItem()).getValue())); +// break; +// case "heightRestrictCheckBox": +// boolean isHeightRestrict = heightRestrictCheckBox.isSelected(); +//// ((ChartEditor)xCreator.toData()).setHeightRestrict(isHeightRestrict); +// maxHeightSpinner.setVisible(isHeightRestrict); +// maxHeightLabel.setVisible(isHeightRestrict); +// break; +// case "maxHeightSpinner": +//// ((ChartEditor)xCreator.toData()).setHeightPercent(maxHeightSpinner.getValue()); +// break; +// } + } + + private void setGlobalNames() { +// this.hComboBox.setGlobalName("hComboBox"); +// this.vComboBox.setGlobalName("vComboBox"); +// this.heightRestrictCheckBox.setGlobalName("heightRestrictCheckBox"); +// this.maxHeightSpinner.setGlobalName("maxHeightSpinner"); + } + +}