Browse Source

Merge pull request #3983 in DESIGN/design from feature/10.0 to feature/x

* commit 'c86c59b2c770accc876719786e196ff26ab2a034':
  REPORT-51103  改个日志方便定位问题
  REPORT-51103  优化界面显示
  REPORT-51103 加上遗漏的mysql另一种驱动;优化展示效果
  REPORT-49055 设计器数据连接配置界面优化
  REPORT-49055 设计器数据连接配置界面优化
  REPORT-49055 设计器数据连接配置界面优化
  KERNEL-7376 优化设计器上一些性能问题
  REPORT-49067 导出缺失字体提示
  REPORT-49686 决策报表自适应布局,添加参数面板后,无法通过右侧设置面板调整绝对画布块的大小 【问题原因】这里绝对画布块的高度调整要分为两种方式,一种是拖拽改变,另一种是在右侧面板中改变高度数值,问题的原因是此前REPORT-7588中,拖拽时会走到FormSelection#fixCreator(),这里面为绝对画布块做特殊处理时,漏算了参数面板的高度,然后在REPORT-34739中,FRFitLayoutAdapter#fix()方法中处理了一下参数面板造成的偏移,所以拖拽的逻辑都正常;但是如果在右侧面板中改变高度时,会直接走到FRFitLayoutAdapter#fix()中,此时是没有漏算参数面板高度的,因此经过处理之后,反而组件的backupBound会多了个参数面板高度,这样会造成每次改变都加上这个高度,就出现了bug现象 【改动思路】把判断参数面板是否漏算的逻辑放到FormSelection#fixCreator()中
  CHART-18881 单元格图表有时候无法点出图表属性面板
  REPORT-50809 frm模版与cpt模版在设计器内预览图标大小不一致
research/11.0
superman 4 years ago
parent
commit
968c3a1d4d
  1. 118
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java
  2. 70
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  3. 396
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  4. 2
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  5. 2
      designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java
  6. 2
      designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java
  7. 16
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  8. 7
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  9. 173
      designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java
  10. 139
      designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java
  11. 8
      designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java
  12. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/check.png
  13. BIN
      designer-base/src/main/resources/com/fr/design/images/buttonicon/run24.png
  14. BIN
      designer-base/src/main/resources/com/fr/design/images/correct.png
  15. BIN
      designer-base/src/main/resources/com/fr/design/images/error.png
  16. BIN
      designer-base/src/main/resources/com/fr/design/images/waiting.png
  17. BIN
      designer-base/src/main/resources/com/fr/design/images/warnings/warning32.png
  18. 12
      designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java
  19. 10
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  20. 18
      designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java

118
designer-base/src/main/java/com/fr/design/data/datapane/connect/DBCPAttrPane.java

@ -0,0 +1,118 @@
package com.fr.design.data.datapane.connect;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.pool.DBCPConnectionPoolAttr;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.IntegerEditor;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import java.awt.BorderLayout;
import java.awt.Component;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
public class DBCPAttrPane extends BasicPane {
public static final int TIME_MULTIPLE = 1000;
// carl:DBCP的一些属性
private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor();
private IntegerEditor DBCP_MAX_ACTIVE = new IntegerEditor();
private IntegerEditor DBCP_MAX_IDLE = new IntegerEditor();
private IntegerEditor DBCP_MIN_IDLE = new IntegerEditor();
private IntegerEditor DBCP_MAX_WAIT = new IntegerEditor();
private UITextField DBCP_VALIDATION_QUERY = new UITextField();
private UIComboBox DBCP_TESTONBORROW = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")});
private UIComboBox DBCP_TESTONRETURN = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")});
private UIComboBox DBCP_TESTWHILEIDLE = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")});
private IntegerEditor DBCP_TIMEBETWEENEVICTIONRUNSMILLS = new IntegerEditor();
private IntegerEditor DBCP_NUMTESTSPEREVICTIONRUN = new IntegerEditor();
private IntegerEditor DBCP_MINEVICTABLEIDLETIMEMILLIS = new IntegerEditor();
public DBCPAttrPane() {
JPanel defaultPane = this;
// JPanel northFlowPane
JPanel northFlowPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
defaultPane.add(northFlowPane, BorderLayout.NORTH);
DBCP_VALIDATION_QUERY.setColumns(15);
// ContextPane
double f = TableLayout.FILL;
// double p = TableLayout.PREFERRED;
double[] rowSize = {f, f, f, f, f, f, f, f, f, f, f, f};
double[] columnSize = {f, f};
Component[][] comps = {
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Initial_Size") + ":", SwingConstants.RIGHT), DBCP_INITIAL_SIZE},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Active") + ":", SwingConstants.RIGHT), DBCP_MAX_ACTIVE},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Idle") + ":", SwingConstants.RIGHT), DBCP_MAX_IDLE},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Min_Idle") + ":", SwingConstants.RIGHT), DBCP_MIN_IDLE},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Max_Wait_Time") + ":", SwingConstants.RIGHT), DBCP_MAX_WAIT},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Validation_Query") + ":", SwingConstants.RIGHT), DBCP_VALIDATION_QUERY},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Borrow") + ":", SwingConstants.RIGHT), DBCP_TESTONBORROW},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Return") + ":", SwingConstants.RIGHT), DBCP_TESTONRETURN},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_While_Idle") + ":", SwingConstants.RIGHT), DBCP_TESTWHILEIDLE},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis") + ":", SwingConstants.RIGHT),
DBCP_TIMEBETWEENEVICTIONRUNSMILLS},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Num_Test_Per_Evction_Run") + ":", SwingConstants.RIGHT), DBCP_NUMTESTSPEREVICTIONRUN},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Mix_Evictable_Idle_Time_Millis") + ":", SwingConstants.RIGHT),
DBCP_MINEVICTABLEIDLETIMEMILLIS}};
JPanel contextPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSize, columnSize, 10, 4);
contextPane.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, UIConstants.LINE_COLOR));
northFlowPane.add(contextPane);
}
public void populate(JDBCDatabaseConnection jdbcDatabase) {
DBCPConnectionPoolAttr dbcpAttr = jdbcDatabase.getDbcpAttr();
if (dbcpAttr == null) {
dbcpAttr = new DBCPConnectionPoolAttr();
jdbcDatabase.setDbcpAttr(dbcpAttr);
}
this.DBCP_INITIAL_SIZE.setValue(dbcpAttr.getInitialSize());
this.DBCP_MAX_ACTIVE.setValue(dbcpAttr.getMaxActive());
this.DBCP_MAX_IDLE.setValue(dbcpAttr.getMaxIdle());
this.DBCP_MAX_WAIT.setValue(dbcpAttr.getMaxWait());
this.DBCP_MIN_IDLE.setValue(dbcpAttr.getMinIdle());
this.DBCP_VALIDATION_QUERY.setText(dbcpAttr.getValidationQuery());
this.DBCP_TESTONBORROW.setSelectedIndex(dbcpAttr.isTestOnBorrow() ? 1 : 0);
this.DBCP_TESTONRETURN.setSelectedIndex(dbcpAttr.isTestOnReturn() ? 1 : 0);
this.DBCP_TESTWHILEIDLE.setSelectedIndex(dbcpAttr.isTestWhileIdle() ? 1 : 0);
this.DBCP_MINEVICTABLEIDLETIMEMILLIS.setValue(dbcpAttr.getMinEvictableIdleTimeMillis() / TIME_MULTIPLE);
this.DBCP_NUMTESTSPEREVICTIONRUN.setValue(dbcpAttr.getNumTestsPerEvictionRun());
this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.setValue(dbcpAttr.getTimeBetweenEvictionRunsMillis());
}
public void update(JDBCDatabaseConnection jdbcDatabase) {
DBCPConnectionPoolAttr dbcpAttr = jdbcDatabase.getDbcpAttr();
if (dbcpAttr == null) {
dbcpAttr = new DBCPConnectionPoolAttr();
jdbcDatabase.setDbcpAttr(dbcpAttr);
}
dbcpAttr.setInitialSize(this.DBCP_INITIAL_SIZE.getValue().intValue());
dbcpAttr.setMaxActive(this.DBCP_MAX_ACTIVE.getValue().intValue());
dbcpAttr.setMaxIdle(this.DBCP_MAX_IDLE.getValue().intValue());
dbcpAttr.setMaxWait(this.DBCP_MAX_WAIT.getValue().intValue());
dbcpAttr.setMinIdle(this.DBCP_MIN_IDLE.getValue().intValue());
dbcpAttr.setValidationQuery(this.DBCP_VALIDATION_QUERY.getText());
dbcpAttr.setTestOnBorrow(this.DBCP_TESTONBORROW.getSelectedIndex() == 0 ? false : true);
dbcpAttr.setTestOnReturn(this.DBCP_TESTONRETURN.getSelectedIndex() == 0 ? false : true);
dbcpAttr.setTestWhileIdle(this.DBCP_TESTWHILEIDLE.getSelectedIndex() == 0 ? false : true);
dbcpAttr.setMinEvictableIdleTimeMillis(((Number) this.DBCP_MINEVICTABLEIDLETIMEMILLIS.getValue()).intValue() * TIME_MULTIPLE);
dbcpAttr.setNumTestsPerEvictionRun(((Number) this.DBCP_NUMTESTSPEREVICTIONRUN.getValue()).intValue());
dbcpAttr.setTimeBetweenEvictionRunsMillis(((Number) this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.getValue()).intValue());
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr");
}
}

