From 2cae02f227bd81113282f81b067807c2bbf56659 Mon Sep 17 00:00:00 2001 From: Lee Date: Wed, 8 Jun 2016 10:42:42 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E6=9B=B4=E6=94=B9=E5=88=B0master?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/mobile/MobileRadioCheckPane.java | 70 +++++++++++++++++++ .../report/mobile/ReportMobileAttrPane.java | 12 ++-- .../design/designer/creator/XElementCase.java | 48 +++---------- .../mobile/ElementCasePropertyTable.java | 66 +++++++++++++---- .../properties/mobile/MobileFitEditor.java | 2 +- 5 files changed, 142 insertions(+), 56 deletions(-) create mode 100644 designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java diff --git a/designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java b/designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java new file mode 100644 index 0000000000..9264619d32 --- /dev/null +++ b/designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java @@ -0,0 +1,70 @@ +package com.fr.design.report.mobile; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.general.Inter; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +public class MobileRadioCheckPane extends BasicBeanPane { + + private List checkBoxes = new ArrayList(); + + public MobileRadioCheckPane(String title) { + initComponents(title); + } + + private void initComponents(String title) { + double p = TableLayout.PREFERRED; + double[] rowSize = {p}; + double[] columnSize = {p,p}; + + UICheckBox checkBox = new UICheckBox(Inter.getLocText("FR-Designer_Mobile-Open")); + checkBox.setSelected(true); + + checkBoxes.add(checkBox); + + Component[][] components = new Component[][]{ + new Component[]{new UILabel(title), checkBox} + }; + JPanel fitOpsPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); + fitOpsPane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10)); + + this.add(fitOpsPane); + } + + public int getCurrentState() { + return checkBoxes.get(0).isSelected() ? 0 : 1; + } + /** + * 设置按钮状态 + */ + public void setEnabled(boolean enabled) { + for (UICheckBox checkBox : checkBoxes) { + checkBox.setEnabled(enabled); + } + } + + @Override + protected String title4PopupWindow() { + return StringUtils.EMPTY; + } + + @Override + public void populateBean(Boolean ob) { + checkBoxes.get(0).setSelected(ob); + } + + @Override + public Boolean updateBean() { + int state = getCurrentState(); + return state == 0 ? true : false; + } +} \ No newline at end of file diff --git a/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java b/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java index 1cd04e8d03..a4522c14a6 100644 --- a/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java +++ b/designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java @@ -18,6 +18,8 @@ public class ReportMobileAttrPane extends BasicBeanPane { private MobileRadioGroupPane horizionPane; //竖屏设置面板 private MobileRadioGroupPane verticalPane; + //缩放设置面板 + private MobileRadioCheckPane radioCheckPane; public ReportMobileAttrPane() { initComponents(); @@ -30,9 +32,10 @@ public class ReportMobileAttrPane extends BasicBeanPane { JPanel fitOpsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); horizionPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Horizontal")); verticalPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Vertical")); + radioCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-Zoom")); fitOpsPane.add(horizionPane, BorderLayout.NORTH); - fitOpsPane.add(verticalPane, BorderLayout.SOUTH); - + fitOpsPane.add(verticalPane, BorderLayout.CENTER); + fitOpsPane.add(radioCheckPane, BorderLayout.SOUTH); borderPane.add(fitOpsPane); this.add(borderPane); } @@ -45,14 +48,15 @@ public class ReportMobileAttrPane extends BasicBeanPane { horizionPane.populateBean(ob.getHorziontalAttr()); verticalPane.populateBean(ob.getVerticalAttr()); + radioCheckPane.populateBean(ob.isZoom()); } @Override public ElementCaseMobileAttr updateBean() { MobileFitAttrState horizonState = horizionPane.updateBean(); MobileFitAttrState verticalState = verticalPane.updateBean(); - - return new ElementCaseMobileAttr(horizonState, verticalState); + boolean isZoom = radioCheckPane.updateBean(); + return new ElementCaseMobileAttr(horizonState, verticalState, isZoom); } @Override diff --git a/designer_form/src/com/fr/design/designer/creator/XElementCase.java b/designer_form/src/com/fr/design/designer/creator/XElementCase.java index 022d8de06d..29310ca0c3 100644 --- a/designer_form/src/com/fr/design/designer/creator/XElementCase.java +++ b/designer_form/src/com/fr/design/designer/creator/XElementCase.java @@ -25,8 +25,6 @@ import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; -import java.util.ArrayList; -import java.util.List; public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{ private UILabel imageLable; @@ -56,23 +54,14 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme * @throws IntrospectionException 异常 */ public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - CRPropertyDescriptor[] crp = ((ElementCaseEditor) data).isHeightRestrict() ? revealHeightLimit() : getDefault(); - FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getPropertyTableEditor(); - if (processor == null) { - return crp; - } - PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass()); - return (CRPropertyDescriptor[]) ArrayUtils.addAll(crp, extraEditor); - } - protected List createNonListenerProperties() throws IntrospectionException { - CRPropertyDescriptor[] propertyTableEditor = { + CRPropertyDescriptor[] propertyTableEditor = new CRPropertyDescriptor[]{ new CRPropertyDescriptor("widgetName", this.data.getClass()) .setI18NName(Inter.getLocText("Form-Widget_Name")), new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass( WLayoutBorderStyleEditor.class).setRendererClass(LayoutBorderStyleRenderer.class).setI18NName( - Inter.getLocText("FR-Designer-Widget_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"). - setPropertyChangeListener(new PropertyChangeAdapter() { + Inter.getLocText("FR-Designer-Widget_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") + .setPropertyChangeListener(new PropertyChangeAdapter() { @Override public void propertyChange() { @@ -85,34 +74,15 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class) .setI18NName(Inter.getLocText("Form-EC_toolbar")) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), - new CRPropertyDescriptor("heightRestrict", this.data.getClass()).setEditorClass(InChangeBooleanEditor.class) - .setI18NName(Inter.getLocText("Form-EC_heightrestrict")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") - }; - List defaultList = new ArrayList<>(); + }; - for (CRPropertyDescriptor propertyDescriptor : propertyTableEditor) { - defaultList.add(propertyDescriptor); + FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getPropertyTableEditor(); + if (processor == null){ + return propertyTableEditor; } - return defaultList; - } - - protected CRPropertyDescriptor[] revealHeightLimit() throws IntrospectionException { - CRPropertyDescriptor heightLimitProperty = new CRPropertyDescriptor("heightPercent", this.data.getClass()) - .setEditorClass(DoubleEditor.class) - .setI18NName(Inter.getLocText("Form-EC_heightpercent")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); - - ArrayList defaultList = (ArrayList) createNonListenerProperties(); - defaultList.add(heightLimitProperty); - - return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]); - } - - protected CRPropertyDescriptor[] getDefault() throws IntrospectionException { - ArrayList defaultList = (ArrayList) createNonListenerProperties(); - return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]); + PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass()); + return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); } diff --git a/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java b/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java index 06e2a520e1..9d4a14d5b5 100644 --- a/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java +++ b/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java @@ -1,6 +1,7 @@ package com.fr.design.designer.properties.mobile; import com.fr.base.FRContext; +import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.XCreator; import com.fr.design.form.util.XCreatorConstants; @@ -9,16 +10,20 @@ import com.fr.design.gui.itable.PropertyGroup; import com.fr.design.gui.xtable.PropertyGroupModel; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.widget.editors.DoubleEditor; +import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor; +import com.fr.form.ui.ElementCaseEditor; import com.fr.general.Inter; import javax.swing.table.TableModel; import java.beans.IntrospectionException; import java.util.ArrayList; +import java.util.List; /** * Created by Administrator on 2016/5/16/0016. */ -public class ElementCasePropertyTable extends AbstractPropertyTable { +public class ElementCasePropertyTable extends AbstractPropertyTable{ private XCreator xCreator; private FormDesigner designer; @@ -27,6 +32,52 @@ public class ElementCasePropertyTable extends AbstractPropertyTable { this.xCreator = xCreator; } + public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { + if (((ElementCaseEditor ) xCreator.toData()).getVerticalAttr().getState() == 2 && !((ElementCaseEditor ) xCreator.toData()).isHeightRestrict()) { + ((ElementCaseEditor ) xCreator.toData()).setHeightRestrict(true); + return revealHeightLimit(); + } + CRPropertyDescriptor[] crp = ((ElementCaseEditor) xCreator.toData()).isHeightRestrict() ? revealHeightLimit() : getDefault(); + return crp; + } + + protected List createNonListenerProperties() throws IntrospectionException { + CRPropertyDescriptor[] propertyTableEditor = { + new CRPropertyDescriptor("horziontalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class) + .setRendererClass(MobileFitRender.class) + .setI18NName(Inter.getLocText("FR-Designer_Mobile-Horizontal")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")), + new CRPropertyDescriptor("verticalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class) + .setRendererClass(MobileFitRender.class) + .setI18NName(Inter.getLocText("FR-Designer_Mobile-Vertical")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")), + new CRPropertyDescriptor("heightRestrict", this.xCreator.toData().getClass()).setEditorClass(InChangeBooleanEditor.class) + .setI18NName(Inter.getLocText("Form-EC_heightrestrict")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")) + }; + List defaultList = new ArrayList<>(); + + for (CRPropertyDescriptor propertyDescriptor: propertyTableEditor) { + defaultList.add(propertyDescriptor); + } + return defaultList; + } + + protected CRPropertyDescriptor[] revealHeightLimit() throws IntrospectionException { + CRPropertyDescriptor heightLimitProperty = new CRPropertyDescriptor("heightPercent", this.xCreator.toData().getClass()) + .setEditorClass(DoubleEditor.class) + .setI18NName(Inter.getLocText("Form-EC_heightpercent")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); + ArrayList defaultList = (ArrayList) createNonListenerProperties(); + defaultList.add(heightLimitProperty); + return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]); + } + + protected CRPropertyDescriptor[] getDefault() throws IntrospectionException { + ArrayList defaultList = (ArrayList) createNonListenerProperties(); + return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]); + } + @Override public void initPropertyGroups(Object source) { this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); @@ -34,17 +85,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable { groups = new ArrayList(); CRPropertyDescriptor[] propertyTableEditor = null; try { - propertyTableEditor = new CRPropertyDescriptor[]{ - new CRPropertyDescriptor("horziontalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class) - .setRendererClass(MobileFitRender.class) - .setI18NName(Inter.getLocText("FR-Designer_Mobile-Horizontal")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")), - new CRPropertyDescriptor("verticalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class) - .setRendererClass(MobileFitRender.class) - .setI18NName(Inter.getLocText("FR-Designer_Mobile-Vertical")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")) - - }; + propertyTableEditor = supportedDescriptor(); } catch (IntrospectionException e) { FRContext.getLogger().error(e.getMessage()); } @@ -59,6 +100,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable { @Override public void firePropertyEdit() { + designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); } public void populate(FormDesigner designer) { diff --git a/designer_form/src/com/fr/design/designer/properties/mobile/MobileFitEditor.java b/designer_form/src/com/fr/design/designer/properties/mobile/MobileFitEditor.java index 97c6938fc5..9b3948b177 100644 --- a/designer_form/src/com/fr/design/designer/properties/mobile/MobileFitEditor.java +++ b/designer_form/src/com/fr/design/designer/properties/mobile/MobileFitEditor.java @@ -45,6 +45,6 @@ public class MobileFitEditor extends ComboEditor { */ @Override public boolean refreshInTime() { - return false; + return true; } } From d76e2e27a08a682ffc4f029bc0a8b11e3d743285 Mon Sep 17 00:00:00 2001 From: Lee Date: Sun, 12 Jun 2016 15:46:38 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E8=A1=A8=E5=8D=95body=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=EF=BC=8C=E5=9C=A8=E4=BA=8B=E4=BB=B6=E5=8F=B3?= =?UTF-8?q?=E8=BE=B9=E5=A2=9E=E5=8A=A0=E2=80=9C=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E2=80=9D=EF=BC=8C=E7=84=B6=E5=90=8E=E6=8A=8A?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E9=87=8D=E5=B8=83=E5=B1=80=E7=A7=BB=E5=88=B0?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=B1=9E=E6=80=A7=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E9=87=8C=E9=9D=A2=E3=80=82=20=E8=BF=99=E4=B8=AA=E8=8A=B1?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E9=97=B4=E8=BE=83=E5=A4=9A=EF=BC=8C=E4=B8=BB?= =?UTF-8?q?=E8=A6=81=E6=98=AF=E6=95=B4=E4=B8=AA=E4=BB=A3=E7=A0=81=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E9=83=BD=E4=B8=8D=E5=A4=AA=E4=B8=80=E6=A0=B7=E4=BA=86?= =?UTF-8?q?=EF=BC=8C=E7=86=9F=E6=82=89=E4=BA=86=E5=A5=BD=E4=B9=85=E3=80=82?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/FRBodyFitLayoutAdapter.java | 21 ++++ .../designer/creator/XWBodyFitLayout.java | 20 ++++ .../design/designer/creator/XWFitLayout.java | 7 ++ .../BodyMobileLayoutPropertiesGroupModel.java | 111 ++++++++++++++++++ .../FRFitLayoutPropertiesGroupModel.java | 64 +--------- .../properties/WidgetLayoutTable.java | 83 +++++++++++++ .../mobile/BodyElementCasePropertyUI.java | 30 +++++ 7 files changed, 278 insertions(+), 58 deletions(-) create mode 100644 designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyFitLayoutAdapter.java create mode 100644 designer_form/src/com/fr/design/designer/creator/XWBodyFitLayout.java create mode 100644 designer_form/src/com/fr/design/designer/properties/BodyMobileLayoutPropertiesGroupModel.java create mode 100644 designer_form/src/com/fr/design/designer/properties/WidgetLayoutTable.java create mode 100644 designer_form/src/com/fr/design/designer/properties/mobile/BodyElementCasePropertyUI.java diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyFitLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyFitLayoutAdapter.java new file mode 100644 index 0000000000..0dc00045b7 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyFitLayoutAdapter.java @@ -0,0 +1,21 @@ +package com.fr.design.designer.beans.adapters.layout; + +import com.fr.design.beans.GroupModel; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.designer.properties.BodyMobileLayoutPropertiesGroupModel; + +public class FRBodyFitLayoutAdapter extends FRFitLayoutAdapter { + + public FRBodyFitLayoutAdapter(XLayoutContainer container) { + super(container); + } + /** + * 返回布局自身属性,方便一些特有设置在layout刷新时处理 + */ + @Override + public GroupModel getLayoutProperties() { + XWFitLayout xfl = (XWFitLayout) container; + return new BodyMobileLayoutPropertiesGroupModel(xfl); + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XWBodyFitLayout.java b/designer_form/src/com/fr/design/designer/creator/XWBodyFitLayout.java new file mode 100644 index 0000000000..d9a404cb55 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/creator/XWBodyFitLayout.java @@ -0,0 +1,20 @@ +package com.fr.design.designer.creator; + +import com.fr.design.designer.beans.LayoutAdapter; +import com.fr.design.designer.beans.adapters.layout.FRBodyFitLayoutAdapter; +import com.fr.form.ui.container.WFitLayout; +import java.awt.Dimension; + +public class XWBodyFitLayout extends XWFitLayout { + public XWBodyFitLayout() { + this(new WFitLayout(), new Dimension()); + } + + public XWBodyFitLayout(WFitLayout widget, Dimension initSize) { + super(widget, initSize); + } + @Override + public LayoutAdapter getLayoutAdapter() { + return new FRBodyFitLayoutAdapter(this); + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java b/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java index bd2b34290d..79bdc2582a 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java @@ -13,7 +13,9 @@ import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter; import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; +import com.fr.design.designer.properties.mobile.BodyElementCasePropertyUI; import com.fr.design.form.layout.FRFitLayout; +import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.mainframe.FormArea; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.PaddingMargin; @@ -1155,5 +1157,10 @@ public class XWFitLayout extends XLayoutContainer { public XLayoutContainer findNearestFit() { return this; } + + @Override + public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { + return new WidgetPropertyUIProvider[]{ new BodyElementCasePropertyUI(new XWBodyFitLayout())}; + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/BodyMobileLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/BodyMobileLayoutPropertiesGroupModel.java new file mode 100644 index 0000000000..7ec4376627 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/BodyMobileLayoutPropertiesGroupModel.java @@ -0,0 +1,111 @@ +package com.fr.design.designer.properties; + +import com.fr.design.beans.GroupModel; +import com.fr.form.ui.container.WFitLayout; +import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.mainframe.widget.editors.BooleanEditor; +import com.fr.design.mainframe.widget.editors.PropertyCellEditor; +import com.fr.general.Inter; + +import javax.swing.*; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; +import java.awt.*; + +public class BodyMobileLayoutPropertiesGroupModel implements GroupModel { + private PropertyCellEditor reLayoutEditor; + private CheckBoxCellRenderer reLayoutrenderer; + private WFitLayout layout; + private XWFitLayout xfl; + + public BodyMobileLayoutPropertiesGroupModel(XWFitLayout xfl) { + this.xfl = xfl; + this.layout = xfl.toData(); + reLayoutrenderer = new CheckBoxCellRenderer(); + reLayoutEditor = new PropertyCellEditor(new BooleanEditor()); + } + + @Override + public String getGroupName() { + return Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"); + } + + @Override + public int getRowCount() { + return 1; + } + + @Override + public TableCellRenderer getRenderer(int row) { + return reLayoutrenderer; + } + + @Override + public TableCellEditor getEditor(int row) { + return reLayoutEditor; + } + + @Override + public Object getValue(int row, int column) { + if (column == 0) { + return Inter.getLocText("FR-Designer-App_ReLayout"); + }else { + return layout.getAppRelayout(); + } + } + + @Override + public boolean setValue(Object value, int row, int column) { + int state = 0; + boolean appRelayoutState = true; + if(value instanceof Integer) { + state = (Integer)value; + }else if (value instanceof Boolean) { + appRelayoutState = (boolean)value; + } + if (column == 0 || state < 0) { + return false; + } else { + layout.setAppRelayout(appRelayoutState); + return true; + } + } + + /** + * 是否可编辑 + * @param row 行 + * @return 否 + */ + @Override + public boolean isEditable(int row) { + return true; + } + + private class CheckBoxCellRenderer extends UICheckBox implements TableCellRenderer { + + + public CheckBoxCellRenderer() { + super(); + setOpaque(true); + + } + + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + if (value instanceof Boolean) { + setSelected(((Boolean) value).booleanValue()); + setEnabled(table.isCellEditable(row, column)); + if (isSelected) { + setBackground(table.getSelectionBackground()); + setForeground(table.getSelectionForeground()); + } else { + setForeground(table.getForeground()); + setBackground(table.getBackground()); + } + } else { + return null; + } + return this; + } + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java index bbabddcc86..8a2f507936 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java @@ -5,19 +5,15 @@ package com.fr.design.designer.properties; import com.fr.design.beans.GroupModel; import com.fr.design.designer.creator.XWFitLayout; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.mainframe.widget.editors.BooleanEditor; import com.fr.design.mainframe.widget.editors.FitLayoutDirectionEditor; import com.fr.design.mainframe.widget.editors.IntegerPropertyEditor; import com.fr.design.mainframe.widget.editors.PropertyCellEditor; import com.fr.form.ui.container.WFitLayout; import com.fr.general.Inter; -import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; -import java.awt.*; /** * 自适应布局自身的属性表 @@ -32,8 +28,6 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { private DefaultTableCellRenderer renderer; private FitLayoutDirectionEditor stateEditor; private FitStateRenderer stateRenderer; - private PropertyCellEditor reLayoutEditor; - private CheckBoxCellRenderer reLayoutrenderer; private WFitLayout layout; private XWFitLayout xfl; @@ -44,8 +38,6 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { editor = new PropertyCellEditor(new IntegerPropertyEditor()); stateEditor = new FitLayoutDirectionEditor(); stateRenderer = new FitStateRenderer(); - reLayoutrenderer = new CheckBoxCellRenderer(); - reLayoutEditor = new PropertyCellEditor(new BooleanEditor()); } /** @@ -58,7 +50,7 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { @Override public int getRowCount() { - return 3; + return 2; } @Override @@ -66,11 +58,8 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { switch (row) { case 0: return renderer; - case 1: - return stateRenderer; default: - return reLayoutrenderer; - + return stateRenderer; } } @@ -79,10 +68,8 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { switch (row) { case 0: return editor; - case 1: - return stateEditor; default: - return reLayoutEditor; + return stateEditor; } } @@ -92,19 +79,15 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { switch (row) { case 0: return Inter.getLocText("FR-Designer_Component_Interval"); - case 1 : - return Inter.getLocText("FR-Designer_Component_Scale"); default: - return Inter.getLocText("FR-Designer-App_ReLayout"); + return Inter.getLocText("FR-Designer_Component_Scale"); } } else { switch (row) { case 0: return layout.getCompInterval(); - case 1 : - return layout.getCompState(); default: - return layout.getAppRelayout(); + return layout.getCompState(); } } } @@ -112,11 +95,8 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { @Override public boolean setValue(Object value, int row, int column) { int state = 0; - boolean appRelayoutState = true; if(value instanceof Integer) { state = (Integer)value; - } else if (value instanceof Boolean) { - appRelayoutState = (boolean) value; } if (column == 0 || state < 0) { return false; @@ -128,10 +108,7 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { }else if (row == 1) { layout.setCompState(state); return true; - } else if (row == 2) { - layout.setAppRelayout(appRelayoutState); - return true; - } + } return false; } } @@ -155,33 +132,4 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { public boolean isEditable(int row) { return true; } - - - private class CheckBoxCellRenderer extends UICheckBox implements TableCellRenderer { - - - public CheckBoxCellRenderer() { - super(); - setOpaque(true); - - } - - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - if (value instanceof Boolean) { - setSelected(((Boolean) value).booleanValue()); - setEnabled(table.isCellEditable(row, column)); - if (isSelected) { - setBackground(table.getSelectionBackground()); - setForeground(table.getSelectionForeground()); - } else { - setForeground(table.getForeground()); - setBackground(table.getBackground()); - } - } else { - return null; - } - return this; - } - } - } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/WidgetLayoutTable.java b/designer_form/src/com/fr/design/designer/properties/WidgetLayoutTable.java new file mode 100644 index 0000000000..a62d6461cf --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/WidgetLayoutTable.java @@ -0,0 +1,83 @@ +package com.fr.design.designer.properties; + +import java.awt.event.MouseEvent; +import java.util.ArrayList; + +import javax.swing.JTable; +import javax.swing.table.TableColumn; +import javax.swing.table.TableModel; + +import com.fr.design.beans.GroupModel; +import com.fr.design.designer.creator.*; +import com.fr.design.gui.itable.AbstractPropertyTable; +import com.fr.design.gui.itable.PropertyGroup; +import com.fr.design.designer.beans.LayoutAdapter; + + +public class WidgetLayoutTable extends AbstractPropertyTable { + + private XWBodyFitLayout xwBodyFitLayout; + + public WidgetLayoutTable(XWBodyFitLayout xwBodyFitLayout) { + super(); + setDesigner(xwBodyFitLayout); + } + + public static ArrayList getCreatorPropertyGroup(XCreator source) { + ArrayList groups = new ArrayList(); + if (source instanceof XLayoutContainer) { + LayoutAdapter layoutAdapter = ((XLayoutContainer)source).getLayoutAdapter(); + if(layoutAdapter != null){ + GroupModel m = layoutAdapter.getLayoutProperties(); + if (m != null) { + groups.add(new PropertyGroup(m)); + } + } + } + return groups; + } + + /** + * 初始化属性表组 + * @param source 控件 + */ + public void initPropertyGroups(Object source) { + + groups = getCreatorPropertyGroup(xwBodyFitLayout); + + TableModel model = new BeanTableModel(); + setModel(model); + this.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); + TableColumn tc = this.getColumn(this.getColumnName(0)); + tc.setPreferredWidth(30); + this.repaint(); + } + + private void setDesigner(XWBodyFitLayout xwBodyFitLayout) { + this.xwBodyFitLayout = xwBodyFitLayout; + } + + + /** + * 单元格tooltip + * 属性名悬浮提示 + * + * @param 鼠标点击事件 + * @return 单元格tooltip + */ + public String getToolTipText(MouseEvent event) { + int row = WidgetLayoutTable.super.rowAtPoint(event.getPoint()); + int column = WidgetLayoutTable.super.columnAtPoint(event.getPoint()); + if(row != -1 && column == 0){ + return String.valueOf(this.getValueAt(row, column)); + } + return null; + } + + /** + * 待说明 + */ + public void firePropertyEdit() { + + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/mobile/BodyElementCasePropertyUI.java b/designer_form/src/com/fr/design/designer/properties/mobile/BodyElementCasePropertyUI.java new file mode 100644 index 0000000000..32cccefec2 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/mobile/BodyElementCasePropertyUI.java @@ -0,0 +1,30 @@ +package com.fr.design.designer.properties.mobile; + +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XWBodyFitLayout; +import com.fr.design.designer.properties.WidgetLayoutTable; +import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; +import com.fr.design.gui.itable.AbstractPropertyTable; +import com.fr.general.Inter; + +/** + * Created by Administrator on 2016/5/16/0016. + */ +public class BodyElementCasePropertyUI extends AbstractWidgetPropertyUIProvider { + + private XCreator xCreator; + + public BodyElementCasePropertyUI(XWBodyFitLayout xWBodyFitLayout) { + this.xCreator = xWBodyFitLayout; + } + + @Override + public AbstractPropertyTable createWidgetAttrTable() { + return new WidgetLayoutTable((XWBodyFitLayout) xCreator); + } + + @Override + public String tableTitle() { + return Inter.getLocText("FR-Designer_Mobile-Attr"); + } +} From 48110e51de7d7f3179f00e5705c06d6dbcf57b1e Mon Sep 17 00:00:00 2001 From: Lee Date: Sun, 12 Jun 2016 17:05:39 +0800 Subject: [PATCH 3/8] =?UTF-8?q?class=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/designer/creator/XWFitLayout.java | 4 ++-- .../{WidgetLayoutTable.java => BodyAppRelayoutTable.java} | 8 ++++---- ...ementCasePropertyUI.java => BodyMobilePropertyUI.java} | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) rename designer_form/src/com/fr/design/designer/properties/{WidgetLayoutTable.java => BodyAppRelayoutTable.java} (87%) rename designer_form/src/com/fr/design/designer/properties/mobile/{BodyElementCasePropertyUI.java => BodyMobilePropertyUI.java} (69%) diff --git a/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java b/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java index 79bdc2582a..38652b3d4c 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java @@ -13,7 +13,7 @@ import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter; import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; -import com.fr.design.designer.properties.mobile.BodyElementCasePropertyUI; +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; @@ -1160,7 +1160,7 @@ public class XWFitLayout extends XLayoutContainer { @Override public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { - return new WidgetPropertyUIProvider[]{ new BodyElementCasePropertyUI(new XWBodyFitLayout())}; + return new WidgetPropertyUIProvider[]{ new BodyMobilePropertyUI(new XWBodyFitLayout())}; } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/WidgetLayoutTable.java b/designer_form/src/com/fr/design/designer/properties/BodyAppRelayoutTable.java similarity index 87% rename from designer_form/src/com/fr/design/designer/properties/WidgetLayoutTable.java rename to designer_form/src/com/fr/design/designer/properties/BodyAppRelayoutTable.java index a62d6461cf..e675a81f0b 100644 --- a/designer_form/src/com/fr/design/designer/properties/WidgetLayoutTable.java +++ b/designer_form/src/com/fr/design/designer/properties/BodyAppRelayoutTable.java @@ -14,11 +14,11 @@ import com.fr.design.gui.itable.PropertyGroup; import com.fr.design.designer.beans.LayoutAdapter; -public class WidgetLayoutTable extends AbstractPropertyTable { +public class BodyAppRelayoutTable extends AbstractPropertyTable { private XWBodyFitLayout xwBodyFitLayout; - public WidgetLayoutTable(XWBodyFitLayout xwBodyFitLayout) { + public BodyAppRelayoutTable(XWBodyFitLayout xwBodyFitLayout) { super(); setDesigner(xwBodyFitLayout); } @@ -66,8 +66,8 @@ public class WidgetLayoutTable extends AbstractPropertyTable { * @return 单元格tooltip */ public String getToolTipText(MouseEvent event) { - int row = WidgetLayoutTable.super.rowAtPoint(event.getPoint()); - int column = WidgetLayoutTable.super.columnAtPoint(event.getPoint()); + int row = BodyAppRelayoutTable.super.rowAtPoint(event.getPoint()); + int column = BodyAppRelayoutTable.super.columnAtPoint(event.getPoint()); if(row != -1 && column == 0){ return String.valueOf(this.getValueAt(row, column)); } diff --git a/designer_form/src/com/fr/design/designer/properties/mobile/BodyElementCasePropertyUI.java b/designer_form/src/com/fr/design/designer/properties/mobile/BodyMobilePropertyUI.java similarity index 69% rename from designer_form/src/com/fr/design/designer/properties/mobile/BodyElementCasePropertyUI.java rename to designer_form/src/com/fr/design/designer/properties/mobile/BodyMobilePropertyUI.java index 32cccefec2..3816b9841e 100644 --- a/designer_form/src/com/fr/design/designer/properties/mobile/BodyElementCasePropertyUI.java +++ b/designer_form/src/com/fr/design/designer/properties/mobile/BodyMobilePropertyUI.java @@ -2,7 +2,7 @@ package com.fr.design.designer.properties.mobile; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XWBodyFitLayout; -import com.fr.design.designer.properties.WidgetLayoutTable; +import com.fr.design.designer.properties.BodyAppRelayoutTable; import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; import com.fr.design.gui.itable.AbstractPropertyTable; import com.fr.general.Inter; @@ -10,17 +10,17 @@ import com.fr.general.Inter; /** * Created by Administrator on 2016/5/16/0016. */ -public class BodyElementCasePropertyUI extends AbstractWidgetPropertyUIProvider { +public class BodyMobilePropertyUI extends AbstractWidgetPropertyUIProvider { private XCreator xCreator; - public BodyElementCasePropertyUI(XWBodyFitLayout xWBodyFitLayout) { + public BodyMobilePropertyUI(XWBodyFitLayout xWBodyFitLayout) { this.xCreator = xWBodyFitLayout; } @Override public AbstractPropertyTable createWidgetAttrTable() { - return new WidgetLayoutTable((XWBodyFitLayout) xCreator); + return new BodyAppRelayoutTable((XWBodyFitLayout) xCreator); } @Override From 75ecd607cdb2e70b8540de2582c46670f7be222c Mon Sep 17 00:00:00 2001 From: Lee Date: Mon, 13 Jun 2016 17:12:45 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E9=87=8D=E8=BD=BD=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86=E7=9A=84=E5=85=89=E6=A0=87=E4=BA=8B=E4=BB=B6=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E4=B8=8D=E7=AE=A1=E6=98=AF=E5=85=89=E6=A0=87?= =?UTF-8?q?=E7=A7=BB=E5=87=BA=E8=BF=98=E6=98=AF=E6=8C=89=E4=B8=8B=E5=9B=9E?= =?UTF-8?q?=E8=BD=A6=EF=BC=88enter=EF=BC=89=EF=BC=8C=E4=BC=9A=E7=AB=8B?= =?UTF-8?q?=E5=8D=B3=E8=A7=A6=E5=8F=91=E8=A1=A8=E5=8D=95=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E9=AB=98=E5=BA=A6=E5=B1=9E=E6=80=A7=E7=9A=84setter?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E5=B9=B6=E7=BB=99=E5=87=BA=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E6=8F=90=E7=A4=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/widget/editors/FormattedEditor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java b/designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java index 942fc902c7..2d92f819c4 100644 --- a/designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java +++ b/designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java @@ -36,11 +36,11 @@ public class FormattedEditor extends AbstractPropertyEditor { public void keyReleased(KeyEvent e) { try { - textField.commitEdit(); + textField.commitEdit(); + return; } catch (ParseException e1) { return; } - firePropertyChanged(); } }); } From 758e1f73adc45d24f80cd97518c90d46e3f9556c Mon Sep 17 00:00:00 2001 From: Lee Date: Mon, 13 Jun 2016 23:02:26 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E7=B1=BB=E6=8A=BD=E5=8F=96=E9=9C=80=E8=A6=81=E7=9A=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=8D=95=E7=8B=AC=E4=BD=9C=E4=B8=80=E4=B8=AA=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E5=9C=A8=E5=AD=90=E7=B1=BB=E4=B8=AD=E9=87=8D?= =?UTF-8?q?=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/editors/FormattedEditor.java | 21 ++++++++++------- .../widget/editors/DoubleEditor.java | 23 +++++++++++++++++++ 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java b/designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java index 2d92f819c4..2db12f23b8 100644 --- a/designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java +++ b/designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java @@ -4,6 +4,7 @@ import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; import java.text.Format; import java.text.ParseException; @@ -32,17 +33,21 @@ public class FormattedEditor extends AbstractPropertyEditor { textField = new JFormattedTextField(format); panel.add(textField, BorderLayout.CENTER); textField.setBorder(null); - textField.addKeyListener(new KeyAdapter() { + textField.addKeyListener(createKeyListener()); + } + + protected KeyListener createKeyListener() { + return new KeyAdapter() { - public void keyReleased(KeyEvent e) { - try { + public void keyReleased(KeyEvent e) { + try { textField.commitEdit(); + } catch (ParseException e1) { return; - } catch (ParseException e1) { - return; - } - } - }); + } + firePropertyChanged(); + } + }; } @Override diff --git a/designer_form/src/com/fr/design/mainframe/widget/editors/DoubleEditor.java b/designer_form/src/com/fr/design/mainframe/widget/editors/DoubleEditor.java index 932338dd34..e88d3cea0a 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/editors/DoubleEditor.java +++ b/designer_form/src/com/fr/design/mainframe/widget/editors/DoubleEditor.java @@ -1,11 +1,34 @@ package com.fr.design.mainframe.widget.editors; +import javax.swing.*; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; import java.text.NumberFormat; +import java.text.ParseException; public class DoubleEditor extends FormattedEditor { + private JFormattedTextField textField; + public DoubleEditor() { super(NumberFormat.getNumberInstance()); + textField = (JFormattedTextField) super.getCustomEditor(); + } + + @Override + public KeyListener createKeyListener() { + return new KeyAdapter() { + + public void keyReleased(KeyEvent e) { + try { + textField.commitEdit(); + return; + } catch (ParseException e1) { + return; + } + } + }; } @Override From 5ebadf7e294068d0f464f55e412c5cc44dd1dce0 Mon Sep 17 00:00:00 2001 From: xiaohu Date: Tue, 14 Jun 2016 09:50:10 +0800 Subject: [PATCH 6/8] dev->master --- .../src/com/fr/design/dialog/BasicScrollPane.java | 10 ++++++++-- .../fr/design/editor/editor/ColumnSelectedEditor.java | 4 ++++ .../src/com/fr/design/gui/ibutton/UIButtonGroup.java | 10 ++-------- .../src/com/fr/design/gui/ibutton/UITabGroup.java | 7 ++----- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/designer_base/src/com/fr/design/dialog/BasicScrollPane.java b/designer_base/src/com/fr/design/dialog/BasicScrollPane.java index 7ff1bab92a..bdb5a012f1 100644 --- a/designer_base/src/com/fr/design/dialog/BasicScrollPane.java +++ b/designer_base/src/com/fr/design/dialog/BasicScrollPane.java @@ -153,8 +153,9 @@ public abstract class BasicScrollPane extends BasicBeanPane{ scrollBar.setEnabled(false); scrollBar.setVisible(false); } else { - scrollBar.setEnabled(true); - scrollBar.setVisible(true); + boolean show = isShowScrollBar(); + scrollBar.setEnabled(show); + scrollBar.setVisible(show); } maxheight = getHeight() - DET_HEIGHT; if ((MAXVALUE - scrollBar.getVisibleAmount()) == 0) { @@ -179,8 +180,13 @@ public abstract class BasicScrollPane extends BasicBeanPane{ } leftcontentPane.validate(); } + } + protected boolean isShowScrollBar() { + return true; + } + @Override public T updateBean() { return null; diff --git a/designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java b/designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java index b3997c1b19..0f1c50a5fd 100644 --- a/designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java +++ b/designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java @@ -13,6 +13,7 @@ import com.fr.stable.StringUtils; import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.util.List; import java.util.regex.Pattern; /** @@ -35,6 +36,9 @@ public class ColumnSelectedEditor extends Editor { @Override public void itemStateChanged(ItemEvent e) { + //这边需要重新初始化columnNames, 否则nameList长度和columnNames长度不同导致出錯。 + List nameList = tableDataComboBox.getSelectedItem().calculateColumnNameList(); + columnNames = new String[nameList.size()]; columnNames = tableDataComboBox.getSelectedItem().calculateColumnNameList().toArray(columnNames); columnNameComboBox.removeAllItems(); for (int i = 0; i < columnNames.length; i++) { diff --git a/designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java b/designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java index f12eec0cb2..8a266a2a1e 100644 --- a/designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java +++ b/designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java @@ -1,12 +1,6 @@ package com.fr.design.gui.ibutton; -import java.awt.BorderLayout; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.GridLayout; -import java.awt.Insets; -import java.awt.RenderingHints; -import java.awt.Shape; +import java.awt.*; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -174,7 +168,7 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver { return BorderFactory.createEmptyBorder(1, 1, 1, 1); } - protected GridLayout getGridLayout(int number) { + protected LayoutManager getGridLayout(int number) { return new GridLayout(0, number, 1, 0); } diff --git a/designer_base/src/com/fr/design/gui/ibutton/UITabGroup.java b/designer_base/src/com/fr/design/gui/ibutton/UITabGroup.java index 7f6ec850a2..406dc8bff7 100644 --- a/designer_base/src/com/fr/design/gui/ibutton/UITabGroup.java +++ b/designer_base/src/com/fr/design/gui/ibutton/UITabGroup.java @@ -1,9 +1,6 @@ package com.fr.design.gui.ibutton; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.GridLayout; -import java.awt.RenderingHints; +import java.awt.*; import javax.swing.BorderFactory; import javax.swing.Icon; @@ -38,7 +35,7 @@ public class UITabGroup extends UIButtonGroup { } @Override - protected GridLayout getGridLayout(int number) { + protected LayoutManager getGridLayout(int number) { if (number < BUTTON_NUMBER || isOneLineTab) { return super.getGridLayout(number); } else if (number == BUTTON_NUMBER || number == SEVEN_NUMBER) { From 93c676528fbac2f927e099b961e827cc43209d70 Mon Sep 17 00:00:00 2001 From: Lee Date: Tue, 14 Jun 2016 15:14:35 +0800 Subject: [PATCH 7/8] =?UTF-8?q?1.=20=E9=87=8D=E5=86=99=E4=BA=86=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E7=9A=84model=E6=9D=A5=E5=9C=A8set=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=80=BC=E4=B9=8B=E5=89=8D=E8=BF=9B=E8=A1=8C=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E5=B9=B6=E7=BB=99=E5=87=BA=E5=BC=B9=E7=AA=97=E6=8F=90=E7=A4=BA?= =?UTF-8?q?;=202.=20=E7=BB=A7=E6=89=BFDoubleEditor=E6=9D=A5=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E5=85=BC=E5=AE=B9=E5=BC=B9=E7=AA=97=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=95=88=E6=9E=9C=E7=9A=84=E6=8E=A7=E4=BB=B6=EF=BC=8C=E5=A4=8D?= =?UTF-8?q?=E5=8E=9F=E4=B9=8B=E5=89=8D=E5=9F=BA=E7=A1=80=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E6=89=80=E6=9C=89=E6=9B=B4=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mobile/ElementCasePropertyTable.java | 10 +-- .../xtable/ReportAppPropertyGroupModel.java | 67 +++++++++++++++++++ .../widget/editors/DoubleEditor.java | 23 ------- .../widget/editors/RefinedDoubleEditor.java | 31 +++++++++ 4 files changed, 103 insertions(+), 28 deletions(-) create mode 100644 designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java create mode 100644 designer_form/src/com/fr/design/mainframe/widget/editors/RefinedDoubleEditor.java diff --git a/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java b/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java index 9d4a14d5b5..85c70f810c 100644 --- a/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java +++ b/designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java @@ -7,11 +7,11 @@ import com.fr.design.designer.creator.XCreator; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.itable.AbstractPropertyTable; import com.fr.design.gui.itable.PropertyGroup; -import com.fr.design.gui.xtable.PropertyGroupModel; +import com.fr.design.gui.xtable.ReportAppPropertyGroupModel; import com.fr.design.mainframe.FormDesigner; -import com.fr.design.mainframe.WidgetPropertyPane; -import com.fr.design.mainframe.widget.editors.DoubleEditor; +import com.fr.design.mainframe.WidgetPropertyPane;; import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor; +import com.fr.design.mainframe.widget.editors.RefinedDoubleEditor; import com.fr.form.ui.ElementCaseEditor; import com.fr.general.Inter; @@ -65,7 +65,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{ protected CRPropertyDescriptor[] revealHeightLimit() throws IntrospectionException { CRPropertyDescriptor heightLimitProperty = new CRPropertyDescriptor("heightPercent", this.xCreator.toData().getClass()) - .setEditorClass(DoubleEditor.class) + .setEditorClass(RefinedDoubleEditor.class) .setI18NName(Inter.getLocText("Form-EC_heightpercent")) .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"); ArrayList defaultList = (ArrayList) createNonListenerProperties(); @@ -91,7 +91,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{ } - groups.add(new PropertyGroup(new PropertyGroupModel(Inter.getLocText("FR-Designer_Fit-App"), xCreator, propertyTableEditor, designer))); + groups.add(new PropertyGroup(new ReportAppPropertyGroupModel(Inter.getLocText("FR-Designer_Fit-App"), xCreator, propertyTableEditor, designer))); TableModel model = new BeanTableModel(); setModel(model); diff --git a/designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java b/designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java new file mode 100644 index 0000000000..eac09aa63e --- /dev/null +++ b/designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java @@ -0,0 +1,67 @@ +package com.fr.design.gui.xtable; + +import com.fr.base.FRContext; +import com.fr.design.designer.creator.CRPropertyDescriptor; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.mainframe.FormDesigner; +import com.fr.general.Inter; +import java.lang.reflect.Method; +import com.fr.general.ComparatorUtils; +import com.fr.report.stable.FormConstants; + +import javax.swing.*; + +public class ReportAppPropertyGroupModel extends PropertyGroupModel { + + private static final double MAX_HEIGHT = 0.8; + + public ReportAppPropertyGroupModel(String name, XCreator creator, CRPropertyDescriptor[] propArray, + FormDesigner designer) { + super(name, creator, propArray, designer); + } + + @Override + public boolean setValue(Object value, int row, int column) { + double state = 0; + if (column == 0) { + return false; + } + if (value instanceof Double) { + state = (Double) value; + } + + try { + Method m = properties[row].getWriteMethod(); + if (state > MAX_HEIGHT) { + //弹窗提示 + Object[] options = {Inter.getLocText("FR-Designer_Button-OK"), Inter.getLocText("FR-Designer_Button-Cancel")}; + int choice = JOptionPane.showOptionDialog(null, + Inter.getLocText("FR-Designer_Mobile-Warning"), + Inter.getLocText("FR-Designer_Tooltips"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.INFORMATION_MESSAGE, + null, + options, + options[0]); + if (choice == JOptionPane.OK_OPTION || choice == JOptionPane.NO_OPTION) { + return false; + } + return false; + } + m.invoke(dealCreatorData(), value); + //属性名称为控件名时,单独处理下 + if(ComparatorUtils.equals(FormConstants.NAME, properties[row].getName())){ + creator.resetCreatorName(value.toString()); + } + properties[row].firePropertyChanged(); + return true; + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + return false; + } + } + + private Object dealCreatorData() { + return creator.getPropertyDescriptorCreator().toData(); + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/widget/editors/DoubleEditor.java b/designer_form/src/com/fr/design/mainframe/widget/editors/DoubleEditor.java index e88d3cea0a..932338dd34 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/editors/DoubleEditor.java +++ b/designer_form/src/com/fr/design/mainframe/widget/editors/DoubleEditor.java @@ -1,34 +1,11 @@ package com.fr.design.mainframe.widget.editors; -import javax.swing.*; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; import java.text.NumberFormat; -import java.text.ParseException; public class DoubleEditor extends FormattedEditor { - private JFormattedTextField textField; - public DoubleEditor() { super(NumberFormat.getNumberInstance()); - textField = (JFormattedTextField) super.getCustomEditor(); - } - - @Override - public KeyListener createKeyListener() { - return new KeyAdapter() { - - public void keyReleased(KeyEvent e) { - try { - textField.commitEdit(); - return; - } catch (ParseException e1) { - return; - } - } - }; } @Override diff --git a/designer_form/src/com/fr/design/mainframe/widget/editors/RefinedDoubleEditor.java b/designer_form/src/com/fr/design/mainframe/widget/editors/RefinedDoubleEditor.java new file mode 100644 index 0000000000..0caad975df --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/widget/editors/RefinedDoubleEditor.java @@ -0,0 +1,31 @@ +package com.fr.design.mainframe.widget.editors; + +import javax.swing.*; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.text.ParseException; + +public class RefinedDoubleEditor extends DoubleEditor { + + private JFormattedTextField textField; + + public RefinedDoubleEditor() { + super(); + textField = (JFormattedTextField) super.getCustomEditor(); + } + + @Override + public KeyListener createKeyListener() { + return new KeyAdapter() { + + public void keyReleased(KeyEvent e) { + try { + textField.commitEdit(); + return; + } catch (ParseException e1) { + } + } + }; + } +} \ No newline at end of file From 3449016840c30f15809288f55099bccc9a6921fa Mon Sep 17 00:00:00 2001 From: Lee Date: Tue, 14 Jun 2016 15:39:04 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=A1=86=E7=AE=80?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E6=9B=B4=E7=AE=80=E6=B4=81=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xtable/ReportAppPropertyGroupModel.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java b/designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java index eac09aa63e..3b45260e4b 100644 --- a/designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java +++ b/designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java @@ -34,19 +34,11 @@ public class ReportAppPropertyGroupModel extends PropertyGroupModel { Method m = properties[row].getWriteMethod(); if (state > MAX_HEIGHT) { //弹窗提示 - Object[] options = {Inter.getLocText("FR-Designer_Button-OK"), Inter.getLocText("FR-Designer_Button-Cancel")}; - int choice = JOptionPane.showOptionDialog(null, - Inter.getLocText("FR-Designer_Mobile-Warning"), - Inter.getLocText("FR-Designer_Tooltips"), - JOptionPane.OK_CANCEL_OPTION, - JOptionPane.INFORMATION_MESSAGE, - null, - options, - options[0]); - if (choice == JOptionPane.OK_OPTION || choice == JOptionPane.NO_OPTION) { - return false; - } - return false; + JOptionPane.showMessageDialog(null, + Inter.getLocText("FR-Designer_Mobile-Warning"), + Inter.getLocText("FR-Designer_Tooltips"), + JOptionPane.PLAIN_MESSAGE); + return false; } m.invoke(dealCreatorData(), value); //属性名称为控件名时,单独处理下