Browse Source

Pull request #1640: 无jira任务, bugfix -> release

Merge in DESIGN/design from bugfix/10.0 to release/10.0

* commit 'd03f0e35397579281a15ce9905dcfd2366f923f2':
  REPORT-26837 非法数据集名称
  REPORT-28922 正如zack所说,列数较少的情况没有测试过
  REPORT-29864 服务器数据集重命名问题
feature/big-screen
neil 5 years ago
parent
commit
6bb899e796
  1. 6
      designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java
  2. 12
      designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
  3. 2
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  4. 36
      designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java
  5. 4
      designer-base/src/main/java/com/fr/design/data/datapane/ReportTableDataPane.java
  6. 9
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  7. 4
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataDefinedPane.java
  8. 3
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java
  9. 5
      designer-base/src/main/java/com/fr/design/dialog/UIDialog.java
  10. 44
      designer-base/src/test/java/com/fr/design/data/BasicTableDataUtilsTest.java

6
designer-base/src/main/java/com/fr/design/actions/TableDataSourceAction.java

@ -42,11 +42,15 @@ public class TableDataSourceAction extends TemplateComponentAction<JTemplate<?,
populate(tds); populate(tds);
} }
}; };
BasicDialog reportTableDataDialog = tableDataPane.showLargeWindow(SwingUtilities.getWindowAncestor(this.getEditingComponent()), null); final BasicDialog reportTableDataDialog = tableDataPane.showLargeWindow(SwingUtilities.getWindowAncestor(this.getEditingComponent()), null);
reportTableDataDialog.addDialogActionListener(new DialogActionAdapter() { reportTableDataDialog.addDialogActionListener(new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
if (!tableDataPane.isNamePermitted()) {
reportTableDataDialog.setDoOKSucceed(false);
return;
}
DesignModelAdapter.getCurrentModelAdapter().renameTableData(tableDataPane.getDsNameChangedMap()); DesignModelAdapter.getCurrentModelAdapter().renameTableData(tableDataPane.getDsNameChangedMap());
tableDataPane.update(tds); tableDataPane.update(tds);
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());

12
designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java

@ -77,17 +77,7 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
} }
protected void renameConnection(final String oldName, final String newName) { protected void renameConnection(final String oldName, final String newName) {
Configurations.update(new Worker() { tableDataConfig.renameTableData(oldName, newName);
@Override
public void run() {
tableDataConfig.renameTableData(oldName, newName);
}
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{TableDataConfig.class, ProcedureConfig.class};
}
});
} }
}; };
final BasicDialog globalTableDataDialog = globalTableDataPane.showLargeWindow(designerFrame, null); final BasicDialog globalTableDataDialog = globalTableDataPane.showLargeWindow(designerFrame, null);

2
designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java

@ -137,6 +137,8 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
nPanel.setShowText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Stored_Procedure_Name_Tips")); nPanel.setShowText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Stored_Procedure_Name_Tips"));
dg.setButtonEnabled(false); dg.setButtonEnabled(false);
} }
} else if (!BasicTableDataUtils.checkName(tempName)) {
dg.setButtonEnabled(false);
} else { } else {
nPanel.setShowText(StringUtils.BLANK); nPanel.setShowText(StringUtils.BLANK);
dg.setButtonEnabled(true); dg.setButtonEnabled(true);

36
designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java

@ -0,0 +1,36 @@
package com.fr.design.data;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.StringUtils;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/4/27
*/
public abstract class BasicTableDataUtils {
private static final int LEN = 2;
public static boolean checkName(String name) {
if (isInValidName(name)) {
FineJOptionPane.showMessageDialog(null,
Toolkit.i18nText("Fine-Design_Basic_DataSet_Rename_Warning", name),
Toolkit.i18nText("Fine-Design_Basic_Alert"),
FineJOptionPane.WARNING_MESSAGE);
return false;
}
return true;
}
public static boolean isInValidName(String name) {
String[] values = name.split("\\.");
if (values.length == LEN) {
return (StringUtils.isNotEmpty(values[0]) && StringUtils.isNotEmpty(values[1]))
|| (StringUtils.isEmpty(values[0]) && StringUtils.isNotEmpty(values[1]));
}
return false;
}
}

4
designer-base/src/main/java/com/fr/design/data/datapane/ReportTableDataPane.java

@ -59,4 +59,8 @@ public class ReportTableDataPane extends LoadingBasicPane {
public Map<String, String> getDsNameChangedMap() { public Map<String, String> getDsNameChangedMap() {
return tdPane.getDsNameChangedMap(); return tdPane.getDsNameChangedMap();
} }
public boolean isNamePermitted() {
return tdPane.isNamePermitted();
}
} }

9
designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java

