Browse Source

Pull request #5006: REPORT-55227 【组件背景分离】组件复用-组件悬停1s后判断组件移入tab内部,这时候的tab块没有预期的蓝色阴影样式

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

* commit '236228b2fa30aca4d4adb66f96d5c0a6dac0d2dd':
  REPORT-55227 【组件背景分离】组件复用-组件悬停1s后判断组件移入tab内部,这时候的tab块没有预期的蓝色阴影样式 fix
  REPORT-55227 【组件背景分离】组件复用-组件悬停1s后判断组件移入tab内部,这时候的tab块没有预期的蓝色阴影样式
zheng-1641779399395
Hades 3 years ago
parent
commit
b11a20bb9b
  1. 12
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  2. 4
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java
  3. 23
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java
  4. 1
      designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java

12
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -3,6 +3,7 @@
*/ */
package com.fr.design.designer.creator.cardlayout; package com.fr.design.designer.creator.cardlayout;
import com.fr.base.GraphHelper;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.LayoutAdapter;
@ -32,6 +33,8 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.act.BorderPacker; import com.fr.general.act.BorderPacker;
import com.fr.stable.Constants;
import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
@ -50,6 +53,9 @@ import java.util.List;
*/ */
public class XWCardMainBorderLayout extends XWBorderLayout { public class XWCardMainBorderLayout extends XWBorderLayout {
private static final int BORDER_WIDTH = 4;
private static final Color OUTER_BORDER_COLOR = new Color(65, 155, 249, 30);
private static final int CENTER = 1; private static final int CENTER = 1;
private static final int NORTH = 0; private static final int NORTH = 0;
private static final int TITLE_STYLE = 2; private static final int TITLE_STYLE = 2;
@ -345,6 +351,12 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
@Override @Override
public void paintBorder(Graphics g, Rectangle bounds){ public void paintBorder(Graphics g, Rectangle bounds){
if (isDragInAble()) {
Color oldColor = g.getColor();
g.setColor(OUTER_BORDER_COLOR);
GraphHelper.draw(g, new Rectangle(bounds.x - BORDER_WIDTH, bounds.y - BORDER_WIDTH, bounds.width + BORDER_WIDTH + 3, bounds.height + BORDER_WIDTH + 3), Constants.LINE_LARGE);
g.setColor(oldColor);
}
if (!isMouseEnter) { if (!isMouseEnter) {
super.paintBorder(g, bounds); super.paintBorder(g, bounds);
} }

4
designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -335,4 +335,8 @@ public class FormCreatorDropTarget extends DropTarget {
} }
} }
} }
public TabDragInner getTabDragInner() {
return this.tabDragInner;
}
} }

23
designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java

@ -13,7 +13,7 @@ import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
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.XWCardMainBorderLayout;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
@ -24,6 +24,7 @@ import com.fr.report.core.ReportUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import java.awt.dnd.DropTarget;
import javax.swing.*; import javax.swing.*;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
@ -94,6 +95,7 @@ public class FormDesignerUI extends ComponentUI {
} }
paintBorder(g); paintBorder(g);
paintSelection(g); paintSelection(g);
paintDropBorderShadow(g);
if (DesignerMode.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
paintAuthorityDetails(g, designer.getRootComponent()); paintAuthorityDetails(g, designer.getRootComponent());
@ -330,6 +332,25 @@ public class FormDesignerUI extends ComponentUI {
} }
} }
/**
* 绘制可拖拽进tab块之前的阴影
*
* @param g
*/
private void paintDropBorderShadow(Graphics g) {
DropTarget dropTarget = designer.getDropTarget();
if (dropTarget instanceof FormCreatorDropTarget) {
FormCreatorDropTarget target = (FormCreatorDropTarget) dropTarget;
XLayoutContainer layoutContainer = target.getTabDragInner().getBelowXLayoutContainer();
if (layoutContainer != null && layoutContainer.acceptType(XWCardMainBorderLayout.class)) {
Rectangle creatorBounds = ComponentUtils.getRelativeBounds(layoutContainer);
creatorBounds.x -= designer.getHorizontalScaleValue();
creatorBounds.y -= designer.getVerticalScaleValue();
layoutContainer.paintBorder(g, creatorBounds);
}
}
}
/** /**
* 初始为自适应时处理选中的范围 * 初始为自适应时处理选中的范围
* @param bound * @param bound

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

@ -71,6 +71,7 @@ public class TabDragInner {
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, belowXLayoutContainer); ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, belowXLayoutContainer);
if (adapter != null) { if (adapter != null) {
editingMouseListener.startEditing(belowXLayoutContainer, adapter.getDesignerEditor(), adapter); editingMouseListener.startEditing(belowXLayoutContainer, adapter.getDesignerEditor(), adapter);
belowXLayoutContainer.setDragInAble(false);
} }
} }
} }

Loading…
Cancel
Save