Browse Source

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

feature/big-screen
Yvan 4 years ago
parent
commit
2f43d059e0
  1. 8
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  2. 27
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  3. 8
      designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java
  4. 75
      designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java
  5. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java
  6. 6
      designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java
  7. 7
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  8. 59
      designer-form/src/main/java/com/fr/design/mainframe/FormDesigner.java
  9. 12
      designer-realize/src/main/java/com/fr/design/mainframe/JPolyWorkBook.java
  10. 14
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  11. 43
      designer-realize/src/main/java/com/fr/design/mainframe/PolySheetNameTabPane.java

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

@ -746,12 +746,10 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*/ */
public void checkCombineUp(boolean flag, ArrayList<String> al) { public void checkCombineUp(boolean flag, ArrayList<String> al) {
//Yvan: 检查当前是否为WORK_SHEET状态,因为只有WORK_SHEET中含有格式刷组件,此时是不需要进行checkComponentsByNames的 //Yvan: 检查当前是否为WORK_SHEET状态,因为只有WORK_SHEET中含有格式刷组件,此时是不需要进行checkComponentsByNames的
JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getMenuState() == DesignState.WORK_SHEET) {
if (jTemplate != null) { return;
if (jTemplate.getMenuState() != DesignState.WORK_SHEET) {
combineUp.checkComponentsByNames(flag, al);
}
} }
combineUp.checkComponentsByNames(flag, al);
} }
/** /**

27
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -19,10 +19,10 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.CommonCodeUtils; import com.fr.stable.CommonCodeUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.start.ServerStarter; import com.fr.start.ServerStarter;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
import java.awt.Desktop; import java.awt.Desktop;
@ -31,7 +31,6 @@ import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
@ -83,6 +82,7 @@ public class DesignUtils {
/** /**
* 判断设计器端口是否被其他程序占用 * 判断设计器端口是否被其他程序占用
* 尝试去通信无回应就是其他程序占用端口否则需要继续判断是否为设计器进程未关闭 * 尝试去通信无回应就是其他程序占用端口否则需要继续判断是否为设计器进程未关闭
*
* @return * @return
*/ */
public static boolean isPortOccupied() { public static boolean isPortOccupied() {
@ -153,7 +153,7 @@ public class DesignUtils {
return; return;
} }
try (Socket socket = new Socket("localhost", port)) { try (Socket socket = new Socket("localhost", port)) {
clientSend(lines, socket); clientSend(lines, socket);
} catch (Exception ignore) { } catch (Exception ignore) {
} }
@ -189,10 +189,10 @@ public class DesignUtils {
DesignerEnvManager.getEnvManager().setCurrentEnv2Default(); DesignerEnvManager.getEnvManager().setCurrentEnv2Default();
ServerStarter.browserDemoURL(); ServerStarter.browserDemoURL();
} else if ("check".equals(line)) { } else if ("check".equals(line)) {
clientSend(new String[] {"response"}, socket); clientSend(new String[]{"response"}, socket);
} else if ("end".equals(line)) { } else if ("end".equals(line)) {
DesignerExiter.getInstance().execute(); } DesignerExiter.getInstance().execute();
else if (StringUtils.isNotEmpty(line)) { } else if (StringUtils.isNotEmpty(line)) {
File f = new File(line); File f = new File(line);
String path = f.getAbsolutePath(); String path = f.getAbsolutePath();
@ -219,7 +219,7 @@ public class DesignUtils {
} }
public static void responseToClient(Socket socket) { public static void responseToClient(Socket socket) {
try (OutputStream outputStream = socket.getOutputStream()) { try (OutputStream outputStream = socket.getOutputStream()) {
outputStream.write("reponse".getBytes(StandardCharsets.UTF_8)); outputStream.write("reponse".getBytes(StandardCharsets.UTF_8));
outputStream.flush(); outputStream.flush();
@ -285,13 +285,20 @@ public class DesignUtils {
return key.startsWith("TextField.") || key.startsWith("PasswordField."); return key.startsWith("TextField.") || key.startsWith("PasswordField.");
} }
/**
* 获取当前系统语言下设计器用的默认字体
*
* @return 默认字体
*/
private static FRFont getCurrentLocaleFont() { private static FRFont getCurrentLocaleFont() {
FRFont guiFRFont; FRFont guiFRFont;
Locale defaultLocale = Locale.getDefault(); Locale defaultLocale = Locale.getDefault();
// JDK9 之后宋体在计算label中字母的空间上出现问题,暂时先用雅黑兼容,以后再统一字体
if (isDisplaySimSun(defaultLocale)) { if (StableUtils.getMajorJavaVersion() >= 9 && OperatingSystem.isWindows()) {
guiFRFont = getNamedFont("Microsoft YaHei");
} else if (isDisplaySimSun(defaultLocale)) {
guiFRFont = getNamedFont("SimSun"); guiFRFont = getNamedFont("SimSun");
} else { } else {
guiFRFont = getNamedFont("Dialog"); guiFRFont = getNamedFont("Dialog");
} }

8
designer-chart/src/main/java/com/fr/van/chart/column/VanChartCustomStackAndAxisConditionPane.java

@ -6,18 +6,19 @@ import com.fr.data.condition.ListCondition;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.LiteConditionPane; import com.fr.design.condition.LiteConditionPane;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.plugin.chart.base.AttrSeriesStackAndAxis; import com.fr.plugin.chart.base.AttrSeriesStackAndAxis;
import com.fr.van.chart.designer.style.series.VanChartSeriesConditionPane; import com.fr.van.chart.designer.style.series.VanChartSeriesConditionPane;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -46,10 +47,13 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<Condi
//配置界面 //配置界面
JPanel deployPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel deployPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
this.add(deployPane);
deployPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Deploy") + ":", null)); deployPane.setBorder(GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Deploy") + ":", null));
deployPane.add(createDeployPane()); deployPane.add(createDeployPane());
UIScrollPane scrollPane = new UIScrollPane(deployPane);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
this.add(scrollPane);
//条件界面 //条件界面
JPanel conditionPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); JPanel conditionPane = FRGUIPaneFactory.createBorderLayout_L_Pane();

75
designer-chart/src/main/java/com/fr/van/chart/designer/style/axis/component/VanChartAxisButtonPane.java

@ -8,7 +8,6 @@ import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.VanChartAttrHelper; import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.axis.VanChartAxis; import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; import com.fr.plugin.chart.attr.plot.VanChartAxisPlot;
@ -18,6 +17,8 @@ import javax.swing.BorderFactory;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
@ -29,8 +30,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
/** /**
* 坐标轴-上方按钮界面 * 坐标轴-上方按钮界面
@ -41,9 +40,12 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
private static final int B_W = 56; private static final int B_W = 56;
private static final int B_H = 21; private static final int B_H = 21;
private static final int COL_COUNT = 3; private static final int COL_COUNT = 3;
private static final int MAX_COUNT = 20;
private UIButton addButton; private UIButton addButton;
private UIPopupMenu popupMenu; private UIPopupMenu popupMenu;
private UIMenuItem itemX;
private UIMenuItem itemY;
private List<ChartAxisButton> indexList_X = new ArrayList<ChartAxisButton>(); private List<ChartAxisButton> indexList_X = new ArrayList<ChartAxisButton>();
private List<ChartAxisButton> indexList_Y = new ArrayList<ChartAxisButton>(); private List<ChartAxisButton> indexList_Y = new ArrayList<ChartAxisButton>();
@ -51,7 +53,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
private VanChartAxisPane parent; private VanChartAxisPane parent;
public VanChartAxisButtonPane(VanChartAxisPane vanChartAxisPane){ public VanChartAxisButtonPane(VanChartAxisPane vanChartAxisPane) {
this.parent = vanChartAxisPane; this.parent = vanChartAxisPane;
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
@ -66,6 +68,20 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 10, 0)); buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 10, 0));
this.add(buttonPane, BorderLayout.CENTER); this.add(buttonPane, BorderLayout.CENTER);
itemX = new UIMenuItem(VanChartAttrHelper.X_AXIS_PREFIX);
itemX.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addXAxis();
}
});
itemY = new UIMenuItem(VanChartAttrHelper.Y_AXIS_PREFIX);
itemY.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addYAxis();
}
});
addButton.addActionListener(addListener); addButton.addActionListener(addListener);
} }
@ -92,12 +108,12 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
pane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); pane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
buttonPane.add(pane); buttonPane.add(pane);
} }
if(pane != null) { if (pane != null) {
pane.add(indexList_Y.get(i)); pane.add(indexList_Y.get(i));
} }
} }
if(popupMenu != null){ if (popupMenu != null) {
popupMenu.setVisible(false); popupMenu.setVisible(false);
} }
@ -114,19 +130,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
indexList_X.clear(); indexList_X.clear();
indexList_Y.clear(); indexList_Y.clear();
List<VanChartAxis> xList = plot.getXAxisList(); List<VanChartAxis> xList = plot.getXAxisList();
for(VanChartAxis axis : xList){ for (VanChartAxis axis : xList) {
ChartAxisButton x = new ChartAxisButton(plot.getXAxisName(axis)); ChartAxisButton x = new ChartAxisButton(plot.getXAxisName(axis));
x.setToolTipText(plot.getXAxisName(axis)); x.setToolTipText(plot.getXAxisName(axis));
indexList_X.add(x); indexList_X.add(x);
} }
List<VanChartAxis> yList = plot.getYAxisList(); List<VanChartAxis> yList = plot.getYAxisList();
for(VanChartAxis axis : yList){ for (VanChartAxis axis : yList) {
ChartAxisButton y = new ChartAxisButton(plot.getYAxisName(axis)); ChartAxisButton y = new ChartAxisButton(plot.getYAxisName(axis));
y.setToolTipText(plot.getYAxisName(axis)); y.setToolTipText(plot.getYAxisName(axis));
indexList_Y.add(y); indexList_Y.add(y);
} }
if(indexList_X.isEmpty()){ if (indexList_X.isEmpty()) {
this.removeAll(); this.removeAll();
} else { } else {
indexList_X.get(0).setSelected(true); indexList_X.get(0).setSelected(true);
@ -143,7 +159,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
return null; return null;
} }
public String getNewChartName(List<ChartAxisButton> existList, String prefix){ public String getNewChartName(List<ChartAxisButton> existList, String prefix) {
int count = existList.size() + 1; int count = existList.size() + 1;
while (true) { while (true) {
String name_test = prefix + count; String name_test = prefix + count;
@ -165,31 +181,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
ActionListener addListener = new ActionListener() { ActionListener addListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if(popupMenu == null){ popupMenu = new UIPopupMenu();
popupMenu = new UIPopupMenu(); if (indexList_X.size() < MAX_COUNT) {
UIMenuItem item_x = new UIMenuItem(VanChartAttrHelper.X_AXIS_PREFIX); popupMenu.add(itemX);
item_x.addActionListener(new ActionListener() { }
@Override if (indexList_Y.size() < MAX_COUNT) {
public void actionPerformed(ActionEvent e) { popupMenu.add(itemY);
addXAxis();
}
});
UIMenuItem item_y = new UIMenuItem(VanChartAttrHelper.Y_AXIS_PREFIX);
item_y.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addYAxis();
}
});
popupMenu.add(item_x);
popupMenu.add(item_y);
} }
popupMenu.setVisible(true); popupMenu.setVisible(true);
GUICoreUtils.showPopupMenu(popupMenu, addButton, addButton.getWidth() - popupMenu.getPreferredSize().width, addButton.getY() - 1 + addButton.getHeight()); GUICoreUtils.showPopupMenu(popupMenu, addButton, addButton.getWidth() - popupMenu.getPreferredSize().width, addButton.getY() - 1 + addButton.getHeight());
} }
}; };
private void addXAxis(){ private void addXAxis() {
String name = getNewChartName(indexList_X, VanChartAttrHelper.X_AXIS_PREFIX); String name = getNewChartName(indexList_X, VanChartAttrHelper.X_AXIS_PREFIX);
ChartAxisButton button = new ChartAxisButton(name); ChartAxisButton button = new ChartAxisButton(name);
@ -199,7 +203,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
layoutPane(); layoutPane();
} }
private void addYAxis(){ private void addYAxis() {
String name = getNewChartName(indexList_Y, VanChartAttrHelper.Y_AXIS_PREFIX); String name = getNewChartName(indexList_Y, VanChartAttrHelper.Y_AXIS_PREFIX);
ChartAxisButton button = new ChartAxisButton(name); ChartAxisButton button = new ChartAxisButton(name);
@ -216,9 +220,10 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
private class AddButton extends UIButton { private class AddButton extends UIButton {
public AddButton(Icon icon){ public AddButton(Icon icon) {
super(icon); super(icon);
} }
/** /**
* 组件是否需要响应添加的观察者事件 * 组件是否需要响应添加的观察者事件
* *
@ -277,19 +282,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
} }
private void noSelected() { private void noSelected() {
for(ChartAxisButton button : indexList_X){ for (ChartAxisButton button : indexList_X) {
button.setSelected(false); button.setSelected(false);
} }
for(ChartAxisButton button : indexList_Y){ for (ChartAxisButton button : indexList_Y) {
button.setSelected(false); button.setSelected(false);
} }
} }
private void checkMoveOn(boolean moveOn) { private void checkMoveOn(boolean moveOn) {
for(ChartAxisButton button : indexList_X){ for (ChartAxisButton button : indexList_X) {
button.isMoveOn = false; button.isMoveOn = false;
} }
for(ChartAxisButton button : indexList_Y){ for (ChartAxisButton button : indexList_Y) {
button.isMoveOn = false; button.isMoveOn = false;
} }

2
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeCateOrPercentLabelDetailPane.java

@ -22,7 +22,7 @@ public class VanChartGaugeCateOrPercentLabelDetailPane extends VanChartGaugeLabe
} }
protected double[] getLabelPaneRowSize(Plot plot, double p) { protected double[] getLabelPaneRowSize(Plot plot, double p) {
if (hasLabelAlign(plot)) { if (hasLabelAlignPane()) {
return new double[]{p, p, p, p}; return new double[]{p, p, p, p};
} }

6
designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartGaugeLabelDetailPane.java

@ -123,7 +123,7 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
} }
protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) { protected Component[][] getLabelPaneComponents(Plot plot, double p, double[] columnSize) {
if (hasLabelAlign(plot)) { if (hasLabelAlignPane()) {
return new Component[][]{ return new Component[][]{
new Component[]{getDataLabelContentPane(), null}, new Component[]{getDataLabelContentPane(), null},
@ -222,6 +222,10 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout(); return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout();
} }
protected boolean hasLabelAlignPane() {
return getGaugeStyle() == GaugeStyle.THERMOMETER;
}
public void populate(AttrLabelDetail detail) { public void populate(AttrLabelDetail detail) {
super.populate(detail); super.populate(detail);

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

@ -345,17 +345,16 @@ public class XCreatorUtils {
} }
/** /**
* 获取组件的最顶层XMainBorderLayout,没有则返回null * 获取组件的上一层的XMainBorderLayout,没有则返回null
* */ * */
@Nullable @Nullable
public static XWCardMainBorderLayout getTopXMainBorderLayout(Container creator) { public static XWCardMainBorderLayout getTopXMainBorderLayout(Container creator) {
XWCardMainBorderLayout result = null;
while (creator != null) { while (creator != null) {
if (creator instanceof XWCardMainBorderLayout) { if (creator instanceof XWCardMainBorderLayout) {
result = (XWCardMainBorderLayout) creator; return (XWCardMainBorderLayout) creator;
} }
creator = creator.getParent(); creator = creator.getParent();
} }
return result; return null;
} }
} }

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

