Browse Source

Merge pull request #1065 in BA/design from ~FANGLEI/design:9.0 to 9.0

* commit '3cc27359bcadd2e048055235d5497a237e226bf8':
  去掉多余的注释
  移动端拓展tab接口变动 新增9.0设计器报表块属性面板
master
superman 7 years ago
parent
commit
7df796cf31
  1. 5
      designer_base/src/com/fr/design/fun/WidgetPropertyUIProvider.java
  2. 6
      designer_form/src/com/fr/design/designer/properties/mobile/BodyMobilePropertyUI.java
  3. 7
      designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyUI.java
  4. 20
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java
  5. 124
      designer_form/src/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java
  6. 13
      designer_form/src/com/fr/design/widget/ui/designer/mobile/MobileWidgetDefinePane.java

5
designer_base/src/com/fr/design/fun/WidgetPropertyUIProvider.java

@ -1,5 +1,6 @@
package com.fr.design.fun;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.stable.fun.mark.Mutable;
@ -12,7 +13,11 @@ public interface WidgetPropertyUIProvider extends Mutable {
int CURRENT_LEVEL = 1;
@Deprecated
AbstractPropertyTable createWidgetAttrTable();
//fanglei: 9.0新界面采用pane,不再用JTable
BasicPane createWidgetAttrPane();
String tableTitle();
}

6
designer_form/src/com/fr/design/designer/properties/mobile/BodyMobilePropertyUI.java

