From f9e6d148c7b8bda391bb54dbbcaedc01eb0bb084 Mon Sep 17 00:00:00 2001 From: fanglei <294531121> Date: Tue, 21 Feb 2017 14:53:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=B8=AA=E5=B0=8F?= =?UTF-8?q?=E9=94=99=E8=AF=AF=EF=BC=8CWLayout->WSortLayout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/MobileParaWidgetTable.java | 2 +- .../design/mainframe/MobileWidgetTable.java | 22 ++++++------------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/MobileParaWidgetTable.java b/designer_form/src/com/fr/design/mainframe/MobileParaWidgetTable.java index 67f47f951..a39d3d94a 100644 --- a/designer_form/src/com/fr/design/mainframe/MobileParaWidgetTable.java +++ b/designer_form/src/com/fr/design/mainframe/MobileParaWidgetTable.java @@ -245,7 +245,7 @@ class MobileParaWidgetTable extends JTable { } WParameterLayout para = (WParameterLayout) (paraContainer.toData()); - return para.getWidgetNameTag(); // TODO 从这个函数开始看,可以看到后台如何决定拖动后的控件顺序的 + return para.getWidgetNameTag(); } /** diff --git a/designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java b/designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java index bb7ba9918..5044b4f8d 100644 --- a/designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java +++ b/designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java @@ -3,7 +3,7 @@ package com.fr.design.mainframe; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.util.ArrayList; +import java.util.List; import javax.swing.BorderFactory; import javax.swing.JLabel; @@ -14,11 +14,8 @@ import javax.swing.table.*; import com.fr.design.designer.creator.XCreator; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itable.GroupRenderer; -import com.fr.design.gui.itable.HeaderRenderer; import com.fr.form.ui.Widget; import com.fr.form.ui.container.*; -import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; -import com.fr.form.ui.container.cardlayout.WCardTitleLayout; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.stable.StringUtils; @@ -67,6 +64,9 @@ public class MobileWidgetTable extends JTable { add(moveComponent); } + /** + * 设置表格属性 + */ private void setTableProperties() { JTableHeader header = getTableHeader(); header.setReorderingAllowed(false); @@ -112,7 +112,7 @@ public class MobileWidgetTable extends JTable { moveComponent.setVisible(false); int toIndex = e.getY() < GAP ? 0 : (int)Math.rint((e.getY() - GAP)/WIDGET_TABLE_ROW_HEIGHT) + 1; //当鼠标放开时,将选中的容器调整至新的顺序 - ((WLayout)designer.getSelectionModel().getSelection().getSelectedCreator().toData()).adjustOrder(selectedRow - 1, toIndex - 1); + ((WSortLayout)designer.getSelectionModel().getSelection().getSelectedCreator().toData()).adjustOrder(selectedRow - 1, toIndex - 1); //拿取排序后表格数据,然后重绘表格 getInstance().refreshData(); getInstance().repaint(); @@ -261,16 +261,8 @@ public class MobileWidgetTable extends JTable { } // 选择的控件有两种类型,一种是WLayout,代表容器,一种是Widget,代表控件 - if (selectedModel.acceptType(WLayout.class)) { - //WCardLayout里面并不是控件,而仍然是容器TabFitLayout,故要向下获取控件 - //WCardTitlelLayout是XWCardLayout的标题容器,里面同样不是控件,不能获取MobileList - //WTitleLayout是标题容器,比如图表的标题,里面是图表控件和Label标题控件,但是不需要获取MobileList - if (selectedModel.acceptType(WCardLayout.class) || selectedModel.acceptType(WCardTitleLayout.class)) { - if (selectedModel.acceptType(WTitleLayout.class) || selectedModel.acceptType(WCardMainBorderLayout.class)) { - return new String[0][0]; - } - } - ArrayList strings = ((WLayout)selectedModel).getMobileWidgetList(); + if (selectedModel.acceptType(WSortLayout.class)) { + List strings = ((WSortLayout)selectedModel).getMobileWidgetList(); String[][] widgetName = new String[strings.size() + 1][1]; widgetName[0][0] = Inter.getLocText("FR-Designer_WidgetOrder"); for (int i = 0; i < strings.size(); i++) {