Browse Source

Pull request #4525: REPORT-53133 组件复用-合入主版本-有俩商城下载下来的复用组件,拖入后组件树处没显示复用组件的图标,麻烦看下是这俩组件结构有啥问题嘛

Merge in DESIGN/design from ~KERRY/design_10.0:feature/10.0 to feature/10.0

* commit '59d5958c8cc39df0bd7182ea0f39ab7b6e06d89f':
  REPORT-53133 组件复用-合入主版本-有俩商城下载下来的复用组件,拖入后组件树处没显示复用组件的图标,麻烦看下是这俩组件结构有啥问题嘛
feature/10.0
kerry 4 years ago
parent
commit
6f64f92410
  1. 15
      designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java
  2. 14
      designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java
  3. 14
      designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java

15
designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java

@ -112,6 +112,21 @@ public class XWTitleLayout extends DedicateLayoutContainer {
return null;
}
/**
* 返回body组件
* @return body组件
*/
public XCreator getBodyCreator() {
for (int i=0; i < getXCreatorCount(); i++) {
XCreator creator = getXCreator(i);
if (creator.hasTitleStyle()) {
return creator;
}
}
return null;
}
/**
* 编辑状态的时候需要重新绘制下边框
*

14
designer-form/src/main/java/com/fr/design/designer/treeview/ComponentTreeCellRenderer.java

@ -1,13 +1,11 @@
package com.fr.design.designer.treeview;
import com.fr.base.BaseUtils;
import com.fr.base.iofile.attr.ExtendSharableAttrMark;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.design.mainframe.share.util.ShareComponentUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
@ -38,7 +36,7 @@ public class ComponentTreeCellRenderer extends DefaultTreeCellRenderer {
}
if (icon != null) {
setIcon(icon);
this.needAddShareIcon = isShareWidget((XCreator) value);
this.needAddShareIcon = ShareComponentUtils.isShareWidgetWithChild((XCreator) value);
}
}
@ -47,14 +45,6 @@ public class ComponentTreeCellRenderer extends DefaultTreeCellRenderer {
return this;
}
private boolean isShareWidget(XCreator xCreator) {
if (!xCreator.toData().acceptType(AbstractBorderStyleWidget.class)) {
return false;
}
ExtendSharableAttrMark attrMark = ((AbstractBorderStyleWidget) xCreator.toData()).getWidgetAttrMark(ExtendSharableAttrMark.XML_TAG);
return attrMark != null && StringUtils.isNotEmpty(attrMark.getShareId());
}
public void paint(Graphics g) {
super.paint(g);

14
designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java

@ -5,6 +5,7 @@ import com.fr.base.iofile.attr.ExtendSharableAttrMark;
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.XWTitleLayout;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.FormSelection;
@ -91,6 +92,19 @@ public class ShareComponentUtils {
return false;
}
public static boolean isShareWidgetWithChild(XCreator xCreator) {
boolean result = isShareWidget(xCreator);
if (result) {
return true;
}
//做下兼容处理,老的组件结构的共享信息存储在子组件上
if (xCreator instanceof XWTitleLayout) {
XCreator child = ((XWTitleLayout) xCreator).getBodyCreator();
return isShareWidget(child);
}
return false;
}
public static List<XCreator> getHelpConfigXCreatorList(XCreator root) {
List<XCreator> helpConfigXCreatorList = new ArrayList<>();

Loading…
Cancel
Save