Browse Source

Pull request #1633: REPORT-27998 bugfix

Merge in DESIGN/design from ~JAVA.EDGE/design:release/10.0 to release/10.0

* commit 'bd68a99584552b1ecc8a560f08ce0e52715a839c':
  REPORT-27998 bugfix 优化导入
  REPORT-27998 bugfix 移除无用类和变量
  REPORT-27998 bugfix
  REPORT-27998 bugfix use ArrayUtils.contains to simply code.
  REPORT-27998 bugfix add comment
  REPORT-27998 bugfix
feature/big-screen
Java.Edge 5 years ago
parent
commit
aa14561f71
  1. 2
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataCreatorProducer.java
  2. 15
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataNameObjectCreator.java
  3. 39
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java

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

@ -60,6 +60,7 @@ public class TableDataCreatorProducer {
"Proc", "Proc",
"/com/fr/design/images/data/store_procedure.png", "/com/fr/design/images/data/store_procedure.png",
StoreProcedure.class, ProcedureDataPane.class) { StoreProcedure.class, ProcedureDataPane.class) {
@Override
public boolean shouldInsertSeparator() { public boolean shouldInsertSeparator() {
return true; return true;
} }
@ -92,6 +93,7 @@ public class TableDataCreatorProducer {
}; };
TableDataNameObjectCreator storeProcedure = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Stored_Procedure"), "/com/fr/design/images/data/store_procedure.png", TableDataNameObjectCreator storeProcedure = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Stored_Procedure"), "/com/fr/design/images/data/store_procedure.png",
StoreProcedure.class, ProcedureDataPane.class) { StoreProcedure.class, ProcedureDataPane.class) {
@Override
public boolean shouldInsertSeparator() { public boolean shouldInsertSeparator() {
return true; return true;
} }

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

@ -5,10 +5,13 @@ import com.fr.data.impl.DBTableData;
import com.fr.design.actions.tabledata.TableDataAction; import com.fr.design.actions.tabledata.TableDataAction;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.UnrepeatedNameHelper;
import com.fr.design.icon.WarningIcon; import com.fr.design.icon.WarningIcon;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.Icon; import javax.swing.Icon;
@ -95,6 +98,7 @@ public class TableDataNameObjectCreator extends NameObjectCreator {
* *
* @return 图片 * @return 图片
*/ */
@Override
public Icon menuIcon() { public Icon menuIcon() {
return createMenuIcon(); return createMenuIcon();
} }
@ -112,6 +116,7 @@ public class TableDataNameObjectCreator extends NameObjectCreator {
* *
* @return 提示 * @return 提示
*/ */
@Override
public String createTooltip() { public String createTooltip() {
return b ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") : null; return b ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Connect_SQL_Cannot_Null") : null;
} }
@ -166,11 +171,21 @@ public class TableDataNameObjectCreator extends NameObjectCreator {
return false; return false;
} }
@Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return obj instanceof TableDataNameObjectCreator return obj instanceof TableDataNameObjectCreator
&& ComparatorUtils.equals(menuName, ((TableDataNameObjectCreator) obj).menuName); && ComparatorUtils.equals(menuName, ((TableDataNameObjectCreator) obj).menuName);
} }
@Override
public Nameable createNameable(UnrepeatedNameHelper helper) {
try {
return new NameObject(helper.createUnrepeatedName(this.getPrefix()), clazzOfInitCase.newInstance());
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}
@Override @Override
public int hashCode() { public int hashCode() {
return menuName == null ? 0 : menuName.hashCode(); return menuName == null ? 0 : menuName.hashCode();

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

@ -14,6 +14,7 @@ import com.fr.file.ProcedureConfig;
import com.fr.file.TableDataConfig; import com.fr.file.TableDataConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
@ -133,36 +134,28 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
return super.createUnrepeatedName(prefix); return super.createUnrepeatedName(prefix);
} }
String[] allDsNames = DesignTableDataManager.getAllDSNames(source); String[] allDsNames = DesignTableDataManager.getAllDSNames(source);
// richer:生成的名字从1开始. kunsnat: 添加属性从0开始.
int count = 1;
while (isDsNameRepeated(prefix + count, allDsNames)) {
count++;
}
return prefix + count;
}
private boolean isDsNameRepeated(String name, String[] allDsNames) {
DefaultListModel model = this.getModel(); DefaultListModel model = this.getModel();
Nameable[] all = new Nameable[model.getSize()]; Nameable[] all = new Nameable[model.getSize()];
for (int i = 0; i < model.size(); i++) { for (int i = 0; i < model.size(); i++) {
all[i] = ((ListModelElement) model.get(i)).wrapper; all[i] = ((ListModelElement) model.get(i)).wrapper;
} }
// richer:生成的名字从1开始. kunsnat: 添加属性从0开始. for (int i = 0, len = model.size(); i < len; i++) {
int count = all.length + 1; Nameable nameable = all[i];
while (true) { if (ComparatorUtils.equals(nameable.getName(), name)) {
String name_test = prefix + count; return true;
boolean repeated = false;
for (int i = 0, len = model.size(); i < len; i++) {
Nameable nameable = all[i];
if (ComparatorUtils.equals(nameable.getName(), name_test)) {
repeated = true;
break;
}
}
for (String dsname : allDsNames) {
if (ComparatorUtils.equals(dsname, name_test)) {
repeated = true;
break;
}
} }
if (!repeated) {
return name_test;
}
count++;
} }
return ArrayUtils.contains(allDsNames, name);
} }
@Override @Override

Loading…
Cancel
Save