@ -842,26 +842,61 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
if (shouldContinue) { if (shouldContinue) {
continue; continue;
} }
//如果组件为XWCardMainBorderLayout的子组件,直接从XWCardMainBorderLayout中去找 //获取当前组件父组件相对于rootComponent或者paraComponent的距离
XWCardMainBorderLayout borderLayout = XCreatorUtils.getTopXMainBorderLayout(creator); int relativeParentX = getRelativeParentX(creator.getParent());
if (borderLayout != null) { int relativeParentY = getRelativeParentY(creator.getParent());
return xCreatorAt(x, y, borderLayout, null);
//如果不是布局容器,直接进行对比
if (!(creator instanceof XLayoutContainer)) {
int newX = x - relativeParentX - creator.getX();
int newY = y - relativeParentY - creator.getY();
Rectangle rect = ComponentUtils.computeVisibleRect(creator);
// 判断是否处于交叉区域
if (isIntersectArea(newX, newY, rect)) {
return creator;
}
} }
//如果是布局容器,从布局容器向下找
if (creator instanceof XLayoutContainer) { if (creator instanceof XLayoutContainer) {
return xCreatorAt(x, y, creator, null); XCreator result = xCreatorAt(x - relativeParentX, y - relativeParentY, creator, null);
if (result != null) {
return result;
}
} }
x -= creator.getX();
y -= creator.getY(); //最后,如果组件为Tab容器中的子组件,再从Tab容器中去找
Rectangle rect = ComponentUtils.computeVisibleRect(creator); XWCardMainBorderLayout borderLayout = XCreatorUtils.getTopXMainBorderLayout(creator);
// 判断是否处于交叉区域 if (borderLayout != null) {
if (!isIntersectArea(x, y, rect)) { relativeParentX = getRelativeParentX(borderLayout.getParent());
continue; relativeParentY = getRelativeParentY(borderLayout.getParent());
return xCreatorAt(x - relativeParentX, y - relativeParentY, borderLayout, null);
} }
return creator;
} }
return null; return null;
} }
/**
* 获取当前组件相对于rootComponent或者paraComponent的横向距离
*/
private int getRelativeParentX(Container container) {
return returnZero(container) ? 0 : container.getX() + getRelativeParentX(container.getParent());
}
/**
* 获取当前组件相对于rootComponent或者paraComponent的纵向距离
*/
private int getRelativeParentY(Container container) {
return returnZero(container) ? 0 : container.getY() + getRelativeParentY(container.getParent());
}
private boolean returnZero(Container container) {
return !(container instanceof XLayoutContainer)
|| container == rootComponent
|| (paraComponent != null && container == paraComponent);
}
/** /**
* 刷新顶层组件 * 刷新顶层组件
* */ * */