70
designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java

@ -12,8 +12,10 @@ import com.fr.data.solution.entity.DriverPage;
import com.fr.data.solution.processor.ClassNotFoundExceptionSolutionProcessor; import com.fr.data.solution.processor.ClassNotFoundExceptionSolutionProcessor;
import com.fr.data.solution.processor.SolutionProcessor; import com.fr.data.solution.processor.SolutionProcessor;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -97,7 +99,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
protected void done() { protected void done() {
try { try {
get(); get();
dialog.setSize(new Dimension(380, 118)); dialog.setSize(new Dimension(380, 125));
okButton.setEnabled(true); okButton.setEnabled(true);
uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon"));
message.setText(Toolkit.i18nText("Fine-Design_Basic_Datasource_Connection_Successfully")); message.setText(Toolkit.i18nText("Fine-Design_Basic_Datasource_Connection_Successfully"));
@ -208,7 +210,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail")); detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail"));
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right")); directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right"));
} else { } else {
dialog.setSize(new Dimension(380, 260)); dialog.setSize(new Dimension(380, 270));
hiddenPanel.setVisible(true); hiddenPanel.setVisible(true);
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Hide_Detail")); detailLabel.setText(Toolkit.i18nText("Fine_Designer_Hide_Detail"));
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.down")); directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.down"));
@ -245,14 +247,16 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
@Override @Override
public void populateBean(com.fr.data.impl.Connection ob) { public void populateBean(com.fr.data.impl.Connection ob) {
populateSubDatabaseConnectionBean((E) ob);
if (mainPanel() instanceof JDBCDefPane) {
return;
}
this.originalCharSet = ob.getOriginalCharsetName(); this.originalCharSet = ob.getOriginalCharsetName();
if (StringUtils.isBlank(originalCharSet)) { if (StringUtils.isBlank(originalCharSet)) {
this.charSetComboBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Encode_Auto")); this.charSetComboBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Encode_Auto"));
} else { } else {
this.charSetComboBox.setSelectedItem(ob.getOriginalCharsetName()); this.charSetComboBox.setSelectedItem(ob.getOriginalCharsetName());
} }
populateSubDatabaseConnectionBean((E) ob);
} }
protected abstract void populateSubDatabaseConnectionBean(E ob); protected abstract void populateSubDatabaseConnectionBean(E ob);
@ -260,7 +264,9 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
@Override @Override
public com.fr.data.impl.Connection updateBean() { public com.fr.data.impl.Connection updateBean() {
E ob = updateSubDatabaseConnectionBean(); E ob = updateSubDatabaseConnectionBean();
if (mainPanel() instanceof JDBCDefPane) {
return ob;
}
ob.setOriginalCharsetName(this.originalCharSet); ob.setOriginalCharsetName(this.originalCharSet);
if (this.charSetComboBox.getSelectedIndex() == 0) { if (this.charSetComboBox.getSelectedIndex() == 0) {
ob.setNewCharsetName(null); ob.setNewCharsetName(null);
@ -287,8 +293,6 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
midPane.add(detailLabel); midPane.add(detailLabel);
okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK")); okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK"));
cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel")); cancelButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Cancel"));
String[] defaultEncode = new String[]{Toolkit.i18nText("Fine-Design_Encode_Auto")};
charSetComboBox = new UIComboBox(ArrayUtils.addAll(defaultEncode, EncodeConstants.ENCODING_ARRAY));
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
@ -303,14 +307,40 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
// Center // Center
northPane.add(mainPanel(), BorderLayout.CENTER); northPane.add(mainPanel(), BorderLayout.CENTER);
// ChartSet JPanel advancedPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel chartSetPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); advancedPanel.setBorder(BorderFactory.createTitledBorder(
northPane.add(chartSetPane);
chartSetPane.setBorder(BorderFactory.createTitledBorder(
new ModLineBorder(ModLineBorder.TOP), new ModLineBorder(ModLineBorder.TOP),
Toolkit.i18nText("Fine-Design_Basic_Advanced") Toolkit.i18nText("Fine-Design_Basic_Advanced")
)); ));
chartSetPane.add(GUICoreUtils.createNamedPane(charSetComboBox, Toolkit.i18nText("Fine-Design_Basic_Datasource_Charset") + ":")); if (mainPanel() instanceof JDBCDefPane) {
ActionLabel actionLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr"));
actionLabel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
JDialog wDialog = createJDialog();
if (wDialog != null) {
wDialog.setVisible(true);
}
}
});
JPanel actionLabelPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
actionLabelPanel.setBorder(BorderFactory.createEmptyBorder(2, 4, 4, 20));
actionLabelPanel.add(actionLabel, BorderLayout.WEST);
advancedPanel.add(actionLabelPanel);
} else {
//非jdbc配置布局保持不变
// ChartSet
String[] defaultEncode = new String[]{Toolkit.i18nText("Fine-Design_Encode_Auto")};
charSetComboBox = new UIComboBox(ArrayUtils.addAll(defaultEncode, EncodeConstants.ENCODING_ARRAY));
JPanel chartSetPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2);
chartSetPane.add(GUICoreUtils.createNamedPane(charSetComboBox, Toolkit.i18nText("Fine-Design_Basic_Datasource_Charset") + ":"));
advancedPanel.add(chartSetPane);
}
northPane.add(advancedPanel);
}
private JDialog createJDialog() {
return JDBC.getAdvancedAttrPane() != null ? JDBC.getAdvancedAttrPane().showWindow(SwingUtilities.getWindowAncestor(mainPanel())) : null;
} }
private void initDialogPane() { private void initDialogPane() {
@ -319,7 +349,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
message.setBorder(BorderFactory.createEmptyBorder(8, 5, 0, 0)); message.setBorder(BorderFactory.createEmptyBorder(8, 5, 0, 0));
okButton.setEnabled(false); okButton.setEnabled(false);
dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(DatabaseConnectionPane.this), Toolkit.i18nText("Fine-Design_Basic_Datasource_Test_Connection"), true); dialog = new JDialog((Dialog) SwingUtilities.getWindowAncestor(DatabaseConnectionPane.this), Toolkit.i18nText("Fine-Design_Basic_Datasource_Test_Connection"), true);
dialog.setSize(new Dimension(380, 118)); dialog.setSize(new Dimension(380, 125));
okButton.setEnabled(false); okButton.setEnabled(false);
JPanel jp = new JPanel(); JPanel jp = new JPanel();
JPanel upPane = new JPanel(); JPanel upPane = new JPanel();
@ -332,10 +362,10 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right")); directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right"));
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail")); detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail"));
detailLabel.setForeground(Color.BLUE); detailLabel.setForeground(Color.BLUE);
hiddenPanel.setLayout(new BorderLayout(10, 0)); hiddenPanel.setLayout(new BorderLayout(2, 0));
hiddenPanel.add(new JPanel(), BorderLayout.WEST); hiddenPanel.add(new JPanel(), BorderLayout.WEST);
hiddenPanel.add(new JPanel(), BorderLayout.EAST); hiddenPanel.add(new JPanel(), BorderLayout.EAST);
downPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 9)); downPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 15, 9));
downPane.add(okButton); downPane.add(okButton);
downPane.add(cancelButton); downPane.add(cancelButton);
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS)); jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
@ -351,6 +381,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
public static class JDBC extends DatabaseConnectionPane<JDBCDatabaseConnection> { public static class JDBC extends DatabaseConnectionPane<JDBCDatabaseConnection> {
private static JDBCDefPane jdbcDefPane = new JDBCDefPane(); private static JDBCDefPane jdbcDefPane = new JDBCDefPane();
private static DBCPAttrPane dbcpAttrPane = new DBCPAttrPane();
@Override @Override
protected JPanel mainPanel() { protected JPanel mainPanel() {
@ -362,14 +393,21 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
return false; return false;
} }
protected static BasicPane getAdvancedAttrPane() {
return dbcpAttrPane;
}
@Override @Override
protected void populateSubDatabaseConnectionBean(JDBCDatabaseConnection ob) { protected void populateSubDatabaseConnectionBean(JDBCDatabaseConnection ob) {
jdbcDefPane.populate(ob); jdbcDefPane.populate(ob);
dbcpAttrPane.populate(jdbcDefPane.getJDBCDatabase());
} }
@Override @Override
protected JDBCDatabaseConnection updateSubDatabaseConnectionBean() { protected JDBCDatabaseConnection updateSubDatabaseConnectionBean() {
return jdbcDefPane.update(); JDBCDatabaseConnection jdbcDatabaseConnection = jdbcDefPane.update();
dbcpAttrPane.update(jdbcDatabaseConnection);
return jdbcDatabaseConnection;
} }
@Override @Override

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

@ -1,9 +1,7 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.design.constants.UIConstants;
import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.pool.DBCPConnectionPoolAttr;
import com.fr.design.border.UITitledBorder; import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
@ -16,22 +14,24 @@ 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.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.dialog.BasicPane;
import com.fr.design.editor.editor.IntegerEditor;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;
import com.fr.file.filter.ChooseFileFilter; import com.fr.file.filter.ChooseFileFilter;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.awt.event.InputMethodEvent;
import java.awt.event.InputMethodListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JFileChooser; import javax.swing.JFileChooser;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JPasswordField; import javax.swing.JPasswordField;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -44,13 +44,18 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
public class JDBCDefPane extends JPanel { public class JDBCDefPane extends JPanel {
public static final String DRIVER_TYPE = "driver_type"; public static final String DRIVER_TYPE = "driver_type";
public static final String USER_NAME = "user_name"; public static final String USER_NAME = "user_name";
public static final int TIME_MULTIPLE = 1000;
private static final String OTHER_DB = "Others"; private static final String OTHER_DB = "Others";
private static final Pattern ORACLE_URL = Pattern.compile("^jdbc:oracle:thin:@[/]*([0-9a-zA-Z_\\.]+)(:([0-9]+|port))?([:/](.*))?.*", Pattern.CASE_INSENSITIVE);
private static final Pattern GENERAL_URL = Pattern.compile("^jdbc:(mysql|sqlserver|db2|derby|postgresql|inceptor|inceptor2|hive2)://([0-9a-zA-Z_\\.]+)(:([0-9]+|port))?((/|;DatabaseName=)(.*))?.*", Pattern.CASE_INSENSITIVE);
private static final Pattern PORT = Pattern.compile("^0$|^[1-9][\\d]*[\\d]*$");
// 编码转换.
private String originalCharSet = null;
private static Map<String, DriverURLName[]> jdbcMap = new HashMap<String, DriverURLName[]>(); private static Map<String, DriverURLName[]> jdbcMap = new HashMap<String, DriverURLName[]>();
static { static {
@ -59,45 +64,38 @@ public class JDBCDefPane extends JPanel {
new DriverURLName("COM.cloudscape.JDBCDriver", "jdbc:cloudscape:/cloudscape/"), new DriverURLName("COM.cloudscape.JDBCDriver", "jdbc:cloudscape:/cloudscape/"),
new DriverURLName("com.internetcds.jdbc.tds.Driver", "jdbc:freetds:sqlserver://localhost/"), new DriverURLName("com.internetcds.jdbc.tds.Driver", "jdbc:freetds:sqlserver://localhost/"),
new DriverURLName("com.fr.swift.jdbc.Driver", "jdbc:swift:emb://default")}); new DriverURLName("com.fr.swift.jdbc.Driver", "jdbc:swift:emb://default")});
jdbcMap.put("Inceptor", new DriverURLName[]{new DriverURLName("org.apache.hive.jdbc.HiveDriver", "jdbc:inceptor2://localhost:10000/default"), jdbcMap.put("Inceptor", new DriverURLName[]{new DriverURLName("org.apache.hive.jdbc.HiveDriver", "jdbc:inceptor2://localhost:port/databaseName"),
new DriverURLName("org.apache.hadoop.hive.jdbc.HiveDriver", "jdbc:inceptor://localhost:10000/default")}); new DriverURLName("org.apache.hadoop.hive.jdbc.HiveDriver", "jdbc:inceptor://localhost:port/databaseName")});
jdbcMap.put("Oracle", new DriverURLName[]{new DriverURLName("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@localhost:1521:databaseName")}); jdbcMap.put("Oracle", new DriverURLName[]{new DriverURLName("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@localhost:port:databaseName")});
jdbcMap.put("DB2", new DriverURLName[]{new DriverURLName("com.ibm.db2.jcc.DB2Driver", "jdbc:db2://localhost:50000/")}); jdbcMap.put("DB2", new DriverURLName[]{new DriverURLName("com.ibm.db2.jcc.DB2Driver", "jdbc:db2://localhost:port/databaseName")});
jdbcMap.put("SQL Server", new DriverURLName[]{new DriverURLName("com.microsoft.sqlserver.jdbc.SQLServerDriver", "jdbc:sqlserver://localhost:1433;" + "databaseName=")}); jdbcMap.put("SQL Server", new DriverURLName[]{new DriverURLName("com.microsoft.sqlserver.jdbc.SQLServerDriver", "jdbc:sqlserver://localhost:port;databaseName=databaseName")});
jdbcMap.put("MySQL", new DriverURLName[]{new DriverURLName("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/"), jdbcMap.put("MySQL", new DriverURLName[]{new DriverURLName("com.mysql.jdbc.Driver", "jdbc:mysql://localhost:port/databaseName"),
new DriverURLName("org.gjt.mm.mysql.Driver", "jdbc:mysql://localhost/")}); new DriverURLName("org.gjt.mm.mysql.Driver", "jdbc:mysql://localhost:port/databaseName")});
jdbcMap.put("Sybase", new DriverURLName[]{new DriverURLName("com.sybase.jdbc2.jdbc.SybDriver", "jdbc:sybase:Tds:localhost:5000/")}); jdbcMap.put("Sybase", new DriverURLName[]{new DriverURLName("com.sybase.jdbc2.jdbc.SybDriver", "jdbc:sybase:Tds:localhost:port/databaseName")});
jdbcMap.put("Derby", new DriverURLName[]{new DriverURLName("org.apache.derby.jdbc.ClientDriver", "jdbc:derby://localhost:port/databaseName")});
jdbcMap.put("Postgre", new DriverURLName[]{new DriverURLName("org.postgresql.Driver", "jdbc:postgresql://localhost:port/databaseName")});
jdbcMap.put("Access", new DriverURLName[]{new DriverURLName("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=")}); jdbcMap.put("Access", new DriverURLName[]{new DriverURLName("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=")});
jdbcMap.put("Derby", new DriverURLName[]{new DriverURLName("org.apache.derby.jdbc.ClientDriver", "jdbc:derby://localhost:1527/")});
jdbcMap.put("Postgre", new DriverURLName[]{new DriverURLName("org.postgresql.Driver", "jdbc:postgresql://localhost:5432/")});
jdbcMap.put("SQLite", new DriverURLName[]{new DriverURLName("org.sqlite.JDBC", "jdbc:sqlite://${ENV_HOME}/../help/FRDemo.db")}); jdbcMap.put("SQLite", new DriverURLName[]{new DriverURLName("org.sqlite.JDBC", "jdbc:sqlite://${ENV_HOME}/../help/FRDemo.db")});
} }
private UIButton dbtypeButton; private UIButton dbtypeButton;
private UIComboBox dbtypeComboBox; private UIComboBox dbtypeComboBox;
private UIComboBox driverComboBox; private UIComboBox driverComboBox;
private UITextField dbNameTextField;
private UITextField hostTextField;
private UITextField portTextField;
private UITextField urlTextField; private UITextField urlTextField;
private UITextField userNameTextField; private UITextField userNameTextField;
private JPasswordField passwordTextField; private JPasswordField passwordTextField;
private UIComboBox charSetComboBox;
private ActionLabel odbcTipsLink; private ActionLabel odbcTipsLink;
private JPanel centerPanel;
private Component[][] allComponents;
private Component[][] partComponents;
// 请不要改动dbtype,只应该最后添加 // 请不要改动dbtype,只应该最后添加
private final String[] dbtype = {"Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre", "SQLite", "Inceptor", OTHER_DB}; private final String[] dbtype = {"Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre", "SQLite", "Inceptor", OTHER_DB};
// carl:DBCP的一些属性
private IntegerEditor DBCP_INITIAL_SIZE = new IntegerEditor();
private IntegerEditor DBCP_MAX_ACTIVE = new IntegerEditor();
private IntegerEditor DBCP_MAX_IDLE = new IntegerEditor();
private IntegerEditor DBCP_MIN_IDLE = new IntegerEditor();
private IntegerEditor DBCP_MAX_WAIT = new IntegerEditor();
private UITextField DBCP_VALIDATION_QUERY = new UITextField();
private UIComboBox DBCP_TESTONBORROW = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")});
private UIComboBox DBCP_TESTONRETURN = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")});
private UIComboBox DBCP_TESTWHILEIDLE = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Design_Basic_No"), Toolkit.i18nText("Fine-Design_Basic_Yes")});
private IntegerEditor DBCP_TIMEBETWEENEVICTIONRUNSMILLS = new IntegerEditor();
private IntegerEditor DBCP_NUMTESTSPEREVICTIONRUN = new IntegerEditor();
private IntegerEditor DBCP_MINEVICTABLEIDLETIMEMILLIS = new IntegerEditor();
private JDBCDatabaseConnection jdbcDatabase; private JDBCDatabaseConnection jdbcDatabase;
@ -118,7 +116,14 @@ public class JDBCDefPane extends JPanel {
driverComboBox = new UIComboBox(); driverComboBox = new UIComboBox();
driverComboBox.setEditable(true); driverComboBox.setEditable(true);
driverComboBox.addActionListener(driverListener); driverComboBox.addActionListener(driverListener);
dbNameTextField = new UITextField(15);
hostTextField = new UITextField(15);
portTextField = new UITextField(15);
portTextField.addInputMethodListener(portInputMethodListener);
portTextField.addKeyListener(portKeyListener);
urlTextField = new UITextField(15); urlTextField = new UITextField(15);
urlTextField.getDocument().addDocumentListener(updateParaListener);
enableSubDocListener();
userNameTextField = new UITextField(15); userNameTextField = new UITextField(15);
userNameTextField.setName(USER_NAME); userNameTextField.setName(USER_NAME);
passwordTextField = new UIPasswordFieldWithFixedLength(15); passwordTextField = new UIPasswordFieldWithFixedLength(15);
@ -130,11 +135,10 @@ public class JDBCDefPane extends JPanel {
double f = TableLayout.FILL; double f = TableLayout.FILL;
JPanel dbtypePane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); JPanel dbtypePane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
dbtypePane.add(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Database") + ":"))); dbtypePane.add(new UILabel((Toolkit.i18nText("Fine-Design_Basic_Database") + ":")));
JPanel dbtypeComPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
Component[][] dbtypeComComponents = {{dbtypeComboBox}}; Component[][] dbtypeComComponents = {{dbtypeComboBox}};
double[] dbtypeRowSize = {p}; double[] dbtypeRowSize = {p};
double[] dbtypeColumnSize = {p}; double[] dbtypeColumnSize = {p};
dbtypeComPane = TableLayoutHelper.createTableLayoutPane(dbtypeComComponents, dbtypeRowSize, dbtypeColumnSize); JPanel dbtypeComPane = TableLayoutHelper.createTableLayoutPane(dbtypeComComponents, dbtypeRowSize, dbtypeColumnSize);
JPanel driverPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); JPanel driverPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
driverPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Driver") + ":")); driverPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Driver") + ":"));
@ -161,43 +165,61 @@ public class JDBCDefPane extends JPanel {
driverComboBoxAndTips.add(driverComboBox, BorderLayout.WEST); driverComboBoxAndTips.add(driverComboBox, BorderLayout.WEST);
driverComboBoxAndTips.add(odbcTipsPane, BorderLayout.CENTER); driverComboBoxAndTips.add(odbcTipsPane, BorderLayout.CENTER);
JPanel hostPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
hostPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Host") + ":"));
Component[][] hostComComponents = {{hostTextField}};
double[] hostRowSize = {p};
double[] hostColumnSize = {p};
JPanel hostComPane = TableLayoutHelper.createTableLayoutPane(hostComComponents, hostRowSize, hostColumnSize);
JPanel portPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
portPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Port") + ":"));
Component[][] portComComponents = {{portTextField}};
double[] portRowSize = {p};
double[] portColumnSize = {p};
JPanel portComPane = TableLayoutHelper.createTableLayoutPane(portComComponents, portRowSize, portColumnSize);
JPanel dbNamePane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
dbNamePane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_DatabaseName") + ":"));
Component[][] dbNameComComponents = {{dbNameTextField}};
double[] dbNameRowSize = {p};
double[] dbNameColumnSize = {p};
JPanel dbNameComPane = TableLayoutHelper.createTableLayoutPane(dbNameComComponents, dbNameRowSize, dbNameColumnSize);
JPanel urlPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); JPanel urlPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
urlPane.add(new UILabel("URL:")); urlPane.add(new UILabel("URL:"));
JPanel urlComPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
Component[][] urlComComponents = {{urlTextField, dbtypeButton}}; Component[][] urlComComponents = {{urlTextField, dbtypeButton}};
double[] urlRowSize = {p}; double[] urlRowSize = {p};
double[] urlColumnSize = {f, 21}; double[] urlColumnSize = {f, 21};
urlComPane = TableLayoutHelper.createCommonTableLayoutPane(urlComComponents, urlRowSize, urlColumnSize, 4); JPanel urlComPane = TableLayoutHelper.createCommonTableLayoutPane(urlComComponents, urlRowSize, urlColumnSize, 4);
JPanel userPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); JPanel userPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
userPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_UserName") + ":")); userPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Report_UserName") + ":"));
JPanel userComPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
Component[][] userComComponents = {{userNameTextField, new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password") + ":"), passwordTextField}}; Component[][] userComComponents = {{userNameTextField, new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password") + ":"), passwordTextField}};
double[] userRowSize = {p}; double[] userRowSize = {p};
double[] userColumnSize = {f, p, f}; double[] userColumnSize = {f, p, f};
userComPane = TableLayoutHelper.createCommonTableLayoutPane(userComComponents, userRowSize, userColumnSize, 4); JPanel userComPane = TableLayoutHelper.createCommonTableLayoutPane(userComComponents, userRowSize, userColumnSize, 4);
JPanel passwordPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane(); String[] defaultEncode = new String[]{Toolkit.i18nText("Fine-Design_Encode_Auto")};
passwordPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Password") + ":")); charSetComboBox = new UIComboBox(ArrayUtils.addAll(defaultEncode, EncodeConstants.ENCODING_ARRAY));
JPanel chartSetPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
Component[][] components = {{dbtypePane, dbtypeComPane}, {driverPane, driverComboBoxAndTips}, {urlPane, urlComPane}, {userPane, userComPane},}; chartSetPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Datasource_Charset") + ":"));
Component[][] charSetComComponents = {{charSetComboBox}};
double[] rowSize = {p, p, p, p}; double[] charSetRowSize = {p};
double[] charSetColumnSize = {f};
JPanel charSetComPane = TableLayoutHelper.createTableLayoutPane(charSetComComponents, charSetRowSize, charSetColumnSize);
//这边调整的话注意下面的changePane
allComponents = new Component[][]{{dbtypePane, dbtypeComPane}, {driverPane, driverComboBoxAndTips}, {hostPane, hostComPane},
{portPane, portComPane}, {dbNamePane, dbNameComPane}, {userPane, userComPane},
{chartSetPane, charSetComPane}, {urlPane, urlComPane}};
partComponents = new Component[][]{{dbtypePane, dbtypeComPane}, {driverPane, driverComboBoxAndTips}, {urlPane, urlComPane},
{userPane, userComPane}, {chartSetPane, charSetComPane}};
double[] rowSize = {p, p, p, p, p, p, p, p};
double[] columnSize = {p, f, 22}; double[] columnSize = {p, f, 22};
// REPORT-41450 Windows环境的jdk11下dpi为125%时会因为缩放导致显示问题,因此加个水平gap值 // REPORT-41450 Windows环境的jdk11下dpi为125%时会因为缩放导致显示问题,因此加个水平gap值
JPanel centerPanel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 6, 6); centerPanel = TableLayoutHelper.createGapTableLayoutPane(allComponents, rowSize, columnSize, 6, 6);
innerthis.add(centerPanel); innerthis.add(centerPanel);
JPanel southPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
innerthis.add(southPanel);
southPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 4, 20));
ActionLabel actionLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr"));
southPanel.add(actionLabel, BorderLayout.EAST);
actionLabel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
JDialog wDialog = createJDialog();
wDialog.setVisible(true);
}
});
} }
public void populate(JDBCDatabaseConnection jdbcDatabase) { public void populate(JDBCDatabaseConnection jdbcDatabase) {
@ -205,7 +227,6 @@ public class JDBCDefPane extends JPanel {
jdbcDatabase = new JDBCDatabaseConnection(); jdbcDatabase = new JDBCDatabaseConnection();
} }
this.jdbcDatabase = jdbcDatabase; this.jdbcDatabase = jdbcDatabase;
this.dbtypeComboBox.removeActionListener(dbtypeActionListener);
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");
@ -230,30 +251,35 @@ public class JDBCDefPane extends JPanel {
this.dbtypeComboBox.setSelectedItem(OTHER_DB); this.dbtypeComboBox.setSelectedItem(OTHER_DB);
} }
} }
this.dbtypeComboBox.addActionListener(dbtypeActionListener);
this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver()); this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver());
this.urlTextField.setText(jdbcDatabase.getURL()); this.urlTextField.setText(jdbcDatabase.getURL());
this.userNameTextField.setText(jdbcDatabase.getUser()); this.userNameTextField.setText(jdbcDatabase.getUser());
this.passwordTextField.setText(jdbcDatabase.getPassword()); this.passwordTextField.setText(jdbcDatabase.getPassword());
this.originalCharSet = jdbcDatabase.getOriginalCharsetName();
if (StringUtils.isBlank(originalCharSet)) {
this.charSetComboBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Encode_Auto"));
} else {
this.charSetComboBox.setSelectedItem(jdbcDatabase.getOriginalCharsetName());
}
}
protected JDBCDatabaseConnection getJDBCDatabase() {
return this.jdbcDatabase;
}
DBCPConnectionPoolAttr dbcpAttr = jdbcDatabase.getDbcpAttr(); private void changePane(Object dbType) {
if (dbcpAttr == null) { double p = TableLayout.PREFERRED;
dbcpAttr = new DBCPConnectionPoolAttr(); double f = TableLayout.FILL;
jdbcDatabase.setDbcpAttr(dbcpAttr); double[] columnSize = {p, f, 22};
this.jdbcDatabase.setDbcpAttr(dbcpAttr); if (ComparatorUtils.equals(dbType, OTHER_DB) || ComparatorUtils.equals(dbType, "Access") || ComparatorUtils.equals(dbType, "SQLite")) {
if (this.centerPanel.getComponentCount() != partComponents.length * 2) {
centerPanel.removeAll();
TableLayoutHelper.addComponent2ResultPane(partComponents, new double[]{p, p, p, p, p}, columnSize, centerPanel);
}
} else if (this.centerPanel.getComponentCount() != allComponents.length * 2) {
centerPanel.removeAll();
TableLayoutHelper.addComponent2ResultPane(allComponents, new double[]{p, p, p, p, p, p, p, p}, columnSize, centerPanel);
} }
this.DBCP_INITIAL_SIZE.setValue(dbcpAttr.getInitialSize());
this.DBCP_MAX_ACTIVE.setValue(dbcpAttr.getMaxActive());
this.DBCP_MAX_IDLE.setValue(dbcpAttr.getMaxIdle());
this.DBCP_MAX_WAIT.setValue(dbcpAttr.getMaxWait());
this.DBCP_MIN_IDLE.setValue(dbcpAttr.getMinIdle());
this.DBCP_VALIDATION_QUERY.setText(dbcpAttr.getValidationQuery());
this.DBCP_TESTONBORROW.setSelectedIndex(dbcpAttr.isTestOnBorrow() ? 1 : 0);
this.DBCP_TESTONRETURN.setSelectedIndex(dbcpAttr.isTestOnReturn() ? 1 : 0);
this.DBCP_TESTWHILEIDLE.setSelectedIndex(dbcpAttr.isTestWhileIdle() ? 1 : 0);
this.DBCP_MINEVICTABLEIDLETIMEMILLIS.setValue(dbcpAttr.getMinEvictableIdleTimeMillis() / TIME_MULTIPLE);
this.DBCP_NUMTESTSPEREVICTIONRUN.setValue(dbcpAttr.getNumTestsPerEvictionRun());
this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.setValue(dbcpAttr.getTimeBetweenEvictionRunsMillis());
} }
public JDBCDatabaseConnection update() { public JDBCDatabaseConnection update() {
@ -265,25 +291,14 @@ public class JDBCDefPane extends JPanel {
jdbcDatabase.setURL(this.urlTextField.getText().trim()); jdbcDatabase.setURL(this.urlTextField.getText().trim());
jdbcDatabase.setUser(this.userNameTextField.getText().trim()); jdbcDatabase.setUser(this.userNameTextField.getText().trim());
jdbcDatabase.setPassword(new String(this.passwordTextField.getPassword()).trim()); jdbcDatabase.setPassword(new String(this.passwordTextField.getPassword()).trim());
jdbcDatabase.setOriginalCharsetName(this.originalCharSet);
DBCPConnectionPoolAttr dbcpAttr = jdbcDatabase.getDbcpAttr(); if (this.charSetComboBox.getSelectedIndex() == 0) {
if (dbcpAttr == null) { jdbcDatabase.setNewCharsetName(null);
dbcpAttr = new DBCPConnectionPoolAttr(); jdbcDatabase.setOriginalCharsetName(null);
jdbcDatabase.setDbcpAttr(dbcpAttr); } else {
jdbcDatabase.setNewCharsetName(EncodeConstants.ENCODING_GBK);
jdbcDatabase.setOriginalCharsetName(((String) this.charSetComboBox.getSelectedItem()));
} }
dbcpAttr.setInitialSize(this.DBCP_INITIAL_SIZE.getValue().intValue());
dbcpAttr.setMaxActive(this.DBCP_MAX_ACTIVE.getValue().intValue());
dbcpAttr.setMaxIdle(this.DBCP_MAX_IDLE.getValue().intValue());
dbcpAttr.setMaxWait(this.DBCP_MAX_WAIT.getValue().intValue());
dbcpAttr.setMinIdle(this.DBCP_MIN_IDLE.getValue().intValue());
dbcpAttr.setValidationQuery(this.DBCP_VALIDATION_QUERY.getText());
dbcpAttr.setTestOnBorrow(this.DBCP_TESTONBORROW.getSelectedIndex() == 0 ? false : true);
dbcpAttr.setTestOnReturn(this.DBCP_TESTONRETURN.getSelectedIndex() == 0 ? false : true);
dbcpAttr.setTestWhileIdle(this.DBCP_TESTWHILEIDLE.getSelectedIndex() == 0 ? false : true);
dbcpAttr.setMinEvictableIdleTimeMillis(((Number) this.DBCP_MINEVICTABLEIDLETIMEMILLIS.getValue()).intValue() * TIME_MULTIPLE);
dbcpAttr.setNumTestsPerEvictionRun(((Number) this.DBCP_NUMTESTSPEREVICTIONRUN.getValue()).intValue());
dbcpAttr.setTimeBetweenEvictionRunsMillis(((Number) this.DBCP_TIMEBETWEENEVICTIONRUNSMILLS.getValue()).intValue());
return jdbcDatabase; return jdbcDatabase;
} }
@ -307,6 +322,7 @@ public class JDBCDefPane extends JPanel {
} }
// 更改数据库类型后 数据库名称置空和之前逻辑保持一致 // 更改数据库类型后 数据库名称置空和之前逻辑保持一致
jdbcDatabase.setDatabase(StringUtils.EMPTY); jdbcDatabase.setDatabase(StringUtils.EMPTY);
changePane(dbtypeComboBox.getSelectedItem());
} }
}; };
@ -365,49 +381,157 @@ public class JDBCDefPane extends JPanel {
} }
}; };
private JDialog createJDialog() { InputMethodListener portInputMethodListener = new InputMethodListener() {
return new DBCPAttrPane().showWindow(SwingUtilities.getWindowAncestor(JDBCDefPane.this)); @Override
public void inputMethodTextChanged(InputMethodEvent event) {
char ch = event.getText().current();
if (!(ch >= '0' && ch <= '9')) {
event.consume();
}
}
@Override
public void caretPositionChanged(InputMethodEvent event) {
}
};
DocumentListener updateParaListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
updatePara();
}
@Override
public void removeUpdate(DocumentEvent e) {
updatePara();
}
@Override
public void changedUpdate(DocumentEvent e) {
updatePara();
}
};
private void updatePara() {
String dbType = dbtypeComboBox.getSelectedItem().toString();
if (ComparatorUtils.equals(dbType, OTHER_DB) || ComparatorUtils.equals(dbType, "Access") || ComparatorUtils.equals(dbType, "SQLite")) {
return;
}
disableSubDocListener();
String url = urlTextField.getText().trim();
Matcher matcher = ORACLE_URL.matcher(url);
if (matcher.find()) {
if (matcher.group(1) != null) {
hostTextField.setText(matcher.group(1));
} else {
hostTextField.setText(StringUtils.EMPTY);
}
if (matcher.group(3) != null) {
portTextField.setText(matcher.group(3));
} else {
portTextField.setText(StringUtils.EMPTY);
}
if (matcher.group(5) != null) {
dbNameTextField.setText(matcher.group(5));
} else {
dbNameTextField.setText(StringUtils.EMPTY);
}
enableSubDocListener();
return;
}
matcher = GENERAL_URL.matcher(url);
if (matcher.find()) {
if (matcher.group(2) != null) {
hostTextField.setText(matcher.group(2));
} else {
hostTextField.setText(StringUtils.EMPTY);
}
if (matcher.group(4) != null) {
portTextField.setText(matcher.group(4));
} else {
portTextField.setText(StringUtils.EMPTY);
}
if (matcher.group(7) != null) {
dbNameTextField.setText(matcher.group(7));
} else {
dbNameTextField.setText(StringUtils.EMPTY);
}
enableSubDocListener();
}
}
private void enableSubDocListener() {
this.dbNameTextField.getDocument().addDocumentListener(updateURLListener);
this.hostTextField.getDocument().addDocumentListener(updateURLListener);
}
private void disableSubDocListener() {
this.dbNameTextField.getDocument().removeDocumentListener(updateURLListener);
this.hostTextField.getDocument().removeDocumentListener(updateURLListener);
}
KeyListener portKeyListener = new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
String port = portTextField.getText().trim();
if (isPortValid(port)) {
updateURL();
} else {
portTextField.setText(port.replaceAll(e.getKeyChar() + "", ""));
if (!isPortValid(portTextField.getText())) {
portTextField.setText("");
}
}
}
};
private boolean isPortValid(String port) {
return PORT.matcher(port).find();
} }
class DBCPAttrPane extends BasicPane { DocumentListener updateURLListener = new DocumentListener() {
public DBCPAttrPane() {
JPanel defaultPane = this; @Override
public void insertUpdate(DocumentEvent e) {
// JPanel northFlowPane updateURL();
JPanel northFlowPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
defaultPane.add(northFlowPane, BorderLayout.NORTH);
DBCP_VALIDATION_QUERY.setColumns(15);
// ContextPane
double f = TableLayout.FILL;
// double p = TableLayout.PREFERRED;
double[] rowSize = {f, f, f, f, f, f, f, f, f, f, f, f};
double[] columnSize = {f, f};
Component[][] comps = {
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Initial_Size") + ":", SwingConstants.RIGHT), DBCP_INITIAL_SIZE},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Active") + ":", SwingConstants.RIGHT), DBCP_MAX_ACTIVE},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Max_Idle") + ":", SwingConstants.RIGHT), DBCP_MAX_IDLE},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Min_Idle") + ":", SwingConstants.RIGHT), DBCP_MIN_IDLE},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Max_Wait_Time") + ":", SwingConstants.RIGHT), DBCP_MAX_WAIT},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Validation_Query") + ":", SwingConstants.RIGHT), DBCP_VALIDATION_QUERY},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Borrow") + ":", SwingConstants.RIGHT), DBCP_TESTONBORROW},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_On_Return") + ":", SwingConstants.RIGHT), DBCP_TESTONRETURN},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Test_While_Idle") + ":", SwingConstants.RIGHT), DBCP_TESTWHILEIDLE},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Evictionruns_millis") + ":", SwingConstants.RIGHT),
DBCP_TIMEBETWEENEVICTIONRUNSMILLS},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Dbcp_Num_Test_Per_Evction_Run") + ":", SwingConstants.RIGHT), DBCP_NUMTESTSPEREVICTIONRUN},
{new UILabel(Toolkit.i18nText("Fine-Design_Basic_Connection_Pool_Mix_Evictable_Idle_Time_Millis") + ":", SwingConstants.RIGHT),
DBCP_MINEVICTABLEIDLETIMEMILLIS}};
JPanel contextPane = TableLayoutHelper.createGapTableLayoutPane(comps, rowSize, columnSize, 10, 4);
contextPane.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, UIConstants.LINE_COLOR));
northFlowPane.add(contextPane);
} }
@Override @Override
protected String title4PopupWindow() { public void removeUpdate(DocumentEvent e) {
return Toolkit.i18nText("Fine-Design_Basic_ConnectionPool_Attr"); updateURL();
}
@Override
public void changedUpdate(DocumentEvent e) {
updateURL();
}
};
private void updateURL() {
String dbType = dbtypeComboBox.getSelectedItem().toString();
if (!ComparatorUtils.equals(dbType, OTHER_DB) && !ComparatorUtils.equals(dbType, "Access") && !ComparatorUtils.equals(dbType, "SQLite")) {
urlTextField.getDocument().removeDocumentListener(updateParaListener);
DriverURLName[] driverURLNames = jdbcMap.get(dbType);
String defaultURL = null;
for (DriverURLName driverURLName : driverURLNames) {
if (ComparatorUtils.equals(driverURLName.getDriver(), driverComboBox.getSelectedItem().toString())) {
defaultURL = driverURLName.getURL();
}
}
if (defaultURL != null) {
String host = hostTextField.getText().trim();
String port = portTextField.getText().trim();
String dbName = dbNameTextField.getText().trim();
defaultURL = defaultURL.replace("localhost", host).replace(":port", ComparatorUtils.equals(port, "") ? "" : ":" + port);
if (defaultURL.startsWith("jdbc:sqlserver")) {
defaultURL = defaultURL.replace("=databaseName", "=" + dbName);
} else {
defaultURL = defaultURL.replace("databaseName", dbName);
}
}
urlTextField.setText(defaultURL);
urlTextField.getDocument().addDocumentListener(updateParaListener);
} }
} }

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

