Browse Source

Merge pull request #4058 in DESIGN/design from final/10.0 to persist/10.0

* commit '4a972a12e091a3c489c5d0b609c2f7f9d2d25762':
  REPORT-50908 填报-填报属性设置-填报属性中对表查询定位的问题
  REPORT-51199 模版数据集预览图标偏移
  REPORT-49034 引用JS静态资源文件路径出错
  REPORT-50908 填报-填报属性设置-填报属性中对表查询定位的问题
  REPORT-50908 填报-填报属性设置-填报属性中对表查询定位的问题
  REPORT-50096 处理下切换数据连接场景
  REPORT-49686 决策报表自适应布局,添加参数面板后,无法通过右侧设置面板调整绝对画布块的大小 【问题原因】这里绝对画布块的高度调整要分为两种方式,一种是拖拽改变,另一种是在右侧面板中改变高度数值,问题的原因是此前REPORT-7588中,拖拽时会走到FormSelection#fixCreator(),这里面为绝对画布块做特殊处理时,漏算了参数面板的高度,然后在REPORT-34739中,FRFitLayoutAdapter#fix()方法中处理了一下参数面板造成的偏移,所以拖拽的逻辑都正常;但是如果在右侧面板中改变高度时,会直接走到FRFitLayoutAdapter#fix()中,此时是没有漏算参数面板高度的,因此经过处理之后,反而组件的backupBound会多了个参数面板高度,这样会造成每次改变都加上这个高度,就出现了bug现象 【改动思路】把判断参数面板是否漏算的逻辑放到FormSelection#fixCreator()中
  REPORT-50096 数据填充时不需要触发监听
  REPORT-50096 在设计器中更改数据库类型后 数据库名称字段操作和之前保持一致
  REPORT-50096 fix 预防npe
  REPORT-50096 FR远程BI,未改动配置,确认保存后配置发生变化
persist/10.0 10.0.15.2021.04.20
superman 4 years ago
parent
commit
ff37e3146b
  1. 21
      designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java
  2. 15
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  3. 11
      designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java
  4. 79
      designer-base/src/main/java/com/fr/design/gui/icombobox/SearchPreTaskTreeComboBox.java
  5. 4
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  6. 4
      designer-base/src/main/java/com/fr/file/FILEFactory.java
  7. 2
      designer-base/src/main/java/com/fr/file/FileNodeFILE.java
  8. 2
      designer-base/src/main/resources/com/fr/design/images/m_file/preview_disabled.svg
  9. 10
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  10. 18
      designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java

21
designer-base/src/main/java/com/fr/design/data/datapane/ChoosePane.java

