Browse Source

Merge pull request #5390 in DESIGN/design from feature/10.0 to feature/big-screen

* commit '7dc14fe8c559d2b9bbf4b28ae5f356db09bcc83d':
  REPORT-57326&EPORT-57324&REPORT-57330&REPORT-56895 布局推荐若干间距线的bug
  REPORT-56925 【FRM布局推荐】组件复用-手动间距输入框没有显示水印
  REPORT-56532 文件选择器弹窗 && REPORT-56683 文件选择器弹窗-图片压缩功能入口迁移的初次提示问题
  REPORT-56926 【FRM布局推荐】组件复用-手动间距目前不支持输入小数(允许输入小数,但自动取整处理)
  REPORT-57233 修正本地调试的修改
  REPORT-57233 【FRM布局推荐】组件复用-对齐、自动间距、手动间距,调整后没有触发模板的保存和还原按钮,导致关闭再打开此模板还是调整前的效果
  REPORT-57057 远程设计报错规范-启动远程状态下的设计器时,报错弹窗被 切换工作目录的弹窗覆盖
  REPORT-53615 调整代码格式
  REPORT-53615   驱动管理的设计器适配
  KERNEL-7634 jxbrowser 小版本再升级下
  REPORT-56929 【FRM布局推荐】组件复用-手动间距输入框目前不支持回车触发生效
  CHART-20229 图表控件修改
  REPORT-56906  由于UIIntNumberField被引用的地方太多了,所以还原这个类的重命名
  REPORT-56134js提交事件报错中添加定位信息
  REPORT-55481 模板Web属性的顶部和底部工具栏在权限编辑时,顶部工具栏被底部工具栏覆盖
  REPORT-56595 数据集预览时可复制-表头复制问题
  REPORT-56906&REPORT-56926 修正一个笔误
  REPORT-56906&REPORT-56926 自定义一个输入框,只支持输入整数
feature/big-screen
superman 3 years ago
parent
commit
913c8e5bed
  1. 8
      build.gradle
  2. 5
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  3. 2
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  4. 448
      designer-base/src/main/java/com/fr/design/data/datapane/connect/JDBCDefPane.java
  5. 116
      designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java
  6. 13
      designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java
  7. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  8. 3
      designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneProvider.java
  9. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java
  10. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java
  11. 87
      designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java
  12. 1
      designer-base/src/main/java/com/fr/design/gui/itextfield/UIIntNumberField.java
  13. 104
      designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java
  14. 15
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java
  15. 15
      designer-base/src/main/java/com/fr/design/style/background/image/ImageFileChooser.java
  16. 9
      designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java
  17. 44
      designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java
  18. 16
      designer-base/src/main/java/com/fr/design/ui/compatible/NxComplexInterceptRequestCallback.java
  19. 34
      designer-base/src/main/java/com/fr/design/ui/compatible/NxInterceptRequestCallback.java
  20. 204
      designer-chart/src/main/java/com/fr/design/gui/xcombox/MarkerComboBox.java
  21. 17
      designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java
  22. 19
      designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java
  23. 44
      designer-form/src/main/java/com/fr/design/mainframe/MultiSelectionArrangement.java
  24. 14
      designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java
  25. 27
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/AbstractMultiSelectionArrangementButton.java
  26. 1
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/BottomAlignButton.java
  27. 1
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalCenterButton.java
  28. 1
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalDistributionButton.java
  29. 1
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/LeftAlignButton.java
  30. 4
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/MultiSelectionArrangementButton.java
  31. 1
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/RightAlignButton.java
  32. 1
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/TopAlignButton.java
  33. 1
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalCenterButton.java
  34. 1
      designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalDistributionButton.java
  35. 84
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java
  36. 10
      designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java
  37. 10
      designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java
  38. 1175
      designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java
  39. 3
      designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java
  40. 50
      designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java
  41. 5
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

8
build.gradle

@ -60,10 +60,10 @@ allprojects {
implementation 'com.fr.third:jxbrowser:6.23'
implementation 'com.fr.third:jxbrowser-mac:6.23'
implementation 'com.fr.third:jxbrowser-win64:6.23'
implementation 'com.fr.third:jxbrowser-v7:7.7'
implementation 'com.fr.third:jxbrowser-mac-v7:7.7'
implementation 'com.fr.third:jxbrowser-win64-v7:7.7'
implementation 'com.fr.third:jxbrowser-swing-v7:7.7'
implementation 'com.fr.third:jxbrowser-v7:7.15'
implementation 'com.fr.third:jxbrowser-mac-v7:7.15'
implementation 'com.fr.third:jxbrowser-win64-v7:7.15'
implementation 'com.fr.third:jxbrowser-swing-v7:7.15'
implementation 'com.fr.third.server:servlet-api:3.0'
implementation 'org.swingexplorer:swexpl:2.0.1'
implementation 'org.swingexplorer:swag:1.0'

5
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -407,7 +407,7 @@ public class EnvChangeEntrance {
/**
* 处理异常
*/
public void dealEvnExceptionWhenStartDesigner() {
public void dealEvnExceptionWhenStartDesigner(Throwable e, DesignerWorkspaceInfo workspaceInfo) {
ProcessEventPipe eventPipe = FineProcessContext.getParentPipe();
if (eventPipe != null) {
eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue()));
@ -435,6 +435,9 @@ public class EnvChangeEntrance {
DesignerExiter.getInstance().execute();
}
});
if (e != null) {
RemoteDesignExceptionHandler.getInstance().handleInStart(e, workspaceInfo);
}
envListDialog.setVisible(true);
}

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

