|
|
@ -1,14 +1,19 @@ |
|
|
|
package com.fr.design.data.datapane; |
|
|
|
package com.fr.design.data.datapane; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
|
|
|
|
import com.fr.data.TableDataSource; |
|
|
|
import com.fr.data.impl.DBTableData; |
|
|
|
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.data.DesignTableDataManager; |
|
|
|
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; |
|
|
@ -32,6 +37,7 @@ public class TableDataNameObjectCreator extends NameObjectCreator { |
|
|
|
private boolean isNeedInsertSeparator = false; |
|
|
|
private boolean isNeedInsertSeparator = false; |
|
|
|
private String prefix = ""; |
|
|
|
private String prefix = ""; |
|
|
|
private java.util.List<String> names = new ArrayList<String>(); |
|
|
|
private java.util.List<String> names = new ArrayList<String>(); |
|
|
|
|
|
|
|
private String[] allDSNames; |
|
|
|
|
|
|
|
|
|
|
|
public TableDataNameObjectCreator(TableDataAction action) { |
|
|
|
public TableDataNameObjectCreator(TableDataAction action) { |
|
|
|
super(action.getDisplayName(), action.getIconPath(), action.getTableDataClass(), action.getUpdateTableDataPaneClass()); |
|
|
|
super(action.getDisplayName(), action.getIconPath(), action.getTableDataClass(), action.getUpdateTableDataPaneClass()); |
|
|
@ -90,11 +96,7 @@ public class TableDataNameObjectCreator extends NameObjectCreator { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@Override |
|
|
|
* 取得菜单的图片 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return 图片 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public Icon menuIcon() { |
|
|
|
public Icon menuIcon() { |
|
|
|
return createMenuIcon(); |
|
|
|
return createMenuIcon(); |
|
|
|
} |
|
|
|
} |
|
|
@ -107,11 +109,7 @@ public class TableDataNameObjectCreator extends NameObjectCreator { |
|
|
|
return b ? new WarningIcon(this.menuImage) : this.menuIcon; |
|
|
|
return b ? new WarningIcon(this.menuImage) : this.menuIcon; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@Override |
|
|
|
* 创建提示 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return 提示 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
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 +164,43 @@ 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(this.createUnrepeatedName(this.getPrefix()), clazzOfInitCase.newInstance()); |
|
|
|
|
|
|
|
} catch (InstantiationException | IllegalAccessException e) { |
|
|
|
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String createUnrepeatedName(String prefix) { |
|
|
|
|
|
|
|
int count = 1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (isDsNameRepeated(prefix + count)) { |
|
|
|
|
|
|
|
count++; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return prefix + count; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean isDsNameRepeated(String name) { |
|
|
|
|
|
|
|
if (allDSNames == null) { |
|
|
|
|
|
|
|
TableDataSource source = DesignTableDataManager.getEditingTableDataSource(); |
|
|
|
|
|
|
|
allDSNames = DesignTableDataManager.getAllDSNames(source); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (String allDSName : allDSNames) { |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(name, allDSName)) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public int hashCode() { |
|
|
|
public int hashCode() { |
|
|
|
return menuName == null ? 0 : menuName.hashCode(); |
|
|
|
return menuName == null ? 0 : menuName.hashCode(); |
|
|
|