@ -1,6 +1,7 @@
package com.fr.design.data.datapane; package com.fr.design.data.datapane;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.data.core.DataCoreUtils; import com.fr.data.core.DataCoreUtils;
import com.fr.data.core.db.DBUtils; import com.fr.data.core.db.DBUtils;
import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.TableProcedure;
@ -17,7 +18,7 @@ import com.fr.design.data.datapane.preview.PreviewLabel.Previewable;
import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.data.tabledata.Prepare4DataSourceChange;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.icombobox.FRTreeComboBox; import com.fr.design.gui.icombobox.SearchPreTaskTreeComboBox;
import com.fr.design.gui.icombobox.FilterableComboBoxModel; import com.fr.design.gui.icombobox.FilterableComboBoxModel;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxEditor; import com.fr.design.gui.icombobox.UIComboBoxEditor;
@ -59,6 +60,10 @@ import java.util.Collection;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
/** /**
* @author zhou * @author zhou
@ -80,21 +85,25 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
/** /**
* 表名 * 表名
*/ */
protected FRTreeComboBox tableNameComboBox; protected SearchPreTaskTreeComboBox tableNameComboBox;
private SwingWorker populateWorker; private SwingWorker populateWorker;
private static final ExecutorService SERVICE = Executors.newSingleThreadExecutor(new NamedThreadFactory("ChoosePaneThread"));
private PopupMenuListener popupMenuListener = new PopupMenuListener() { private PopupMenuListener popupMenuListener = new PopupMenuListener() {
@Override @Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
new Thread() { FutureTask<Void> task = new FutureTask<Void>(new Callable() {
@Override @Override
public void run() { public Object call() {
calculateTableDataNames(); calculateTableDataNames();
return null;
} }
}.start(); });
SERVICE.submit(task);
tableNameComboBox.setPreSearchTask(task);
} }
@Override @Override
@ -158,7 +167,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
schemaBox = new StringUIComboBox(); schemaBox = new StringUIComboBox();
schemaBox.setEditor(new ComboBoxEditor()); schemaBox.setEditor(new ComboBoxEditor());
tableNameComboBox = new FRTreeComboBox(new JTree(new DefaultMutableTreeNode()), tableNameTreeRenderer, false); tableNameComboBox = new SearchPreTaskTreeComboBox(new JTree(new DefaultMutableTreeNode()), tableNameTreeRenderer, false);
tableNameComboBox.setEditable(true); tableNameComboBox.setEditable(true);
tableNameComboBox.setRenderer(listCellRenderer); tableNameComboBox.setRenderer(listCellRenderer);
registerDSChangeListener(); registerDSChangeListener();

15
designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java

@ -99,6 +99,9 @@ public class JDBCDefPane extends JPanel {
private IntegerEditor DBCP_NUMTESTSPEREVICTIONRUN = new IntegerEditor(); private IntegerEditor DBCP_NUMTESTSPEREVICTIONRUN = new IntegerEditor();
private IntegerEditor DBCP_MINEVICTABLEIDLETIMEMILLIS = new IntegerEditor(); private IntegerEditor DBCP_MINEVICTABLEIDLETIMEMILLIS = new IntegerEditor();
private JDBCDatabaseConnection jdbcDatabase;
private boolean needRefresh = true;
public JDBCDefPane() { public JDBCDefPane() {
this.setBorder(UITitledBorder.createBorderWithTitle("JDBC" + ":")); this.setBorder(UITitledBorder.createBorderWithTitle("JDBC" + ":"));
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout()); this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
@ -199,9 +202,11 @@ public class JDBCDefPane extends JPanel {
} }
public void populate(JDBCDatabaseConnection jdbcDatabase) { public void populate(JDBCDatabaseConnection jdbcDatabase) {
needRefresh = false;
if (jdbcDatabase == null) { if (jdbcDatabase == null) {
jdbcDatabase = new JDBCDatabaseConnection(); jdbcDatabase = new JDBCDatabaseConnection();
} }
this.jdbcDatabase = jdbcDatabase;
if (ComparatorUtils.equals(jdbcDatabase.getDriver(), "sun.jdbc.odbc.JdbcOdbcDriver") if (ComparatorUtils.equals(jdbcDatabase.getDriver(), "sun.jdbc.odbc.JdbcOdbcDriver")
&& jdbcDatabase.getURL().startsWith("jdbc:odbc:Driver={Microsoft")) { && jdbcDatabase.getURL().startsWith("jdbc:odbc:Driver={Microsoft")) {
this.dbtypeComboBox.setSelectedItem("Access"); this.dbtypeComboBox.setSelectedItem("Access");
@ -235,6 +240,7 @@ public class JDBCDefPane extends JPanel {
if (dbcpAttr == null) { if (dbcpAttr == null) {
dbcpAttr = new DBCPConnectionPoolAttr(); dbcpAttr = new DBCPConnectionPoolAttr();
jdbcDatabase.setDbcpAttr(dbcpAttr); jdbcDatabase.setDbcpAttr(dbcpAttr);
this.jdbcDatabase.setDbcpAttr(dbcpAttr);
} }
this.DBCP_INITIAL_SIZE.setValue(dbcpAttr.getInitialSize()); this.DBCP_INITIAL_SIZE.setValue(dbcpAttr.getInitialSize());
this.DBCP_MAX_ACTIVE.setValue(dbcpAttr.getMaxActive()); this.DBCP_MAX_ACTIVE.setValue(dbcpAttr.getMaxActive());
@ -248,10 +254,13 @@ public class JDBCDefPane extends JPanel {
this.DBCP_MINEVICTABLEIDLETIMEMILLIS.setValue(dbcpAttr.getMinEvictableIdleTimeMillis() / TIME_MULTIPLE); this.DBCP_MINEVICTABLEIDLETIMEMILLIS.setValue(dbcpAttr.getMinEvictableIdleTimeMillis() / TIME_MULTIPLE);
this.DBCP_NUMTESTSPEREVICTIONRUN.setValue(dbcpAttr.getNumTestsPerEvictionRun()); this.DBCP_NUMTESTSPEREVICTIONRUN.setValue(dbcpAttr.getNumTestsPerEvictionRun());
this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.setValue(dbcpAttr.getTimeBetweenEvictionRunsMillis()); this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.setValue(dbcpAttr.getTimeBetweenEvictionRunsMillis());
needRefresh = true;
} }
public JDBCDatabaseConnection update() { public JDBCDatabaseConnection update() {
JDBCDatabaseConnection jdbcDatabase = new JDBCDatabaseConnection(); if (jdbcDatabase == null) {
jdbcDatabase = new JDBCDatabaseConnection();
}
Object driveItem = this.driverComboBox.getSelectedItem(); Object driveItem = this.driverComboBox.getSelectedItem();
jdbcDatabase.setDriver(driveItem == null ? null : driveItem.toString()); jdbcDatabase.setDriver(driveItem == null ? null : driveItem.toString());
jdbcDatabase.setURL(this.urlTextField.getText().trim()); jdbcDatabase.setURL(this.urlTextField.getText().trim());
@ -297,6 +306,10 @@ public class JDBCDefPane extends JPanel {
urlTextField.setText(dus[i].getURL()); urlTextField.setText(dus[i].getURL());
} }
} }
// 更改数据库类型后 数据库名称置空和之前逻辑保持一致
if (needRefresh) {
jdbcDatabase.setDatabase(StringUtils.EMPTY);
}
} }
}; };

