Browse Source

Merge pull request #6521 in DESIGN/design from bugfix/10.0 to feature/10.0

* commit '52823132d028fda601a9b368d298b3a5eeb7aae4':
  REPORT-62179 数字控件的最大最小值校验需支持公式
  REPORT-62016 BI插件匹配检测
  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 聚合报表块手动修改位置以后,点击空白处位置偏移
feature/10.0
superman 3 years ago
parent
commit
7f857e2b9b
  1. 2
      designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java
  2. 23
      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. 16
      designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java
  5. 22
      designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java
  6. 25
      designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java
  7. 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
*/
public abstract class BasicTableDataUtils {
private static final String SEPARATOR = "-";
private static final String SEPARATOR = "_";
private static final int LEN = 2;

23
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.refreshTable();
}
self.requestFocusInWindow();
}
private int getColumn(MouseEvent e) {
@ -249,14 +250,29 @@ public class CopyableJTable extends SortableJTable {
FineLoggerFactory.getLogger().info("copy cell value");
java.util.List<java.util.List<Object>> table = new ArrayList<>();
if ((startRow != endRow || startCol != endCol) && Math.min(startCol, endCol) > -1) {
copyAreaData(table);
} else if (pointList.size() > 0) {
copyPointsData(table);
}
Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable tText = new StringSelection(ClipboardHelper.formatExcelString(table));
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);
}
}
} else if (pointList.size() > 0) {
}
}
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;
@ -267,13 +283,10 @@ public class CopyableJTable extends SortableJTable {
currentRow++;
}
Object text = this.getTableValue(point.x, point.y);
if (text != null) {
table.get(table.size() - 1).add(text);
}
}
Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable tText = new StringSelection(ClipboardHelper.formatExcelString(table));
clip.setContents(tText, null);
}
private Object getTableValue(int row, int col) {

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.JPanel;
import javax.swing.JWindow;
import javax.swing.border.AbstractBorder;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
@ -20,6 +21,7 @@ import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.event.MouseAdapter;
@ -99,9 +101,25 @@ public abstract class AbstractSelectBox<T> extends AbstractPopBox implements Mou
displayComponent.addMouseListener(new MouseAdapter() {
@Override
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();
if (e.getY() < rectangle.y) {
//如果是从displayComponent上面离开的,隐藏弹出界面。
boolean bottomPopAndExitTop = displayComponentP.getY() < popMenuP.getY() && e.getY() <= rectangle.y;
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();
}

16
designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java

@ -64,6 +64,11 @@ public class VersionCheckUtils {
private static final String ID = "id";
private static final String VERSION = "version";
private static final String NAME = "name";
private static final String RUNNING = "running";
private static final String SYNC = "sync";
private static final String GROUP = "group";
private static final String BI = "bi";
private static final String BIPREFIX = "com.finebi";
private static final Set<String> pluginsNeedIgnore = new HashSet<>();
static {
pluginsNeedIgnore.addAll(Arrays.asList(
@ -263,13 +268,10 @@ public class VersionCheckUtils {
Map<String, String> pluginsNameMap = ReportHelper.getPluginNameMap();
for (int i = 0; i < remotePlugins.size(); i++) {
remotePlugin = remotePlugins.getJSONObject(i);
if (ComparatorUtils.equals(remotePlugin.getString("running"), "false") || (remotePlugin.containsKey("sync") && !remotePlugin.getBoolean("sync"))) {
if (isPluginNeedIgnore(remotePlugin)) {
continue;
}
String remotePluginID = remotePlugin.getString(ID);
if (pluginsNeedIgnore.contains(remotePluginID)) {
continue;
}
if (localPluginsMap.containsKey(remotePluginID)) {
if (ComparatorUtils.equals(localPluginsMap.get(remotePluginID).getVersion(), remotePlugin.getString(VERSION))) {
continue;
@ -290,6 +292,12 @@ public class VersionCheckUtils {
return differentPlugins;
}
private static boolean isPluginNeedIgnore(JSONObject remotePlugin) {
return ComparatorUtils.equals(remotePlugin.getString(RUNNING), "false") || (remotePlugin.containsKey(SYNC) && !remotePlugin.getBoolean(SYNC))
|| (remotePlugin.containsKey(GROUP) && ComparatorUtils.equals(remotePlugin.containsKey(GROUP), BI) || remotePlugin.getString(ID).startsWith(BIPREFIX)
|| pluginsNeedIgnore.contains(remotePlugin.getString(ID)));
}
public static JSONArray syncPlugins(JSONArray differentPlugins) {
Set<String> uninstallFailed = uninstallPlugins(differentPlugins);
List<PluginMarker> plugins = getSyncPlugins(differentPlugins, uninstallFailed);

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

@ -1,6 +1,10 @@
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.fun.TextFieldAdapterProvider;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
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.TableLayoutHelper;
import com.fr.form.ui.NumberEditor;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils;
@ -35,7 +40,7 @@ public class NumberEditorValidatePane extends JPanel {
private UISpinner minValueSpinner;
private UISpinner decimalLength;
private JPanel limitNumberPane;
private UITextField errorMsgTextField;
private ErrorMsgTextFieldAdapter errorMsgTextField;
private JPanel errorMsgTextFieldPane;
private ActionListener allowDecimalsListener;
@ -100,9 +105,20 @@ public class NumberEditorValidatePane extends JPanel {
}
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(
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.mainframe.chart.ChartEditPane;
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 javax.swing.BorderFactory;
@ -41,6 +48,7 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
private ChartPropertyPane() {
initComponent();
addListener();
}
protected void initComponent() {
@ -48,6 +56,23 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
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
public void updateChartEditPane(String 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
public Object getValue(int row, int column) {
UnitRectangle ur = block.getBounds();
Rectangle r = ur.toRectangle(resolution);
Rectangle r = ur.toRoundRectangle(resolution);
if (column == 0) {
switch (row) {
case 0:
@ -83,7 +83,7 @@ public class PolyBoundsGroup implements GroupModel {
if (column == 1) {
int v = value == null ? 0 : ((Number) value).intValue();
UnitRectangle ur = block.getBounds();
Rectangle r = ur.toRectangle(resolution);
Rectangle r = ur.toRoundRectangle(resolution);
switch (row) {
case 0:
r.x = v;

Loading…
Cancel
Save