12
designer-realize/src/main/java/com/fr/design/mainframe/JPolyWorkBook.java

@ -1,6 +1,4 @@
/**
*
*/
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.design.mainframe.template.info.JPolyWorkBookProcessInfo; import com.fr.design.mainframe.template.info.JPolyWorkBookProcessInfo;
@ -13,7 +11,6 @@ import com.fr.report.poly.PolyWorkSheet;
* 聚合报表Book, 跟WorkBook区别在于不能放入WorkSheet. * 聚合报表Book, 跟WorkBook区别在于不能放入WorkSheet.
* *
* @author neil * @author neil
*
* @date: 2015-2-5-上午8:58:39 * @date: 2015-2-5-上午8:58:39
*/ */
public class JPolyWorkBook extends JWorkBook { public class JPolyWorkBook extends JWorkBook {
@ -32,15 +29,12 @@ public class JPolyWorkBook extends JWorkBook {
* 创建sheet名称tab面板 * 创建sheet名称tab面板
* *
* @param reportCompositeX 当前组件对象 * @param reportCompositeX 当前组件对象
*
* @return sheet名称tab面板 * @return sheet名称tab面板
*
* @date 2015-2-5-上午11:42:12 * @date 2015-2-5-上午11:42:12
*
*/ */
@Override @Override
public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite reportCompositeX){ public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite reportCompositeX) {
return new PolySheetNameTabPane(reportCompositeX); return new SheetNameTabPane(reportCompositeX);
} }
@Override @Override

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

@ -208,13 +208,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
} }
}; };
reportComposite.addTargetModifiedListener(new TargetModifiedListener() { reportComposite.addTargetModifiedListener(e -> JWorkBook.this.fireTargetModified());
@Override
public void targetModified(TargetModifiedEvent e) {
JWorkBook.this.fireTargetModified();
}
});
reportComposite.setParentContainer(centerPane); reportComposite.setParentContainer(centerPane);
return centerPane; return centerPane;
@ -241,11 +235,11 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/** /**
* 判断sheet权限 * 判断sheet权限
* *
* @param rolsName 角色 * @param rolesName 角色
*/ */
@Override @Override
public void judgeSheetAuthority(String rolsName) { public void judgeSheetAuthority(String rolesName) {
boolean isCovered = reportComposite.getEditingTemplateReport().getWorkSheetPrivilegeControl().checkInvisible(rolsName); boolean isCovered = reportComposite.getEditingTemplateReport().getWorkSheetPrivilegeControl().checkInvisible(rolesName);
centerPane.setSheeetCovered(isCovered); centerPane.setSheeetCovered(isCovered);
centerPane.refreshContainer(); centerPane.refreshContainer();
} }