@ -3,6 +3,7 @@ package com.fr.design.designer.properties.mobile;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.general.Inter;
@ -27,6 +28,11 @@ public class BodyMobilePropertyUI extends AbstractWidgetPropertyUIProvider {
return new BodyAppRelayoutTable(xCreator);
}
@Override
public BasicPane createWidgetAttrPane() {
return null;
}
@Override
public String tableTitle() {
return Inter.getLocText("FR-Designer_Mobile-Attr");

7
designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyUI.java

@ -2,8 +2,10 @@ package com.fr.design.designer.properties.mobile;
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.ElementCaseDefinePane;
import com.fr.general.Inter;
/**
@ -22,6 +24,11 @@ public class ElementCasePropertyUI extends AbstractWidgetPropertyUIProvider {
return new ElementCasePropertyTable(xCreator);
}
@Override
public BasicPane createWidgetAttrPane() {
return new ElementCaseDefinePane(xCreator);
}
@Override
public String tableTitle() {
return Inter.getLocText("FR-Designer_Mobile-Attr");

20
designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

@ -6,12 +6,14 @@ import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.properties.EventPropertyTable;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.ui.FormWidgetCardPane;
import com.fr.design.widget.ui.designer.mobile.MobileWidgetDefinePane;
import com.fr.form.ui.Widget;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
@ -35,6 +37,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
private FormWidgetCardPane formWidgetCardPane; // 控件的属性表
private EventPropertyTable eventTable; // 控件的事件表
private List<AbstractPropertyTable> widgetPropertyTables; // 这个变量应该是保存控件拓展的属性tab
private List<MobileWidgetDefinePane> mobileExtraPropertyPanes; // 保存9.0设计器下移动端拓展的属性tab,舍弃JTable
private FormDesigner designer; // 当前designer
private UIScrollPane psp; // 用来装载属性表table的容器
private UIScrollPane esp; //用来装载事件table的容器
@ -97,6 +100,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
return;
}
widgetPropertyTables = new ArrayList<AbstractPropertyTable>();
mobileExtraPropertyPanes = new ArrayList<>();
//依次创建属性表、事件表、移动端表,再将它们整合到TabPane中去
this.createPropertyTable();
@ -113,8 +117,10 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
private void initTables() {
formWidgetCardPane.populate();
eventTable.refresh();
for (AbstractPropertyTable propertyTable : widgetPropertyTables) {
propertyTable.initPropertyGroups(designer);
if (mobileExtraPropertyPanes != null) {
for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) {
extraPane.initPropertyGroups(designer);
}
}
}
@ -211,12 +217,12 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
wsp.add(downPanel);
} else {
for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) {
AbstractPropertyTable propertyTable = widgetAttrProvider.createWidgetAttrTable();
widgetPropertyTables.add(propertyTable);
MobileWidgetDefinePane extraPane = (MobileWidgetDefinePane) widgetAttrProvider.createWidgetAttrPane();
if (extraPane != null) {
mobileExtraPropertyPanes.add(extraPane);
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(formWidgetCardPane));
UIScrollPane uiScrollPane = new UIScrollPane(getExtraBodyTable(propertyTable));
wsp.add(uiScrollPane);
wsp.add(extraPane);
}
}
}
}

124
designer_form/src/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java

@ -0,0 +1,124 @@
package com.fr.design.widget.ui.designer.mobile;
import com.fr.base.mobile.MobileFitAttrState;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
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.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* 报表块-移动端属性面板
*
* Created by fanglei on 2017/8/8.
*/
public class ElementCaseDefinePane extends MobileWidgetDefinePane{
private static final String[] ITEMS = {
MobileFitAttrState.HORIZONTAL.description(),
MobileFitAttrState.VERTICAL.description(),
MobileFitAttrState.BIDIRECTIONAL.description(),
MobileFitAttrState.NONE.description()
};
private XCreator xCreator; // 当前选中控件的xCreator
private FormDesigner designer; // 当前设计器
private UIComboBox hComboBox; // 横屏下拉框
private UIComboBox vComboBox;// 竖屏下拉框
private UICheckBox heightRestrictCheckBox; // 手机显示限制高度复选框
private UILabel maxHeightLabel;
private UISpinner maxHeightSpinner; // 最大高度Spinner
public ElementCaseDefinePane (XCreator xCreator) {
this.xCreator = xCreator;
}
@Override
protected String title4PopupWindow() {
return "ElementCase";
}
@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("Form-EC_heightrestrict"));
this.maxHeightLabel = new UILabel(Inter.getLocText("Form-EC_heightpercent"), 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(Inter.getLocText("FR-Designer_Mobile-Horizontal"), SwingConstants.LEFT), hComboBox},
new Component[] {new UILabel(Inter.getLocText("FR-Designer_Mobile-Vertical"), SwingConstants.LEFT), vComboBox},
new Component[] {heightRestrictCheckBox, 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(Inter.getLocText("FR-Designer_Fit"), 280, 20, panelWrapper);
this.add(folderPane, BorderLayout.NORTH);
this.bingListeners2Widgets();
this.repaint();
}
public void bingListeners2Widgets() {
this.hComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
((ElementCaseEditor)xCreator.toData()).setHorziontalAttr(MobileFitAttrState.parse(hComboBox.getSelectedIndex() + 1));
}
});
this.vComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
((ElementCaseEditor)xCreator.toData()).setVerticalAttr(MobileFitAttrState.parse(vComboBox.getSelectedIndex() + 1));
}
});
this.heightRestrictCheckBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
boolean isHeightRestrict = heightRestrictCheckBox.isSelected();
((ElementCaseEditor)xCreator.toData()).setHeightRestrict(isHeightRestrict);
maxHeightSpinner.setVisible(isHeightRestrict);
maxHeightLabel.setVisible(isHeightRestrict);
}
});
this.maxHeightSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
((ElementCaseEditor)xCreator.toData()).setHeightPercent(maxHeightSpinner.getValue());
}
});
}
}

13
designer_form/src/com/fr/design/widget/ui/designer/mobile/MobileWidgetDefinePane.java

@ -0,0 +1,13 @@
package com.fr.design.widget.ui.designer.mobile;
import com.fr.design.dialog.BasicPane;
/**
* 所有移动端需要拓展的属性面板均继承此类
*
* Created by fanglei on 2017/8/8.
*/
public abstract class MobileWidgetDefinePane extends BasicPane{
//初始化panel数据再repaint
public abstract void initPropertyGroups(Object source);
}
Loading…
Cancel
Save