diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java index f540832d0d..f3afcacc98 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java @@ -56,6 +56,10 @@ public class DesktopCardPane extends BasicPane implements TargetModifiedListener } else if (!DesignModeContext.isVcsMode() && !DesignModeContext.isAuthorityEditing()) { DesignModeContext.switchTo(DesignerMode.NORMAL); } + // 切换时 + if (component != null) { + component.fireTabChange(); + } DesignerFrameFileDealerPane.getInstance().setCurrentEditingTemplate(jt); if (component != null) { layeredPane.remove(component); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index abd219ee7f..f1bc2cbafe 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -95,7 +95,7 @@ import java.util.concurrent.Callable; /** * 报表设计和表单设计的编辑区域(设计器编辑的IO文件) */ -public abstract class JTemplate> extends TargetComponent implements ToolBarMenuDockPlus, DesignerProxy, JTemplateSave { +public abstract class JTemplate> extends TargetComponent implements ToolBarMenuDockPlus, DesignerProxy, JTemplateSave, TabChangeListener { // TODO ALEX_SEP editingFILE这个属性一定要吗?如果非要不可,有没有可能保证不为null private static final int PREFIX_NUM = 3000; protected FILE editingFILE = null; @@ -218,6 +218,11 @@ public abstract class JTemplate> } } + @Override + public void fireTabChange() { + // do nothing + } + protected void addPane(PropertyItemPaneProvider provider) { // do nothing } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/TabChangeListener.java b/designer-base/src/main/java/com/fr/design/mainframe/TabChangeListener.java new file mode 100644 index 0000000000..a69706c551 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/TabChangeListener.java @@ -0,0 +1,13 @@ +package com.fr.design.mainframe; + +/** + * tab切换时对当前打开的模版处理些事件 + * + * @author hades + * @version 10.0 + * Created by hades on 2021/7/22 + */ +public interface TabChangeListener { + + void fireTabChange(); +} 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 754638783c..26d65cb5d1 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 @@ -194,13 +194,14 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{ titleCreator.setBorder(new BottomLineBorder(color, thickness)); } - if (bodyXCreator instanceof XBorderStyleWidgetCreator) { - XBorderStyleWidgetCreator styledBodyXCreator = (XBorderStyleWidgetCreator) bodyXCreator; - Background background4Painting = styledBodyXCreator.getBackground4Painting(); - - styledBodyXCreator.setBackground4Painting(null); // body不绘制背景 - titleParent.setBackground4Painting(background4Painting); // 容器绘制完整背景 - } + // 主体背景的生效范围暂时保持原样,不作用于包含标题区域的整体范围内 +// if (bodyXCreator instanceof XBorderStyleWidgetCreator) { +// XBorderStyleWidgetCreator styledBodyXCreator = (XBorderStyleWidgetCreator) bodyXCreator; +// Background background4Painting = styledBodyXCreator.getBackground4Painting(); +// +// styledBodyXCreator.setBackground4Painting(null); // body不绘制背景 +// titleParent.setBackground4Painting(background4Painting); // 容器绘制完整背景 +// } } } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 2f5f0e6282..fa9267b1a7 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -778,7 +778,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo int extraY = (int) (bounds.y * designer.getScale()); popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY); popup.updatePane(designer); - popup.setVisible(selected && accept && popup.hasVisibleButtons()); + popup.setVisible(selected && accept && popup.hasVisibleButtons() && popup.isCanVisible()); popup.setRelativeBounds(bounds); } @@ -836,4 +836,10 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } } + public void processPopup(boolean canVisible) { + if (popup != null) { + popup.setCanVisible(canVisible); + } + } + } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java index c6d0067c3a..fdd62d1b0f 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -447,10 +447,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { super.paint(g); //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 if (isMouseEnter && !this.editable) { - CoverReportPane.paintEditButton(g, this); - if (isShared()) { - CoverReportPane.paintShareButton(g, this); - } + CoverReportPane.paintCover(g, this); } } 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 523533e5e7..6009711f71 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 @@ -344,10 +344,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout { super.paint(g); //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 if (isMouseEnter && !editable) { - CoverReportPane.paintEditButton(g, this); - if (isShared()) { - CoverReportPane.paintShareButton(g, this); - } + CoverReportPane.paintCover(g, this); } } diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java index ebcfa472f0..ad003ff692 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java @@ -4,7 +4,9 @@ import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWTitleLayout; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.VerticalFlowLayout; @@ -193,7 +195,7 @@ public class PopupControlPanel extends JPanel { } public void updatePane(FormDesigner designer) { - setButtonVisible(editButton, creator.acceptType(XWTitleLayout.class)); + setButtonVisible(editButton, creator.acceptType(XWTitleLayout.class, XWCardMainBorderLayout.class) || creator.getClass().equals(XWAbsoluteLayout.class)); setButtonVisible(settingButton, creator.isShared()); setButtonVisible(toggleButton, AdapterBus.searchLayoutAdapter(designer, creator) instanceof FRAbsoluteLayoutAdapter); toggleButton.setSelected(creator.toData().isAspectRatioLocked()); diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java index c5f94d70eb..285bbc3b8b 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java @@ -20,6 +20,8 @@ public class SelectedPopupDialog extends JDialog { private final PopupControlPanel controlPanel; + private boolean canVisible = true; + public SelectedPopupDialog(XCreator creator, FormDesigner designer) { super(DesignerContext.getDesignerFrame()); this.setUndecorated(true); @@ -43,4 +45,11 @@ public class SelectedPopupDialog extends JDialog { this.controlPanel.setRelativeBounds(rectangle); } + public boolean isCanVisible() { + return canVisible; + } + + public void setCanVisible(boolean canVisible) { + this.canVisible = canVisible; + } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java b/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java index 25bf1f5de7..0c838b61ec 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java @@ -4,6 +4,7 @@ import com.fr.design.constants.UIConstants; 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.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.treeview.ComponentTreeCellRenderer; @@ -414,7 +415,7 @@ public class ComponentTree extends JTree { private void showSelectedPopup(XCreator comp) { Rectangle rectangle = getRelativeBounds(comp); - comp.showSelectedPopup(designer, rectangle, comp.acceptType(XWTitleLayout.class)); + comp.showSelectedPopup(designer, rectangle, comp.acceptType(XWTitleLayout.class, XWCardMainBorderLayout.class, XWAbsoluteLayout.class)); comp.setSelected(true); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/CoverPane.java b/designer-form/src/main/java/com/fr/design/mainframe/CoverPane.java index f63c430554..6bafb317f3 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/CoverPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/CoverPane.java @@ -42,9 +42,7 @@ public class CoverPane extends JComponent { Graphics2D g2d = (Graphics2D) g; Composite oldComposite = g2d.getComposite(); //画白色的编辑层 - g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 50 / 100.0F)); - g2d.setColor(XCreatorConstants.COVER_COLOR); - g2d.fillRect(x, y, w, h); + paintCover(g, component); //画编辑按钮所在框 FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); AlphaComposite alphaComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, formDesigner.getCursor().getType() != Cursor.DEFAULT_CURSOR ? 0.9f : 0.7f); @@ -71,6 +69,21 @@ public class CoverPane extends JComponent { GraphHelper.draw(g, new Rectangle(BORDER_WIDTH, BORDER_WIDTH, w - BORDER_WIDTH * 2, h - BORDER_WIDTH * 2), Constants.LINE_MEDIUM); } + /** + * 绘制悬浮层 + * @param g + * @param component + */ + public static void paintCover(Graphics g, Component component) { + Graphics2D g2d = (Graphics2D) g; + Composite oldComposite = g2d.getComposite(); + //画白色的编辑层 + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 50 / 100.0F)); + g2d.setColor(XCreatorConstants.COVER_COLOR); + g2d.fillRect(0, 0, component.getWidth(), component.getHeight()); + g2d.setComposite(oldComposite); + } + public CoverPane() { setBackground(null); setOpaque(false); @@ -87,6 +100,6 @@ public class CoverPane extends JComponent { public void paint(Graphics g) { super.paint(g); - paintEditButton(g, this); + paintCover(g, this); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java b/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java index 14b8aed7a3..ba687f5255 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java @@ -75,8 +75,5 @@ public class CoverReportPane extends CoverPane{ @Override public void paint(Graphics g) { super.paint(g); - if (isShared()) { - paintShareButton(g, this); - } } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java index 783e984b9d..5cd0458350 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java @@ -18,7 +18,9 @@ import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XEditorHolder; import com.fr.design.designer.creator.XElementCase; import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.cardlayout.XCardAddButton; import com.fr.design.designer.creator.cardlayout.XCardSwitchButton; import com.fr.design.designer.creator.cardlayout.XWCardLayout; @@ -383,6 +385,14 @@ public class EditingMouseListener extends MouseInputAdapter { } private boolean isEditButton(MouseEvent e, XCreator component, Insets insets) { + // 不显示编辑按钮 鼠标格式 + if (component.getParent() instanceof XCreator) { + XCreator parent = (XCreator) component.getParent(); + if (parent.acceptType(XWTitleLayout.class) || component.acceptType(XWCardMainBorderLayout.class, XWAbsoluteLayout.class)) { + return false; + } + } + int innerWidth = component.getWidth() - insets.left - insets.right; int innerHeight = component.getHeight() - insets.top - insets.bottom; @@ -458,10 +468,7 @@ public class EditingMouseListener extends MouseInputAdapter { if (designer.getCursor().getType() == Cursor.HAND_CURSOR) { designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } - if (isShareConfigButton(e, component, insets)) { - designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - component.setHelpBtnOnFocus(true); - } else if (isEditButton(e, component, insets)) { + if (isEditButton(e, component, insets)) { designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java index 1d4fad8e34..1a6d24ec55 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java @@ -1743,4 +1743,18 @@ public class FormDesigner extends TargetComponent
implements TreeSelection return false; } + public void processPopup(boolean canVisible) { + XCreator creator = this.getSelectionModel().getSelection().getSelectedCreator(); + if (creator != null) { + creator.processPopup(canVisible); + } + } + + public void hidePopup() { + XCreator creator = this.getSelectionModel().getSelection().getSelectedCreator(); + if (creator != null) { + creator.hidePopup(); + } + } + } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java index bc32c5fd9e..8c9b1f2bc8 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/JForm.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/JForm.java @@ -89,8 +89,6 @@ import com.fr.stable.StringUtils; import com.fr.stable.bridge.StableFactory; import com.fr.web.controller.ViewRequestConstants; -import java.awt.event.ContainerAdapter; -import java.awt.event.ContainerEvent; import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JComponent; @@ -133,36 +131,16 @@ public class JForm extends JTemplate implements BaseJForm implements BaseJForm implements BaseJForm { centerPane = new UIModeControlContainer(parameterPane, reportComposite = new ReportComponentComposite(this)) { @Override protected void onModeChanged() { + processPopup(isUpMode()); refreshToolArea(); } @@ -1221,4 +1222,19 @@ public class JWorkBook extends JTemplate { super.whenClose(); reportComposite.doRemoveAction(); } + + protected void processPopup(boolean visible) { + FormDesigner designer = (FormDesigner) parameterPane.getParaDesigner(); + if (designer != null) { + designer.processPopup(visible); + } + } + + @Override + public void fireTabChange() { + FormDesigner designer = (FormDesigner) parameterPane.getParaDesigner(); + if (designer != null) { + designer.hidePopup(); + } + } }