Browse Source

rename

master
yaoh.wu 8 years ago
parent
commit
0a76edfca6
  1. 12
      designer_form/src/com/fr/design/designer/creator/DedicateLayoutContainer.java
  2. 33
      designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java
  3. 3
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

12
designer_form/src/com/fr/design/designer/creator/DedicateLayoutContainer.java

@ -11,6 +11,7 @@ import java.util.ArrayList;
/**
* 一些控件专属的容器如标题容器sclae容器
*
* @author jim
* @date 2014-11-7
*/
@ -22,6 +23,7 @@ public abstract class DedicateLayoutContainer extends XLayoutContainer {
/**
* 得到属性名
*
* @return 属性名
* @throws IntrospectionException
*/
@ -36,7 +38,7 @@ public abstract class DedicateLayoutContainer extends XLayoutContainer {
*/
@Override
public String getIconPath() {
if(this.getXCreator(XWScaleLayout.INDEX) != null){
if (this.getXCreator(XWScaleLayout.INDEX) != null) {
return this.getXCreator(XWScaleLayout.INDEX).getIconPath();
}
return "/com/fr/web/images/form/resources/text_field_16.png";
@ -45,24 +47,28 @@ public abstract class DedicateLayoutContainer extends XLayoutContainer {
/**
* 控件树不显示此组件
*
* @param path 控件树list
*/
public void notShowInComponentTree(ArrayList<Component> path) {
path.remove(path.size()-1);
path.remove(path.size() - 1);
}
/**
* 重置组件的名称
*
* @param name 名称
*/
public void resetCreatorName(String name) {
super.resetCreatorName(name);
XCreator child = getXCreator(XWScaleLayout.INDEX);
//TODO 这里是怎么实现改名的
child.toData().setWidgetName(name);
}
/**
* 返回对应属性表的组件scale和title返回其子组件
*
* @return 组件
*/
public XCreator getPropertyDescriptorCreator() {
@ -71,6 +77,7 @@ public abstract class DedicateLayoutContainer extends XLayoutContainer {
/**
* 是否作为控件树的叶子节点
*
* @return 是则返回true
*/
public boolean isComponentTreeLeaf() {
@ -79,6 +86,7 @@ public abstract class DedicateLayoutContainer extends XLayoutContainer {
/**
* 是否为sclae和title专属容器
*
* @return 是则返回true
*/
public boolean isDedicateContainer() {

33
designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java

@ -7,14 +7,12 @@ import java.util.List;
import com.fr.base.FRContext;
import com.fr.design.designer.beans.adapters.layout.AbstractLayoutAdapter;
import com.fr.design.designer.creator.*;
import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.general.ComparatorUtils;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.form.ui.Widget;
public class FormSelectionUtils {
@ -44,7 +42,7 @@ public class FormSelectionUtils {
Rectangle rec = clipBoard.getSelctionBounds();
for (XCreator creator : clipBoard.getSelectedCreators()) {
try {
Widget copied = copyWidget(designer, creator.toData());
Widget copied = copyWidget(designer, creator);
XCreator copiedCreator = XCreatorUtils.createXCreator(copied, creator.getSize());
// 获取位置
Point point = getPasteLocation((AbstractLayoutAdapter) adapter,
@ -121,17 +119,23 @@ public class FormSelectionUtils {
}
private static Widget copyWidget(FormDesigner formDesigner, Widget widget) throws
private static Widget copyWidget(FormDesigner formDesigner, XCreator xCreator) throws
CloneNotSupportedException {
ArrayList<String> clonedNameList = new ArrayList<String>();
Widget copied = (Widget) widget.clone();
Widget copied = (Widget) xCreator.toData().clone();
//重命名拷贝的组件
setCopiedName(formDesigner, copied, clonedNameList);
if (copied instanceof WLayout) {
for (int i = 0; i < ((WLayout) copied).getWidgetCount(); i++) {
setCopiedName(formDesigner, ((WLayout) copied).getWidget(i), clonedNameList);
}
String name = getCopiedName(formDesigner, copied, clonedNameList);
if (copied instanceof WTitleLayout) {
XWTitleLayout xwTitleLayout = new XWTitleLayout((WTitleLayout) copied, xCreator.getSize());
xwTitleLayout.resetCreatorName(name);
} else {
copied.setWidgetName(name);
}
// if (copied instanceof WLayout) {
// for (int i = 0; i < ((WLayout) copied).getWidgetCount(); i++) {
// setCopiedName(formDesigner, ((WLayout) copied).getWidget(i), clonedNameList);
// }
// }
return copied;
}
@ -141,14 +145,15 @@ public class FormSelectionUtils {
* @param formDesigner
* @param copied
* @param clonedNameList
* @return name
*/
private static void setCopiedName(FormDesigner formDesigner, Widget copied, ArrayList<String> clonedNameList) {
private static String getCopiedName(FormDesigner formDesigner, Widget copied, ArrayList<String> clonedNameList) {
String name = copied.getWidgetName();
do {
name += postfix;
} while (formDesigner.getTarget().isNameExist(name) || clonedNameList.contains(name));
copied.setWidgetName(name);
clonedNameList.add(name);
return name;
}
public static void rebuildSelection(FormDesigner designer) {

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

@ -147,7 +147,8 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
designer.addDesignerEditListener(new mobileWidgetDesignerAdapter());
centerPane = FRGUIPaneFactory.createCardLayout_S_Pane();
cardLayout = (CardLayout) centerPane.getLayout();
centerPane.add(mobileParaWidgetTable, PARA);// 采用卡片布局的容器必须指定卡片名字,如果没有卡片名字
centerPane.add(mobileParaWidgetTable, PARA);
// 采用卡片布局的容器必须指定卡片名字,如果没有卡片名字
// 就会出现:Exception in thread "main" java.lang.IllegalArgumentException:
// cannot add to layout: constraint must be a string
// 第二个参数代表卡片的名字。后来show方法调用时通过名字找到要显示的卡片

Loading…
Cancel
Save