Browse Source

Merge pull request #6520 in DESIGN/design from release/10.0 to bugfix/10.0

* commit 'a084c8010f000c11fe3ef3582bb5f6702287a233':
  REPORT-62179 数字控件的最大最小值校验需支持公式
  REPORT-61410 数据集预览时可复制-表头复制问题 && REPORT-61409 数据集预览时可复制-赋值空值时显示成Null
  update
  代码质量:每个实例各自监听插件事件
  REPORT-61695
  REPORT-61618 复用组件生成时带“-”,导致部分公式失效@Jaimme
  REPORT-61695 决策报表-自适应布局下组件右侧设置面板显示“组件大小”,绝对布局下显示的是“控件位置”“控件大小”
  REPORT-61610 fix:插件重新加载 图表配置界面报错 A.class can not cast to A.class
  CHART-21418 fix:第二次修改 区分弹框在上面还是下面 如果在上面 则是从displayComponent下面离开 隐藏弹框
  REPORT-59744 聚合报表块手动修改位置以后,点击空白处位置偏移
bugfix/10.0
superman 3 years ago
parent
commit
52823132d0
  1. 2
      designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java
  2. 51
      designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java
  3. 22
      designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java
  4. 22
      designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java
  5. 25
      designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java
  6. 4
      designer-realize/src/main/java/com/fr/poly/group/PolyBoundsGroup.java

2
designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java