11
designer-base/src/main/java/com/fr/design/gui/icombobox/FRTreeComboBox.java

@ -597,6 +597,10 @@ public class FRTreeComboBox extends UIComboBox {
return this.item; return this.item;
} }
public boolean isSetting() {
return setting;
}
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
changeHandler(); changeHandler();
} }
@ -614,6 +618,13 @@ public class FRTreeComboBox extends UIComboBox {
return; return;
} }
setPopupVisible(true); setPopupVisible(true);
search();
}
/**
* 模糊搜索选中首个匹配项
*/
protected void search() {
this.item = textField.getText(); this.item = textField.getText();
TreeNode root = (TreeNode) tree.getModel().getRoot(); TreeNode root = (TreeNode) tree.getModel().getRoot();
TreePath parent = new TreePath(root); TreePath parent = new TreePath(root);

79
designer-base/src/main/java/com/fr/design/gui/icombobox/SearchPreTaskTreeComboBox.java

@ -0,0 +1,79 @@
package com.fr.design.gui.icombobox;
import com.fr.design.ui.util.UIUtil;
import com.fr.log.FineLoggerFactory;
import javax.swing.JTree;
import javax.swing.SwingWorker;
import javax.swing.tree.TreeCellRenderer;
import java.util.concurrent.FutureTask;
/**
* 模糊搜索前需执行完前置任务的TreeComboBox
* @author Lucian.Chen
* @version 10.0
* Created by Lucian.Chen on 2021/4/14
*/
public class SearchPreTaskTreeComboBox extends FRTreeComboBox {
/**
* 模糊搜索前任务
*/
private FutureTask<Void> preSearchTask;
public SearchPreTaskTreeComboBox(JTree tree, TreeCellRenderer renderer, boolean editable) {
super(tree, renderer, editable);
}
public FutureTask<Void> getPreSearchTask() {
return preSearchTask;
}
public void setPreSearchTask(FutureTask<Void> preSearchTask) {
this.preSearchTask = preSearchTask;
}
protected UIComboBoxEditor createEditor() {
return new SearchPreTaskComboBoxEditor(this);
}
private class SearchPreTaskComboBoxEditor extends FrTreeSearchComboBoxEditor {
public SearchPreTaskComboBoxEditor(FRTreeComboBox comboBox) {
super(comboBox);
}
protected void changeHandler() {
if (isSetting()) {
return;
}
setPopupVisible(true);
// 模糊搜索异步
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() {
FutureTask<Void> task = getPreSearchTask();
try {
// 确保模糊搜索前任务执行完成后,再进行模糊搜索
if (task != null) {
task.get();
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (task != null) {
// 任务执行后置空,否则会被别的操作重复触发
setPreSearchTask(null);
}
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
search();
}
});
return null;
}
}.execute();
}
}
}