@ -64,7 +64,6 @@ public class HistoryTemplateListCache implements CallbackEvent {
* @param selected 选择的 * @param selected 选择的
*/ */
public void closeSelectedReport(JTemplate<?, ?> selected) { public void closeSelectedReport(JTemplate<?, ?> selected) {
DesignModuleFactory.clearChartPropertyPane();
DesignTableDataManager.closeTemplate(selected); DesignTableDataManager.closeTemplate(selected);
//直接关闭模板的时候(当且仅当设计器tab上只剩一个模板)退出权限编辑 //直接关闭模板的时候(当且仅当设计器tab上只剩一个模板)退出权限编辑
if (DesignModeContext.isAuthorityEditing() && historyList.size() <= 1) { if (DesignModeContext.isAuthorityEditing() && historyList.size() <= 1) {
@ -92,7 +91,6 @@ public class HistoryTemplateListCache implements CallbackEvent {
* @param selected 选择的 * @param selected 选择的
*/ */
public void closeVirtualSelectedReport(JTemplate<?, ?> selected) { public void closeVirtualSelectedReport(JTemplate<?, ?> selected) {
DesignModuleFactory.clearChartPropertyPane();
DesignTableDataManager.closeTemplate(selected); DesignTableDataManager.closeTemplate(selected);
if (contains(selected) == -1) { if (contains(selected) == -1) {
return; return;

2
designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java

@ -205,7 +205,7 @@ public class UILookAndFeel extends MetalLookAndFeel {
"com/fr/design/images/lookandfeel/" + fileName, UILookAndFeel.class); "com/fr/design/images/lookandfeel/" + fileName, UILookAndFeel.class);
if (url == null) { if (url == null) {
FineLoggerFactory.getLogger().error("Icon directory could not be resolved."); FineLoggerFactory.getLogger().error(fileName + " :Icon directory could not be resolved.");
return null; return null;
} }
} }

2
designer-base/src/main/java/com/fr/design/layout/TableLayoutHelper.java

@ -233,7 +233,7 @@ public class TableLayoutHelper {
container.repaint(); container.repaint();
} }
private static void addComponent2ResultPane(Component[][] components, double[] rowSize, double[] columnSize, JPanel resultPane) { public static void addComponent2ResultPane(Component[][] components, double[] rowSize, double[] columnSize, JPanel resultPane) {
for (int i = 0; i < components.length; i++) { for (int i = 0; i < components.length; i++) {
if (i >= rowSize.length) { if (i >= rowSize.length) {

16
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -84,13 +84,13 @@ import javax.swing.UIManager;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
import javax.swing.border.MatteBorder; import javax.swing.border.MatteBorder;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.Insets; import java.awt.Insets;
import java.awt.Point; import java.awt.Point;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.Component;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.dnd.DnDConstants; import java.awt.dnd.DnDConstants;
@ -701,6 +701,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
} }
} }
//添加检测按钮
addCheckButton();
//添加分享按钮 //添加分享按钮
addShareButton(); addShareButton();
//添加插件中的按钮 //添加插件中的按钮
@ -724,6 +726,18 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
} }
private void addCheckButton() {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt == null) {
return;
}
combineUp.addSeparator(new Dimension(2, 16));
UIButton[] checkButtons = jt.createCheckButton();
for (UIButton checkButton : checkButtons) {
combineUp.add(checkButton);
}
}
private void addShareButton() { private void addShareButton() {
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();

7
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -40,6 +40,7 @@ import com.fr.design.gui.itree.filetree.TemplateFileTree;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.check.CheckButton;
import com.fr.design.mainframe.template.info.TemplateInfoCollector; import com.fr.design.mainframe.template.info.TemplateInfoCollector;
import com.fr.design.mainframe.template.info.TemplateProcessInfo; import com.fr.design.mainframe.template.info.TemplateProcessInfo;
import com.fr.design.mainframe.template.info.TimeConsumeTimer; import com.fr.design.mainframe.template.info.TimeConsumeTimer;
@ -86,11 +87,11 @@ import javax.swing.JComponent;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager; import javax.swing.undo.UndoManager;
import java.awt.BorderLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.awt.BorderLayout;
/** /**
* 报表设计和表单设计的编辑区域(设计器编辑的IO文件) * 报表设计和表单设计的编辑区域(设计器编辑的IO文件)
@ -1376,6 +1377,10 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return uiButtons; return uiButtons;
} }
public UIButton[] createCheckButton() {
return new UIButton[]{new CheckButton()};
}
/** /**
* 由于老版本的模板没有模板ID当勾选使用参数模板时候就加一个模板ID attr * 由于老版本的模板没有模板ID当勾选使用参数模板时候就加一个模板ID attr
* *

173
designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java

@ -0,0 +1,173 @@
package com.fr.design.mainframe.check;
import com.fr.base.BaseUtils;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.file.FILE;
import com.fr.file.FileNodeFILE;
import com.fr.log.FineLoggerFactory;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.check.TemplateChecker;
import javax.swing.BoxLayout;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
import static javax.swing.JOptionPane.OK_OPTION;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
public class CheckButton extends UIButton {
private UILabel message;
private UIButton okButton;
private JDialog dialog;
private UILabel uiLabel;
public CheckButton() {
this.setIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/check.png"));
this.setToolTipText(Toolkit.i18nText("Fine_Designer_Check_Font"));
this.set4ToolbarButton();
this.addActionListener(checkListener);
}
private ActionListener checkListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// Try check
final SwingWorker<Set<String>, Void> checkThread = new SwingWorker<Set<String>, Void>() {
@Override
protected Set<String> doInBackground() throws Exception {
// 返回校验结果
return check(DesignerContext.getDesignerFrame().getSelectedJTemplate());
}
@Override
protected void done() {
try {
Set<String> set = get();
if (set == null) {
return;
}
if(set.isEmpty()) {
okButton.setEnabled(true);
uiLabel.setIcon(BaseUtils.readIcon("com/fr/design/images/correct.png"));
message.setText("<html>" + Toolkit.i18nText("Fine_Designer_Check_Font_Success") + "</html>");
} else {
dialog.dispose();
StringBuilder textBuilder = new StringBuilder();
textBuilder.append(Toolkit.i18nText("Fine_Designer_Check_Font_Missing_Font")).append("\n");
for (String font : set) {
textBuilder.append(font).append("\n");
}
String areaText = textBuilder.toString();
CheckFontInfoDialog dialog = new CheckFontInfoDialog(DesignerContext.getDesignerFrame(), areaText);
dialog.setVisible(true);
}
} catch (InterruptedException | ExecutionException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
};
JTemplate jtemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate();
if (jtemplate == null || jtemplate.getEditingFILE() == null) {
return;
}
FILE currentTemplate = jtemplate.getEditingFILE();
if(currentTemplate instanceof FileNodeFILE){
checkThread.execute();
}else {
//模板不在报表环境下,提示保存
int selVal = FineJOptionPane.showConfirmDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"),
Toolkit.i18nText("Fine_Designer_Check_Font"),
OK_CANCEL_OPTION,
WARNING_MESSAGE);
if (OK_OPTION == selVal) {
//保存成功才执行检测
if (jtemplate.saveAsTemplate2Env()) {
checkThread.execute();
}
}
}
initDialogPane();
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dialog.dispose();
}
});
dialog.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) {
checkThread.cancel(true);
}
});
dialog.setVisible(true);
dialog.dispose();
}
};
private Set<String> check(JTemplate jtemplate) {
String path = jtemplate.getEditingFILE().getEnvFullName();
Set<String> fontSet = WorkContext.getCurrent().get(TemplateChecker.class, new ExceptionHandler<Void>() {
@Override
public Void callHandler(RPCInvokerExceptionInfo rpcInvokerExceptionInfo) {
uiLabel.setIcon(BaseUtils.readIcon("com/fr/design/images/error.png"));
message.setText("<html>" + Toolkit.i18nText("Fine_Designer_Check_Font_Upgrade") + "</html>");
okButton.setEnabled(true);
return null;
}
}).checkFont(path);
return fontSet;
}
private void initDialogPane() {
message = new UILabel();
message.setText(Toolkit.i18nText("Fine-Designer_Check_Font_Checking") + "...");
uiLabel = new UILabel();
okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK"));
okButton.setEnabled(false);
dialog = new JDialog();
dialog.setTitle(Toolkit.i18nText("Fine_Designer_Check_Font"));
dialog.setModal(true);
dialog.setSize(new Dimension(268, 118));
JPanel jp = new JPanel();
JPanel upPane = new JPanel();
JPanel downPane = new JPanel();
uiLabel = new UILabel(BaseUtils.readIcon("com/fr/design/images/waiting.png"));
upPane.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
upPane.add(uiLabel);
upPane.add(message);
downPane.setLayout(new FlowLayout(FlowLayout.CENTER, 6, 0));
downPane.add(okButton);
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
jp.add(upPane);
jp.add(downPane);
dialog.add(jp);
dialog.setResizable(false);
dialog.setLocationRelativeTo(SwingUtilities.getWindowAncestor(this));
}
}

139
designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java

@ -0,0 +1,139 @@
package com.fr.design.mainframe.check;
import com.fr.design.dialog.link.MessageWithLink;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.UIManager;
import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Locale;
/**
* 字体缺失检测的具体结果对话框
*
*/
public class CheckFontInfoDialog extends JDialog implements ActionListener {
private JPanel topPanel;
private JPanel upInTopPanel;
private JPanel downInTopPanel;
private JPanel hiddenPanel;
private JPanel bottomPanel;
private UILabel imageLabel;
private UILabel directUiLabel;
private UILabel detailLabel;
public CheckFontInfoDialog(Frame parent, String areaText) {
super(parent,true);
//提示信息
JPanel imagePanel = new JPanel();
imageLabel = new UILabel(IOUtils.readIcon("com/fr/design/images/warnings/warning32.png"));
imagePanel.add(imageLabel);
JPanel messagePanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true);
MessageWithLink linkMessage = new MessageWithLink(Toolkit.i18nText("Fine_Designer_Check_Font_Message"),
Toolkit.i18nText("Fine_Designer_Check_Font_Install_Font"),
CloudCenter.getInstance().acquireUrlByKind("help.install.font", "https://help.fanruan.com/finereport/doc-view-3999.html"));
linkMessage.setPreferredSize(new Dimension(380, 31));
messagePanel.add(linkMessage);
// 查看详情按钮
directUiLabel = new UILabel();
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right"));
detailLabel = new UILabel();
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail"));
upInTopPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
upInTopPanel.add(imageLabel, BorderLayout.WEST);
upInTopPanel.add(messagePanel, BorderLayout.CENTER);
downInTopPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
downInTopPanel.add(directUiLabel, BorderLayout.WEST);
downInTopPanel.add(detailLabel, BorderLayout.CENTER);
topPanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true);
topPanel.add(upInTopPanel, BorderLayout.NORTH);
topPanel.add(downInTopPanel, BorderLayout.SOUTH);
//中间的详情展示(可隐藏)
hiddenPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
hiddenPanel.setBorder(BorderFactory.createEmptyBorder(0,12,0,12));
JScrollPane scrollPane = new JScrollPane();
JTextArea checkArea = new JTextArea(areaText);
scrollPane.setViewportView(checkArea);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
checkArea.setEnabled(false);
hiddenPanel.add(scrollPane);
hiddenPanel.setVisible(false);
downInTopPanel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (hiddenPanel.isVisible()) {
hiddenPanel.setVisible(false);
CheckFontInfoDialog.this.setSize(new Dimension(380, 185));
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Look_Detail"));
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.right"));
} else {
CheckFontInfoDialog.this.setSize(new Dimension(380, 280));
hiddenPanel.setVisible(true);
detailLabel.setText(Toolkit.i18nText("Fine_Designer_Hide_Detail"));
directUiLabel.setIcon(UIManager.getIcon("OptionPane.narrow.down"));
}
}
@Override
public void mouseEntered(MouseEvent e) {
detailLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
@Override
public void mouseExited(MouseEvent e) {
detailLabel.setCursor(Cursor.getDefaultCursor());
}
});
//底部的按钮面板
UIButton okButton = new UIButton(Toolkit.i18nText("Fine-Design_Report_OK"));
JPanel buttonPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
buttonPanel.setBorder(BorderFactory.createEmptyBorder(0,10,10,10));
buttonPanel.add(okButton, BorderLayout.EAST);
okButton.addActionListener(this);
bottomPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
bottomPanel.add(buttonPanel);
this.setTitle(Toolkit.i18nText("Fine_Designer_Check_Font"));
this.setResizable(false);
this.add(topPanel, BorderLayout.NORTH);
this.add(hiddenPanel, BorderLayout.CENTER);
this.add(bottomPanel, BorderLayout.SOUTH);
this.setSize(new Dimension(GeneralContext.getLocale().equals(Locale.US)? 400:380, 185));
GUICoreUtils.centerWindow(this);
}
@Override
public void actionPerformed(ActionEvent e) {
this.dispose();
}
}

8
designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java

@ -243,14 +243,6 @@ public class DesignModuleFactory {
return bp; return bp;
} }
public static void clearChartPropertyPane() {
if (instance.chartPropertyPaneClass != null) {
StableUtils.clearInstance(instance.chartPropertyPaneClass);
}
}
public static void registerButtonDetailPaneClass(Class clazz) { public static void registerButtonDetailPaneClass(Class clazz) {
instance.buttonDetailPaneClass = clazz; instance.buttonDetailPaneClass = clazz;
} }

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/check.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

BIN
designer-base/src/main/resources/com/fr/design/images/buttonicon/run24.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 942 B

After

Width:  |  Height:  |  Size: 736 B

BIN
designer-base/src/main/resources/com/fr/design/images/correct.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

BIN
designer-base/src/main/resources/com/fr/design/images/error.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 B

BIN
designer-base/src/main/resources/com/fr/design/images/waiting.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1011 B

BIN
designer-base/src/main/resources/com/fr/design/images/warnings/warning32.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 B

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

@ -24,15 +24,9 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
* 创建图表属性表实例. * 创建图表属性表实例.
*/ */
private synchronized static ChartPropertyPane getInstance() { private synchronized static ChartPropertyPane getInstance() {
//创建新图表时,创建属性表配置面板 return new ChartPropertyPane();
if (singleton == null) {
singleton = new ChartPropertyPane();
}
return singleton;
} }
private static ChartPropertyPane singleton;
protected TargetComponentContainer container = new TargetComponentContainer(); protected TargetComponentContainer container = new TargetComponentContainer();
protected ChartEditPane chartEditPane; protected ChartEditPane chartEditPane;
@ -160,8 +154,4 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
chartEditPane.setSupportCellData(supportCellData); chartEditPane.setSupportCellData(supportCellData);
} }
} }
public synchronized static void clear() {
singleton = null;
}
} }

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