Browse Source

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

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

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.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.start.ServerStarter;
import com.fr.workspace.WorkContext;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Desktop;
@ -31,7 +31,6 @@ import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
@ -83,6 +82,7 @@ public class DesignUtils {
/**
* 判断设计器端口是否被其他程序占用
* 尝试去通信无回应就是其他程序占用端口否则需要继续判断是否为设计器进程未关闭
*
* @return
*/
public static boolean isPortOccupied() {
@ -153,7 +153,7 @@ public class DesignUtils {
return;
}
try (Socket socket = new Socket("localhost", port)) {
clientSend(lines, socket);
clientSend(lines, socket);
} catch (Exception ignore) {
}
@ -189,10 +189,10 @@ public class DesignUtils {
DesignerEnvManager.getEnvManager().setCurrentEnv2Default();
ServerStarter.browserDemoURL();
} else if ("check".equals(line)) {
clientSend(new String[] {"response"}, socket);
clientSend(new String[]{"response"}, socket);
} else if ("end".equals(line)) {
DesignerExiter.getInstance().execute(); }
else if (StringUtils.isNotEmpty(line)) {
DesignerExiter.getInstance().execute();
} else if (StringUtils.isNotEmpty(line)) {
File f = new File(line);
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()) {
outputStream.write("reponse".getBytes(StandardCharsets.UTF_8));
outputStream.flush();
@ -285,13 +285,20 @@ public class DesignUtils {
return key.startsWith("TextField.") || key.startsWith("PasswordField.");
}
/**
* 获取当前系统语言下设计器用的默认字体
*
* @return 默认字体
*/
private static FRFont getCurrentLocaleFont() {
FRFont guiFRFont;
Locale defaultLocale = Locale.getDefault();
if (isDisplaySimSun(defaultLocale)) {
// JDK9 之后宋体在计算label中字母的空间上出现问题,暂时先用雅黑兼容,以后再统一字体
if (StableUtils.getMajorJavaVersion() >= 9 && OperatingSystem.isWindows()) {
guiFRFont = getNamedFont("Microsoft YaHei");
} else if (isDisplaySimSun(defaultLocale)) {
guiFRFont = getNamedFont("SimSun");
} else {
} else {
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.condition.LiteConditionPane;
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.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.plugin.chart.base.AttrSeriesStackAndAxis;
import com.fr.van.chart.designer.style.series.VanChartSeriesConditionPane;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
@ -46,10 +47,13 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<Condi
//配置界面
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.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();

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.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.VanChartAttrHelper;
import com.fr.plugin.chart.attr.axis.VanChartAxis;
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot;
@ -18,6 +17,8 @@ import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.Icon;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
@ -29,8 +30,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.Rectangle2D;
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_H = 21;
private static final int COL_COUNT = 3;
private static final int MAX_COUNT = 20;
private UIButton addButton;
private UIPopupMenu popupMenu;
private UIMenuItem itemX;
private UIMenuItem itemY;
private List<ChartAxisButton> indexList_X = new ArrayList<ChartAxisButton>();
private List<ChartAxisButton> indexList_Y = new ArrayList<ChartAxisButton>();
@ -51,7 +53,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
private VanChartAxisPane parent;
public VanChartAxisButtonPane(VanChartAxisPane vanChartAxisPane){
public VanChartAxisButtonPane(VanChartAxisPane vanChartAxisPane) {
this.parent = vanChartAxisPane;
this.setLayout(new BorderLayout());
@ -66,6 +68,20 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 10, 0));
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);
}
@ -92,12 +108,12 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
pane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
buttonPane.add(pane);
}
if(pane != null) {
if (pane != null) {
pane.add(indexList_Y.get(i));
}
}
if(popupMenu != null){
if (popupMenu != null) {
popupMenu.setVisible(false);
}
@ -114,19 +130,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
indexList_X.clear();
indexList_Y.clear();
List<VanChartAxis> xList = plot.getXAxisList();
for(VanChartAxis axis : xList){
for (VanChartAxis axis : xList) {
ChartAxisButton x = new ChartAxisButton(plot.getXAxisName(axis));
x.setToolTipText(plot.getXAxisName(axis));
indexList_X.add(x);
}
List<VanChartAxis> yList = plot.getYAxisList();
for(VanChartAxis axis : yList){
for (VanChartAxis axis : yList) {
ChartAxisButton y = new ChartAxisButton(plot.getYAxisName(axis));
y.setToolTipText(plot.getYAxisName(axis));
indexList_Y.add(y);
}
if(indexList_X.isEmpty()){
if (indexList_X.isEmpty()) {
this.removeAll();
} else {
indexList_X.get(0).setSelected(true);
@ -143,7 +159,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
return null;
}
public String getNewChartName(List<ChartAxisButton> existList, String prefix){
public String getNewChartName(List<ChartAxisButton> existList, String prefix) {
int count = existList.size() + 1;
while (true) {
String name_test = prefix + count;
@ -165,31 +181,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
ActionListener addListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if(popupMenu == null){
popupMenu = new UIPopupMenu();
UIMenuItem item_x = new UIMenuItem(VanChartAttrHelper.X_AXIS_PREFIX);
item_x.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
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 = new UIPopupMenu();
if (indexList_X.size() < MAX_COUNT) {
popupMenu.add(itemX);
}
if (indexList_Y.size() < MAX_COUNT) {
popupMenu.add(itemY);
}
popupMenu.setVisible(true);
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);
ChartAxisButton button = new ChartAxisButton(name);
@ -199,7 +203,7 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
layoutPane();
}
private void addYAxis(){
private void addYAxis() {
String name = getNewChartName(indexList_Y, VanChartAttrHelper.Y_AXIS_PREFIX);
ChartAxisButton button = new ChartAxisButton(name);
@ -216,9 +220,10 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
private class AddButton extends UIButton {
public AddButton(Icon icon){
public AddButton(Icon icon) {
super(icon);
}
/**
* 组件是否需要响应添加的观察者事件
*
@ -277,19 +282,19 @@ public class VanChartAxisButtonPane extends BasicBeanPane<VanChartAxisPlot> {
}
private void noSelected() {
for(ChartAxisButton button : indexList_X){
for (ChartAxisButton button : indexList_X) {
button.setSelected(false);
}
for(ChartAxisButton button : indexList_Y){
for (ChartAxisButton button : indexList_Y) {
button.setSelected(false);
}
}
private void checkMoveOn(boolean moveOn) {
for(ChartAxisButton button : indexList_X){
for (ChartAxisButton button : indexList_X) {
button.isMoveOn = false;
}
for(ChartAxisButton button : indexList_Y){
for (ChartAxisButton button : indexList_Y) {
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) {
if (hasLabelAlign(plot)) {
if (hasLabelAlignPane()) {
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) {
if (hasLabelAlign(plot)) {
if (hasLabelAlignPane()) {
return new Component[][]{
new Component[]{getDataLabelContentPane(), null},
@ -222,6 +222,10 @@ public class VanChartGaugeLabelDetailPane extends VanChartPlotLabelDetailPane {
return getGaugeStyle() == GaugeStyle.THERMOMETER && !((VanChartGaugePlot) plot).getGaugeDetailStyle().isHorizontalLayout();
}
protected boolean hasLabelAlignPane() {
return getGaugeStyle() == GaugeStyle.THERMOMETER;
}
public void populate(AttrLabelDetail 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
public static XWCardMainBorderLayout getTopXMainBorderLayout(Container creator) {
XWCardMainBorderLayout result = null;
while (creator != null) {
if (creator instanceof XWCardMainBorderLayout) {
result = (XWCardMainBorderLayout) creator;
return (XWCardMainBorderLayout) creator;
}
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) {
continue;
}
//如果组件为XWCardMainBorderLayout的子组件,直接从XWCardMainBorderLayout中去找
XWCardMainBorderLayout borderLayout = XCreatorUtils.getTopXMainBorderLayout(creator);
if (borderLayout != null) {
return xCreatorAt(x, y, borderLayout, null);
//获取当前组件父组件相对于rootComponent或者paraComponent的距离
int relativeParentX = getRelativeParentX(creator.getParent());
int relativeParentY = getRelativeParentY(creator.getParent());
//如果不是布局容器,直接进行对比
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) {
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();
Rectangle rect = ComponentUtils.computeVisibleRect(creator);
// 判断是否处于交叉区域
if (!isIntersectArea(x, y, rect)) {
continue;
//最后,如果组件为Tab容器中的子组件,再从Tab容器中去找
XWCardMainBorderLayout borderLayout = XCreatorUtils.getTopXMainBorderLayout(creator);
if (borderLayout != null) {
relativeParentX = getRelativeParentX(borderLayout.getParent());
relativeParentY = getRelativeParentY(borderLayout.getParent());
return xCreatorAt(x - relativeParentX, y - relativeParentY, borderLayout, null);
}
return creator;
}
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;
import com.fr.design.mainframe.template.info.JPolyWorkBookProcessInfo;
@ -13,7 +11,6 @@ import com.fr.report.poly.PolyWorkSheet;
* 聚合报表Book, 跟WorkBook区别在于不能放入WorkSheet.
*
* @author neil
*
* @date: 2015-2-5-上午8:58:39
*/
public class JPolyWorkBook extends JWorkBook {
@ -32,15 +29,12 @@ public class JPolyWorkBook extends JWorkBook {
* 创建sheet名称tab面板
*
* @param reportCompositeX 当前组件对象
*
* @return sheet名称tab面板
*
* @date 2015-2-5-上午11:42:12
*
*/
@Override
public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite reportCompositeX){
return new PolySheetNameTabPane(reportCompositeX);
public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite reportCompositeX) {
return new SheetNameTabPane(reportCompositeX);
}
@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() {
@Override
public void targetModified(TargetModifiedEvent e) {
JWorkBook.this.fireTargetModified();
}
});
reportComposite.addTargetModifiedListener(e -> JWorkBook.this.fireTargetModified());
reportComposite.setParentContainer(centerPane);
return centerPane;
@ -241,11 +235,11 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
/**
* 判断sheet权限
*
* @param rolsName 角色
* @param rolesName 角色
*/
@Override
public void judgeSheetAuthority(String rolsName) {
boolean isCovered = reportComposite.getEditingTemplateReport().getWorkSheetPrivilegeControl().checkInvisible(rolsName);
public void judgeSheetAuthority(String rolesName) {
boolean isCovered = reportComposite.getEditingTemplateReport().getWorkSheetPrivilegeControl().checkInvisible(rolesName);
centerPane.setSheeetCovered(isCovered);
centerPane.refreshContainer();
}

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

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