4
designer-base/src/main/java/com/fr/file/FILEChooserPane.java

@ -1158,7 +1158,7 @@ public class FILEChooserPane extends BasicPane {
}; };
} }
if (FILEChooserPane.this.showWebReport) { if (FILEChooserPane.this.showWebReport) {
webReportFILE = new FileNodeFILE(FRContext.getCommonOperator().getWebRootPath()); webReportFILE = new FileNodeFILE(FileNodeFILE.webRootPath);
} }
if (FILEChooserPane.this.showLoc) { if (FILEChooserPane.this.showLoc) {
processSystemFile(); processSystemFile();
@ -1219,7 +1219,7 @@ public class FILEChooserPane extends BasicPane {
} }
if (FILEChooserPane.this.showWebReport) { if (FILEChooserPane.this.showWebReport) {
webReportFILE = new FileNodeFILE(FRContext.getCommonOperator().getWebRootPath()); webReportFILE = new FileNodeFILE(FileNodeFILE.webRootPath);
} }
if (FILEChooserPane.this.showLoc) { if (FILEChooserPane.this.showLoc) {
processSystemFile(); processSystemFile();

4
designer-base/src/main/java/com/fr/file/FILEFactory.java

@ -32,7 +32,7 @@ public class FILEFactory {
return new FileNodeFILE(new FileNode(path.substring(envPath.length() + 1), false)); return new FileNodeFILE(new FileNode(path.substring(envPath.length() + 1), false));
} else if (path.startsWith(WEBREPORT_PREFIX)) { } else if (path.startsWith(WEBREPORT_PREFIX)) {
return new FileNodeFILE(new FileNode(path.substring(WEBREPORT_PREFIX.length()), false), return new FileNodeFILE(new FileNode(path.substring(WEBREPORT_PREFIX.length()), false),
FRContext.getCommonOperator().getWebRootPath()); FileNodeFILE.webRootPath);
} else if (path.startsWith(FILE_PREFIX)) { } else if (path.startsWith(FILE_PREFIX)) {
return new FileFILE(new java.io.File(path.substring(FILE_PREFIX.length()))); return new FileFILE(new java.io.File(path.substring(FILE_PREFIX.length())));
} else { } else {
@ -50,7 +50,7 @@ public class FILEFactory {
fixFILENodeAuth(new FileNode(path.substring(ENV_PREFIX.length()), true)); fixFILENodeAuth(new FileNode(path.substring(ENV_PREFIX.length()), true));
} else if (path.startsWith(WEBREPORT_PREFIX)) { } else if (path.startsWith(WEBREPORT_PREFIX)) {
return new FileNodeFILE(new FileNode(path.substring(WEBREPORT_PREFIX.length()), true), return new FileNodeFILE(new FileNode(path.substring(WEBREPORT_PREFIX.length()), true),
FRContext.getCommonOperator().getWebRootPath()); FileNodeFILE.webRootPath);
} else if (path.startsWith(FILE_PREFIX)) { } else if (path.startsWith(FILE_PREFIX)) {
return new FileFILE(new java.io.File(path.substring(FILE_PREFIX.length()))); return new FileFILE(new java.io.File(path.substring(FILE_PREFIX.length())));
} else { } else {

2
designer-base/src/main/java/com/fr/file/FileNodeFILE.java

@ -32,7 +32,7 @@ import java.util.Arrays;
public class FileNodeFILE implements FILE { public class FileNodeFILE implements FILE {
private static String webRootPath = FRContext.getCommonOperator().getWebRootPath(); public static String webRootPath = FRContext.getCommonOperator().getWebRootPath();
private static String[] supportTypes = FRContext.getFileNodes().getSupportedTypes(); private static String[] supportTypes = FRContext.getFileNodes().getSupportedTypes();
static { static {

2
designer-base/src/main/resources/com/fr/design/images/m_file/preview_disabled.svg

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<svg width="12px" height="14px" viewBox="0 0 12 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <svg width="16px" height="16px" viewBox="0 0 12 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>icon_报表web属性_打印预览_normal</title> <title>icon_报表web属性_打印预览_normal</title>
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.3"> <g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.3">
<g id="工具栏/导入数据集" transform="translate(-116.000000, -7.000000)" fill="#333334"> <g id="工具栏/导入数据集" transform="translate(-116.000000, -7.000000)" fill="#333334">

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

10
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -347,15 +347,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
//拖拽组件原大小、位置 //拖拽组件原大小、位置
Rectangle backupBound = creator.getBackupBound(); Rectangle backupBound = creator.getBackupBound();
backupBound.x -= container.getX(); backupBound.x -= container.getX();
// REPORT-34739 对绝对画布块的backupBound.y的调整还需要考虑一下参数面板块的高度造成的偏移 backupBound.y -= container.getY();
int paraHeight = 0;
if (creator.acceptType(XWAbsoluteLayout.class)) {
JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate instanceof JForm) {
paraHeight = ((JForm) jTemplate).getFormDesign().getParaHeight();
}
}
backupBound.y -= (container.getY() - paraHeight);
//当前拖拽组件的位置 //当前拖拽组件的位置
int x = creator.getX(); int x = creator.getX();
int y = creator.getY(); int y = creator.getY();

18
designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java

@ -12,6 +12,7 @@ import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
@ -270,7 +271,9 @@ public class FormSelection {
LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(designer, creator); LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(designer, creator);
if (layoutAdapter != null) { if (layoutAdapter != null) {
if (creator.acceptType(XWAbsoluteLayout.class) && recs.size() > i) { if (creator.acceptType(XWAbsoluteLayout.class) && recs.size() > i) {
creator.setBackupBound(recs.get(i)); Rectangle rectangle = recs.get(i);
check4ParaPane(rectangle);
creator.setBackupBound(rectangle);
} else { } else {
creator.setBackupBound(backupBounds); creator.setBackupBound(backupBounds);
} }
@ -280,6 +283,19 @@ public class FormSelection {
} }
} }
/**
* 检查下有没有参数面板如果存在处理下参数面板造成的偏移量
* @param rectangle
*/
private void check4ParaPane(Rectangle rectangle) {
int paraHeight = 0;
JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate instanceof JForm) {
paraHeight = ((JForm) jTemplate).getFormDesign().getParaHeight();
}
rectangle.y += paraHeight;
}
private void removeCreatorFromContainer(XCreator creator) { private void removeCreatorFromContainer(XCreator creator) {
XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(creator); XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(creator);
if (parent == null) { if (parent == null) {

Loading…
Cancel
Save