Browse Source

Merge pull request #2269 in DESIGN/design from feature/10.0 to research/10.0

* commit '2b9228d1eefaed9de598fabb402cfca4b7c0bbd7':
  REPORT-38969 修改按照点击坐标获取组件的逻辑
  REPORT-38969 修改按照点击坐标获取组件的逻辑
  CHART-15610 自定义标签格式不保留
research/10.0
superman 4 years ago
parent
commit
5867cc0c9e
  1. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractRectanglePlotPane.java
  2. 7
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  3. 35
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java

2
designer-chart/src/main/java/com/fr/van/chart/designer/type/AbstractRectanglePlotPane.java

@ -68,6 +68,8 @@ public abstract class AbstractRectanglePlotPane extends AbstractVanChartTypePane
VanChartAxis vanChartAxis = vanChartRectanglePlot.getValueAxisList().get(0); VanChartAxis vanChartAxis = vanChartRectanglePlot.getValueAxisList().get(0);
cloneAxis.setFormat(vanChartAxis.getFormat()); cloneAxis.setFormat(vanChartAxis.getFormat());
cloneAxis.setPercentage(vanChartAxis.isPercentage()); cloneAxis.setPercentage(vanChartAxis.isPercentage());
cloneAxis.setCommonValueFormat(vanChartAxis.isCommonValueFormat());
cloneAxis.setHtmlLabel(vanChartAxis.getHtmlLabel());
} }
return clonePlot; return clonePlot;
} catch (CloneNotSupportedException ex) { } catch (CloneNotSupportedException ex) {

7
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -336,4 +336,11 @@ public class XCreatorUtils {
} }
return IOUtils.readIcon(iconPath); return IOUtils.readIcon(iconPath);
} }
public static boolean containComponent(Container ancestor, Container xCreator) {
while (xCreator != null && xCreator.getParent() != ancestor) {
xCreator = xCreator.getParent();
}
return xCreator != null;
}
} }

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

@ -38,6 +38,7 @@ import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.XWTitleLayout; import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.DesignerOpenedListener;
@ -64,6 +65,7 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.WidgetValue; import com.fr.form.ui.WidgetValue;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -189,6 +191,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
this.switchAction = switchAction; this.switchAction = switchAction;
topXCreators=new TopXCreators(this); topXCreators=new TopXCreators(this);
topXCreators.setVisible(true);
add(topXCreators); add(topXCreators);
// 必须刷新"参数/控件树"面板,否则,若最近一次打开模版为 cpt,重启设计器,打开 frm,控件树消失 // 必须刷新"参数/控件树"面板,否则,若最近一次打开模版为 cpt,重启设计器,打开 frm,控件树消失
@ -834,17 +837,22 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
/** /**
* 从已选择的组件中找x,y所在的组件 * 从已选择的组件中找x,y所在的组件
*/ */
private XCreator xCreatorAt(int x, int y, XCreator[] xCreators) { private XCreator xCreatorAt(int x, int y,XCreator root) {
XCreator[] xCreators = selectionModel.getSelection().getSelectedCreators();
for (XCreator creator : xCreators) { for (XCreator creator : xCreators) {
if (creator == null || !creator.isVisible()) { boolean shouldContinue = creator == null
continue; || !creator.isVisible()
} || !XCreatorUtils.containComponent(root, creator)
if (creator instanceof XWAbsoluteBodyLayout || creator instanceof XWFitLayout || creator instanceof XWParameterLayout) { || creator instanceof XWAbsoluteBodyLayout
|| creator instanceof XWFitLayout
|| creator instanceof XWParameterLayout;
if (shouldContinue) {
continue; continue;
} }
x -= creator.getX(); x -= creator.getX();
y -= creator.getY(); y -= creator.getY();
Rectangle rect = ComponentUtils.computeVisibleRect(creator); Rectangle rect = ComponentUtils.computeVisibleRect(creator);
rect.y += nestTabCount(creator) * WCardMainBorderLayout.TAB_HEIGHT;
// 判断是否处于交叉区域 // 判断是否处于交叉区域
if (!isIntersectArea(x, y, rect)) { if (!isIntersectArea(x, y, rect)) {
continue; continue;
@ -852,11 +860,24 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
if (creator instanceof XWTitleLayout) { if (creator instanceof XWTitleLayout) {
return creator.getEditingChildCreator(); return creator.getEditingChildCreator();
} }
return creator; return xCreatorAt(x, y, creator, null);
} }
return null; return null;
} }
/**
* 计算嵌套的tab层数
*/
private int nestTabCount(Container xCreator) {
if (xCreator == null) {
return 0;
}
if (xCreator instanceof XWTabFitLayout) {
return 1 + nestTabCount(xCreator.getParent());
}
return nestTabCount(xCreator.getParent());
}
/** /**
* 刷新顶层组件 * 刷新顶层组件
* */ * */
@ -1056,7 +1077,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
} }
int relativeX = x + (int) (formArea.getHorizontalValue() / scale) - container.getX(); int relativeX = x + (int) (formArea.getHorizontalValue() / scale) - container.getX();
int relativeY = y + (int) (formArea.getVerticalValue() / scale) - container.getY(); int relativeY = y + (int) (formArea.getVerticalValue() / scale) - container.getY();
XCreator result = xCreatorAt(relativeX, relativeY, selectionModel.getSelection().getSelectedCreators()); XCreator result = xCreatorAt(relativeX, relativeY, container);
return result == null ? getComponentAt(x, y, null) : result; return result == null ? getComponentAt(x, y, null) : result;
} }

Loading…
Cancel
Save