43
designer-realize/src/main/java/com/fr/design/mainframe/PolySheetNameTabPane.java

@ -1,35 +1,38 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.Graphics2D;
import com.fr.design.menu.MenuDef; import com.fr.design.menu.MenuDef;
import java.awt.Graphics2D;
/** /**
* 获取 * 获取
* *
* @date 2015-2-5-上午10:19:17 * @date 2015-2-5-上午10:19:17
* * @deprecated 让聚合报表也可以新建普通报表sheet, 逻辑和普通报表保持一致, 弃用此个性化设置
*/ */
public class PolySheetNameTabPane extends SheetNameTabPane{ @Deprecated
public class PolySheetNameTabPane extends SheetNameTabPane {
/**
* 构造函数 /**
*/ * 构造函数
public PolySheetNameTabPane(ReportComponentComposite reportCompositeX) { */
super(reportCompositeX); public PolySheetNameTabPane(ReportComponentComposite reportCompositeX) {
} super(reportCompositeX);
}
protected void paintAddButton(Graphics2D g2d){
ADD_POLY_SHEET.paintIcon(this, g2d, iconLocation, 3); protected void paintAddButton(Graphics2D g2d) {
ADD_POLY_SHEET.paintIcon(this, g2d, iconLocation, 3);
} }
protected void firstInsertActionPerformed(){ protected void firstInsertActionPerformed() {
new PolyReportInsertAction().actionPerformed(null); new PolyReportInsertAction().actionPerformed(null);
} }
protected void addInsertGridShortCut(MenuDef def){ protected void addInsertGridShortCut(MenuDef def) {
} }
} }
Loading…
Cancel
Save