|
|
@ -1,26 +1,16 @@ |
|
|
|
package com.fanruan.api.design.work.form.creator; |
|
|
|
package com.fanruan.api.design.work.form.creator; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fanruan.api.design.DesignKit; |
|
|
|
import com.fanruan.api.design.work.form.macro.XCreatorConstants; |
|
|
|
import com.fanruan.api.design.work.form.macro.XCreatorConstants; |
|
|
|
import com.fanruan.api.report.form.category.BaseBorderStyleWidget; |
|
|
|
import com.fanruan.api.report.form.category.BaseBorderStyleWidget; |
|
|
|
import com.fanruan.api.util.AssistKit; |
|
|
|
|
|
|
|
import com.fanruan.api.util.StringKit; |
|
|
|
import com.fanruan.api.util.StringKit; |
|
|
|
import com.fr.base.BaseFormula; |
|
|
|
|
|
|
|
import com.fr.common.annotations.Compatible; |
|
|
|
import com.fr.common.annotations.Compatible; |
|
|
|
import com.fr.design.border.UIRoundedBorder; |
|
|
|
import com.fr.design.border.UIRoundedBorder; |
|
|
|
import com.fr.design.designer.creator.XLabel; |
|
|
|
|
|
|
|
import com.fr.design.designer.creator.XWFitLayout; |
|
|
|
|
|
|
|
import com.fr.design.designer.creator.XWTitleLayout; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.widget.editors.BackgroundEditor; |
|
|
|
import com.fr.design.mainframe.widget.editors.BackgroundEditor; |
|
|
|
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; |
|
|
|
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; |
|
|
|
import com.fr.design.mainframe.widget.renderer.BackgroundRenderer; |
|
|
|
import com.fr.design.mainframe.widget.renderer.BackgroundRenderer; |
|
|
|
import com.fr.form.ui.Label; |
|
|
|
|
|
|
|
import com.fr.form.ui.LayoutBorderStyle; |
|
|
|
|
|
|
|
import com.fr.form.ui.PaddingMargin; |
|
|
|
import com.fr.form.ui.PaddingMargin; |
|
|
|
import com.fr.form.ui.WidgetTitle; |
|
|
|
|
|
|
|
import com.fr.form.ui.WidgetValue; |
|
|
|
|
|
|
|
import com.fr.form.ui.container.WTitleLayout; |
|
|
|
|
|
|
|
import com.fr.general.act.BorderPacker; |
|
|
|
import com.fr.general.act.BorderPacker; |
|
|
|
import com.fr.general.act.TitlePacker; |
|
|
|
|
|
|
|
import com.fr.stable.Constants; |
|
|
|
import com.fr.stable.Constants; |
|
|
|
import com.fr.stable.core.PropertyChangeAdapter; |
|
|
|
import com.fr.stable.core.PropertyChangeAdapter; |
|
|
|
|
|
|
|
|
|
|
@ -49,7 +39,7 @@ public abstract class XOpenBorderStyleCreator extends XOpenCreator { |
|
|
|
return new Attribute[]{ |
|
|
|
return new Attribute[]{ |
|
|
|
Attribute.newAttribute("borderStyle", toData().getClass()) |
|
|
|
Attribute.newAttribute("borderStyle", toData().getClass()) |
|
|
|
.editorClass(borderStyleEditorClass()) |
|
|
|
.editorClass(borderStyleEditorClass()) |
|
|
|
.i18n("Fine-Design_Report_Engine_Style") |
|
|
|
.i18n(DesignKit.i18nText("Fine-Design_Report_Engine_Style")) |
|
|
|
.keyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") |
|
|
|
.keyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") |
|
|
|
.listener(new PropertyChangeAdapter() { |
|
|
|
.listener(new PropertyChangeAdapter() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -60,7 +50,7 @@ public abstract class XOpenBorderStyleCreator extends XOpenCreator { |
|
|
|
Attribute.newAttribute("background", toData().getClass()) |
|
|
|
Attribute.newAttribute("background", toData().getClass()) |
|
|
|
.editorClass(backgroundEditorClass()) |
|
|
|
.editorClass(backgroundEditorClass()) |
|
|
|
.rendererClass(backgroundRendererClass()) |
|
|
|
.rendererClass(backgroundRendererClass()) |
|
|
|
.i18n("Fine-Design_Basic_Background") |
|
|
|
.i18n(DesignKit.i18nText("Fine-Design_Basic_Background")) |
|
|
|
.keyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") |
|
|
|
.keyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") |
|
|
|
.listener(new PropertyChangeAdapter() { |
|
|
|
.listener(new PropertyChangeAdapter() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -106,13 +96,7 @@ public abstract class XOpenBorderStyleCreator extends XOpenCreator { |
|
|
|
|
|
|
|
|
|
|
|
@Compatible |
|
|
|
@Compatible |
|
|
|
protected void initStyle() { |
|
|
|
protected void initStyle() { |
|
|
|
BorderPacker style = toData().getBorderStyle(); |
|
|
|
|
|
|
|
initBorderStyle(); |
|
|
|
initBorderStyle(); |
|
|
|
if (AssistKit.equals(style.getType(), LayoutBorderStyle.TITLE)) { |
|
|
|
|
|
|
|
initTitleStyle(style); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
clearTitleWidget(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Compatible |
|
|
|
@Compatible |
|
|
@ -125,78 +109,6 @@ public abstract class XOpenBorderStyleCreator extends XOpenCreator { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void clearTitleWidget() { |
|
|
|
|
|
|
|
if (acceptType(XWFitLayout.class)) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
XWTitleLayout parent = (XWTitleLayout) this.getParent(); |
|
|
|
|
|
|
|
if (parent.getComponentCount() > 1) { |
|
|
|
|
|
|
|
parent.remove(parent.getTitleCreator()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 设置样式为标题样式时,对应组件加上标题 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param style 样式 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void initTitleStyle(BorderPacker style) { |
|
|
|
|
|
|
|
if (style.getTitle() == null || style.getTitle().getTextObject() == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
XWTitleLayout parent = (XWTitleLayout) this.getParent(); |
|
|
|
|
|
|
|
if (parent.getComponentCount() > 1) { |
|
|
|
|
|
|
|
XLabel title = (XLabel) parent.getTitleCreator(); |
|
|
|
|
|
|
|
Label widget = title.toData(); |
|
|
|
|
|
|
|
updateTitleWidgetStyle(widget, style); |
|
|
|
|
|
|
|
initXLabel(title); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 初始化标题控件
|
|
|
|
|
|
|
|
XLabel title = new XLabel(new Label(), new Dimension()); |
|
|
|
|
|
|
|
Label label = title.toData(); |
|
|
|
|
|
|
|
updateTitleWidgetStyle(label, style); |
|
|
|
|
|
|
|
parent.add(title, WTitleLayout.TITLE); |
|
|
|
|
|
|
|
// 初始化标题边框
|
|
|
|
|
|
|
|
initXLabel(title); |
|
|
|
|
|
|
|
WTitleLayout layout = parent.toData(); |
|
|
|
|
|
|
|
layout.updateChildBounds(layout.getBodyBoundsWidget().getBounds()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void initXLabel(XLabel xLabel) { |
|
|
|
|
|
|
|
Label label = xLabel.toData(); |
|
|
|
|
|
|
|
xLabel.setEnabled(label.isEnabled()); |
|
|
|
|
|
|
|
if (label.getBorder() != 0) { |
|
|
|
|
|
|
|
this.setBorder(new UIRoundedBorder(label.getBorder(), label.getColor(), label.isCorner() ? 15 : 0)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.setBorder(DEFAULT_BORDER); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 更新标题控件所有的样式 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void updateTitleWidgetStyle(Label title, BorderPacker style) { |
|
|
|
|
|
|
|
//标题的边框样式目前是取对应的控件的边框样式
|
|
|
|
|
|
|
|
title.setBorder(style.getBorder()); |
|
|
|
|
|
|
|
title.setColor(style.getColor()); |
|
|
|
|
|
|
|
// title.setCorner(style.isCorner());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TitlePacker wTitle = style.getTitle(); |
|
|
|
|
|
|
|
//设置成随机不重复的, 不然都用一个名字的话, 联动只能联动一个
|
|
|
|
|
|
|
|
title.setWidgetName(WidgetTitle.TITLE_NAME_INDEX + this.toData().getWidgetName()); |
|
|
|
|
|
|
|
title.setWidgetValue(getTitleValue(wTitle)); |
|
|
|
|
|
|
|
title.setFont(wTitle.getFrFont()); |
|
|
|
|
|
|
|
title.setTextalign(wTitle.getPosition()); |
|
|
|
|
|
|
|
title.setBackground(wTitle.getBackground()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private WidgetValue getTitleValue(TitlePacker wTitle) { |
|
|
|
|
|
|
|
String content = String.valueOf(wTitle.getTextObject()); |
|
|
|
|
|
|
|
Object value = content.startsWith("=") ? BaseFormula.createFormulaBuilder().build(content) : content; |
|
|
|
|
|
|
|
return new WidgetValue(value); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected String getIconName() { |
|
|
|
protected String getIconName() { |
|
|
|
return StringKit.EMPTY; |
|
|
|
return StringKit.EMPTY; |
|
|
|