@ -11,7 +11,7 @@ import com.fr.stable.StringUtils;
* Created by hades on 2020/4/27 * Created by hades on 2020/4/27
*/ */
public abstract class BasicTableDataUtils { public abstract class BasicTableDataUtils {
private static final String SEPARATOR = "-"; private static final String SEPARATOR = "_";
private static final int LEN = 2; private static final int LEN = 2;

51
designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java

@ -106,6 +106,7 @@ public class CopyableJTable extends SortableJTable {
self.updateEndPoint(-1, column); self.updateEndPoint(-1, column);
self.refreshTable(); self.refreshTable();
} }
self.requestFocusInWindow();
} }
private int getColumn(MouseEvent e) { private int getColumn(MouseEvent e) {
@ -249,26 +250,9 @@ public class CopyableJTable extends SortableJTable {
FineLoggerFactory.getLogger().info("copy cell value"); FineLoggerFactory.getLogger().info("copy cell value");
java.util.List<java.util.List<Object>> table = new ArrayList<>(); java.util.List<java.util.List<Object>> table = new ArrayList<>();
if ((startRow != endRow || startCol != endCol) && Math.min(startCol, endCol) > -1) { if ((startRow != endRow || startCol != endCol) && Math.min(startCol, endCol) > -1) {
for (int i = Math.min(startRow, endRow); i <= Math.max(startRow, endRow); i++) { copyAreaData(table);
table.add(new ArrayList<>());
for (int j = Math.min(startCol, endCol); j <= Math.max(startCol, endCol); j++) {
Object text = this.getTableValue(i, j);
table.get(table.size() - 1).add(text);
}
}
} else if (pointList.size() > 0) { } else if (pointList.size() > 0) {
Collections.sort(pointList, Comparator.comparing(Point::getX).thenComparing(Point::getY)); copyPointsData(table);
int startRow = pointList.get(0).x;
int currentRow = startRow;
table.add(new ArrayList<>());
for (Point point : pointList) {
while (currentRow < point.x) {
table.add(new ArrayList<>());
currentRow++;
}
Object text = this.getTableValue(point.x, point.y);
table.get(table.size() - 1).add(text);
}
} }
Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard(); Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
@ -276,6 +260,35 @@ public class CopyableJTable extends SortableJTable {
clip.setContents(tText, null); clip.setContents(tText, null);
} }
private void copyAreaData(java.util.List<java.util.List<Object>> table) {
for (int i = Math.min(startRow, endRow); i <= Math.max(startRow, endRow); i++) {
table.add(new ArrayList<>());
for (int j = Math.min(startCol, endCol); j <= Math.max(startCol, endCol); j++) {
Object text = this.getTableValue(i, j);
if (text != null) {
table.get(table.size() - 1).add(text);
}
}
}
}
private void copyPointsData(java.util.List<java.util.List<Object>> table) {
Collections.sort(pointList, Comparator.comparing(Point::getX).thenComparing(Point::getY));
int startRow = pointList.get(0).x;
int currentRow = startRow;
table.add(new ArrayList<>());
for (Point point : pointList) {
while (currentRow < point.x) {
table.add(new ArrayList<>());
currentRow++;
}
Object text = this.getTableValue(point.x, point.y);
if (text != null) {
table.get(table.size() - 1).add(text);
}
}
}
private Object getTableValue(int row, int col) { private Object getTableValue(int row, int col) {
Object value = null; Object value = null;
if (col > -1) { if (col > -1) {

22
designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java

@ -10,6 +10,7 @@ import com.fr.stable.Constants;
import javax.swing.AbstractButton; import javax.swing.AbstractButton;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JWindow;
import javax.swing.border.AbstractBorder; import javax.swing.border.AbstractBorder;
import javax.swing.event.AncestorEvent; import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener; import javax.swing.event.AncestorListener;
@ -20,6 +21,7 @@ import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Insets; import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
@ -99,9 +101,25 @@ public abstract class AbstractSelectBox<T> extends AbstractPopBox implements Mou
displayComponent.addMouseListener(new MouseAdapter() { displayComponent.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
if (!isPopupVisible()) {
//如果弹出框==null 或者 弹出框不可见 直接return
return;
}
Point popMenuP = getControlWindow().getLocation();
Point displayComponentP = displayComponent.getLocationOnScreen();
if (popMenuP.getX() < displayComponentP.getX() - 1) {
//如果 弹出框横向超出屏幕 往左调整了 和displayComponent横向错开 就不处理了
return;
}
Rectangle rectangle = displayComponent.getBounds(); Rectangle rectangle = displayComponent.getBounds();
if (e.getY() < rectangle.y) { boolean bottomPopAndExitTop = displayComponentP.getY() < popMenuP.getY() && e.getY() <= rectangle.y;
//如果是从displayComponent上面离开的,隐藏弹出界面。 boolean topPopAndExitBottom = displayComponentP.getY() > popMenuP.getY() && e.getY() >= rectangle.y + rectangle.getHeight();
boolean exitLeftOrRight = rectangle.x > e.getX() || rectangle.x + rectangle.getWidth() < e.getX();
if (bottomPopAndExitTop || topPopAndExitBottom || exitLeftOrRight) {
//弹出框在displayComponent下面 且 鼠标是从displayComponent上面离开的,隐藏弹出界面。
//弹出框在displayComponent上面 且 鼠标是从displayComponent下面离开的,隐藏弹出界面。
//鼠标从displayComponent左边 或者 右边 离开,隐藏弹出界面。
hidePopupMenu(); hidePopupMenu();
} }

22
designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java

@ -1,6 +1,10 @@
package com.fr.design.widget.component; package com.fr.design.widget.component;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.ErrorMsgTextFieldAdapter;
import com.fr.design.beans.UITextFieldAdapter;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.TextFieldAdapterProvider;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
@ -9,6 +13,7 @@ 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.form.ui.NumberEditor; import com.fr.form.ui.NumberEditor;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -35,7 +40,7 @@ public class NumberEditorValidatePane extends JPanel {
private UISpinner minValueSpinner; private UISpinner minValueSpinner;
private UISpinner decimalLength; private UISpinner decimalLength;
private JPanel limitNumberPane; private JPanel limitNumberPane;
private UITextField errorMsgTextField; private ErrorMsgTextFieldAdapter errorMsgTextField;
private JPanel errorMsgTextFieldPane; private JPanel errorMsgTextFieldPane;
private ActionListener allowDecimalsListener; private ActionListener allowDecimalsListener;
@ -100,9 +105,20 @@ public class NumberEditorValidatePane extends JPanel {
} }
private void initErrorMsgPane() { private void initErrorMsgPane() {
errorMsgTextField = new UITextField(); TextFieldAdapterProvider provider = ExtraDesignClassManager.getInstance().getSingle(TextFieldAdapterProvider.XML_TAG);
if (provider != null) {
try {
errorMsgTextField = provider.createTextFieldAdapter();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
errorMsgTextField = new UITextFieldAdapter();
}
} else {
errorMsgTextField = new UITextFieldAdapter();
}
errorMsgTextFieldPane = TableLayoutHelper.createGapTableLayoutPane( errorMsgTextFieldPane = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")), errorMsgTextField}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Error_Tip")), errorMsgTextField.getErrorMsgTextField()}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
} }

25
designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java

@ -16,6 +16,13 @@ import com.fr.design.gui.chart.ChartEditPaneProvider;
import com.fr.design.gui.frpane.UITitlePanel; import com.fr.design.gui.frpane.UITitlePanel;
import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.GeneralContext;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -41,6 +48,7 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
private ChartPropertyPane() { private ChartPropertyPane() {
initComponent(); initComponent();
addListener();
} }
protected void initComponent() { protected void initComponent() {
@ -48,6 +56,23 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
} }
private void addListener() {
GeneralContext.listenPlugin(PluginEventType.AfterRun, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
//禁用启用图表插件 这边id置空。这样展示图表配置属性不管和上一个id是否一样 都新建chartEditPane
currentID = null;
}
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraChartDesign);
}
});
}
@Override @Override
public void updateChartEditPane(String plotID) { public void updateChartEditPane(String plotID) {
if (!AssistUtils.equals(currentID, plotID)) { if (!AssistUtils.equals(currentID, plotID)) {

4
designer-realize/src/main/java/com/fr/poly/group/PolyBoundsGroup.java

@ -52,7 +52,7 @@ public class PolyBoundsGroup implements GroupModel {
@Override @Override
public Object getValue(int row, int column) { public Object getValue(int row, int column) {
UnitRectangle ur = block.getBounds(); UnitRectangle ur = block.getBounds();
Rectangle r = ur.toRectangle(resolution); Rectangle r = ur.toRoundRectangle(resolution);
if (column == 0) { if (column == 0) {
switch (row) { switch (row) {
case 0: case 0:
@ -83,7 +83,7 @@ public class PolyBoundsGroup implements GroupModel {
if (column == 1) { if (column == 1) {
int v = value == null ? 0 : ((Number) value).intValue(); int v = value == null ? 0 : ((Number) value).intValue();
UnitRectangle ur = block.getBounds(); UnitRectangle ur = block.getBounds();
Rectangle r = ur.toRectangle(resolution); Rectangle r = ur.toRoundRectangle(resolution);
switch (row) { switch (row) {
case 0: case 0:
r.x = v; r.x = v;

Loading…
Cancel
Save