Browse Source

Merge pull request #135 in BA/design from ~GARYTU/design:master to master

* commit '2cae02f227bd81113282f81b067807c2bbf56659':
  移动端属性更改到master
master
superman 9 years ago
parent
commit
47f364e563
  1. 70
      designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java
  2. 12
      designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java
  3. 48
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  4. 66
      designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java
  5. 2
      designer_form/src/com/fr/design/designer/properties/mobile/MobileFitEditor.java

70
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<Boolean> {
private List<UICheckBox> checkBoxes = new ArrayList<UICheckBox>();
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;
}
}

12
designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java

@ -18,6 +18,8 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr> {
private MobileRadioGroupPane horizionPane; private MobileRadioGroupPane horizionPane;
//竖屏设置面板 //竖屏设置面板
private MobileRadioGroupPane verticalPane; private MobileRadioGroupPane verticalPane;
//缩放设置面板
private MobileRadioCheckPane radioCheckPane;
public ReportMobileAttrPane() { public ReportMobileAttrPane() {
initComponents(); initComponents();
@ -30,9 +32,10 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr> {
JPanel fitOpsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel fitOpsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
horizionPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Horizontal")); horizionPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Horizontal"));
verticalPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Vertical")); 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(horizionPane, BorderLayout.NORTH);
fitOpsPane.add(verticalPane, BorderLayout.SOUTH); fitOpsPane.add(verticalPane, BorderLayout.CENTER);
fitOpsPane.add(radioCheckPane, BorderLayout.SOUTH);
borderPane.add(fitOpsPane); borderPane.add(fitOpsPane);
this.add(borderPane); this.add(borderPane);
} }
@ -45,14 +48,15 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr> {
horizionPane.populateBean(ob.getHorziontalAttr()); horizionPane.populateBean(ob.getHorziontalAttr());
verticalPane.populateBean(ob.getVerticalAttr()); verticalPane.populateBean(ob.getVerticalAttr());
radioCheckPane.populateBean(ob.isZoom());
} }
@Override @Override
public ElementCaseMobileAttr updateBean() { public ElementCaseMobileAttr updateBean() {
MobileFitAttrState horizonState = horizionPane.updateBean(); MobileFitAttrState horizonState = horizionPane.updateBean();
MobileFitAttrState verticalState = verticalPane.updateBean(); MobileFitAttrState verticalState = verticalPane.updateBean();
boolean isZoom = radioCheckPane.updateBean();
return new ElementCaseMobileAttr(horizonState, verticalState); return new ElementCaseMobileAttr(horizonState, verticalState, isZoom);
} }
@Override @Override

48
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.awt.image.BufferedImage;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
import java.util.ArrayList;
import java.util.List;
public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{ public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{
private UILabel imageLable; private UILabel imageLable;
@ -56,23 +54,14 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
* @throws IntrospectionException 异常 * @throws IntrospectionException 异常
*/ */
public CRPropertyDescriptor[] supportedDescriptor() 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<CRPropertyDescriptor> createNonListenerProperties() throws IntrospectionException { CRPropertyDescriptor[] propertyTableEditor = new CRPropertyDescriptor[]{
CRPropertyDescriptor[] propertyTableEditor = {
new CRPropertyDescriptor("widgetName", this.data.getClass()) new CRPropertyDescriptor("widgetName", this.data.getClass())
.setI18NName(Inter.getLocText("Form-Widget_Name")), .setI18NName(Inter.getLocText("Form-Widget_Name")),
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass( new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
WLayoutBorderStyleEditor.class).setRendererClass(LayoutBorderStyleRenderer.class).setI18NName( WLayoutBorderStyleEditor.class).setRendererClass(LayoutBorderStyleRenderer.class).setI18NName(
Inter.getLocText("FR-Designer-Widget_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"). Inter.getLocText("FR-Designer-Widget_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
setPropertyChangeListener(new PropertyChangeAdapter() { .setPropertyChangeListener(new PropertyChangeAdapter() {
@Override @Override
public void propertyChange() { public void propertyChange() {
@ -85,34 +74,15 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class) new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class)
.setI18NName(Inter.getLocText("Form-EC_toolbar")) .setI18NName(Inter.getLocText("Form-EC_toolbar"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), .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<CRPropertyDescriptor> defaultList = new ArrayList<>(); };
for (CRPropertyDescriptor propertyDescriptor : propertyTableEditor) { FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getPropertyTableEditor();
defaultList.add(propertyDescriptor); if (processor == null){
return propertyTableEditor;
} }
return defaultList; PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass());
} return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor);
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<CRPropertyDescriptor> defaultList = (ArrayList<CRPropertyDescriptor>) createNonListenerProperties();
defaultList.add(heightLimitProperty);
return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]);
}
protected CRPropertyDescriptor[] getDefault() throws IntrospectionException {
ArrayList<CRPropertyDescriptor> defaultList = (ArrayList<CRPropertyDescriptor>) createNonListenerProperties();
return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]);
} }

66
designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java

@ -1,6 +1,7 @@
package com.fr.design.designer.properties.mobile; package com.fr.design.designer.properties.mobile;
import com.fr.base.FRContext; 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.CRPropertyDescriptor;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.form.util.XCreatorConstants; 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.gui.xtable.PropertyGroupModel;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane; 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 com.fr.general.Inter;
import javax.swing.table.TableModel; import javax.swing.table.TableModel;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
/** /**
* Created by Administrator on 2016/5/16/0016. * Created by Administrator on 2016/5/16/0016.
*/ */
public class ElementCasePropertyTable extends AbstractPropertyTable { public class ElementCasePropertyTable extends AbstractPropertyTable{
private XCreator xCreator; private XCreator xCreator;
private FormDesigner designer; private FormDesigner designer;
@ -27,6 +32,52 @@ public class ElementCasePropertyTable extends AbstractPropertyTable {
this.xCreator = xCreator; 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<CRPropertyDescriptor> 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<CRPropertyDescriptor> 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<CRPropertyDescriptor> defaultList = (ArrayList<CRPropertyDescriptor>) createNonListenerProperties();
defaultList.add(heightLimitProperty);
return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]);
}
protected CRPropertyDescriptor[] getDefault() throws IntrospectionException {
ArrayList<CRPropertyDescriptor> defaultList = (ArrayList<CRPropertyDescriptor>) createNonListenerProperties();
return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]);
}
@Override @Override
public void initPropertyGroups(Object source) { public void initPropertyGroups(Object source) {
this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
@ -34,17 +85,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable {
groups = new ArrayList<PropertyGroup>(); groups = new ArrayList<PropertyGroup>();
CRPropertyDescriptor[] propertyTableEditor = null; CRPropertyDescriptor[] propertyTableEditor = null;
try { try {
propertyTableEditor = new CRPropertyDescriptor[]{ propertyTableEditor = supportedDescriptor();
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"))
};
} catch (IntrospectionException e) { } catch (IntrospectionException e) {
FRContext.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());
} }
@ -59,6 +100,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable {
@Override @Override
public void firePropertyEdit() { public void firePropertyEdit() {
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
} }
public void populate(FormDesigner designer) { public void populate(FormDesigner designer) {

2
designer_form/src/com/fr/design/designer/properties/mobile/MobileFitEditor.java

@ -45,6 +45,6 @@ public class MobileFitEditor extends ComboEditor {
*/ */
@Override @Override
public boolean refreshInTime() { public boolean refreshInTime() {
return false; return true;
} }
} }

Loading…
Cancel
Save