@ -503,7 +503,7 @@ public class PreferencePane extends BasicPane {
new JavaFxNativeFileChooser.Builder().
fileSelectionMode(FileSelectionMode.DIR).
build();
int saveValue = fileChooserProvider.showDialog(null);
int saveValue = fileChooserProvider.showDialog(chooseDirBtn);
if (saveValue == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooserProvider.getSelectedFile();
logExportDirectoryField.setText(selectedFile.getAbsolutePath());

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

@ -1,6 +1,8 @@
package com.fr.design.data.datapane.connect;
import com.fr.base.GraphHelper;
import com.fr.data.driver.DriverLoader;
import com.fr.data.driver.config.DriverLoaderConfig;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.ibutton.UIButton;
@ -21,6 +23,8 @@ import com.fr.general.ComparatorUtils;
import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
import com.fr.third.guava.collect.HashBiMap;
import com.fr.workspace.WorkContext;
import javax.swing.BorderFactory;
import javax.swing.JFileChooser;
@ -45,6 +49,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -97,12 +102,161 @@ public class JDBCDefPane extends JPanel {
private Component[][] partComponents;
// 请不要改动dbtype,只应该最后添加
private final String[] dbtype = {"Oracle", "DB2", "SQL Server", "MySQL", "Sybase", "Access", "Derby", "Postgre", "SQLite", "Inceptor", OTHER_DB};
private JDBCDatabaseConnection jdbcDatabase;
private boolean needRefresh = true;
private UIComboBox driverManageBox;
private ActionLabel driverManageLabel;
private UIComboBox driverLoaderBox;
private HashBiMap<String, String> nameAndRepresent;
ActionListener driverListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (driverComboBox.getSelectedItem() == null || ComparatorUtils.equals(driverComboBox.getSelectedItem(), StringUtils.EMPTY)) {
return;
}
odbcTipsLink.setVisible(ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem())); // 选择的如果是ODBC就显示提示
Iterator<Entry<String, DriverURLName[]>> jdbc = jdbcMap.entrySet().iterator();
while (jdbc.hasNext()) {
Entry<String, DriverURLName[]> entry = jdbc.next();
DriverURLName[] dus = entry.getValue();
for (int i = 0, len = dus.length; i < len; i++) {
if (ComparatorUtils.equals(dus[i].getDriver(), (driverComboBox.getSelectedItem()))) {
urlTextField.setText(dus[i].getURL());
return;
}
}
}
}
};
ActionListener dbtypeButtonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), StringUtils.EMPTY)) {
return;
}
DriverURLName[] dus = jdbcMap.get(dbtypeComboBox.getSelectedItem());
for (int i = 0, len = dus.length; i < len; i++) {
if (ComparatorUtils.equals(driverComboBox.getSelectedItem(), (dus[i].getDriver()))) {
urlTextField.setText(dus[i].getURL());
if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), ("Access"))) {
// ben:这个能不能换种处理方案- -
JFileChooser filechooser = new JFileChooser();
filechooser.setDialogTitle(Toolkit.i18nText("Fine-Design_Basic_Open"));
filechooser.setMultiSelectionEnabled(false);
filechooser.addChoosableFileFilter(new ChooseFileFilter(new String[]{"accdb", "mdb"}, "Microsoft Office Access"));
int result = filechooser.showOpenDialog(DesignerContext.getDesignerFrame());
File selectedfile = null;
if (result == JFileChooser.APPROVE_OPTION) {
selectedfile = filechooser.getSelectedFile();
if (selectedfile != null) {
String selectedName = selectedfile.getPath().substring(selectedfile.getPath().lastIndexOf('.') + 1);
if (selectedName.equalsIgnoreCase("mdb") || selectedName.equalsIgnoreCase("accdb")) {
urlTextField.setText(urlTextField.getText() + selectedfile.getPath());
}
}
}
}
break;
}
}
}
};
KeyListener portKeyListener = new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
String port = portTextField.getText();
if (isPortValid(port)) {
updateURL();
} else {
portTextField.setText(port.replaceAll(getCharNeedReplace(e.getKeyChar()), ""));
if (!isPortValid(portTextField.getText())) {
portTextField.setText(StringUtils.EMPTY);
updateURL();
}
}
}
};
ActionListener driverManageListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
boolean selectSelfDefine = isSelfDefine();
driverManageLabel.setVisible(selectSelfDefine);
driverLoaderBox.setVisible(selectSelfDefine);
driverComboBox.setVisible(!selectSelfDefine);
}
};
ActionListener dbtypeActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
urlTextField.setText(StringUtils.EMPTY);
driverComboBox.removeAllItems();
driverManageBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Default"));
if (driverLoaderBox.getItemCount() > 0) {
driverLoaderBox.setSelectedIndex(0);
}
if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), StringUtils.EMPTY)) {
driverComboBox.setSelectedItem(StringUtils.EMPTY);
return;
}
DriverURLName[] dus = jdbcMap.get(dbtypeComboBox.getSelectedItem());
for (int i = 0, len = dus.length; i < len; i++) {
driverComboBox.addItem(dus[i].getDriver());
if (i == 0) {
driverComboBox.setSelectedItem(dus[i].getDriver());
urlTextField.setText(dus[i].getURL());
}
}
// 更改数据库类型后 数据库名称置空和之前逻辑保持一致
if (needRefresh) {
jdbcDatabase.setDatabase(StringUtils.EMPTY);
}
changePane(dbtypeComboBox.getSelectedItem());
JDBCConnectionDef.getInstance().setConnection((String) dbtypeComboBox.getSelectedItem(), jdbcDatabase);
DatabaseConnectionPane.JDBC.getAdvancedAttrPane().populate(jdbcDatabase);
}
};
InputMethodListener portInputMethodListener = new InputMethodListener() {
@Override
public void inputMethodTextChanged(InputMethodEvent event) {
if (null == event.getText()) {
return;
}
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();
}
};
public JDBCDefPane() {
initMap();
this.setBorder(UITitledBorder.createBorderWithTitle("JDBC" + ":"));
this.setLayout(FRGUIPaneFactory.createLabelFlowLayout());
JPanel innerthis = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
@ -115,7 +269,14 @@ public class JDBCDefPane extends JPanel {
}
dbtypeComboBox.addActionListener(dbtypeActionListener);
dbtypeComboBox.setMaximumRowCount(10);
driverLoaderBox = new UIComboBox();
refreshDriverLoader();
driverLoaderBox.setEditable(false);
driverManageBox = new UIComboBox();
refreshDriverManage(true);
driverManageBox.setEditable(false);
driverManageBox.addActionListener(driverManageListener);
driverLoaderBox.setVisible(isSelfDefine());
driverComboBox = new UIComboBox();
driverComboBox.setEditable(true);
driverComboBox.addActionListener(driverListener);
@ -155,17 +316,39 @@ public class JDBCDefPane extends JPanel {
_gfx.drawLine(0, this.getHeight() - 1, GraphHelper.getWidth(this.getText()), this.getHeight() - 1);
}
};
odbcTipsPane.add(odbcTipsLink);
odbcTipsLink.setPreferredSize(new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Basic_Odbc_Tips")), odbcTipsLink.getPreferredSize().height));
odbcTipsLink.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
String url = CloudCenter.getInstance().acquireUrlByKind("odbc.help");
BrowseUtils.browser(url);
}
});
driverManageLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Driver_Manage_Add_Driver")) {
@Override
public void paintComponent(Graphics _gfx) {
super.paintComponent(_gfx);
_gfx.setColor(Color.blue);
_gfx.drawLine(0, this.getHeight() - 1, GraphHelper.getWidth(this.getText()), this.getHeight() - 1);
}
};
driverManageLabel.setPreferredSize(new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Driver_Manage_Add_Driver")), driverManageLabel.getPreferredSize().height));
driverManageLabel.setVisible(isSelfDefine());
driverManageLabel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
String url = CloudCenter.getInstance().acquireUrlByKind("driver.add.help");
BrowseUtils.browser(url);
}
});
odbcTipsPane.add(driverManageLabel);
odbcTipsPane.add(odbcTipsLink);
JPanel driverComboBoxAndTips = new JPanel(new BorderLayout());
driverComboBoxAndTips.add(driverComboBox, BorderLayout.WEST);
JPanel normalFlowInnerContainer_s_pane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
normalFlowInnerContainer_s_pane.add(driverManageBox);
normalFlowInnerContainer_s_pane.add(driverComboBox);
normalFlowInnerContainer_s_pane.add(driverLoaderBox);
driverComboBoxAndTips.add(normalFlowInnerContainer_s_pane, BorderLayout.WEST);
driverComboBoxAndTips.add(odbcTipsPane, BorderLayout.CENTER);
JPanel hostPane = FRGUIPaneFactory.createRightFlowInnerContainer_S_Pane();
@ -225,7 +408,70 @@ public class JDBCDefPane extends JPanel {
innerthis.add(centerPanel);
}
private void initMap() {
Map<String, DriverLoader> driverLoaders = DriverLoaderConfig.getInstance().getDriverLoaders();
nameAndRepresent = getDriverLoaderAndRepresent(driverLoaders);
}
private HashBiMap<String, String> getDriverLoaderAndRepresent(Map<String, DriverLoader> driverLoaders) {
HashBiMap<String, String> driverHashBiMap = HashBiMap.create();
if (WorkContext.getCurrent().isWarDeploy()) {
return driverHashBiMap;
}
// name 是唯一的,name+driver自然也是唯一的
for (DriverLoader driverLoader : driverLoaders.values()) {
driverHashBiMap.put(driverLoader.getName(), getRepresent(driverLoader.getDriverClass(), driverLoader.getName()));
}
return driverHashBiMap;
}
protected JDBCDatabaseConnection getJDBCDatabase() {
return this.jdbcDatabase;
}
private void changePane(Object dbType) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f, 22};
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);
}
}
private String getRepresent(String driverClass, String driverName) {
return driverClass + "(" + driverName + ")";
}
private boolean isSelfDefine() {
return ComparatorUtils.equals(Toolkit.i18nText("Fine-Design_Driver_Manage_Self_Define"), driverManageBox.getSelectedItem());
}
private void refreshDriverLoader() {
Set<String> representSet = nameAndRepresent.values();
driverLoaderBox.clearBoxItems();
for (String represent : representSet) {
driverLoaderBox.addItem(represent);
}
}
private void refreshDriverManage(boolean addSelfDefine) {
driverManageBox.clearBoxItems();
driverManageBox.addItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Default"));
if (addSelfDefine) {
driverManageBox.addItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Self_Define"));
}
}
public void populate(JDBCDatabaseConnection jdbcDatabase) {
// 单例对象,重新打开的时候并不会新建,但是由于driverloaderbox里面需要是动态内容,因此需要进行刷新动作
initMap();
refreshDriverLoader();
needRefresh = false;
if (jdbcDatabase == null) {
jdbcDatabase = new JDBCDatabaseConnection();
@ -256,7 +502,23 @@ public class JDBCDefPane extends JPanel {
}
}
this.jdbcDatabase.setIdentity(jdbcDatabase.getIdentity());
this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver());
// jdbcDatabase.getDriverSource() 只会是空或者是有值,但是为了保险起见,还是应该做个处理
String driverSource = jdbcDatabase.getDriverSource();
if (driverSource == null) {
driverSource = StringUtils.EMPTY;
}
if (driverSource.isEmpty()) {
refreshDriverManage(!nameAndRepresent.isEmpty());
this.driverManageBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Default"));
this.driverComboBox.setSelectedItem(jdbcDatabase.getDriver());
} else {
refreshDriverManage(true);
this.driverManageBox.setSelectedItem(Toolkit.i18nText("Fine-Design_Driver_Manage_Self_Define"));
String represent = getRepresent(jdbcDatabase.getDriver(), jdbcDatabase.getDriverSource());
this.driverLoaderBox.removeItem(represent);
this.driverLoaderBox.addItem(represent);
this.driverLoaderBox.setSelectedItem(represent);
}
this.urlTextField.setText(jdbcDatabase.getURL());
this.userNameTextField.setText(jdbcDatabase.getUser());
this.passwordTextField.setText(jdbcDatabase.getPassword());
@ -269,31 +531,10 @@ public class JDBCDefPane extends JPanel {
needRefresh = false;
}
protected JDBCDatabaseConnection getJDBCDatabase() {
return this.jdbcDatabase;
}
private void changePane(Object dbType) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f, 22};
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);
}
}
public JDBCDatabaseConnection update() {
if (jdbcDatabase == null) {
jdbcDatabase = new JDBCDatabaseConnection();
}
Object driveItem = this.driverComboBox.getSelectedItem();
jdbcDatabase.setDriver(driveItem == null ? null : driveItem.toString().trim());
jdbcDatabase.setURL(this.urlTextField.getText().trim());
jdbcDatabase.setUser(this.userNameTextField.getText().trim());
jdbcDatabase.setPassword(new String(this.passwordTextField.getPassword()).trim());
@ -305,126 +546,30 @@ public class JDBCDefPane extends JPanel {
jdbcDatabase.setNewCharsetName(EncodeConstants.ENCODING_GBK);
jdbcDatabase.setOriginalCharsetName(((String) this.charSetComboBox.getSelectedItem()));
}
return jdbcDatabase;
}
ActionListener dbtypeActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
urlTextField.setText(StringUtils.EMPTY);
driverComboBox.removeAllItems();
if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), StringUtils.EMPTY)) {
driverComboBox.setSelectedItem(StringUtils.EMPTY);
return;
}
DriverURLName[] dus = jdbcMap.get(dbtypeComboBox.getSelectedItem());
for (int i = 0, len = dus.length; i < len; i++) {
driverComboBox.addItem(dus[i].getDriver());
if (i == 0) {
driverComboBox.setSelectedItem(dus[i].getDriver());
urlTextField.setText(dus[i].getURL());
}
}
// 更改数据库类型后 数据库名称置空和之前逻辑保持一致
if (needRefresh) {
jdbcDatabase.setDatabase(StringUtils.EMPTY);
}
changePane(dbtypeComboBox.getSelectedItem());
JDBCConnectionDef.getInstance().setConnection((String) dbtypeComboBox.getSelectedItem(), jdbcDatabase);
DatabaseConnectionPane.JDBC.getAdvancedAttrPane().populate(jdbcDatabase);
}
};
ActionListener driverListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (driverComboBox.getSelectedItem() == null || ComparatorUtils.equals(driverComboBox.getSelectedItem(), StringUtils.EMPTY)) {
return;
}
odbcTipsLink.setVisible(ComparatorUtils.equals("sun.jdbc.odbc.JdbcOdbcDriver", driverComboBox.getSelectedItem())); // 选择的如果是ODBC就显示提示
Iterator<Entry<String, DriverURLName[]>> jdbc = jdbcMap.entrySet().iterator();
while (jdbc.hasNext()) {
Entry<String, DriverURLName[]> entry = jdbc.next();
DriverURLName[] dus = entry.getValue();
for (int i = 0, len = dus.length; i < len; i++) {
if (ComparatorUtils.equals(dus[i].getDriver(), (driverComboBox.getSelectedItem()))) {
urlTextField.setText(dus[i].getURL());
return;
}
}
}
String driverLoader = (String) this.driverLoaderBox.getSelectedItem();
if (driverLoader == null) {
driverLoader = StringUtils.EMPTY;
}
};
ActionListener dbtypeButtonActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), StringUtils.EMPTY)) {
return;
}
DriverURLName[] dus = jdbcMap.get(dbtypeComboBox.getSelectedItem());
for (int i = 0, len = dus.length; i < len; i++) {
if (ComparatorUtils.equals(driverComboBox.getSelectedItem(), (dus[i].getDriver()))) {
urlTextField.setText(dus[i].getURL());
if (ComparatorUtils.equals(dbtypeComboBox.getSelectedItem(), ("Access"))) {
// ben:这个能不能换种处理方案- -
JFileChooser filechooser = new JFileChooser();
filechooser.setDialogTitle(Toolkit.i18nText("Fine-Design_Basic_Open"));
filechooser.setMultiSelectionEnabled(false);
filechooser.addChoosableFileFilter(new ChooseFileFilter(new String[]{"accdb", "mdb"}, "Microsoft Office Access"));
int result = filechooser.showOpenDialog(DesignerContext.getDesignerFrame());
File selectedfile = null;
if (result == JFileChooser.APPROVE_OPTION) {
selectedfile = filechooser.getSelectedFile();
if (selectedfile != null) {
String selectedName = selectedfile.getPath().substring(selectedfile.getPath().lastIndexOf('.') + 1);
if (selectedName.equalsIgnoreCase("mdb") || selectedName.equalsIgnoreCase("accdb")) {
urlTextField.setText(urlTextField.getText() + selectedfile.getPath());
}
}
}
}
break;
if (isSelfDefine()) {
String[] split = driverLoader.split("\\(");
if (split.length > 1) {
String name = split[1];
if (name.length() > 0) {
jdbcDatabase.setDriverSource(name.substring(0, name.length() - 1));
} else {
jdbcDatabase.setDriverSource(StringUtils.EMPTY);
}
} else {
jdbcDatabase.setDriverSource(StringUtils.EMPTY);
}
jdbcDatabase.setDriver(split[0]);
} else {
Object driveItem = this.driverComboBox.getSelectedItem();
jdbcDatabase.setDriver(driveItem == null ? null : driveItem.toString().trim());
jdbcDatabase.setDriverSource(StringUtils.EMPTY);
}
};
InputMethodListener portInputMethodListener = new InputMethodListener() {
@Override
public void inputMethodTextChanged(InputMethodEvent event) {
if (null == event.getText()) {
return;
}
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();
}
};
return jdbcDatabase;
}
private void updatePara() {
String dbType = dbtypeComboBox.getSelectedItem().toString();
@ -489,21 +634,6 @@ public class JDBCDefPane extends JPanel {
this.hostTextField.getDocument().removeDocumentListener(updateURLListener);
}
KeyListener portKeyListener = new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
String port = portTextField.getText();
if (isPortValid(port)) {
updateURL();
} else {
portTextField.setText(port.replaceAll(getCharNeedReplace(e.getKeyChar()) , ""));
if (!isPortValid(portTextField.getText())) {
portTextField.setText(StringUtils.EMPTY);
updateURL();
}
}
}
};
private boolean isPortValid(String port) {
return PORT.matcher(port).find();

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

@ -6,7 +6,11 @@ import com.fr.design.gui.itable.TableSorter;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.os.OperatingSystem;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumnModel;
import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
@ -40,27 +44,104 @@ public class CopyableJTable extends SortableJTable {
int commandKeyCode = 157;
//选中单元格的背景色
Color selectBackGround = new Color(54, 133, 242, 63);
Color headerBackGround = new Color(229, 229, 229);
boolean mouseDrag = false;
boolean headerSelect = false;
DefaultTableCellRenderer tableHeaderCellRenderer = new DefaultTableCellRenderer() {
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JComponent comp = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (isChoose(row, column)) {
comp.setBackground(selectBackGround);
} else {
comp.setBackground(headerBackGround);
}
return comp;
}
};
public CopyableJTable(TableSorter tableModel) {
super(tableModel);
initListener();
this.getTableHeader().setDefaultRenderer(tableHeaderCellRenderer);
}
private void initListener() {
CopyableJTable self = this;
this.getTableHeader().addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
if (mouseDrag) {
headerSelect = true;
int column = getColumn(e);
self.updateEndPoint(-1, column);
self.getTableHeader().repaint();
}
}
@Override
public void mouseExited(MouseEvent e) {
if (mouseDrag) {
headerSelect = false;
}
}
@Override
public void mouseClicked(MouseEvent e) {
headerSelect = true;
int column = getColumn(e);
if (column != -1) {
self.clearPoint();
self.addPoint(-1, column);
self.updateStartPoint(-1, column);
self.updateEndPoint(-1, column);
self.refreshTable();
}
}
private int getColumn(MouseEvent e) {
JTableHeader h = (JTableHeader) e.getSource();
TableColumnModel columnModel = h.getColumnModel();
int viewColumn = columnModel.getColumnIndexAtX(e.getX());
return viewColumn;
}
});
this.getTableHeader().addMouseMotionListener(new MouseAdapter() {
@Override
public void mouseMoved(MouseEvent e) {
mouseDrag = false;
}
@Override
public void mouseDragged(MouseEvent e) {
self.clearPoint();
self.updateStartPoint(-1, -1);
self.updateEndPoint(-1, -1);
self.refreshTable();
}
});
this.addMouseMotionListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseDragged(MouseEvent evt) {
mouseDrag = true;
int row = self.rowAtPoint(evt.getPoint());
int col = self.columnAtPoint(evt.getPoint());
if (self.updateEndPoint(row, col)) {
self.repaint();
self.refreshTable();
}
}
public void mouseMoved(MouseEvent e) {
mouseDrag = false;
}
});
this.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
headerSelect = false;
int row = self.rowAtPoint(e.getPoint());
int col = self.columnAtPoint(e.getPoint());
if (!self.isControlDown) {
@ -74,7 +155,7 @@ public class CopyableJTable extends SortableJTable {
self.addPoint(row, col);
self.updateEndPoint(row, col);
self.repaint();
self.refreshTable();
}
});
@ -129,6 +210,8 @@ public class CopyableJTable extends SortableJTable {
private boolean updateEndPoint(int row, int col) {
if (headerSelect && row != -1)
return false;
if (endRow != row || endCol != col) {
endRow = row;
endCol = col;
@ -157,13 +240,12 @@ public class CopyableJTable extends SortableJTable {
private void copy() {
FineLoggerFactory.getLogger().info("copy cell value");
java.util.List<java.util.List<Object>> table = new ArrayList<>();
if ((startRow != endRow || startCol != endCol) &&
Math.min(startRow, endRow) > -1 && Math.min(startCol, endCol) > -1) {
if ((startRow != endRow || startCol != endCol) && Math.min(startCol, endCol) > -1) {
for (int i = Math.min(startRow, endRow); i <= Math.max(startRow, endRow); i++) {
table.add(new ArrayList<>());
for (int j = Math.min(startCol, endCol); j <= Math.max(startCol, endCol); j++) {
Object text = this.getValueAt(i, j);
table.get(i - Math.min(startRow, endRow)).add(text);
Object text = this.getTableValue(i, j);
table.get(table.size() - 1).add(text);
}
}
} else if (pointList.size() > 0) {
@ -176,8 +258,8 @@ public class CopyableJTable extends SortableJTable {
table.add(new ArrayList<>());
currentRow++;
}
Object text = this.getValueAt(point.x, point.y);
table.get(currentRow - startRow).add(text);
Object text = this.getTableValue(point.x, point.y);
table.get(table.size() - 1).add(text);
}
}
@ -186,6 +268,24 @@ public class CopyableJTable extends SortableJTable {
clip.setContents(tText, null);
}
private Object getTableValue(int row, int col) {
Object value = null;
if (col > -1) {
if (row > -1) {
value = this.getValueAt(row, col);
} else if (row == -1) {
col = columnModel.getColumn(col).getModelIndex();
value = this.getModel().getColumnName(col);
}
}
return value;
}
private void refreshTable() {
this.repaint();
this.getTableHeader().repaint();
}
private boolean isChoose(int row, int col) {
if (row >= Math.min(startRow, endRow) && row <= Math.max(startRow, endRow)) {
if (col >= Math.min(startCol, endCol) && col <= Math.max(startCol, endCol)) {

13
designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java

@ -10,6 +10,7 @@ import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.event.Listener;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
@ -76,9 +77,12 @@ class JControlUpdatePane extends JPanel {
cardPane.add(updatePanes[i], String.valueOf(i));
}
card.show(cardPane, String.valueOf(i));
try{
try {
if (ob2Populate instanceof Listener) {
listControlPane.wrapperListener((Listener) ob2Populate);
}
updatePanes[i].populateBean(ob2Populate);
}catch (Exception e){
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
break;
@ -103,12 +107,15 @@ class JControlUpdatePane extends JPanel {
if (pane != null && pane.isVisible()) {
Object bean = pane.updateBean();
try {
if (bean instanceof Listener) {
listControlPane.wrapperListener((Listener) bean);
}
if (bean instanceof RemoteDesignerWorkspaceInfo) {
DesignerWorkspaceInfo info = DesignerEnvManager.getEnvManager().getWorkspaceInfo(elEditing.wrapper.getName());
String remindTime = info.getRemindTime();
((RemoteDesignerWorkspaceInfo) bean).setRemindTime(remindTime);
}
}catch (Exception e){
} catch (Exception e) {
FineLoggerFactory.getLogger().info("remindTime is not exist");
}
if (i < creators.length) {

7
designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java

@ -6,6 +6,7 @@ import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.ModNameActionListener;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.event.Listener;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.invoke.Reflect;
@ -417,4 +418,10 @@ public abstract class JListControlPane extends JControlPane implements ListContr
public JControlUpdatePane getControlUpdatePane() {
return (JControlUpdatePane) controlUpdatePane;
}
@Override
public void wrapperListener(Listener listener){
}
}

3
designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneProvider.java

@ -3,6 +3,7 @@ package com.fr.design.gui.controlpane;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.form.event.Listener;
import com.fr.stable.Nameable;
import javax.swing.DefaultListModel;
@ -32,4 +33,6 @@ public interface ListControlPaneProvider extends UnrepeatedNameHelper {
void showSelectPane();
void showEditPane();
ShortCut4JControlPane[] getShorts();
void wrapperListener(Listener listener);
}

7
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java

@ -6,6 +6,7 @@ import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.UINameEdList;
import com.fr.form.event.Listener;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
@ -314,4 +315,10 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon
public JNameEdList getNameableList() {
return nameableList;
}
@Override
public void wrapperListener(Listener listener){
}
}

7
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java

@ -391,7 +391,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
@Override
public Nameable[] update() {
java.util.List<Nameable> res = new java.util.ArrayList<Nameable>();
List<Nameable> res = new ArrayList<Nameable>();
getControlUpdatePane().update();
Iterator<Map.Entry<String, ListWrapperPane>> iterator = nameEdListMap.entrySet().iterator();
while (iterator.hasNext()) {
@ -516,6 +516,11 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
return StringUtils.EMPTY;
}
@Override
public void wrapperListener(Listener listener){
}
private class ListWrapperPane extends JPanel {
private UINameEdList nameEdList;

87
designer-base/src/main/java/com/fr/design/gui/ifilechooser/JavaFxNativeFileChooser.java

@ -2,16 +2,22 @@ package com.fr.design.gui.ifilechooser;
import com.fr.design.i18n.Toolkit;
import com.fr.design.upm.UpmUtils;
import com.fr.design.mainframe.DesignerContext;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.sun.javafx.application.PlatformImpl;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.paint.Color;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Window;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*;
import java.io.File;
import java.util.List;
@ -40,9 +46,17 @@ public class JavaFxNativeFileChooser implements FileChooserProvider {
@Override
public int showDialog(Component parent) {
final CountDownLatch latch = new CountDownLatch(1);
PlatformImpl.startup(new Runnable() {
PlatformImpl.startup(() -> {
});
Platform.setImplicitExit(false);
Platform.runLater(new Runnable() {
@Override
public void run() {
Component fileChooserParent = parent;
if (fileChooserParent == null) {
fileChooserParent = DesignerContext.getDesignerFrame();
}
Stage stage = showCoverStage(fileChooserParent);
try {
if (fileSelectionMode == FileSelectionMode.FILE || fileSelectionMode == FileSelectionMode.MULTIPLE_FILE) {
FileChooser fileChooser = new FileChooser();
@ -50,12 +64,12 @@ public class JavaFxNativeFileChooser implements FileChooserProvider {
fileChooser.getExtensionFilters().addAll(filters);
fileChooser.setInitialDirectory(currentDirectory);
if (fileSelectionMode == FileSelectionMode.FILE) {
File file = fileChooser.showOpenDialog(null);
File file = fileChooser.showOpenDialog(stage);
if (file != null) {
selectedFiles = new File[]{file};
}
} else if (fileSelectionMode == FileSelectionMode.MULTIPLE_FILE) {
List<File> fileList = fileChooser.showOpenMultipleDialog(null);
List<File> fileList = fileChooser.showOpenMultipleDialog(stage);
if (fileList != null) {
selectedFiles = new File[fileList.size()];
fileList.toArray(selectedFiles);
@ -65,17 +79,70 @@ public class JavaFxNativeFileChooser implements FileChooserProvider {
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle(title);
directoryChooser.setInitialDirectory(currentDirectory);
File folder = directoryChooser.showDialog(null);
File folder = directoryChooser.showDialog(stage);
if (folder != null) {
selectedFiles = new File[]{folder};
}
System.out.println(folder);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
} finally {
latch.countDown();
closeCoverStage(stage);
}
}
private void closeCoverStage(Stage stage) {
if (stage != null) {
stage.close();
closeCoverStage((Stage) stage.getOwner());
}
}
private Stage showCoverStage(Component component) {
try {
if (component == null)
return null;
Stage parentStage = showCoverStage(component.getParent());
if (component instanceof JDialog || component instanceof JFrame) {
return createStage(component.getX(), component.getY(), component.getWidth(), component.getHeight(), parentStage);
} else {
return parentStage;
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
return null;
}
}
private Stage createStage(double x, double y, double w, double h, Stage parentStage) {
try {
Stage stage = new Stage();
stage.setX(x);
stage.setY(y);
stage.setWidth(w);
stage.setHeight(h);
stage.setOpacity(0.2);
stage.setResizable(false);
stage.initStyle(StageStyle.UNDECORATED);
Label label = new Label();
label.setBackground(
new Background(new BackgroundFill(Color.color(0.78, 0.78, 0.80, 0.5), null, null)));
stage.setScene(new Scene(label));
if (parentStage != null) {
stage.initOwner(parentStage);
stage.initModality(Modality.WINDOW_MODAL);
}
stage.show();
return stage;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
return null;
}
}
});

1
designer-base/src/main/java/com/fr/design/gui/itextfield/UIIntNumberField.java

@ -12,6 +12,7 @@ import java.awt.Toolkit;
* Date: 13-3-29
* Time: 下午12:02
* To change this template use File | Settings | File Templates.
* fanglei: 这个类名字虽然叫整数输入框但是里面的业务仅支持输入正整数由于被引用的地方太多无法更改知道就行
*/
public class UIIntNumberField extends UINumberField {
public void setFieldDocument() {

104
designer-base/src/main/java/com/fr/design/javascript/Commit2DBJavaScriptPane.java

@ -1,16 +1,17 @@
package com.fr.design.javascript;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.gui.frpane.CommitTabbedPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.js.Commit2DBJavaScript;
import com.fr.write.DBManipulation;
import javax.swing.*;
import java.awt.*;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
@ -25,63 +26,64 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 构造函数控件事件的提交入库面板
* @param javaScriptActionPane JS提交面板对象
*
* @param javaScriptActionPane JS提交面板对象
* @param dbManipulationPaneList 提交入库的提交面板列表
*/
public Commit2DBJavaScriptPane(final JavaScriptActionPane javaScriptActionPane, List dbManipulationPaneList) {
this.dbmPaneList=dbManipulationPaneList;
this.dbmPaneList = dbManipulationPaneList;
this.javaScriptActionPane = javaScriptActionPane;
this.setLayout(FRGUIPaneFactory.createBorderLayout());
commitTabbedPane = new CommitTabbedPane(this,dbmPaneList);
commitTabbedPane.setPreferredSize(new Dimension(commitTabbedPane.getWidth(),20));
this.add(commitTabbedPane, BorderLayout.NORTH) ;
commitTabbedPane = new CommitTabbedPane(this, dbmPaneList);
commitTabbedPane.setPreferredSize(new Dimension(commitTabbedPane.getWidth(), 20));
this.add(commitTabbedPane, BorderLayout.NORTH);
cardPane = new JPanel(new CardLayout());
cardNames = new String[dbmPaneList.size()] ;
cardNames = new String[dbmPaneList.size()];
for (int i = 0; i < this.dbmPaneList.size(); i++) {
if(((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName() == null){
if (((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName() == null) {
cardNames[i] = "";
} else{
cardNames[i] =((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName();
} else {
cardNames[i] = ((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName();
}
cardPane.add((DBManipulationPane)this.dbmPaneList.get(i),cardNames[i]);
cardPane.add((DBManipulationPane) this.dbmPaneList.get(i), cardNames[i]);
}
this.add(cardPane, BorderLayout.CENTER);
JPanel btPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
this.add(btPane, BorderLayout.SOUTH);
addCallbackButton = javaScriptActionPane.createCallButton();
btPane.add(addCallbackButton);
}
this.add(btPane, BorderLayout.SOUTH);
addCallbackButton = javaScriptActionPane.createCallButton();
btPane.add(addCallbackButton);
}
/**
* 更新DBManipulationPane
*/
public void updateCardPane(){
cardNames = new String[dbmPaneList.size()] ;
public void updateCardPane() {
cardNames = new String[dbmPaneList.size()];
for (int i = 0; i < this.dbmPaneList.size(); i++) {
if(((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName() == null){
if (((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName() == null) {
cardNames[i] = "";
} else{
cardNames[i] =((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName();
} else {
cardNames[i] = ((DBManipulationPane) this.dbmPaneList.get(i)).getSubMitName();
}
cardPane.add((DBManipulationPane)this.dbmPaneList.get(i),cardNames[i]);
cardPane.add((DBManipulationPane) this.dbmPaneList.get(i), cardNames[i]);
}
CardLayout cardLayout = (CardLayout)cardPane.getLayout();
cardLayout.show(cardPane,cardNames[commitTabbedPane.getSelectedIndex()]);
CardLayout cardLayout = (CardLayout) cardPane.getLayout();
cardLayout.show(cardPane, cardNames[commitTabbedPane.getSelectedIndex()]);
}
public void setList(List list){
public void setList(List list) {
this.dbmPaneList = list;
}
/**
* 新建DBManipulationPane
* @return 新建的DBManipulationPane
*
* @return 新建的DBManipulationPane
*/
public DBManipulationPane createDBManipulationPane(){
public DBManipulationPane createDBManipulationPane() {
DBManipulationPane db = javaScriptActionPane.createDBManipulationPane();
db.populateBean(null);
dbmPaneList.add(db);
@ -91,25 +93,26 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 窗口名称
*
* @return 返回窗口名称
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_JavaScript_Commit_To_Database");
}
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_JavaScript_Commit_To_Database");
}
/**
* 界面重置
*/
public void reset() {
this.javaScriptActionPane.setCall(null);
//重置后只保留,只留第一个tab
while (dbmPaneList.size() > 1){
/**
* 界面重置
*/
public void reset() {
this.javaScriptActionPane.setCall(null);
//重置后只保留,只留第一个tab
while (dbmPaneList.size() > 1) {
dbmPaneList.remove(1);
}
((DBManipulationPane)dbmPaneList.get(0)).populateBean(null);
}
((DBManipulationPane) dbmPaneList.get(0)).populateBean(null);
}
@Override
@Override
/**
* 将JavaBean内的数据输出至界面上
*/
@ -131,11 +134,15 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 更新数据层JavaBean
*
* @return 返回JavaBean
*/
public Commit2DBJavaScript updateBean() {
Commit2DBJavaScript commit2dbJavaScript = new Commit2DBJavaScript();
public Commit2DBJavaScript updateBean() {
Commit2DBJavaScript commit2dbJavaScript = new Commit2DBJavaScript();
if (javaScriptActionPane.getResourceInfo() != null) {
commit2dbJavaScript.setJsResourceInfo(javaScriptActionPane.getResourceInfo());
}
List dbmaniList = new ArrayList();
for(int i = 0; i < this.dbmPaneList.size(); i++){
DBManipulationPane dbmpane =(DBManipulationPane)this.dbmPaneList.get(i);
@ -154,11 +161,12 @@ public class Commit2DBJavaScriptPane extends FurtherBasicBeanPane<Commit2DBJavaS
/**
* 判断是否是能接受的数据类型
*
* @param ob 对象
* @return 返回是否是能接受的数据类型
*/
public boolean accept(Object ob) {
return ob instanceof Commit2DBJavaScript;
}
public boolean accept(Object ob) {
return ob instanceof Commit2DBJavaScript;
}
}

15
designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java

@ -12,6 +12,7 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.form.ui.WebContentUtils;
import com.fr.js.JavaScript;
import com.fr.write.JavaScriptResourceInfo;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -29,6 +30,8 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
private List contentDBManiPane;
private JavaScriptResourceInfo resourceInfo;
private JavaScript call = null;
public JavaScriptActionPane() {
@ -75,6 +78,14 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
}
public JavaScriptResourceInfo getResourceInfo() {
return resourceInfo;
}
public void setResourceInfo(JavaScriptResourceInfo resourceInfo) {
this.resourceInfo = resourceInfo;
}
/**
* 生成回调函数的按钮
*
@ -182,8 +193,8 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
* @return 返回生成的面板
*/
public static JavaScriptActionPane createDefault() {
return new JavaScriptActionPane() {
public static JavaScriptActionPane createDefault() {
return new JavaScriptActionPane() {
@Override
public DBManipulationPane createDBManipulationPane() {
return new DBManipulationPane();

15
designer-base/src/main/java/com/fr/design/style/background/image/ImageFileChooser.java

@ -32,11 +32,7 @@ public class ImageFileChooser {
new JavaFxNativeFileChooser.Builder().
fileSelectionMode(FileSelectionMode.FILE).
title(Toolkit.i18nText("Fine-Design_Basic_Open")).
filters(new FileChooser.ExtensionFilter[]{
new FileChooser.ExtensionFilter("jpg", "*.jpg"),
new FileChooser.ExtensionFilter("gif", "*.gif"),
new FileChooser.ExtensionFilter("png", "*.png"),
new FileChooser.ExtensionFilter("bmp", "*.bmp")}).
filter(Toolkit.i18nText("Fine-Design_Basic_Image_Image_Files"), "*.jpg", "*.gif", "*.png", "*.bmp").
build();
}
@ -72,8 +68,13 @@ public class ImageFileChooser {
private void showImageCompressMoveTip() {
if (DesignerEnvManager.getEnvManager().isShowImageCompressMoveTip()) {
DesignerToastMsgUtil.toastWarning(Toolkit.i18nText("Fine-Design_Image_Compress_Move_Tip"));
DesignerEnvManager.getEnvManager().setShowImageCompressMoveTip(false);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
DesignerToastMsgUtil.toastWarning(Toolkit.i18nText("Fine-Design_Image_Compress_Move_Tip"));
DesignerEnvManager.getEnvManager().setShowImageCompressMoveTip(false);
}
});
}
}
}

9
designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java

@ -11,7 +11,14 @@ import com.fr.stable.os.OperatingSystem;
public class ModernUIPaneFactory {
public static <T> ModernUIPane.Builder<T> modernUIPaneBuilder() {
if (OperatingSystem.isWindows()) {
// 7.15的class不存在时 走老版本
boolean hasJxBrowserV7_15 = true;
try {
Class.forName("com.teamdev.jxbrowser.net.Scheme");
} catch (ClassNotFoundException e) {
hasJxBrowserV7_15 = false;
}
if (OperatingSystem.isWindows() && hasJxBrowserV7_15) {
return new NewModernUIPane.Builder<>();
} else {
return new ModernUIPane.Builder<>();

44
designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java

@ -16,15 +16,14 @@ import com.teamdev.jxbrowser.engine.Engine;
import com.teamdev.jxbrowser.engine.EngineOptions;
import com.teamdev.jxbrowser.engine.RenderingMode;
import com.teamdev.jxbrowser.js.JsObject;
import com.teamdev.jxbrowser.net.Network;
import com.teamdev.jxbrowser.net.callback.InterceptRequestCallback;
import com.teamdev.jxbrowser.net.Scheme;
import com.teamdev.jxbrowser.view.swing.BrowserView;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.Map;
import java.util.Optional;
import javax.swing.JDialog;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
@ -43,6 +42,8 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
private String namespace = "Pool";
private String variable = "data";
private String expression = "update()";
private Scheme scheme;
private NxInterceptRequestCallback requestCallback;
private NewModernUIPane() {
super();
@ -96,7 +97,13 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
}
private void initializeBrowser() {
Engine engine = Engine.newInstance(EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").build());
EngineOptions options;
if (scheme != null && requestCallback != null) {
options = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").addScheme(scheme, requestCallback).build();
} else {
options = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").build();
}
Engine engine = Engine.newInstance(options);
browser = engine.newBrowser();
// 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的
@ -124,8 +131,9 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
*/
@Override
public void redirect(String url, Map<String, String> map) {
Network network = browser.engine().network();
network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network, map));
if (requestCallback != null) {
requestCallback.setMap(map);
}
browser.navigation().loadUrl(url);
}
@ -169,8 +177,8 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
*/
@Override
public NewModernUIPane.Builder<T> withEMB(final String path) {
Network network = pane.browser.engine().network();
network.set(InterceptRequestCallback.class, new NxComplexInterceptRequestCallback(network, null));
pane.scheme = Scheme.of("emb");
pane.requestCallback = new NxComplexInterceptRequestCallback(null);
pane.browser.navigation().loadUrl("emb:" + path);
return this;
}
@ -182,8 +190,8 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
*/
@Override
public NewModernUIPane.Builder<T> withURL(final String url) {
Network network = pane.browser.engine().network();
network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network));
pane.scheme = Scheme.of("file");
pane.requestCallback = new NxComplexInterceptRequestCallback(null);
pane.browser.navigation().loadUrl(url);
return this;
}
@ -195,8 +203,8 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
*/
@Override
public NewModernUIPane.Builder<T> withURL(final String url, Map<String, String> map) {
Network network = pane.browser.engine().network();
network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network, map));
pane.scheme = Scheme.of("file");
pane.requestCallback = new NxInterceptRequestCallback(map);
pane.browser.navigation().loadUrl(url);
return this;
}
@ -208,8 +216,8 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
*/
@Override
public NewModernUIPane.Builder<T> withComponent(AssembleComponent component) {
Network network = pane.browser.engine().network();
network.set(InterceptRequestCallback.class, new NxComplexInterceptRequestCallback(network, component));
pane.scheme = Scheme.of("emb");
pane.requestCallback = new NxComplexInterceptRequestCallback(component);
pane.browser.navigation().loadUrl("emb:dynamic");
return this;
}
@ -221,8 +229,8 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
*/
@Override
public NewModernUIPane.Builder<T> withComponent(AssembleComponent component, Map<String, String> map) {
Network network = pane.browser.engine().network();
network.set(InterceptRequestCallback.class, new NxComplexInterceptRequestCallback(network, component, map));
pane.scheme = Scheme.of("emb");
pane.requestCallback = new NxComplexInterceptRequestCallback(component, map);
pane.browser.navigation().loadUrl("emb:dynamic");
return this;
}
@ -235,8 +243,8 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
*/
@Override
public NewModernUIPane.Builder<T> withHTML(String html) {
Network network = pane.browser.engine().network();
network.set(InterceptRequestCallback.class, new NxInterceptRequestCallback(network));
pane.scheme = Scheme.of("html");
pane.requestCallback = new NxInterceptRequestCallback();
pane.browser.mainFrame().ifPresent(frame -> {
frame.loadHtml(html);
});

16
designer-base/src/main/java/com/fr/design/ui/compatible/NxComplexInterceptRequestCallback.java

@ -9,9 +9,6 @@ import com.fr.web.struct.AtomBuilder;
import com.fr.web.struct.PathGroup;
import com.fr.web.struct.category.ScriptPath;
import com.fr.web.struct.category.StylePath;
import com.teamdev.jxbrowser.net.Network;
import com.teamdev.jxbrowser.net.UrlRequest;
import com.teamdev.jxbrowser.net.callback.InterceptRequestCallback;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
@ -26,21 +23,20 @@ public class NxComplexInterceptRequestCallback extends NxInterceptRequestCallbac
private AssembleComponent component;
public NxComplexInterceptRequestCallback(Network network, AssembleComponent component) {
super(network);
public NxComplexInterceptRequestCallback(AssembleComponent component) {
this.component = component;
}
public NxComplexInterceptRequestCallback(Network network, AssembleComponent component, Map<String, String> map) {
super(network, map);
public NxComplexInterceptRequestCallback(AssembleComponent component, Map<String, String> map) {
super(map);
this.component = component;
}
@Override
protected Response next(UrlRequest urlRequest, String path) {
protected Response next(Params params, String path) {
if (path.startsWith("emb:dynamic")) {
String text = htmlText(map);
return InterceptRequestCallback.Response.intercept(generateBasicUrlRequestJob(urlRequest, "text/html", text.getBytes(StandardCharsets.UTF_8)));
return Response.intercept(generateBasicUrlRequestJob(params, "text/html", text.getBytes(StandardCharsets.UTF_8)));
} else {
int index = path.indexOf("=");
if (index > 0) {
@ -52,7 +48,7 @@ public class NxComplexInterceptRequestCallback extends NxInterceptRequestCallbac
if (inputStream == null) {
return Response.proceed();
}
return InterceptRequestCallback.Response.intercept(generateBasicUrlRequestJob(urlRequest, getMimeType(path), IOUtils.inputStream2Bytes(inputStream)));
return Response.intercept(generateBasicUrlRequestJob(params, getMimeType(path), IOUtils.inputStream2Bytes(inputStream)));
}
}

34
designer-base/src/main/java/com/fr/design/ui/compatible/NxInterceptRequestCallback.java

@ -9,11 +9,10 @@ import com.fr.stable.StringUtils;
import com.fr.third.org.apache.commons.codec.net.URLCodec;
import com.teamdev.jxbrowser.net.HttpHeader;
import com.teamdev.jxbrowser.net.HttpStatus;
import com.teamdev.jxbrowser.net.Network;
import com.teamdev.jxbrowser.net.UrlRequest;
import com.teamdev.jxbrowser.net.UrlRequestJob;
import com.teamdev.jxbrowser.net.callback.InterceptRequestCallback;
import com.teamdev.jxbrowser.net.callback.InterceptUrlRequestCallback;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@ -29,17 +28,14 @@ import java.util.Optional;
* @version 10.0
* Created by richie on 2020/3/25
*/
public class NxInterceptRequestCallback implements InterceptRequestCallback {
public class NxInterceptRequestCallback implements InterceptUrlRequestCallback {
Network network;
Map<String, String> map;
public NxInterceptRequestCallback(Network network) {
this.network = network;
public NxInterceptRequestCallback() {
}
public NxInterceptRequestCallback(Network network, Map<String, String> map) {
this.network = network;
public NxInterceptRequestCallback(Map<String, String> map) {
this.map = map;
}
@ -48,21 +44,21 @@ public class NxInterceptRequestCallback implements InterceptRequestCallback {
UrlRequest urlRequest = params.urlRequest();
String path = urlRequest.url();
if (path.startsWith("file:")) {
Optional<UrlRequestJob> optional = generateFileProtocolUrlRequestJob(urlRequest, path);
Optional<UrlRequestJob> optional = generateFileProtocolUrlRequestJob(params, path);
if (optional.isPresent()) {
return InterceptRequestCallback.Response.intercept(optional.get());
return Response.intercept(optional.get());
}
} else {
return next(urlRequest, path);
return next(params, path);
}
return Response.proceed();
}
Response next(UrlRequest urlRequest, String path) {
Response next(Params params, String path) {
return Response.proceed();
}
private Optional<UrlRequestJob> generateFileProtocolUrlRequestJob(UrlRequest urlRequest, String path) {
private Optional<UrlRequestJob> generateFileProtocolUrlRequestJob(Params params, String path) {
try {
String url = new URLCodec().decode(path);
String filePath = TemplateUtils.renderParameter4Tpl(url, map);
@ -77,7 +73,7 @@ public class NxInterceptRequestCallback implements InterceptRequestCallback {
} else {
bytes = IOUtils.inputStream2Bytes(inputStream);
}
return Optional.of(generateBasicUrlRequestJob(urlRequest, mimeType, bytes));
return Optional.of(generateBasicUrlRequestJob(params, mimeType, bytes));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
@ -88,12 +84,12 @@ public class NxInterceptRequestCallback implements InterceptRequestCallback {
return ArrayUtils.contains(new String[]{"text/html", "text/javascript", "text/css"}, mimeType);
}
UrlRequestJob generateBasicUrlRequestJob(UrlRequest urlRequest, String mimeType, byte[] bytes) {
UrlRequestJob generateBasicUrlRequestJob(Params params, String mimeType, byte[] bytes) {
UrlRequestJob.Options options = UrlRequestJob.Options
.newBuilder(urlRequest.id(), HttpStatus.OK)
.newBuilder(HttpStatus.OK)
.addHttpHeader(HttpHeader.of("Content-Type", mimeType))
.build();
UrlRequestJob urlRequestJob = network.newUrlRequestJob(options);
UrlRequestJob urlRequestJob = params.newUrlRequestJob(options);
urlRequestJob.write(bytes);
urlRequestJob.complete();
return urlRequestJob;
@ -145,4 +141,8 @@ public class NxInterceptRequestCallback implements InterceptRequestCallback {
return "text/html";
}
}
public void setMap(Map<String, String> map) {
this.map = map;
}
}

204
designer-chart/src/main/java/com/fr/design/gui/xcombox/MarkerComboBox.java

@ -8,110 +8,122 @@ import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.base.background.ColorBackground;
import com.fr.chart.chartglyph.Marker;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.ConfigHelper;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.plugin.chart.ConfigHelper;
import javax.swing.*;
import java.awt.*;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JLabel;
import javax.swing.JList;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
/**
* Combobox for selecting marker.
*/
public class MarkerComboBox extends UIComboBox {
private static final double TEXT_X_COORDINATES = 12d;
/**
* Constructor.
*
* @param markerArray the array of marker.
*/
public MarkerComboBox(Marker[] markerArray) {
this.setModel(new DefaultComboBoxModel(markerArray));
this.setRenderer(new MarkerCellRenderer());
}
/**
* Get selected marker.
*/
public Marker getSelectedMarkder() {
return (Marker) getSelectedItem();
}
/**
* Set the selected marker.
*/
public void setSelectedMarker(Marker marker) {
setSelectedItem(marker);
}
/**
* CellRenderer.
*/
class MarkerCellRenderer extends UIComboBoxRenderer {
public Component getListCellRendererComponent(JList list,
Object value, int index, boolean isSelected, boolean cellHasFocus) {
this.marker = (Marker) value;
this.isSelected = isSelected;
return this;
}
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Dimension d = getSize();
g2d.setColor(Color.black);
g2d.setFont(FRContext.getDefaultValues().getFRFont());
if (marker != null) {
boolean isAutoMarker = ComparatorUtils.equals(marker.getMarkerType(), ConfigHelper.AUTO_M);
boolean isNullMarker = ComparatorUtils.equals(marker.getMarkerType(), ConfigHelper.NULL_M);
if (isAutoMarker || isNullMarker) {
String text = isNullMarker
?Toolkit.i18nText("Fine-Design_Report_None")
:Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto");
paintTextMarker(g2d, d, text);
} else {
if (marker.getBackground() == null) {
marker.setBackground(ColorBackground.getInstance(Color.black));
}
marker.paint(g2d, d.width / 2, d.height / 2);
}
}
if (isSelected) {
g2d.setColor(Color.blue);
GraphHelper.drawRect(g2d, 0, 0, d.width - 1, d.height - 1);
}
}
public Dimension getPreferredSize() {
return new Dimension(36, 16);
}
public Dimension getMinimumSize() {
return getPreferredSize();
}
private Marker marker = null;
private boolean isSelected = false;
private void paintTextMarker(Graphics2D g2d, Dimension d, String text) {
g2d.setColor(Color.black);
FRFont font = FRContext.getDefaultValues().getFRFont();
int resolution = ScreenResolution.getScreenResolution();
Font rfont = font.applyResolutionNP(resolution);
g2d.setFont(rfont);
FontMetrics fm = GraphHelper.getFontMetrics(rfont);
GraphHelper.drawString(g2d, text, TEXT_X_COORDINATES, (d.height - fm.getHeight()) / 2 + fm.getAscent());
}
}
private static final double TEXT_X_COORDINATES = 12d;
/**
* Constructor.
*
* @param markerArray the array of marker.
*/
public MarkerComboBox(Marker[] markerArray) {
this.setModel(new DefaultComboBoxModel(markerArray));
this.setRenderer(new MarkerCellRenderer());
}
/**
* Get selected marker.
*/
public Marker getSelectedMarkder() {
return (Marker) getSelectedItem();
}
/**
* Set the selected marker.
*/
public void setSelectedMarker(Marker marker) {
setSelectedItem(marker);
}
/**
* CellRenderer.
*/
class MarkerCellRenderer extends UIComboBoxRenderer {
private Marker marker = null;
private boolean isSelected = false;
public Component getListCellRendererComponent(JList list,
Object value, int index, boolean isSelected, boolean cellHasFocus) {
this.marker = (Marker) value;
this.isSelected = isSelected;
String text = null;
if (marker != null) {
boolean isAutoMarker = ComparatorUtils.equals(marker.getMarkerType(), ConfigHelper.AUTO_M);
boolean isNullMarker = ComparatorUtils.equals(marker.getMarkerType(), ConfigHelper.NULL_M);
if (isAutoMarker || isNullMarker) {
text = isNullMarker
? Toolkit.i18nText("Fine-Design_Report_None")
: Toolkit.i18nText("Fine-Design_Basic_ChartF_Auto");
}
}
JLabel comp = (JLabel) super.getListCellRendererComponent(list, text, index, isSelected, cellHasFocus);
return comp;
}
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Dimension d = getSize();
if (marker != null) {
boolean isAutoMarker = ComparatorUtils.equals(marker.getMarkerType(), ConfigHelper.AUTO_M);
boolean isNullMarker = ComparatorUtils.equals(marker.getMarkerType(), ConfigHelper.NULL_M);
if (isAutoMarker || isNullMarker) {
super.paint(g);
} else {
g2d.setColor(Color.black);
if (marker.getBackground() == null) {
marker.setBackground(ColorBackground.getInstance(Color.black));
}
marker.paint(g2d, d.width / 2, d.height / 2);
}
}
if (isSelected) {
g2d.setColor(Color.blue);
GraphHelper.drawRect(g2d, 0, 0, d.width - 1, d.height - 1);
}
}
public Dimension getPreferredSize() {
return new Dimension(36, 16);
}
public Dimension getMinimumSize() {
return getPreferredSize();
}
private void paintTextMarker(Graphics2D g2d, Dimension d, String text) {
g2d.setColor(Color.black);
FRFont font = FRContext.getDefaultValues().getFRFont();
int resolution = ScreenResolution.getScreenResolution();
Font rfont = font.applyResolutionNP(resolution);
g2d.setFont(rfont);
FontMetrics fm = GraphHelper.getFontMetrics(rfont);
GraphHelper.drawString(g2d, text, TEXT_X_COORDINATES, (d.height - fm.getHeight()) / 2 + fm.getAscent());
}
}
}

17
designer-chart/src/main/java/com/fr/van/chart/designer/component/LineTypeComboBox.java

@ -1,12 +1,9 @@
package com.fr.van.chart.designer.component;
import com.fr.base.FRContext;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.i18n.Toolkit;
import com.fr.general.FRFont;
import com.fr.plugin.chart.type.LineType;
import com.fr.stable.Constants;
@ -14,8 +11,6 @@ import javax.swing.JLabel;
import javax.swing.JList;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
@ -37,9 +32,9 @@ public class LineTypeComboBox extends UIComboBox {
public Component getListCellRendererComponent(
JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel comp = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
this.lineType = (LineType) value;
comp.setText(null);
value = lineType == LineType.NONE ? Toolkit.i18nText("Fine-Design_Report_None") : null;
JLabel comp = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
return comp;
}
@ -51,14 +46,6 @@ public class LineTypeComboBox extends UIComboBox {
g2d.setColor(getForeground());
switch (this.lineType) {
case NONE:
FRFont font = FRContext.getDefaultValues().getFRFont();
int resolution = ScreenResolution.getScreenResolution();
Font rfont = font.applyResolutionNP(resolution);
g2d.setFont(rfont);
FontMetrics fm = GraphHelper.getFontMetrics(rfont);
GraphHelper.drawString(g2d, Toolkit.i18nText("Fine-Design_Report_None"), 4, (d.height - fm.getHeight()) / 2 + fm.getAscent());
break;
case SOLID:
GraphHelper.drawLine(g2d, 4, d.height / 2, d.width - 8, d.height / 2);
break;

19
designer-form/src/main/java/com/fr/design/mainframe/FormSpacingLineDrawer.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.utils.ComponentUtils;
import com.fr.stable.Constants;
import com.fr.stable.GraphDrawHelper;
@ -23,6 +24,7 @@ public class FormSpacingLineDrawer {
private FormDesigner designer;
private XCreator hoverCreator = null;
private Rectangle selectedRec;
private Rectangle hoveredRec;
private boolean isMouseMoveEvent = false;
public FormSpacingLineDrawer(FormDesigner designer) {
@ -38,7 +40,6 @@ public class FormSpacingLineDrawer {
}
public void draw(Graphics g) {
this.selectedRec = designer.getSelectionModel().getSelection().getSelctionBounds();
if (!isDrawSpacingLine()) {
return;
}
@ -47,6 +48,9 @@ public class FormSpacingLineDrawer {
return;
}
this.selectedRec = designer.getSelectionModel().getSelection().getRelativeBounds();
this.hoveredRec = ComponentUtils.getRelativeBounds(hoverCreator);
drawHorizontalSpacingLine(g);
drawVerticalSpacingLine(g);
}
@ -158,8 +162,8 @@ public class FormSpacingLineDrawer {
};
AbstractFormParallelLine[] hoveredCreatorSides = new AbstractFormParallelLine[] {
new FormHorizontalParallelLine(hoverCreator.getY(), hoverCreator.getX(), hoverCreator.getX() + hoverCreator.getWidth()),
new FormHorizontalParallelLine(hoverCreator.getY() + hoverCreator.getHeight(), hoverCreator.getX(), hoverCreator.getX() + hoverCreator.getWidth())
new FormHorizontalParallelLine(hoveredRec.y, hoveredRec.x, hoveredRec.x + hoveredRec.width),
new FormHorizontalParallelLine(hoveredRec.y + hoveredRec.height, hoveredRec.x, hoveredRec.x + hoveredRec.width)
};
return getNearestSide(selectedRecSides, hoveredCreatorSides);
}
@ -171,19 +175,20 @@ public class FormSpacingLineDrawer {
};
AbstractFormParallelLine[] hoveredCreatorSides = new AbstractFormParallelLine[] {
new FormVerticalParallelLine(hoverCreator.getX(), hoverCreator.getY(), hoverCreator.getY() + hoverCreator.getHeight()),
new FormVerticalParallelLine(hoverCreator.getX() + hoverCreator.getWidth(), hoverCreator.getY(), hoverCreator.getY() + hoverCreator.getHeight())
new FormVerticalParallelLine(hoveredRec.x, hoveredRec.y, hoveredRec.y + hoveredRec.height),
new FormVerticalParallelLine(hoveredRec.x + hoveredRec.width, hoveredRec.y, hoveredRec.y + hoveredRec.height)
};
return getNearestSide(selectedRecSides, hoveredCreatorSides);
}
private AbstractFormParallelLine[] getNearestSide(AbstractFormParallelLine[] lines1, AbstractFormParallelLine[] lines2) {
AbstractFormParallelLine[] nearestSides = new AbstractFormParallelLine[2];
AbstractFormParallelLine[] nearestSides = new AbstractFormParallelLine[] {lines1[0], lines2[0]};
int minDistance = lines1[0].getDistanceWithLine(lines2[0]);
for (int i = 0; i < lines1.length; i++) {
for (int j = 0; j < lines2.length; j++) {
int distance = lines1[i].getDistanceWithLine(lines2[j]);
if (distance <= minDistance) {
if (distance < minDistance) {
minDistance = distance;
nearestSides[0] = lines1[i];
nearestSides[1] = lines2[j];
}

44
designer-form/src/main/java/com/fr/design/mainframe/MultiSelectionArrangement.java

@ -1,6 +1,12 @@
package com.fr.design.mainframe;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.form.ui.container.WLayout;
import java.awt.Rectangle;
import java.util.Arrays;
@ -10,6 +16,7 @@ import java.util.List;
public class MultiSelectionArrangement {
private FormDesigner designer;
private XLayoutContainer parent; // 当前选中的那些组件所在父容器
private List<XCreator> selectedCreators;
private Rectangle rec;
@ -22,42 +29,42 @@ public class MultiSelectionArrangement {
for (XCreator creator : selectedCreators) {
creator.setLocation(rec.x, creator.getY());
}
repaint();
update();
}
public void rightAlign() {
for (XCreator creator : selectedCreators) {
creator.setLocation(rec.x + rec.width - creator.getWidth(), creator.getY());
}
repaint();
update();
}
public void topAlign() {
for (XCreator creator : selectedCreators) {
creator.setLocation(creator.getX(), rec.y);
}
repaint();
update();
}
public void bottomAlign() {
for (XCreator creator : selectedCreators) {
creator.setLocation(creator.getX(), rec.y + rec.height - creator.getHeight());
}
repaint();
update();
}
public void horizontalCenterAlign() {
for (XCreator creator : selectedCreators) {
creator.setLocation(rec.x + rec.width / 2 - creator.getWidth() / 2, creator.getY());
}
repaint();
update();
}
public void verticalCenterAlign() {
for (XCreator creator : selectedCreators) {
creator.setLocation(creator.getX(), rec.y + rec.height / 2 - creator.getHeight() / 2);
}
repaint();
update();
}
// 水平分布,自动,间距由selectedCreators和border共同计算而来
@ -79,7 +86,7 @@ public class MultiSelectionArrangement {
XCreator preCreator = selectedCreators.get(i - 1);
creator.setLocation(preCreator.getX() + preCreator.getWidth() + gap, creator.getY());
}
repaint();
update();
}
private void reSizeRecByHorizontal(int gap) {
@ -151,7 +158,7 @@ public class MultiSelectionArrangement {
XCreator preCreator = selectedCreators.get(i - 1);
creator.setLocation(creator.getX(), preCreator.getY() + preCreator.getHeight() + gap);
}
repaint();
update();
}
private void reSizeRecByVertical(int gap) {
@ -209,10 +216,25 @@ public class MultiSelectionArrangement {
FormSelection selection = designer.getSelectionModel().getSelection();
this.selectedCreators = Arrays.asList(selection.getSelectedCreators());
this.rec = selection.getSelctionBounds();
this.parent = getParent(selection.getSelectedCreator());
if (parent != null) {
// 这里要修改修改engine里面的对象才能成功保存,光修改设计器对象没用
WLayout wabs = parent.toData();
for (XCreator creator : selectedCreators) {
wabs.setBounds(creator.toData(), creator.getBounds());
}
}
}
private void repaint() {
designer.repaint();
update();
private XLayoutContainer getParent(XCreator source) {
if(source.acceptType(XWCardTagLayout.class)){
return (XLayoutContainer)source.getParent();
}
XLayoutContainer container = XCreatorUtils.getParentXLayoutContainer(source);
if (source.acceptType(XWFitLayout.class) || source.acceptType(XWParameterLayout.class)) {
container = null;
}
return container;
}
}

14
designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java

@ -412,20 +412,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
if (!isValid) {
return;
}
//fanglei:下面的注释不要删,只是暂时屏蔽
// int value = downPanel.getVerticalScrollBar().getValue();
// if (hasSelectParaPane(getEditingFormDesigner())) {
// cardLayout.show(centerPane, PARA);
// mobileParaWidgetTable.refreshData();
// } else {
// cardLayout.show(centerPane, BODY);
// mobileWidgetTable.refreshData();
// }
// //出现滚动条
// downPanel.doLayout();
// //控件列表选中某组件,触发表单中选中控件,选中事件又触发列表刷新,滚动条回到0
// //此处设置滚动条值为刷新前
// downPanel.getVerticalScrollBar().setValue(value);
if (mobileExtraPropertyPanes != null) {
for (MobileWidgetDefinePane extraPane : mobileExtraPropertyPanes) {
extraPane.populate(designer);

27
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/AbstractMultiSelectionArrangementButton.java

@ -1,23 +1,32 @@
package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.MultiSelectionArrangement;
public abstract class AbstractMultiSelectionArrangementButton implements MultiSelectionArrangementButton {
public abstract class AbstractMultiSelectionArrangementButton extends UIButton implements MultiSelectionArrangementButton, UIObserver {
private static final long serialVersionUID = -2114423583742242771L;
protected MultiSelectionArrangement arrangement;
protected UIObserverListener uiObserverListener;
public AbstractMultiSelectionArrangementButton(MultiSelectionArrangement arrangement) {
super();
this.arrangement = arrangement;
this.setNormalPainted(false);
this.setBorderPaintedOnlyWhenPressed(true);
this.setIcon(getIcon());
this.setToolTipText(getTipText());
this.addActionListener(getActionListener());
}
@Override
public UIButton create() {
UIButton btn = new UIButton();
btn.setNormalPainted(false);
btn.setBorderPaintedOnlyWhenPressed(true);
btn.setIcon(getIcon());
btn.setToolTipText(getTipText());
btn.addActionListener(getActionListener());
return btn;
public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener;
}
@Override
public boolean shouldResponseChangeListener() {
return true;
}
}

1
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/BottomAlignButton.java

@ -29,6 +29,7 @@ public class BottomAlignButton extends AbstractMultiSelectionArrangementButton {
@Override
public void actionPerformed(ActionEvent e) {
arrangement.bottomAlign();
uiObserverListener.doChange();
}
};
}

1
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalCenterButton.java

@ -29,6 +29,7 @@ public class HorizontalCenterButton extends AbstractMultiSelectionArrangementBut
@Override
public void actionPerformed(ActionEvent e) {
arrangement.horizontalCenterAlign();
uiObserverListener.doChange();
}
};
}

1
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/HorizontalDistributionButton.java

@ -29,6 +29,7 @@ public class HorizontalDistributionButton extends AbstractMultiSelectionArrangem
@Override
public void actionPerformed(ActionEvent e) {
arrangement.horizontalAutoDistribution();
uiObserverListener.doChange();
}
};
}

1
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/LeftAlignButton.java

@ -29,6 +29,7 @@ public class LeftAlignButton extends AbstractMultiSelectionArrangementButton {
@Override
public void actionPerformed(ActionEvent e) {
arrangement.leftAlign();
uiObserverListener.doChange();
}
};
}

4
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/MultiSelectionArrangementButton.java

@ -1,7 +1,5 @@
package com.fr.design.mainframe.widget.arrangement.buttons;
import com.fr.design.gui.ibutton.UIButton;
import javax.swing.Icon;
import java.awt.event.ActionListener;
@ -11,6 +9,4 @@ public interface MultiSelectionArrangementButton {
String getTipText();
ActionListener getActionListener();
UIButton create();
}

1
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/RightAlignButton.java

@ -29,6 +29,7 @@ public class RightAlignButton extends AbstractMultiSelectionArrangementButton {
@Override
public void actionPerformed(ActionEvent e) {
arrangement.rightAlign();
uiObserverListener.doChange();
}
};
}

1
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/TopAlignButton.java

@ -29,6 +29,7 @@ public class TopAlignButton extends AbstractMultiSelectionArrangementButton {
@Override
public void actionPerformed(ActionEvent e) {
arrangement.topAlign();
uiObserverListener.doChange();
}
};
}

1
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalCenterButton.java

@ -29,6 +29,7 @@ public class VerticalCenterButton extends AbstractMultiSelectionArrangementButto
@Override
public void actionPerformed(ActionEvent e) {
arrangement.verticalCenterAlign();
uiObserverListener.doChange();
}
};
}

1
designer-form/src/main/java/com/fr/design/mainframe/widget/arrangement/buttons/VerticalDistributionButton.java

@ -29,6 +29,7 @@ public class VerticalDistributionButton extends AbstractMultiSelectionArrangemen
@Override
public void actionPerformed(ActionEvent e) {
arrangement.verticalAutoDistribution();
uiObserverListener.doChange();
}
};
}

84
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java

@ -1,8 +1,10 @@
package com.fr.design.mainframe.widget.ui;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UIIntNumberField;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
@ -19,6 +21,7 @@ import com.fr.design.mainframe.widget.arrangement.buttons.VerticalCenterButton;
import com.fr.design.mainframe.widget.arrangement.buttons.VerticalDistributionButton;
import com.fr.general.IOUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -26,8 +29,11 @@ import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
public class FormMultiWidgetCardPane extends FormWidgetCardPane {
private AttributeChangeListener listener;
private MultiSelectionArrangement arrangement;
public FormMultiWidgetCardPane(FormDesigner designer) {
@ -38,6 +44,12 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane {
arrangement = new MultiSelectionArrangement(designer);
content.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0));
content.add(createArrangementLayoutPane(), BorderLayout.CENTER);
this.listener = new AttributeChangeListener() {
@Override
public void attributeChange() {
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_RESIZED);
}
};
}
// 整个排列分布面板的layout,可以看成一个三行一列的表格,第一行是分布,第二行是自动间距,第三行是手动间距
@ -71,12 +83,12 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane {
};
Component[][] components = new Component[][] {
new Component[] {
new LeftAlignButton(arrangement).create(),
new HorizontalCenterButton(arrangement).create(),
new RightAlignButton(arrangement).create(),
new TopAlignButton(arrangement).create(),
new VerticalCenterButton(arrangement).create(),
new BottomAlignButton(arrangement).create()
new LeftAlignButton(arrangement),
new HorizontalCenterButton(arrangement),
new RightAlignButton(arrangement),
new TopAlignButton(arrangement),
new VerticalCenterButton(arrangement),
new BottomAlignButton(arrangement)
}
};
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 18, 0);
@ -90,8 +102,8 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane {
TableLayout.PREFERRED,
TableLayout.PREFERRED
};
UIButton horizontalAutoSpacingBtn = new HorizontalDistributionButton(arrangement).create();
UIButton verticalAutoSpacingBtn = new VerticalDistributionButton(arrangement).create();
UIButton horizontalAutoSpacingBtn = new HorizontalDistributionButton(arrangement);
UIButton verticalAutoSpacingBtn = new VerticalDistributionButton(arrangement);
if (designer.getSelectionModel().getSelection().size() < 3) {
horizontalAutoSpacingBtn.setEnabled(false);
verticalAutoSpacingBtn.setEnabled(false);
@ -129,20 +141,8 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane {
TableLayout.PREFERRED,
TableLayout.FILL
};
UITextField horizontalSpacingNumberField = new UIIntNumberField();
horizontalSpacingNumberField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
distributionDoChange(horizontalSpacingNumberField.getText(), false);
}
});
UITextField verticalSpacingNumberField = new UIIntNumberField();
verticalSpacingNumberField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
distributionDoChange(verticalSpacingNumberField.getText(), true);
}
});
UITextField horizontalSpacingNumberField = createIntNumberField(false, Toolkit.i18nText("Fine-Design_Multi_Selection_Manual_Horizontal_Spacing_Tip"));
UITextField verticalSpacingNumberField = createIntNumberField(true, Toolkit.i18nText("Fine-Design_Multi_Selection_Manual_Vertical_Spacing_Tip"));
Component[][] components = new Component[][] {
new Component[] {
new UILabel(IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_horizontal_spacing.png")),
@ -157,13 +157,37 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane {
return createTitleLayout(Toolkit.i18nText("Fine-Design_Multi_Selection_Manual_Spacing"), centerPane);
}
private void distributionDoChange(String text, boolean isVertical) {
if (StableUtils.isNumber(text)) {
private UINumberField createIntNumberField(boolean isVertical, String tipText) {
final UINumberField numberField = new UINumberField();
numberField.setPlaceholder(tipText);
numberField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
distributionDoChange(numberField, isVertical);
}
});
numberField.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
distributionDoChange(numberField, isVertical);
}
}
});
return numberField;
}
private void distributionDoChange(UINumberField numberField, boolean isVertical) {
String text = numberField.getText();
if (StringUtils.isNotEmpty(text) && StableUtils.isNumber(text)) {
int gap = (int) Math.floor(Float.parseFloat(text));
numberField.setValue(gap);
if (isVertical) {
arrangement.verticalManualDistribution(Math.round(Float.parseFloat(text)));
arrangement.verticalManualDistribution(gap);
} else {
arrangement.horizontalManualDistribution(Math.round(Float.parseFloat(text)));
arrangement.horizontalManualDistribution(gap);
}
attributeChanged();
}
}
@ -175,4 +199,10 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane {
jPanel.add(centerPane, BorderLayout.CENTER);
return jPanel;
}
@Override
public void populate() {
initListener(this);
this.addAttributeChangeListener(listener);
}
}

10
designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java

@ -15,6 +15,8 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.form.event.Listener;
import com.fr.js.JavaScript;
import com.fr.report.web.util.ReportEngineEventMapping;
import com.fr.write.JavaScriptResourceInfo;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -44,6 +46,8 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
private Listener listener;
JavaScriptActionPane javaScriptActionPane;
public ListenerEditPane() {
this.initComponents(new String[0]);
}
@ -87,7 +91,8 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
// 提交入库
List dbManiList = new ArrayList();
dbManiList.add(autoCreateDBManipulationPane());
Commit2DBJavaScriptPane commit2DBJavaScriptPane = new Commit2DBJavaScriptPane(JavaScriptActionPane.createDefaultJavaScriptActionPane(),
javaScriptActionPane = JavaScriptActionPane.createDefaultJavaScriptActionPane();
Commit2DBJavaScriptPane commit2DBJavaScriptPane = new Commit2DBJavaScriptPane(javaScriptActionPane,
dbManiList);
hyperlinkPane.add(DBCOMMIT, commit2DBJavaScriptPane);
// 自定义事件
@ -176,9 +181,12 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
@Override
public Listener updateBean() {
String actionLocaleName = ReportEngineEventMapping.getLocaleName(listener.getEventName());
javaScriptActionPane.setResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.WEB_CONFIG, Toolkit.i18nText(actionLocaleName)));
this.listener.setEventName(this.nameText.getText());
FurtherBasicBeanPane<? extends JavaScript> pane = this.cards.get(this.styleBox.getSelectedIndex());
this.listener.setAction(pane.updateBean());
return this.listener;
}
}

10
designer-realize/src/main/java/com/fr/design/mainframe/AuthorityToolBarPane.java

@ -185,7 +185,7 @@ public class AuthorityToolBarPane<T extends WebContent> extends BasicBeanPane<Re
*/
private void checkToolBarPaneEnable() {
List<ToolBarButton> toolBarButtons = toolBarPane.getToolBarButtons();
boolean isnotEnable = ComparatorUtils.equals(title.getText(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Server_Toolbar_Choose_Role"))&& !WorkContext.getCurrent().isRoot();
boolean isnotEnable = ComparatorUtils.equals(title.getText(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Server_Toolbar_Choose_Role")) && !WorkContext.getCurrent().isRoot();
for (ToolBarButton button : toolBarButtons) {
button.setEnabled(!isnotEnable);
}
@ -296,9 +296,15 @@ public class AuthorityToolBarPane<T extends WebContent> extends BasicBeanPane<Re
if (toolBarManager.length == 0) {
return;
}
ToolBar resultToolbar = new ToolBar();
for (int i = 0; i < toolBarManager.length; i++) {
toolBarPane.populateBean(toolBarManager[i].getToolBar());
ToolBar toolBar = toolBarManager[i].getToolBar();
for (int j = 0; j < toolBar.getWidgetSize(); j++) {
Widget widget = toolBar.getWidget(j);
resultToolbar.addWidget(widget);
}
}
toolBarPane.populateBean(resultToolbar);
}

1175
designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java

File diff suppressed because it is too large Load Diff

3
designer-realize/src/main/java/com/fr/design/widget/CellWidgetCardPane.java

@ -14,7 +14,6 @@ import com.fr.design.widget.ui.BasicWidgetPropertySettingPane;
import com.fr.form.event.Listener;
import com.fr.form.ui.Widget;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
@ -166,7 +165,7 @@ public class CellWidgetCardPane extends BasicPane {
}
widgetPropertyPane.update(widget);
Listener[] listener = eventPane == null ? new Listener[0] : eventPane.updateListeners();
Listener[] listener = eventPane == null ? new Listener[0] : eventPane.updateListeners(widget);
widget.clearListeners();
for (Listener l : listener) {
widget.addListener(l);

50
designer-realize/src/main/java/com/fr/design/widget/WidgetEventPane.java

@ -1,29 +1,30 @@
package com.fr.design.widget;
import java.lang.reflect.Constructor;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.UIListGroupControlPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.CellWidgetPropertyPane;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.design.write.submit.SmartInsertDBManipulationInWidgetEventPane;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListGroupControlPane;
import com.fr.design.gui.frpane.ListenerUpdatePane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.javascript.JavaScriptActionPane;
import com.fr.design.mainframe.CellWidgetPropertyPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.design.write.submit.SmartInsertDBManipulationInWidgetEventPane;
import com.fr.form.event.Listener;
import com.fr.form.ui.Widget;
import com.fr.grid.selection.Selection;
import com.fr.general.NameObject;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
import com.fr.js.Commit2DBJavaScript;
import com.fr.stable.AssistUtils;
import com.fr.stable.Nameable;
import com.fr.write.JavaScriptResourceInfo;
import javax.swing.*;
import javax.swing.BorderFactory;
import java.lang.reflect.Constructor;
public class WidgetEventPane extends UIListGroupControlPane {
private static final Selection NO_SELECTION = new CellSelection(-1, -1, -1, -1);
@ -32,9 +33,11 @@ public class WidgetEventPane extends UIListGroupControlPane {
private ElementCasePane object;
private Widget targetWidget;
public WidgetEventPane(ElementCasePane pane) {
this.object = pane;
if(pane != null){
if (pane != null) {
selection = pane.getSelection();
}
setBorder(BorderFactory.createEmptyBorder(10, 0, 15, 0));
@ -125,18 +128,21 @@ public class WidgetEventPane extends UIListGroupControlPane {
if (widget == null) {
return;
}
this.targetWidget = widget;
refreshPane(widget, EventCreator.createEventCreator(widget.supportedEvents(), WidgetEventListenerUpdatePane.class));
}
/**
* 更新
* @return 监听器
*/
public Listener[] updateListeners() {
/**
* 更新
*
* @return 监听器
*/
public Listener[] updateListeners(Widget widget) {
this.targetWidget = widget;
Nameable[] res = this.update();
Listener[] res_array = new Listener[res.length];
for (int i = 0, len = res.length; i < len; i++) {
res_array[i] = (Listener) ((NameObject)res[i]).getObject();
res_array[i] = (Listener) ((NameObject) res[i]).getObject();
}
return res_array;
}
@ -174,14 +180,22 @@ public class WidgetEventPane extends UIListGroupControlPane {
if (constructor != null) {
return constructor;
} else {
if (AssistUtils.equals(cls.getName(),Object.class.getName())) {
if (AssistUtils.equals(cls.getName(), Object.class.getName())) {
return null;
}
return getConstructor(clazz, cls.getSuperclass());
}
}
protected String getWrapperLabelText(){
@Override
public void wrapperListener(Listener listener) {
if (listener.getAction() instanceof Commit2DBJavaScript) {
Commit2DBJavaScript commit2DBJavaScript = (Commit2DBJavaScript) listener.getAction();
commit2DBJavaScript.setJsResourceInfo(new JavaScriptResourceInfo(JavaScriptResourceInfo.Type.WIDGET, targetWidget.getWidgetName()));
}
}
protected String getWrapperLabelText() {
return Toolkit.i18nText("Fine-Design_Report_Event");
}

5
designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

@ -59,7 +59,7 @@ public class DesignerWorkspaceProvider extends Activator {
Workspace workspace = DesignerWorkspaceGenerator.generate(workspaceInfo);
boolean checkValid = workspace != null && workspaceInfo.checkValid();
if (!checkValid) {
EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner();
EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner(null, workspaceInfo);
} else {
WorkContext.switchTo(workspace);
//在设计器完全启动完成后,对初始环境进行一次服务检测,对主要功能无影响,异常仅做日志提示即可
@ -76,8 +76,7 @@ public class DesignerWorkspaceProvider extends Activator {
});
}
} catch (Throwable e) {
RemoteDesignExceptionHandler.getInstance().handleInStart(e, workspaceInfo);
EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner();
EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner(e, workspaceInfo);
}
}
pluginErrorRemind();

Loading…
Cancel
Save