Browse Source

Merge pull request #5066 in DESIGN/design from release/10.0 to bugfix/10.0

* commit '1da3c0e60db1a08adffe4c700e5965a4f849b6d3':
  REPORT-55549 【组件背景分离】组件复用-组件设置主体背景时,标题处在设计画布里显示了背景效果,但web预览没显示效果
  REPORT-55603 【10.0.18冒烟】【组件背景分离】组件复用-控件组件类插件最新jar下不显示控件大小、控件位置
  REPORT-55545 【组件背景分离】组件复用-下拉类控件,cpt和frm都会出现,收起校验上方任意的设置项,允许为空的那三个选项就会有间隙
  REPORT-55557 弹窗工具栏关闭处理(cpt&frm合并下处理方式)&& REPORT-55552 删除老编辑和帮助设置按钮
  REPORT-55603 【10.0.18冒烟】【组件背景分离】组件复用-控件组件类插件最新jar下不显示控件大小、控件位置
  REPORT-55545 【组件背景分离】组件复用-下拉类控件,cpt和frm都会出现,收起校验上方任意的设置项,允许为空的那三个选项就会有间隙
bugfix/10.0
superman 3 years ago
parent
commit
6ec682b0a8
  1. 4
      designer-base/src/main/java/com/fr/design/mainframe/DesktopCardPane.java
  2. 7
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  3. 13
      designer-base/src/main/java/com/fr/design/mainframe/TabChangeListener.java
  4. 15
      designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  5. 8
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  6. 5
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  7. 5
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  8. 4
      designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java
  9. 9
      designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java
  10. 3
      designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java
  11. 21
      designer-form/src/main/java/com/fr/design/mainframe/CoverPane.java
  12. 3
      designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java
  13. 15
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  14. 14
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  15. 30
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  16. 18
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  17. 15
      designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java
  18. 16
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

4
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);

7
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<T extends BaseBook, U extends BaseUndoState<?>> extends TargetComponent<T> implements ToolBarMenuDockPlus, DesignerProxy, JTemplateSave {
public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>> extends TargetComponent<T> 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<T extends BaseBook, U extends BaseUndoState<?>>
}
}
@Override
public void fireTabChange() {
// do nothing
}
protected <R> void addPane(PropertyItemPaneProvider provider) {
// do nothing
}

13
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();
}

15
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); // 容器绘制完整背景
// }
}
}
}

8
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);
}
}
}

5
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);
}
}

5
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);
}
}

4
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());

9
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;
}
}

3
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);
}

21
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);
}
}

3
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);
}
}
}

15
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));
}
}

14
designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

@ -1743,4 +1743,18 @@ public class FormDesigner extends TargetComponent<Form> 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();
}
}
}

30
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<Form, FormUndoState> implements BaseJForm<F
//FORM_TAB代表是否点击编辑,用于点击编辑前后菜单的显示
protected int index = FORM_TAB;
private ContainerAdapter containerAdapter = new ContainerAdapter() {
@Override
public void componentRemoved(ContainerEvent e) {
// 当前jfrom未在tab中显示时
if (formDesign != null) {
XCreator[] creators = formDesign.getSelectionModel().getSelection().getSelectedCreators();
for (XCreator creator : creators) {
creator.hidePopup();
}
}
}
};
public JForm() {
super(new Form(new WBorderLayout("form")), "Form");
init();
}
public JForm(Form form, FILE file, Parameter[] parameters) {
super(form, file, parameters);
init();
}
public JForm(Form form, FILE file) {
super(form, file);
init();
}
private void init() {
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().addContainerListener(containerAdapter);
}
@Override
@ -1130,7 +1108,6 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
public void whenClose() {
super.whenClose();
this.releaseResources();
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().removeContainerListener(this.containerAdapter);
}
@Override
@ -1151,4 +1128,11 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
}, XElementCase.class);
}
}
@Override
public void fireTabChange() {
if (formDesign != null) {
formDesign.hidePopup();
}
}
}

18
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

@ -150,6 +150,11 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
freshPropertyMode(innerCreator);
if (isExtraWidget) {
// REPORT-55603: 仅对于插件控件,将尺寸*位置面板放置在definePane下方,其余控件将尺寸*位置面板放置在definePane上方
widgetBoundPane = createWidgetBoundPane(xCreator);
if (widgetBoundPane != null) {
attriCardPane.add(widgetBoundPane, BorderLayout.CENTER);
}
return;
}
@ -187,9 +192,18 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
});
DataModify<Widget> definePane = rn.getDefinePane();
JComponent jComponent = definePane.toSwingComponent();
JComponent definePaneComponent = definePane.toSwingComponent();
boolean isExtraWidget = FormWidgetDefinePaneFactoryBase.isExtraXWidget(creator.toData());
attriCardPane.add(jComponent, BorderLayout.CENTER);
if (isExtraWidget) {
// REPORT-55603: 仅对于插件控件,将尺寸*位置面板放置在definePane下方,其余控件将尺寸*位置面板放置在definePane上方
attriCardPane.add(definePaneComponent, BorderLayout.NORTH);
} else {
// 使用单独的JPane和BorderLayout.North进行包装,避免出现CENTER嵌套CENTER后,内容高度变大的情况
JPanel definePaneWrapContent = FRGUIPaneFactory.createBorderLayout_S_Pane();
definePaneWrapContent.add(definePaneComponent, BorderLayout.NORTH);
attriCardPane.add(definePaneWrapContent, BorderLayout.CENTER);
}
currentEditorDefinePane = definePane;
}

15
designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java

@ -62,18 +62,13 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel inbuiltDefineContentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.add(inbuiltDefineContentPane, BorderLayout.NORTH);
designerWidth = new UIBoundSpinner(1, Integer.MAX_VALUE, 1);
JPanel layoutPane = createBoundsPane();
UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Size"), 280, 20, layoutPane);
inbuiltDefineContentPane.add(layoutExpandablePane, BorderLayout.NORTH);
JPanel advancePane = createAdvancePane();
UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, advancePane);
inbuiltDefineContentPane.add(advanceExpandablePane, BorderLayout.CENTER);
this.add(advanceExpandablePane, BorderLayout.NORTH);
JPanel layoutPane = createBoundsPane();
UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Size"), 280, 20, layoutPane);
this.add(layoutExpandablePane, BorderLayout.CENTER);
this.addExtraUIExpandablePaneFromPlugin();
}
@ -88,7 +83,7 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
panel.add(uiExpandablePane);
}
}
this.add(panel, BorderLayout.CENTER);
this.add(panel, BorderLayout.SOUTH);
}
public JPanel createBoundsPane() {

16
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -198,6 +198,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
centerPane = new UIModeControlContainer(parameterPane, reportComposite = new ReportComponentComposite(this)) {
@Override
protected void onModeChanged() {
processPopup(isUpMode());
refreshToolArea();
}
@ -1221,4 +1222,19 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
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();
}
}
}

Loading…
Cancel
Save