Browse Source

Merge remote-tracking branch 'origin/feature/10.0' into feature/10.0

feature/10.0
xiqiu 3 years ago
parent
commit
e713690a68
  1. 3
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  2. 40
      designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java
  3. 1
      designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java
  4. 2
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  5. 72
      designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java

3
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -879,8 +879,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
basePane.add(east, BorderLayout.EAST);
}
layeredPane.repaint();
layeredPane.revalidate();
jTemplate.setComposite();
}
/**

40
designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java

@ -58,26 +58,21 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup {
if (template == null) {
return false;
}
if (template.isJWorkBook() || DesignModeContext.isDuchampMode()) {
// 如果是普通报表单元格,那么没有 FormHyperlink 选项
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
//返回true表示可用,返回false表示不可用
return !ComparatorUtils.equals(clazz, formHyperlink.getClass());
} else {
// 如果是决策报表
Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};
for (Class aClass : classes) {
if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) {
// 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项
if (ComparatorUtils.equals(aClass, clazz)) {
return false;
}
} else if (template.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) {
// 编辑的是决策报表中的报表块,那么没有 ChartHyperRelateFloatLink,有ChartHyperRelateCellLink 和 FormHyperlink 选项
return !ComparatorUtils.equals(clazz, ChartHyperRelateFloatLink.class);
}
if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) {
// 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项
Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};
return !ArrayUtils.contains(classes, clazz);
} else if (template.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) {
// 编辑的是决策报表中的报表块,那么没有 ChartHyperPoplink 和 ChartHyperRelateFloatLink
Class[] classes = new Class[]{ChartHyperPoplink.class, ChartHyperRelateFloatLink.class};
return !ArrayUtils.contains(classes, clazz);
}
}
return true;
@ -101,17 +96,14 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup {
return !ComparatorUtils.equals(object.getClass(), formHyperlink.getClass());
} else {
// 如果是决策报表
Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};
for (Class aClass : classes) {
if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) {
// 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项
if (ComparatorUtils.equals(aClass, object.getClass())) {
return false;
}
} else if (template.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) {
// 编辑的是决策报表中的报表块,那么没有 ChartHyperRelateFloatLink,有ChartHyperRelateCellLink 和 FormHyperlink 选项
return !ComparatorUtils.equals(object.getClass(), ChartHyperRelateFloatLink.class);
}
if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) {
// 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项
Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};
return !ArrayUtils.contains(classes, object.getClass());
} else if (template.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) {
// 编辑的是决策报表中的报表块,那么没有 ChartHyperPoplink 和 ChartHyperRelateFloatLink
Class[] classes = new Class[]{ChartHyperPoplink.class, ChartHyperRelateFloatLink.class};
return !ArrayUtils.contains(classes, object.getClass());
}
}
return true;

1
designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java

@ -217,6 +217,7 @@ public class EditingMouseListener extends MouseInputAdapter {
int oldX = e.getX();
int oldY = e.getY();
offsetEventPoint(e);
designer.getSpacingLineDrawer().updateMouseEvent(e, false);
if (e.isPopupTrigger()) {
if (stateModel.isDragging()) {
stateModel.draggingCancel();

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

@ -1145,7 +1145,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
return comp == null ? container : comp;
}
private XLayoutContainer getRootContainer(int y) {
public XLayoutContainer getRootContainer(int y) {
XLayoutContainer container = y < paraHeight - formArea.getVerticalValue() ? paraComponent : rootComponent;
if (container == null) {
container = rootComponent;

72
designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java

@ -1,6 +1,13 @@
package com.fr.design.mainframe;
import com.fr.design.designer.creator.XChartEditor;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XElementCase;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.form.parameter.FormParaDesigner;
import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.utils.ComponentUtils;
import com.fr.stable.Constants;
import com.fr.stable.GraphDrawHelper;
@ -35,7 +42,7 @@ public class FormSpacingLineDrawer {
public void updateMouseEvent(MouseEvent e, boolean isMouseMoveEvent) {
XCreator creator = designer.getSelectionModel().getSelection().getSelectedCreator();
if (creator != null) {
this.hoverCreator = designer.getComponentAt(e.getX(), e.getY(), creator.getLevel());
this.hoverCreator = getHoverComponentAt(e.getX(), e.getY());
}
this.isMouseMoveEvent = isMouseMoveEvent;
}
@ -129,14 +136,16 @@ public class FormSpacingLineDrawer {
GraphDrawHelper.drawString(g2d, text, labelX, labelY);
}
private boolean isSelectedParaComponent() {
return designer.getParaComponent() == designer.getSelectionModel().getSelection().getSelectedCreator();
}
private boolean isSelectedRootComponent() {
return designer.getSelectionModel().getSelection().size() == 1 &&
designer.isRoot(designer.getSelectionModel().getSelection().getSelectedCreator());
return designer.isRoot(designer.getSelectionModel().getSelection().getSelectedCreator());
}
private boolean isSelectedForm() {
return designer.getSelectionModel().getSelection().size() == 1 &&
designer.getSelectionModel().getSelection().getSelectedCreator().getParent() == null;
return designer.getSelectionModel().getSelection().getSelectedCreator().getParent() == null;
}
private boolean isNeedExtendedLine(AbstractFormParallelLine[] nearestSides) {
@ -144,16 +153,38 @@ public class FormSpacingLineDrawer {
}
private boolean isSelectedRootPane() {
return isSelectedForm() || isSelectedRootComponent();
// form、body、para这三个选中了,都不要画任何间距线
return isSelectedForm() || isSelectedRootComponent() || isSelectedParaComponent();
}
// 当前组件是否在参数面板里面
private boolean isCompInPara(XCreator creator) {
XLayoutContainer container = XCreatorUtils.getHotspotContainer(creator);
boolean xCreatorAccept = creator.acceptType(XWParameterLayout.class);
boolean containerAccept = container != null && container.acceptType(XWParameterLayout.class);
return xCreatorAccept || containerAccept;
}
private boolean isBodyAbsoluteLayout() {
return !(designer instanceof FormParaDesigner) && FormDesignerUtils.isBodyAbsolute(designer);
}
private boolean isSelectedCompInPara() {
return isCompInPara(designer.getSelectionModel().getSelection().getSelectedCreator());
}
private boolean isSelectedCreatorSameParentWithHoveredCreator() {
XCreator selectedCreator = designer.getSelectionModel().getSelection().getSelectedCreator();
return selectedCreator != null && hoverCreator != null && selectedCreator.getParent() == hoverCreator.getParent();
private boolean isHoveredCompInPara() {
return isCompInPara(hoverCreator);
}
private boolean isSelectedCompOrHoveredCompInPara() {
return isSelectedCompInPara() || isHoveredCompInPara();
}
private boolean isDrawSpacingLine() {
return !isSelectedRootPane() && isSelectedCreatorSameParentWithHoveredCreator() && isMouseMoveEvent;
return isBodyAbsoluteLayout() && !isSelectedRootPane() && hoverCreator != null && !isSelectedCompOrHoveredCompInPara() && isMouseMoveEvent;
}
private AbstractFormParallelLine[] getNearestHorizontalSide() {
@ -197,4 +228,25 @@ public class FormSpacingLineDrawer {
}
return nearestSides;
}
private XCreator getHoverComponentAt(int x, int y) {
XCreator component = designer.getComponentAt(x, y);
XLayoutContainer parent = XCreatorUtils.getHotspotContainer(component).getTopLayout();
if (parent != null) {
if (!parent.isEditable()) {
return parent;
} else {
if (parent == component) {
return null;
}
if (component instanceof XChartEditor || component instanceof XElementCase) {
return (XCreator) component.getParent();
}
return component;
}
} else {
return component;
}
}
}

Loading…
Cancel
Save