Browse Source

Pull request #5060: REPORT-55557 弹窗工具栏关闭处理(cpt&frm合并下处理方式)&& REPORT-55552 删除老编辑和帮助设置按钮

Merge in DESIGN/design from ~HADES/design:final/10.0 to final/10.0

* commit '624748dd870d072aa7ac6ddc149684566a5af461':
  REPORT-55557 弹窗工具栏关闭处理(cpt&frm合并下处理方式)&& REPORT-55552 删除老编辑和帮助设置按钮
final/10.0
Kara 3 years ago
parent
commit
eeed5ee096
  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. 8
      designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java
  5. 5
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  6. 5
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  7. 4
      designer-form/src/main/java/com/fr/design/designer/ui/PopupControlPanel.java
  8. 9
      designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java
  9. 3
      designer-form/src/main/java/com/fr/design/mainframe/ComponentTree.java
  10. 21
      designer-form/src/main/java/com/fr/design/mainframe/CoverPane.java
  11. 3
      designer-form/src/main/java/com/fr/design/mainframe/CoverReportPane.java
  12. 15
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  13. 14
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  14. 30
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  15. 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()) { } else if (!DesignModeContext.isVcsMode() && !DesignModeContext.isAuthorityEditing()) {
DesignModeContext.switchTo(DesignerMode.NORMAL); DesignModeContext.switchTo(DesignerMode.NORMAL);
} }
// 切换时
if (component != null) {
component.fireTabChange();
}
DesignerFrameFileDealerPane.getInstance().setCurrentEditingTemplate(jt); DesignerFrameFileDealerPane.getInstance().setCurrentEditingTemplate(jt);
if (component != null) { if (component != null) {
layeredPane.remove(component); 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文件) * 报表设计和表单设计的编辑区域(设计器编辑的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 // TODO ALEX_SEP editingFILE这个属性一定要吗?如果非要不可,有没有可能保证不为null
private static final int PREFIX_NUM = 3000; private static final int PREFIX_NUM = 3000;
protected FILE editingFILE = null; 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) { protected <R> void addPane(PropertyItemPaneProvider provider) {
// do nothing // 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();
}

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()); int extraY = (int) (bounds.y * designer.getScale());
popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY); popup.setLocation(designer.getLocationOnScreen().x + designer.getPaintX() + extraX, designer.getLocationOnScreen().y + designer.getPaintY() + extraY);
popup.updatePane(designer); popup.updatePane(designer);
popup.setVisible(selected && accept && popup.hasVisibleButtons()); popup.setVisible(selected && accept && popup.hasVisibleButtons() && popup.isCanVisible());
popup.setRelativeBounds(bounds); 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); super.paint(g);
//如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层
if (isMouseEnter && !this.editable) { if (isMouseEnter && !this.editable) {
CoverReportPane.paintEditButton(g, this); CoverReportPane.paintCover(g, this);
if (isShared()) {
CoverReportPane.paintShareButton(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); super.paint(g);
//如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层
if (isMouseEnter && !editable) { if (isMouseEnter && !editable) {
CoverReportPane.paintEditButton(g, this); CoverReportPane.paintCover(g, this);
if (isShared()) {
CoverReportPane.paintShareButton(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.adapters.layout.FRAbsoluteLayoutAdapter;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator; 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.XWTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.layout.VerticalFlowLayout;
@ -193,7 +195,7 @@ public class PopupControlPanel extends JPanel {
} }
public void updatePane(FormDesigner designer) { 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(settingButton, creator.isShared());
setButtonVisible(toggleButton, AdapterBus.searchLayoutAdapter(designer, creator) instanceof FRAbsoluteLayoutAdapter); setButtonVisible(toggleButton, AdapterBus.searchLayoutAdapter(designer, creator) instanceof FRAbsoluteLayoutAdapter);
toggleButton.setSelected(creator.toData().isAspectRatioLocked()); 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 final PopupControlPanel controlPanel;
private boolean canVisible = true;
public SelectedPopupDialog(XCreator creator, FormDesigner designer) { public SelectedPopupDialog(XCreator creator, FormDesigner designer) {
super(DesignerContext.getDesignerFrame()); super(DesignerContext.getDesignerFrame());
this.setUndecorated(true); this.setUndecorated(true);
@ -43,4 +45,11 @@ public class SelectedPopupDialog extends JDialog {
this.controlPanel.setRelativeBounds(rectangle); 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.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer; 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.XWTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.treeview.ComponentTreeCellRenderer; import com.fr.design.designer.treeview.ComponentTreeCellRenderer;
@ -414,7 +415,7 @@ public class ComponentTree extends JTree {
private void showSelectedPopup(XCreator comp) { private void showSelectedPopup(XCreator comp) {
Rectangle rectangle = getRelativeBounds(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); 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; Graphics2D g2d = (Graphics2D) g;
Composite oldComposite = g2d.getComposite(); Composite oldComposite = g2d.getComposite();
//画白色的编辑层 //画白色的编辑层
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 50 / 100.0F)); paintCover(g, component);
g2d.setColor(XCreatorConstants.COVER_COLOR);
g2d.fillRect(x, y, w, h);
//画编辑按钮所在框 //画编辑按钮所在框
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
AlphaComposite alphaComposite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, formDesigner.getCursor().getType() != Cursor.DEFAULT_CURSOR ? 0.9f : 0.7f); 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); 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() { public CoverPane() {
setBackground(null); setBackground(null);
setOpaque(false); setOpaque(false);
@ -87,6 +100,6 @@ public class CoverPane extends JComponent {
public void paint(Graphics g) { public void paint(Graphics g) {
super.paint(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 @Override
public void paint(Graphics g) { public void paint(Graphics g) {
super.paint(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.XEditorHolder;
import com.fr.design.designer.creator.XElementCase; import com.fr.design.designer.creator.XElementCase;
import com.fr.design.designer.creator.XLayoutContainer; 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.XWFitLayout;
import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.designer.creator.cardlayout.XCardAddButton; import com.fr.design.designer.creator.cardlayout.XCardAddButton;
import com.fr.design.designer.creator.cardlayout.XCardSwitchButton; import com.fr.design.designer.creator.cardlayout.XCardSwitchButton;
import com.fr.design.designer.creator.cardlayout.XWCardLayout; 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) { 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 innerWidth = component.getWidth() - insets.left - insets.right;
int innerHeight = component.getHeight() - insets.top - insets.bottom; int innerHeight = component.getHeight() - insets.top - insets.bottom;
@ -458,10 +468,7 @@ public class EditingMouseListener extends MouseInputAdapter {
if (designer.getCursor().getType() == Cursor.HAND_CURSOR) { if (designer.getCursor().getType() == Cursor.HAND_CURSOR) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
} }
if (isShareConfigButton(e, component, insets)) { if (isEditButton(e, component, insets)) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
component.setHelpBtnOnFocus(true);
} else if (isEditButton(e, component, insets)) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); 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; 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.stable.bridge.StableFactory;
import com.fr.web.controller.ViewRequestConstants; import com.fr.web.controller.ViewRequestConstants;
import java.awt.event.ContainerAdapter;
import java.awt.event.ContainerEvent;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -133,36 +131,16 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
//FORM_TAB代表是否点击编辑,用于点击编辑前后菜单的显示 //FORM_TAB代表是否点击编辑,用于点击编辑前后菜单的显示
protected int index = 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() { public JForm() {
super(new Form(new WBorderLayout("form")), "Form"); super(new Form(new WBorderLayout("form")), "Form");
init();
} }
public JForm(Form form, FILE file, Parameter[] parameters) { public JForm(Form form, FILE file, Parameter[] parameters) {
super(form, file, parameters); super(form, file, parameters);
init();
} }
public JForm(Form form, FILE file) { public JForm(Form form, FILE file) {
super(form, file); super(form, file);
init();
}
private void init() {
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().addContainerListener(containerAdapter);
} }
@Override @Override
@ -1130,7 +1108,6 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
public void whenClose() { public void whenClose() {
super.whenClose(); super.whenClose();
this.releaseResources(); this.releaseResources();
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().removeContainerListener(this.containerAdapter);
} }
@Override @Override
@ -1151,4 +1128,11 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
}, XElementCase.class); }, XElementCase.class);
} }
} }
@Override
public void fireTabChange() {
if (formDesign != null) {
formDesign.hidePopup();
}
}
} }

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