Browse Source

Pull request #9178: REPORT-73475 && REPORT-72468 决策报表-frm拖入tab块,tab内拖入两个图表块和两个文本域控件,重复随机拖拽调整组件位置,会突然出现组件重叠且错乱的现象; FR11决策报表-附件客户模板,tablayout0的Tab0下拖入tab块,会添加一个重名为tablayout0的tab块

Merge in DESIGN/design from ~KERRY/design_10.0:release/11.0 to release/11.0

* commit '3da899e0e5043aa2aad833cf616b454b71c773e9':
  REPORT-72468 决策报表-frm拖入tab块,tab内拖入两个图表块和两个文本域控件,重复随机拖拽调整组件位置,会突然出现组件重叠且错乱的现象
  REPORT-73475 FR11决策报表-附件客户模板,tablayout0的Tab0下拖入tab块,会添加一个重名为tablayout0的tab块
newui
kerry 3 years ago
parent
commit
f33a598508
  1. 10
      designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java
  2. 11
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  3. 13
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  4. 21
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java

10
designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java

@ -61,6 +61,15 @@ public abstract class ModelUtil {
if (StringUtils.isEmpty(widgetName)) {
widgetName = xCreator.createDefaultName();
}
//先保存默认名字
return uniqueName(form, widgetName, duplicated);
}
public static String uniqueName(Form form, String widgetName) {
return uniqueName(form, widgetName, new HashSet<>());
}
private static String uniqueName(Form form, String widgetName, Set<String> duplicated) {
//先保存默认名字
String raw = widgetName;
int i = 0;
@ -74,5 +83,4 @@ public abstract class ModelUtil {
duplicated.add(widgetName);
return widgetName;
}
}

11
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java

@ -7,6 +7,7 @@ import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRCardLayoutAdapter;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.beans.models.ModelUtil;
import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.XCreator;
@ -21,6 +22,7 @@ import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.BooleanEditor;
import com.fr.design.mainframe.widget.editors.CardTagWLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.editors.DoubleEditor;
import com.fr.form.main.Form;
import com.fr.form.ui.CardAddButton;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.LayoutBorderStyle;
@ -39,6 +41,7 @@ import com.fr.general.cardtag.DefaultTemplateStyle;
import com.fr.general.cardtag.TemplateStyle;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.border.Border;
@ -246,7 +249,13 @@ public class XWCardLayout extends XLayoutContainer {
*/
@Override
protected void setWrapperName(XLayoutContainer parentPanel, String widgetName) {
parentPanel.toData().setWidgetName("tablayout" + widgetName.replaceAll(createDefaultName(), ""));
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
Form form = formDesigner.getTarget();
String name = "tablayout" + widgetName.replaceAll(createDefaultName(), StringUtils.EMPTY);
if (form.isNameExist(name)) {
name = ModelUtil.uniqueName(formDesigner.getTarget(), parentPanel.createDefaultName());
}
parentPanel.toData().setWidgetName(name);
}
/**

13
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -52,6 +52,8 @@ import java.util.List;
* @date: 2014-12-9-下午9:59:31
*/
public class XWCardMainBorderLayout extends XWBorderLayout {
private static final String DEFAULT_NAME = "tablayout";
private static final int BORDER_WIDTH = 4;
private static final Color OUTER_BORDER_COLOR = new Color(65, 155, 249, 30);
@ -85,6 +87,17 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
return (WCardMainBorderLayout) super.toData();
}
/**
* 获取默认名字
*
* @return 默认名
* @date 2014-11-25-下午6:22:40
*/
@Override
public String createDefaultName() {
return DEFAULT_NAME;
}
/**
* 添加标题区域
*

21
designer-form/src/main/java/com/fr/design/mainframe/FormArea.java

@ -771,15 +771,24 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
heightPane.setValue(height);
reCalculateHeight((int) height);
}
if (designer.getRootComponent().acceptType(XWFitLayout.class) ) {
XWFitLayout layout = (XWFitLayout) designer.getRootComponent();
// 撤销时先refreshRoot了,此处去掉内边距再增加间隔
layout.moveContainerMargin();
layout.addCompInterval(layout.getAcualInterval());
}
traverAndAdjust(designer.getRootComponent());
this.slidePane.setShowValue((int) slide);
}
// 撤销时先refreshRoot了,此处去掉内边距再增加间隔,循环遍历布局,调整fitlayout布局的间隔
private void traverAndAdjust(XCreator creator) {
if (creator instanceof XWFitLayout) {
XWFitLayout temp = (XWFitLayout) creator;
temp.moveContainerMargin();
temp.addCompInterval(temp.getAcualInterval());
}
for (int i = 0; i < creator.getComponentCount(); i++) {
Object object = creator.getComponent(i);
if (object instanceof XCreator){
traverAndAdjust((XCreator) object);
}
}
}
/**
* 计算滚动条的值和max

Loading…
Cancel
Save