Browse Source

REPORT-114888 fix:设计器新UI图表无法打开配置面板

newui
vito 9 months ago
parent
commit
c30278f28b
  1. 4
      build.gradle
  2. 26
      designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java
  3. 37
      designer-base/src/main/java/com/fr/design/gui/itable/UITable.java

4
build.gradle

@ -87,9 +87,9 @@ allprojects {
implementation 'com.fr.report:engine-chart:' + frDevVersion
implementation 'com.fr.report:engine-i18n:' + frDevVersion
implementation 'com.fr.design:design-i18n:' + frDevVersion
implementation 'com.formdev:flatlaf:3.2'
implementation 'com.formdev:flatlaf-extras:3.2.1'
implementation 'com.github.weisj:jsvg:1.2.0'
implementation 'com.formdev:flatlaf:3.4'
implementation 'com.formdev:flatlaf-extras:3.4'
implementation 'com.fanruan.vito:gui-inspector:1.0.1'
implementation 'com.fine.swing.ui:layout:1.0-SNAPSHOT'
testImplementation 'org.easymock:easymock:3.5.1'

26
designer-base/src/main/java/com/fr/design/gui/imenutable/UIMenuTable.java

@ -10,17 +10,23 @@ import com.fr.design.hyperlink.ReportletHyperlinkPane;
import com.fr.design.hyperlink.WebHyperlinkPane;
import com.fr.design.javascript.EmailPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.js.EmailJavaScript;
import com.fr.js.ReportletHyperlink;
import com.fr.js.WebHyperlink;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.TableUI;
import javax.swing.table.TableCellRenderer;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.util.ArrayList;
import java.util.List;
@ -76,7 +82,6 @@ public class UIMenuTable extends JTable {
}
/**
*
* @param value 该行列的值(字符串)
* @param row
* @param column
@ -108,6 +113,7 @@ public class UIMenuTable extends JTable {
/**
* 删除某行内容
*
* @param rowIndex
*/
public void removeLine(int rowIndex) {
@ -126,6 +132,7 @@ public class UIMenuTable extends JTable {
/**
* 对某一行拖动时进行排序
*
* @param rowIndex
* @param positive 鼠标移动的距离
*/
@ -157,7 +164,16 @@ public class UIMenuTable extends JTable {
@Override
public TableCellRenderer getDefaultRenderer(Class<?> columnClass) {
return super.getDefaultRenderer(UITable.class);
// 处理null的情况用于创建时未指定数据结构的情况
if (columnClass == null) {
return createDefaultRenderer();
}
return super.getDefaultRenderer(columnClass);
}
private @NotNull TableCellRenderer createDefaultRenderer() {
Object renderer = defaultRenderersByColumnClass.get(UITable.class);
return renderer != null ? (TableCellRenderer) renderer : new UITableRender();
}
private class UITableRender implements TableCellRenderer {

37
designer-base/src/main/java/com/fr/design/gui/itable/UITable.java

@ -6,6 +6,7 @@ import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.utils.gui.GUICoreUtils;
import org.jetbrains.annotations.NotNull;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
@ -91,7 +92,6 @@ public class UITable extends JTable implements UIObserver {
}
private AWTEventListener awt = new AWTEventListener() {
public void eventDispatched(AWTEvent event) {
if (!UITable.this.isShowing()) {
@ -131,6 +131,7 @@ public class UITable extends JTable implements UIObserver {
/**
* 在table底部增加一行内容
*
* @param line 该行的内容
*/
public void addLine(Object[] line) {
@ -167,6 +168,7 @@ public class UITable extends JTable implements UIObserver {
/**
* 格子是否可编辑可置顶某一列column不可编辑
*
* @param row 行号
* @param column 列号
* @return 是否可编辑
@ -232,6 +234,7 @@ public class UITable extends JTable implements UIObserver {
/**
* 鼠标悬浮再某一行时触发的事件
*
* @param index 行号
*/
public void dealWithRollOver(int index) {
@ -259,6 +262,7 @@ public class UITable extends JTable implements UIObserver {
/**
* 停止编辑事件
*
* @param e 事件
*/
public void tableCellEditingStopped(ChangeEvent e) {
@ -267,6 +271,7 @@ public class UITable extends JTable implements UIObserver {
/**
* 取消编辑事件
*
* @param e 事件
*/
public void tableCellEditingCanceled(ChangeEvent e) {
@ -275,6 +280,7 @@ public class UITable extends JTable implements UIObserver {
/**
* 编辑器
*
* @return 编辑器
*/
public UITableEditor createTableEditor() {
@ -289,21 +295,19 @@ public class UITable extends JTable implements UIObserver {
return new UITableUI();
}
// @Override
/**
*
*/
// public TableCellEditor getDefaultEditor(Class<?> columnClass) {
// return super.getDefaultEditor(UITable.class);
// }
@Override
public TableCellRenderer getDefaultRenderer(Class<?> columnClass) {
// 处理null的情况用于创建时未指定数据结构的情况
if (columnClass == null) {
return createDefaultRenderer();
}
return super.getDefaultRenderer(columnClass);
}
// @Override
/**
*
*/
// public TableCellRenderer getDefaultRenderer(Class<?> columnClass) {
// return super.getDefaultRenderer(UITable.class);
// }
private @NotNull TableCellRenderer createDefaultRenderer() {
Object renderer = defaultRenderersByColumnClass.get(UITable.class);
return renderer != null ? (TableCellRenderer) renderer : new UITableRender();
}
/**
* 给组件登记一个观察者监听事件
@ -347,6 +351,7 @@ public class UITable extends JTable implements UIObserver {
/**
* 增加监听
*
* @param l 监听
*/
public void addChangeListener(ChangeListener l) {
@ -355,6 +360,7 @@ public class UITable extends JTable implements UIObserver {
/**
* 移除监听
*
* @param l 监听
*/
public void removeChangeListener(ChangeListener l) {
@ -363,6 +369,7 @@ public class UITable extends JTable implements UIObserver {
/**
* 测试主函数
*
* @param args 参数
*/
public static void main(String... args) {

Loading…
Cancel
Save