@ -4,6 +4,7 @@ import com.fr.base.TableData;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.data.api.StoreProcedureAssist; import com.fr.data.api.StoreProcedureAssist;
import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.data.BasicTableDataUtils;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.JListControlPane;
@ -48,6 +49,14 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY; allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY;
String tempName = getEditingName(); String tempName = getEditingName();
Object editingType = getEditingType(); Object editingType = getEditingType();
if (!BasicTableDataUtils.checkName(tempName)) {
isNamePermitted = false;
nameableList.stopEditing();
setIllegalIndex(editingIndex);
return;
}
if (StringUtils.isEmpty(tempName)) { if (StringUtils.isEmpty(tempName)) {
isNamePermitted = false; isNamePermitted = false;
nameableList.stopEditing(); nameableList.stopEditing();

4
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataDefinedPane.java

@ -25,7 +25,7 @@ import java.util.Date;
public class EmbeddedTableDataDefinedPane extends BasicPane{ public class EmbeddedTableDataDefinedPane extends BasicPane{
private static final int MIN_CELL_WIDTH = 30;
private EmbeddedTableData tableData; private EmbeddedTableData tableData;
private JTable dataJTable; private JTable dataJTable;
private UIButton add; private UIButton add;
@ -64,7 +64,7 @@ public class EmbeddedTableDataDefinedPane extends BasicPane{
// 行号显示 // 行号显示
TableColumn tableColumn = dataJTable.getColumnModel().getColumn(0); TableColumn tableColumn = dataJTable.getColumnModel().getColumn(0);
tableColumn.setCellRenderer(new CellRenderer()); tableColumn.setCellRenderer(new CellRenderer());
tableColumn.setMaxWidth(dataJTable.getColumnCount()); tableColumn.setMaxWidth(Math.max(dataJTable.getColumnCount(), MIN_CELL_WIDTH));
// 控制按钮 // 控制按钮
add = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add")); add = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add"));

3
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/EmbeddedTableDataPane.java

@ -34,6 +34,7 @@ import java.util.Date;
public class EmbeddedTableDataPane extends AbstractTableDataPane<EmbeddedTableData> { public class EmbeddedTableDataPane extends AbstractTableDataPane<EmbeddedTableData> {
private static final int MIN_CELL_WIDTH = 30;
private JTable dataJTable ; private JTable dataJTable ;
private JScrollPane scrollPane; private JScrollPane scrollPane;
private UILabel coordinatelabel; private UILabel coordinatelabel;
@ -220,7 +221,7 @@ public class EmbeddedTableDataPane extends AbstractTableDataPane<EmbeddedTableDa
// 行号显示,每次dateJTable的表结构发生变化时都要调用 // 行号显示,每次dateJTable的表结构发生变化时都要调用
TableColumn tableColumn = dataJTable.getColumnModel().getColumn(0); TableColumn tableColumn = dataJTable.getColumnModel().getColumn(0);
tableColumn.setCellRenderer(new CellRenderer()); tableColumn.setCellRenderer(new CellRenderer());
tableColumn.setMaxWidth(dataJTable.getColumnCount()); tableColumn.setMaxWidth(Math.max(dataJTable.getColumnCount(), MIN_CELL_WIDTH));
} }
private class DoubleRenderer extends DefaultTableCellRenderer { private class DoubleRenderer extends DefaultTableCellRenderer {

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

@ -123,8 +123,11 @@ public abstract class UIDialog extends JDialog {
// transfer focus to CurrentEditor // transfer focus to CurrentEditor
inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "dialogOK"); inputMapAncestor.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "dialogOK");
actionMap.put("dialogOK", new AbstractAction() { actionMap.put("dialogOK", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (!okButton.isEnabled()) {
return;
}
doOK(); doOK();
} }
}); });

44
designer-base/src/test/java/com/fr/design/data/BasicTableDataUtilsTest.java

@ -0,0 +1,44 @@
package com.fr.design.data;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/4/27
*/
public class BasicTableDataUtilsTest extends TestCase {
@Test
public void testIsInValidName() {
boolean result1 = BasicTableDataUtils.isInValidName("a.b");
boolean result2 = BasicTableDataUtils.isInValidName("a.b.c");
boolean result3 = BasicTableDataUtils.isInValidName("a..b");
boolean result4 = BasicTableDataUtils.isInValidName("a.");
boolean result5 = BasicTableDataUtils.isInValidName("a.b.");
boolean result6 = BasicTableDataUtils.isInValidName("abc");
boolean result7 = BasicTableDataUtils.isInValidName(".abc");
boolean result8 = BasicTableDataUtils.isInValidName(".ab.c");
boolean result9 = BasicTableDataUtils.isInValidName("ab.c.");
boolean result10 = BasicTableDataUtils.isInValidName(".abc.");
boolean result11 = BasicTableDataUtils.isInValidName(".ab.c.");
boolean result12 = BasicTableDataUtils.isInValidName("..");
Assert.assertTrue(result1);
Assert.assertFalse(result2);
Assert.assertFalse(result3);
Assert.assertFalse(result4);
Assert.assertTrue(result5);
Assert.assertFalse(result6);
Assert.assertTrue(result7);
Assert.assertFalse(result8);
Assert.assertTrue(result9);
Assert.assertTrue(result10);
Assert.assertFalse(result11);
Assert.assertFalse(result12);
}
}
Loading…
Cancel
Save