Browse Source

MOBILE-3963 9.0设计器新界面(移动端)=>调整代码;增加提示,交互微调

plough 7 years ago
parent
commit
e2b4dfb70b
  1. 11
      designer_form/src/com/fr/design/mainframe/MobileWidgetListPane.java
  2. 47
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

11
designer_form/src/com/fr/design/mainframe/MobileWidgetListPane.java

@ -4,7 +4,6 @@ import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.controlpane.UISimpleListControlPane;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WSortLayout;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import com.fr.stable.Nameable;
@ -18,16 +17,16 @@ public class MobileWidgetListPane extends UISimpleListControlPane {
public static final String LIST_NAME = "Widget_List";
private FormDesigner designer;
private List<String> cellData;
private List<String> widgetNameList;
private static final List<String> EMPTY_LIST = new ArrayList<String>();
public MobileWidgetListPane(FormDesigner designer) {
super();
this.designer = designer;
cellData = getData();
widgetNameList = getData();
List<NameObject> nameObjectList = new ArrayList<NameObject>();
for (String name : cellData) {
for (String name : widgetNameList) {
nameObjectList.add(new NameObject(name, null));
}
populate(nameObjectList.toArray(new NameObject[nameObjectList.size()]));
@ -48,7 +47,7 @@ public class MobileWidgetListPane extends UISimpleListControlPane {
/**
* 获取选中控件的控件列表
*
* @return String[][] 二维数组[0][0]widgetName
* @return List<String> widgetNameList
*/
private List<String> getData() {
if (designer.isFormParaDesigner()) {
@ -67,8 +66,6 @@ public class MobileWidgetListPane extends UISimpleListControlPane {
if (selectedModel.acceptType(WSortLayout.class)) {
java.util.List<String> mobileWidgetList = ((WSortLayout) selectedModel).getOrderedMobileWidgetList();
List<String> widgetName = new ArrayList<String>();
// [mobileWidgetList.size() + 1][1];
// widgetName[0][0] = Inter.getLocText("FR-Designer_WidgetOrder");
for (int i = 0; i < mobileWidgetList.size(); i++) {
widgetName.add(mobileWidgetList.get(i));
}

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

@ -11,6 +11,7 @@ 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.ilable.UILabel;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.ui.FormWidgetCardPane;
@ -33,8 +34,6 @@ import java.util.Set;
*/
public class WidgetPropertyPane extends FormDockView implements BaseWidgetPropertyPane {
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; // 控件的属性表
@ -43,14 +42,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
private List<MobileWidgetDefinePane> mobileExtraPropertyPanes; // 保存9.0设计器下移动端拓展的属性tab,舍弃JTable
private FormDesigner designer; // 当前designer
private UIScrollPane psp; // 用来装载属性表table的容器
private UIScrollPane esp; //用来装载事件table的容器
private JPanel wsp; // 装载移动端tab的容器,包括移动端属性表和控件拓展的移动端属性表
private MobileParaWidgetTable mobileParaWidgetTable; // 参数面板的移动端属性tab(和body的移动端属性tab区别是没有标签名column)
private MobileWidgetTable mobileWidgetTable; // body的移动端属性tab
private UIScrollPane downPanel; // 这个滚动容器是用于装载centerPane的
private JPanel centerPane; // 此centerPane采用的是cardLayout布局,装载着mobileWidgetTable和mobileBodyWidgetTable
private CardLayout cardLayout; // 卡片布局,选中参数面板时显示mobileWidgetTable,选中body时显示mobileBodyWidgetTable
private JTableHeader header;//把表头单独get出来作为一个组件
private UIHeadGroup tabsHeaderIconPane;
private XComponent lastAffectedCreator;
@ -159,33 +151,10 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
//加上表头后,这里不再使用borderLayout布局,而采用BoxLayout布局
wsp = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
wsp.setBorder(null);
mobileParaWidgetTable = new MobileParaWidgetTable(designer);
mobileWidgetTable = new MobileWidgetTable(designer);
designer.addDesignerEditListener(new MobileWidgetDesignerAdapter());
centerPane = FRGUIPaneFactory.createCardLayout_S_Pane();
cardLayout = (CardLayout) centerPane.getLayout();
centerPane.add(mobileParaWidgetTable, PARA);
// 采用卡片布局的容器必须指定卡片名字,如果没有卡片名字
// 就会出现:Exception in thread "main" java.lang.IllegalArgumentException:
// cannot add to layout: constraint must be a string
// 第二个参数代表卡片的名字。后来show方法调用时通过名字找到要显示的卡片
centerPane.add(mobileWidgetTable, BODY); //这两句代码,是把JTable放到一个JPanel中去了,表头不会显示,
//只有放到JScrollPanel中去表头才能正常显示,这就是MobileWidgetTable中定义了表头却没有显示的原因!
//解决方案:MobileWidgetTable实在无法直接放到JScrollPanel中去的时候,应该把表头get出来单独作为一个组件显示
if (hasSelectParaPane(designer)) {
cardLayout.show(centerPane, PARA);
header = mobileParaWidgetTable.getTableHeader();
} else {
cardLayout.show(centerPane, BODY);
header = mobileWidgetTable.getTableHeader();
}
downPanel = new UIScrollPane(centerPane);
downPanel.setBorder(new LineBorder(Color.GRAY));
//获取拓展移动端属性tab
WidgetPropertyUIProvider[] widgetAttrProviders = getExtraPropertyUIProviders();
addWidgetAttr(widgetAttrProviders);
}
@ -220,9 +189,8 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
* @param widgetAttrProviders 拓展的tab
*/
private void addWidgetAttr(WidgetPropertyUIProvider[] widgetAttrProviders) {
if (widgetAttrProviders.length == 0) { // 判断有没有拓展的tab,没有就使用原来的
wsp.add(header);
wsp.add(downPanel);
if (widgetAttrProviders.length == 0) { // 判断有没有拓展的tab,提示"无可用配置项"
wsp.add(getUnavailablePane());
} else {
for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) {
MobileWidgetDefinePane extraPane = (MobileWidgetDefinePane) widgetAttrProvider.createWidgetAttrPane();
@ -243,6 +211,15 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetPrope
}
}
// "无可用配置项"面板
private JPanel getUnavailablePane() {
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel label = new UILabel("无可用配置项");
label.setHorizontalAlignment(SwingConstants.CENTER);
panel.add(label);
return panel;
}
private void initTabPane() {
final String[] tabTitles = new String[]{
Inter.getLocText("FR-Designer_Properties"),

Loading…
Cancel
Save