diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index 9aa9e5ab9c..f38e44f751 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -24,6 +24,7 @@ import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.WTabDisplayPosition; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.general.ComparatorUtils; +import com.fr.general.TextFetcher; import java.awt.Component; import java.awt.Dimension; @@ -284,7 +285,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { backupBound.x -= rec.x; backupBound.y -= rec.y; XWCardLayout cardLayout = mainLayout.getCardPart(); - LayoutBorderStyle style = cardLayout.toData().getBorderStyle(); + TextFetcher style = cardLayout.toData().getBorderStyle(); XWCardTitleLayout xwCardTitleLayout = mainLayout.getTitlePart(); Dimension titleDimension = xwCardTitleLayout.getSize(); diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java index b1ca803c6b..b280cb71a4 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java @@ -19,6 +19,7 @@ import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.general.ComparatorUtils; +import com.fr.general.TextFetcher; import java.awt.*; @@ -90,7 +91,7 @@ public class FRTabFitLayoutAdapter extends FRFitLayoutAdapter { // TODO 可以直接在这边将x,y都变成相对坐标,这样在后面判断拖进来的新控件放置方式的时候就不用再判断了 private int adjustY(int y, XWTabFitLayout tabLayout) { XWCardLayout cardLayout = (XWCardLayout) tabLayout.getBackupParent(); - LayoutBorderStyle style = cardLayout.toData().getBorderStyle(); + TextFetcher style = cardLayout.toData().getBorderStyle(); y = y - this.getParaEditorYOffset(); if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) { y = y - WCardMainBorderLayout.TAB_HEIGHT; diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java index 0466631023..05d35c8212 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java @@ -11,6 +11,7 @@ import com.fr.form.ui.WidgetTitle; import com.fr.form.ui.WidgetValue; import com.fr.form.ui.container.WTitleLayout; import com.fr.general.ComparatorUtils; +import com.fr.general.TextFetcher; import com.fr.stable.Constants; import com.fr.stable.StringUtils; @@ -41,7 +42,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ } protected void initStyle() { - LayoutBorderStyle style = toData().getBorderStyle(); + TextFetcher style = toData().getBorderStyle(); initBorderStyle(); if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) { initTitleStyle(style); @@ -52,7 +53,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ // 边框默认值设为NONE,不然像scalelayout这种只用默认边框的会不显示边框 protected void initBorderStyle() { - LayoutBorderStyle style = toData().getBorderStyle(); + TextFetcher style = toData().getBorderStyle(); if (style != null && style.getBorder() != Constants.LINE_NONE) { this.setBorder(new UIRoundedBorder(style.getBorder(), style.getColor(), style.getBorderRadius())); } else { @@ -74,8 +75,8 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ * 设置样式为标题样式时,对应组件加上标题 * @param style 样式 */ - protected void initTitleStyle(LayoutBorderStyle style){ - if (style.getTitle() == null) { + protected void initTitleStyle(TextFetcher style){ + if (style.getTextObject() == null) { return; } XWTitleLayout parent = (XWTitleLayout) this.getParent(); @@ -100,13 +101,13 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ /** * 更新标题控件所有的样式 */ - private void updateTitleWidgetStyle(Label title, LayoutBorderStyle style) { + private void updateTitleWidgetStyle(Label title, TextFetcher style) { //标题的边框样式目前是取对应的控件的边框样式 title.setBorder(style.getBorder()); title.setColor(style.getColor()); // title.setCorner(style.isCorner()); - WidgetTitle wTitle = style.getTitle(); + WidgetTitle wTitle = WidgetTitle.as(style); //设置成随机不重复的, 不然都用一个名字的话, 联动只能联动一个 title.setWidgetName(wTitle.TITLE_NAME_INDEX + this.toData().getWidgetName()); title.setWidgetValue(getTitleValue(wTitle)); diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java index 72d0669c83..615c328aa1 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java @@ -22,7 +22,6 @@ import com.fr.design.mainframe.JForm; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.CardSwitchButton; -import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.WidgetTitle; import com.fr.form.ui.container.WTabTextDirection; import com.fr.form.ui.container.cardlayout.WCardTagLayout; @@ -30,23 +29,13 @@ import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.general.Background; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; - +import com.fr.general.TextFetcher; import com.fr.general.cardtag.TemplateStyle; import com.fr.stable.unit.PT; -import javax.swing.Action; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.JPopupMenu; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.plaf.basic.BasicLabelUI; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Point; +import java.awt.*; import java.awt.event.MouseEvent; import java.awt.geom.Rectangle2D; import java.util.ArrayList; @@ -355,8 +344,8 @@ public class XCardSwitchButton extends XButton { if (this.cardLayout == null) { initRelateLayout(); } - LayoutBorderStyle style = this.cardLayout.toData().getBorderStyle(); - return style.getTitle(); + TextFetcher style = this.cardLayout.toData().getBorderStyle(); + return WidgetTitle.as(style); } //删除tab布局 diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java index 107e31ed12..653416e12f 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java @@ -34,6 +34,7 @@ import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTitleLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.general.ComparatorUtils; +import com.fr.general.TextFetcher; import com.fr.general.cardtag.DefaultTemplateStyle; import com.fr.general.cardtag.TemplateStyle; import com.fr.stable.ArrayUtils; @@ -165,7 +166,7 @@ public class XWCardLayout extends XLayoutContainer { WCardMainBorderLayout border = new WCardMainBorderLayout(); XWCardMainBorderLayout xMainBorder = new XWCardMainBorderLayout(border, dimension); //将子WCardBorder的style设置到父容器上 - LayoutBorderStyle style = (this.toData()).getBorderStyle(); + TextFetcher style = (this.toData()).getBorderStyle(); border.setBorderStyle(style); this.setBackupParent(xMainBorder); XWCardTitleLayout titlePart = this.initTitlePart(widgetName, xMainBorder); @@ -397,13 +398,13 @@ public class XWCardLayout extends XLayoutContainer { //初始化样式 @Override protected void initStyle() { - LayoutBorderStyle style = toData().getBorderStyle(); + TextFetcher style = toData().getBorderStyle(); initBorderTitleStyle(style); initBorderStyle(); clearOrShowTitleLayout(ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)); } - private void initBorderTitleStyle(LayoutBorderStyle style) { + private void initBorderTitleStyle(TextFetcher style) { //初始化默认标题样式 if (!initFlag) { return; @@ -411,7 +412,7 @@ public class XWCardLayout extends XLayoutContainer { style.setType(LayoutBorderStyle.TITLE); style.setBorder(Constants.LINE_THIN); - WidgetTitle widgetTitle = style.getTitle(); + WidgetTitle widgetTitle = WidgetTitle.as(style); widgetTitle.setBackground(ColorBackground.getInstance(TITLE_COLOR)); initFlag = false; } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index c7f235154e..b0731e152b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -38,6 +38,7 @@ import com.fr.form.ui.container.cardlayout.WCardTitleLayout; import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; +import com.fr.general.TextFetcher; import com.fr.share.ShareConstants; import com.fr.stable.Constants; @@ -164,7 +165,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout { String tabpaneName = cardLayout.getWidgetName(); if (!wCardTagLayout.isNewTab()) { wCardTagLayout.setWidgetName(tabpaneName); - LayoutBorderStyle borderStyle = cardLayout.getBorderStyle(); + TextFetcher borderStyle = cardLayout.getBorderStyle(); if(borderStyle != null){ //新tab默认都有标题 borderStyle.setType(LayoutBorderStyle.TITLE); diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java index 1b9d2690e6..cc118001fb 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java @@ -27,21 +27,18 @@ import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.form.ui.CardSwitchButton; -import com.fr.form.ui.LayoutBorderStyle; import com.fr.form.ui.Widget; -import com.fr.form.ui.WidgetTitle; import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WTabDisplayPosition; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; +import com.fr.general.TextFetcher; import com.fr.general.cardtag.DefaultTemplateStyle; import javax.swing.border.Border; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Rectangle; +import java.awt.*; import java.awt.event.ContainerEvent; import java.awt.event.MouseEvent; import java.util.HashMap; @@ -363,9 +360,8 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout { if (this.cardLayout == null) { initCardLayout(); } - LayoutBorderStyle borderStyle = this.cardLayout.toData().getBorderStyle(); - WidgetTitle title = borderStyle.getTitle(); - FRFont f = title.getFrFont(); + TextFetcher borderStyle = this.cardLayout.toData().getBorderStyle(); + FRFont f = borderStyle.getFrFont(); FontMetrics fm = GraphHelper.getFontMetrics(f); switch (wCardTagLayout.getTextDirection()) { diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java index 41ea1c1c7d..06a14c25a2 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java @@ -107,7 +107,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify public void populateBean(WCardTagLayout ob) { //标题背景和字体属性设置在WCardLayout上做兼容 XLayoutContainer topLayout = creator.getTopLayout(); - LayoutBorderStyle layoutBorderStyle = ((XWCardMainBorderLayout) topLayout).getCardPart().toData().getBorderStyle(); + LayoutBorderStyle layoutBorderStyle = (LayoutBorderStyle) ((XWCardMainBorderLayout) topLayout).getCardPart().toData().getBorderStyle(); displayPositionGroup.setSelectedIndex(ob.getDisplayPosition().getType()); textDirectionGroup.setSelectedIndex(ob.getTextDirection().getType()); @@ -125,7 +125,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify //标题背景和字体属性设置在WCardLayout上做兼容 XLayoutContainer topLayout = creator.getTopLayout(); XWCardLayout xCardLayout = ((XWCardMainBorderLayout) topLayout).getCardPart(); - LayoutBorderStyle layoutBorderStyle = xCardLayout.toData().getBorderStyle(); + LayoutBorderStyle layoutBorderStyle = (LayoutBorderStyle) xCardLayout.toData().getBorderStyle(); FRFont frFont = layoutBorderStyle.getTitle().getFrFont() == null ? FRFont.getInstance() : layoutBorderStyle.getTitle().getFrFont(); FRFont titleFont = frFontPane.update(frFont); layoutBorderStyle.getTitle().setFrFont(titleFont);