Browse Source

CORE-116 国际化+DataModel相关处理

master
richie 6 years ago
parent
commit
b063251020
  1. 17
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  2. 21
      designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
  3. 2
      designer-base/src/main/java/com/fr/design/constants/UIConstants.java
  4. 3
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  5. 20
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  6. 17
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  7. 6
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureListPane.java
  8. 4
      designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java
  9. 8
      designer-base/src/main/java/com/fr/design/gui/NameInspector.java
  10. 134
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  11. 51
      designer-base/src/main/java/com/fr/design/gui/controlpane/ObjectJControlPane.java
  12. 70
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java
  13. 2
      designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java
  14. 40
      designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java
  15. 2
      designer-base/src/main/java/com/fr/design/gui/ilist/ListModelElement.java
  16. 10
      designer-base/src/main/java/com/fr/design/gui/ilist/UINameEdList.java
  17. 4
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java
  18. 3
      designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java
  19. 8
      designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java
  20. 16
      designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java
  21. 8
      designer-base/src/main/java/com/fr/env/EnvListPane.java
  22. 4
      designer-base/src/main/java/com/fr/start/BaseDesigner.java

17
designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java

@ -8,18 +8,17 @@ import com.fr.design.data.datapane.connect.ConnectionShowPane;
import com.fr.design.data.datapane.connect.DatabaseConnectionPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.NameInspector;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.file.ConnectionConfig;
import com.fr.general.IOUtils;
import com.fr.locale.InterProviderFactory;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations;
import com.fr.transaction.WorkerFacade;
import javax.swing.KeyStroke;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.util.Map;
@ -130,17 +129,9 @@ public class ConnectionListAction extends UpdateAction {
*/
public static int isConnectionMapContainsRename(ConnectionConfig datasourceManager) {
Map<String, Connection> tableDataMap = datasourceManager.getConnections();
String rename = InterProviderFactory.getProvider().getLocText("FR-Engine_Please_Rename") + "!";
if (tableDataMap.containsKey(rename)) {
return datasourceManager.getConnectionIndex(rename);
if (tableDataMap.containsKey(NameInspector.ILLEGAL_NAME_HOLDER)) {
return datasourceManager.getConnectionIndex(NameInspector.ILLEGAL_NAME_HOLDER);
}
//todo 这边同上面和远程修改数据集属性有关先屏蔽
// for (int i = tableDataRenameIndex; i >= 1; i--) {
// rename = InterProviderFactory.getProvider().getLocText("FR-Engine_Please_Rename") + i + "!";
// if (nameTableDataMap.map.containsKey(rename)) {
// return nameTableDataMap.map.indexOf(rename);
// }
// }
return -1;
}

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

@ -14,6 +14,7 @@ import com.fr.design.data.tabledata.ResponseDataSourceChange;
import com.fr.design.data.tabledata.tabledatapane.TableDataManagerPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.NameInspector;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
@ -128,14 +129,6 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
globalTableDataDialog.setVisible(true);
}
/**
* 是否正常更新完datasourceManager
*
* @param datasourceManager
* @param tableDataManagerPane
* @param databaseListDialog
* @return
*/
private boolean doWithDatasourceManager(TableDataConfig datasourceManager, TableDataManagerPane tableDataManagerPane, BasicDialog databaseListDialog) {
boolean isFailed = false;
//
@ -156,17 +149,9 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
*/
public int isTableDataMapContainsRename(TableDataConfig datasourceManager) {
Map<String, TableData> tableDataMap = datasourceManager.getTableDatas();
String rename = InterProviderFactory.getProvider().getLocText("FR-Engine_Please_Rename") + "!";
if (tableDataMap.containsKey(rename)) {
return datasourceManager.getTableDataIndex(rename);
if (tableDataMap.containsKey(NameInspector.ILLEGAL_NAME_HOLDER)) {
return datasourceManager.getTableDataIndex(NameInspector.ILLEGAL_NAME_HOLDER);
}
//todo 这边同上面和远程修改数据集属性有关先屏蔽
// for (int i = tableDataRenameIndex; i >= 1; i--) {
// rename = InterProviderFactory.getProvider().getLocText("FR-Engine_Please_Rename") + i + "!";
// if (nameTableDataMap.map.containsKey(rename)) {
// return nameTableDataMap.map.indexOf(rename);
// }
// }
return -1;
}

2
designer-base/src/main/java/com/fr/design/constants/UIConstants.java

@ -219,7 +219,7 @@ public interface UIConstants {
@Override
public String toString() {
return com.fr.design.i18n.Toolkit.i18nText("Loading") + "...";
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Loading") + "...";
}
};
/**

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

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.TableData;
import com.fr.data.TableDataSource;
import com.fr.data.core.StoreProcedureAssist;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction;
@ -142,7 +143,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
private boolean isIncludeUnderline(String name) {
return ComparatorUtils.equals(name.indexOf(StoreProcedure.SPLIT), -1) ? false : true;
return ComparatorUtils.equals(name.indexOf(StoreProcedureAssist.GROUP_MARKER), -1) ? false : true;
}
public abstract TableDataTree getDataTree();

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

@ -2,11 +2,13 @@ package com.fr.design.data.datapane;
import com.fr.base.TableData;
import com.fr.data.TableDataSource;
import com.fr.data.core.StoreProcedureAssist;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.i18n.Toolkit;
import com.fr.file.ProcedureConfig;
import com.fr.file.TableDataConfig;
import com.fr.general.ComparatorUtils;
@ -34,7 +36,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
public TableDataPaneListPane() {
super();
dsNameChangedMap.clear();
this.addEditingListner(new PropertyChangeAdapter() {
this.addEditingListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
isNamePermitted = true;
@ -47,22 +49,22 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
if (StringUtils.isEmpty(tempName)) {
isNamePermitted = false;
nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Table_Data_Empty_Name_Tips"));
setWarnigText(editingIndex);
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Table_Data_Empty_Name_Tips"));
setIllegalIndex(editingIndex);
return;
}
if (!ComparatorUtils.equals(tempName, selectedName)
&& isNameRepeted(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) {
&& isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) {
isNamePermitted = false;
nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Table_Data_Duplicate_Name_Tips"));
setWarnigText(editingIndex);
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Table_Data_Duplicate_Name_Tips", tempName));
setIllegalIndex(editingIndex);
} else if (editingType instanceof StoreProcedure && isIncludeUnderline(tempName)) {
isNamePermitted = false;
nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Stored_Procedure_Name_Tips"));
setWarnigText(editingIndex);
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Stored_Procedure_Name_Tips"));
setIllegalIndex(editingIndex);
}
if (nameableList.getSelectedValue() instanceof ListModelElement) {
Nameable selected = ((ListModelElement) nameableList.getSelectedValue()).wrapper;
@ -101,7 +103,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
}
private boolean isIncludeUnderline(String name) {
return ComparatorUtils.equals(name.indexOf(StoreProcedure.SPLIT), -1) ? false : true;
return ComparatorUtils.equals(name.indexOf(StoreProcedureAssist.GROUP_MARKER), -1) ? false : true;
}
/**

17
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -8,6 +8,7 @@ import com.fr.design.fun.ConnectionProvider;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.i18n.Toolkit;
import com.fr.file.ConnectionConfig;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
@ -28,13 +29,13 @@ import java.util.Set;
* Connection List Pane.
*/
public class ConnectionListPane extends JListControlPane implements ConnectionShowPane {
public static final String TITLE_NAME = com.fr.design.i18n.Toolkit.i18nText("Server-Define_Data_Connection");
public static final String TITLE_NAME = Toolkit.i18nText("Server-Define_Data_Connection");
private boolean isNamePermitted = true;
private HashMap<String, String> renameMap = new HashMap<String, String>();
public ConnectionListPane() {
renameMap.clear();
this.addEditingListner(new PropertyChangeAdapter() {
this.addEditingListener(new PropertyChangeAdapter() {
public void propertyChange() {
isNamePermitted = true;
String[] allListNames = nameableList.getAllNames();
@ -43,17 +44,17 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
if (StringUtils.isEmpty(tempName)) {
nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Connection_Empty_Name"));
setWarnigText(editingIndex);
setIllegalIndex(editingIndex);
isNamePermitted = false;
return;
}
if (!ComparatorUtils.equals(tempName, selectedName)
&& isNameRepeted(new List[]{Arrays.asList(allListNames)}, tempName)) {
&& isNameRepeated(new List[]{Arrays.asList(allListNames)}, tempName)) {
isNamePermitted = false;
nameableList.stopEditing();
String message = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Connection_Duplicate_Name", tempName);
String message = Toolkit.i18nText("Fine-Design_Connection_Duplicate_Name", tempName);
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), message);
setWarnigText(editingIndex);
setIllegalIndex(editingIndex);
}
if (isNamePermitted && !ComparatorUtils.equals(tempName, selectedName)) {
rename(selectedName, tempName);
@ -65,9 +66,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
protected void rename(String oldName, String newName) {
if (renameMap.containsKey(selectedName)) {
renameMap.remove(selectedName);
}
renameMap.remove(selectedName);
renameMap.put(selectedName, newName);
}

6
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureListPane.java

@ -22,7 +22,7 @@ import java.util.List;
public class ProcedureListPane extends JListControlPane {
public ProcedureListPane() {
super();
this.addEditingListner(new PropertyChangeAdapter() {
this.addEditingListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
TableDataSource source = DesignTableDataManager.getEditingTableDataSource();
@ -34,7 +34,7 @@ public class ProcedureListPane extends JListControlPane {
if(StringUtils.isEmpty(tempName)) {
nameableList.stopEditing();
//JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ProcedureListPane.this), com.fr.design.i18n.Toolkit.i18nText("NOT_NULL_Des") + "," + com.fr.design.i18n.Toolkit.i18nText("Please_Rename") + "!");
setWarnigText(nameableList.getSelectedIndex());
setIllegalIndex(nameableList.getSelectedIndex());
return;
}
for(int i = 0; i < allDSNames.length; i++) {
@ -42,7 +42,7 @@ public class ProcedureListPane extends JListControlPane {
if (ComparatorUtils.equals(dsname, tempName)) {
// JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ProcedureListPane.this), com.fr.design.i18n.Toolkit.i18nText(new String[]{"already_exists", "TableData"})
// + tempName + "," + com.fr.design.i18n.Toolkit.i18nText("Please_Rename") + "!");
setWarnigText(nameableList.getSelectedIndex());
setIllegalIndex(nameableList.getSelectedIndex());
break;
}
}

4
designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java vendored

@ -1,6 +1,6 @@
package com.fr.design.env;
import com.fr.locale.InterProviderFactory;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.AssistUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
@ -36,7 +36,7 @@ public class RemoteWorkspace implements Workspace {
@Override
public String getDescription() {
return InterProviderFactory.getProvider().getLocText("Fine-Designer_Basic_Remote_Env");
return Toolkit.i18nText("Fine-Design_Basic_Remote_Env");
}
@Override

8
designer-base/src/main/java/com/fr/design/gui/NameInspector.java

@ -0,0 +1,8 @@
package com.fr.design.gui;
import com.fr.design.i18n.Toolkit;
public class NameInspector {
public static final String ILLEGAL_NAME_HOLDER = Toolkit.i18nText("Fine-Design_Illegal_Name_Tips");
}

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

@ -9,42 +9,32 @@ import com.fr.design.data.tabledata.tabledatapane.GlobalTreeTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.MultiTDTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.TreeTableDataPane;
import com.fr.design.gui.HyperlinkFilterHelper;
import com.fr.design.gui.NameInspector;
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.ModNameActionListener;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.LineSeparator;
import com.fr.design.menu.MenuDef;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.invoke.Reflect;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.Comparator;
@ -207,7 +197,7 @@ public abstract class JListControlPane extends JControlPane {
*
* @param l 监听
*/
public void addEditingListner(PropertyChangeAdapter l) {
public void addEditingListener(PropertyChangeAdapter l) {
this.nameableList.addEditingListner(l);
}
@ -240,8 +230,8 @@ public abstract class JListControlPane extends JControlPane {
return this.nameableList.getAllTypes()[editingIndex];
}
public void setWarnigText(int index) {
this.nameableList.setWarnigText(index);
public void setIllegalIndex(int index) {
this.nameableList.setIllegalIndex(index);
}
/**
@ -253,7 +243,7 @@ public abstract class JListControlPane extends JControlPane {
return el == null ? null : el.wrapper.getName();
}
protected boolean isNameRepeted(java.util.List[] list, String name) {
protected boolean isNameRepeated(java.util.List[] list, String name) {
for (int i = 0; i < list.length; i++) {
if (list[i].contains(name)) {
isNameRepeated = true;
@ -673,9 +663,6 @@ public abstract class JListControlPane extends JControlPane {
}
}
/*
* Nameable的ListCellRenerer
*/
private class NameableListCellRenderer extends
DefaultListCellRenderer {
@Override
@ -685,12 +672,12 @@ public abstract class JListControlPane extends JControlPane {
cellHasFocus);
if (value instanceof ListModelElement) {
Nameable wrappee = ((ListModelElement) value).wrapper;
this.setText(((ListModelElement) value).wrapper.getName());
ListModelElement element = ((ListModelElement) value);
Nameable nameable = element.wrapper;
this.setText(nameable.getName());
boolean iconSet = false;
for (NameableCreator creator : JListControlPane.this.creators()) {
if (creator.menuIcon() != null && creator.acceptObject2Populate(wrappee) != null) {
if (creator.menuIcon() != null && creator.acceptObject2Populate(nameable) != null) {
this.setIcon(creator.menuIcon());
this.setToolTipText(creator.createTooltip());
iconSet = true;
@ -698,10 +685,9 @@ public abstract class JListControlPane extends JControlPane {
}
}
if (!iconSet) {
this.setIcon(BaseUtils.readIcon("/com/fr/base/images/oem/cpt.png"));
this.setIcon(IOUtils.readIcon("/com/fr/base/images/oem/cpt.png"));
}
}
return this;
}
}
@ -736,52 +722,6 @@ public abstract class JListControlPane extends JControlPane {
}
}
public class SortEnableShortCut extends ShortCut4JControlPane {
public SortEnableShortCut(ShortCut shortCut) {
this.shortCut = shortCut;
}
/**
* 检查是否可用
*/
@Override
public void checkEnable() {
this.shortCut.setEnabled(getModel().getSize() > 1);
}
}
public class MoveUpEnableShortCut extends ShortCut4JControlPane {
public MoveUpEnableShortCut(ShortCut shortCut) {
this.shortCut = shortCut;
}
/**
* 检查是否可用
*/
@Override
public void checkEnable() {
this.shortCut.setEnabled(getModel().getSize() > 1
&& JListControlPane.this.nameableList.getSelectedIndex() > 0);
}
}
public class MoveDownEnableShortCut extends ShortCut4JControlPane {
public MoveDownEnableShortCut(ShortCut shortCut) {
this.shortCut = shortCut;
}
/**
* 检查是否可用
*/
@Override
public void checkEnable() {
this.shortCut.setEnabled(getModel().getSize() > 1
&& JListControlPane.this.nameableList.getSelectedIndex() < JListControlPane.this.nameableList.getModel().getSize() - 1);
}
}
private class JControlUpdatePane extends JPanel {
private CardLayout card;
@ -871,45 +811,11 @@ public abstract class JListControlPane extends JControlPane {
}
protected BasicBeanPane createPaneByCreators(NameableCreator creator) {
try {
return creator.getUpdatePane().newInstance();
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
protected BasicBeanPane createPaneByCreators(NameableCreator creator, String string) {
Constructor constructor = null;
try {
constructor = creator.getUpdatePane().getDeclaredConstructor(new Class[]{String.class});
constructor.setAccessible(true);
return (BasicBeanPane) constructor.newInstance(string);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
}
}
// 选项添加个数有限制等情况下 要求能控制快捷按钮的状态
protected void setToolbarDefEnable(int shortCutIndex, int itemIndex, boolean enabled) {
ToolBarDef toolbarDef = getToolbarDef();
if (toolbarDef.getShortCutCount() > shortCutIndex) {
ShortCut sc = toolbarDef.getShortCut(shortCutIndex);
if (sc instanceof AddItemMenuDef) {
AddItemMenuDef am = (AddItemMenuDef) sc;
if (am.getShortCutCount() > itemIndex) {
am.getShortCut(itemIndex).setEnabled(enabled);
}
}
}
return Reflect.on(creator.getUpdatePane()).create().get();
}
private BasicBeanPane createPaneByCreators(NameableCreator creator, String string) {
return Reflect.on(creator.getUpdatePane()).create(string).get();
}
/**

51
designer-base/src/main/java/com/fr/design/gui/controlpane/ObjectJControlPane.java

@ -1,9 +1,7 @@
package com.fr.design.gui.controlpane;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import com.fr.design.beans.BasicBeanPane;
import com.fr.invoke.Reflect;
/**
* 生成带参数的BasicBeanPane
@ -25,52 +23,7 @@ public abstract class ObjectJControlPane extends JListControlPane {
@Override
protected BasicBeanPane createPaneByCreators(NameableCreator creator) {
try {
if (object == null) {
return super.createPaneByCreators(creator);
} else if (object.getClass().isArray()) {
return creator.getUpdatePane().getConstructor(object.getClass()).newInstance(object);
} else {
Constructor<? extends BasicBeanPane> constructor = getConstructor(creator.getUpdatePane(), object.getClass());
return constructor == null ? super.createPaneByCreators(creator) : constructor.newInstance(object);
}
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (SecurityException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
}
/**
* 传进BasicBeanPane的构造函数的参数可能是
*
* @param clazz
* @param cls
* @return
*/
private Constructor<? extends BasicBeanPane> getConstructor(Class<? extends BasicBeanPane> clazz, Class<?> cls) {
Constructor<? extends BasicBeanPane> constructor = null;
try {
constructor = clazz.getConstructor(cls);
} catch (SecurityException e) {
} catch (NoSuchMethodException e) {
}
if (constructor != null) {
return constructor;
} else {
if (cls.getName() == Object.class.getName()) {
return null;
}
return getConstructor(clazz, cls.getSuperclass());
}
return Reflect.on(creator.getUpdatePane()).create(object).get();
}
}

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

@ -232,56 +232,6 @@ public abstract class UIListControlPane extends UIControlPane {
isPopulating = false;
}
/**
* 添加名字改变时的listener
*
* @param l 名字改变时的监听
*/
public void addModNameActionListener(ModNameActionListener l) {
this.nameableList.addModNameActionListener(l);
}
/**
* 添加Editinglistener
*
* @param l 监听
*/
public void addEditingListner(PropertyChangeAdapter l) {
this.nameableList.addEditingListner(l);
}
/*
* 刷新当前的选中的UpdatePane
*/
protected void populateSelectedValue() {
((JControlUpdatePane) UIListControlPane.this.controlUpdatePane).populate();
}
/**
* 根据name,选中UINameEdList中的item
*/
public void setSelectedName(String name) {
DefaultListModel listModel = (DefaultListModel) this.nameableList.getModel();
for (int i = 0, len = listModel.getSize(); i < len; i++) {
Nameable item = ((ListModelElement) listModel.getElementAt(i)).wrapper;
if (ComparatorUtils.equals(name, item.getName())) {
this.nameableList.setSelectedIndex(i);
break;
}
}
}
public String getEditingName() {
return this.nameableList.getEditingName();
}
public Object getEditingType() {
return this.nameableList.getAllTypes()[editingIndex];
}
public void setWarnigText(int index) {
this.nameableList.setWarnigText(index);
}
/**
* 获取选中的名字
@ -292,26 +242,6 @@ public abstract class UIListControlPane extends UIControlPane {
return el == null ? null : el.wrapper.getName();
}
protected boolean isNameRepeted(java.util.List[] list, String name) {
for (int i = 0; i < list.length; i++) {
if (list[i].contains(name)) {
isNameRepeated = true;
return true;
}
}
isNameRepeated = false;
return false;
}
/**
* 名字是否重复
*
* @return 重复则返回true
*/
public boolean isNameRepeated() {
return isNameRepeated;
}
/**
* 添加 Nameable
*

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

@ -23,7 +23,7 @@ import java.util.concurrent.ExecutionException;
public abstract class LazyComboBox extends UIComboBox implements PopupMenuListener {
private static final int NUM = 80;
private static final String[] PENDING_CONTENT = new String[]{"", com.fr.design.i18n.Toolkit.i18nText("Loading") + "..."};
private static final String[] PENDING_CONTENT = new String[]{"", com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Loading") + "..."};
/**
* 是否加载完成

40
designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java

@ -1,5 +1,7 @@
package com.fr.design.gui.ilist;
import com.fr.design.gui.NameInspector;
import com.fr.general.GeneralUtils;
import com.fr.general.NameObject;
import com.fr.base.Utils;
import com.fr.design.gui.itextfield.UITextField;
@ -32,6 +34,10 @@ public class JNameEdList extends UIList implements CellEditorListener {
transient protected int editingIndex;
private PropertyChangeAdapter editingListner;
private java.util.List<ModNameActionListener> ll = new ArrayList<ModNameActionListener>();
/*
* 编辑第index个item
*/
private String oldName;
public JNameEdList(ListModel dataModel) {
super(dataModel);
@ -160,34 +166,27 @@ public class JNameEdList extends UIList implements CellEditorListener {
public Object getType(int index) {
Nameable nameable = ((ListModelElement) getModel().getElementAt(index)).wrapper;
if (nameable != null && nameable instanceof NameObject) {
if (nameable instanceof NameObject) {
return ((NameObject) nameable).getObject();
}
return null;
}
public void setWarnigText() {
setWarnigText(this.getSelectedIndex());
}
public void setWarnigText(int index) {
setNameAt(com.fr.design.i18n.Toolkit.i18nText("Please_Rename") + "!", index);
public void setIllegalIndex(int index) {
setNameAt(NameInspector.ILLEGAL_NAME_HOLDER, index);
this.repaint();
}
/*
* 设置index节点的名字
*/
// b:edit改变name的时候怎么办?
public void setNameAt(String name, int index) {
Nameable nameable = ((ListModelElement) getModel().getElementAt(index)).wrapper;
ListModelElement element = (ListModelElement) getModel().getElementAt(index);
modifyNameable(element.wrapper, name, index);
}
private void modifyNameable(Nameable nameable, String name, int index) {
if (nameable != null) {
String oldName = nameable.getName();
if (isNameShouldNumber()) {
// kunsnat: 限制只能是数字(int型)
Number number = Utils.string2Number(name);
Number number = GeneralUtils.string2Number(name);
if (number == null) {
nameable.setName(oldName);
} else {
@ -197,18 +196,12 @@ public class JNameEdList extends UIList implements CellEditorListener {
} else {
nameable.setName(name);
}
for (int i = 0, len = ll.size(); i < len; i++) {
ll.get(i).nameModed(index, oldName, name);
}
}
}
/*
* 编辑第index个item
*/
private String oldName;
/**
* 编辑第index项
*
@ -268,9 +261,8 @@ public class JNameEdList extends UIList implements CellEditorListener {
private Component prepareEditor(ListCellEditor cellEditor, int index) {
String name = getNameAt(index);
boolean isSelected = this.isSelectedIndex(index);
Component comp = cellEditor.getListCellEditorComponent(this, name, isSelected, index);
return comp;
return cellEditor.getListCellEditorComponent(this, name, isSelected, index);
}
/*

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

@ -1 +1 @@
package com.fr.design.gui.ilist; import com.fr.general.ComparatorUtils; import com.fr.stable.Nameable; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 7.0.3 * Date: 13-1-2 * Time: 下午2:39 */ public class ListModelElement { public Nameable wrapper; /** /** /** /** * Created by IntelliJ IDEA. /** * Author : Richer /** /** * Version: 7.0.3 /** * Date: 13-1-2 /** * Time: 下午2:39 } }
package com.fr.design.gui.ilist; import com.fr.general.ComparatorUtils; import com.fr.stable.Nameable; /** */ /** public class ListModelElement { /** public Nameable wrapper; * Created by IntelliJ IDEA. /** public Nameable wrapper; * Created by IntelliJ IDEA. /** * Created by IntelliJ IDEA. * Created by IntelliJ IDEA. * Created by IntelliJ IDEA. * Author : Richer /** public Nameable wrapper; * Created by IntelliJ IDEA. * Version: 7.0.3 * Created by IntelliJ IDEA. * Date: 13-1-2 * Created by IntelliJ IDEA. * Time: 下午2:39 } }

10
designer-base/src/main/java/com/fr/design/gui/ilist/UINameEdList.java

@ -166,16 +166,6 @@ public class UINameEdList extends UIList implements CellEditorListener {
return null;
}
public void setWarnigText() {
setWarnigText(this.getSelectedIndex());
}
public void setWarnigText(int index) {
setNameAt(com.fr.design.i18n.Toolkit.i18nText("Please_Rename") + "!", index);
this.repaint();
}
/*
* 设置index节点的名字
*/

4
designer-base/src/main/java/com/fr/design/gui/itree/filetree/EnvFileTree.java

@ -5,10 +5,10 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.gui.itree.refreshabletree.RefreshableJTree;
import com.fr.design.i18n.Toolkit;
import com.fr.file.filetree.FileNode;
import com.fr.file.filetree.FileNodeFilter;
import com.fr.general.ComparatorUtils;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils;
@ -68,7 +68,7 @@ public class EnvFileTree extends RefreshableJTree {
String name = node.getName();
if (treeNode.hasFullAuthority()) {
if (lock != null && !node.getUserID().equals(lock)) {
name = name + InterProviderFactory.getProvider().getLocText("Locked");
name = name + Toolkit.i18nText("Fine-Design_Template_Status_Locked", "(", ")");
this.setIcon(FileTreeIcon.getIcon(node));
} else {
this.setIcon(FileTreeIcon.getIcon(node, false));

3
designer-base/src/main/java/com/fr/design/gui/itree/refreshabletree/RefreshableJTree.java

@ -3,6 +3,7 @@ package com.fr.design.gui.itree.refreshabletree;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.itooltip.UIToolTip;
import com.fr.design.gui.itree.checkboxtree.CheckBoxTree;
import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
import com.fr.locale.InterProviderFactory;
@ -36,7 +37,7 @@ public abstract class RefreshableJTree extends CheckBoxTree {
@Override
public String toString() {
return InterProviderFactory.getProvider().getLocText("Loading") + "...";
return Toolkit.i18nText("Fine-Design_Loading") + "...";
}
};

8
designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java

@ -28,7 +28,7 @@ public class ParameterArrayPane extends JListControlPane {
}
});
this.addEditingListner( new PropertyChangeAdapter() {
this.addEditingListener(new PropertyChangeAdapter() {
public void propertyChange() {
Parameter[] parameters = ParameterConfig.getInstance().getGlobalParameters();
String[] allListNames = nameableList.getAllNames();
@ -37,15 +37,15 @@ public class ParameterArrayPane extends JListControlPane {
if (StringUtils.isEmpty(tempName)) {
nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Empty_Parameter_Name"));
setWarnigText(editingIndex);
setIllegalIndex(editingIndex);
return;
}
if (!ComparatorUtils.equals(tempName, selectedName)
&& isNameRepeted(new List[]{Arrays.asList(parameters), Arrays.asList(allListNames)}, tempName)) {
&& isNameRepeated(new List[]{Arrays.asList(parameters), Arrays.asList(allListNames)}, tempName)) {
nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Duplicate_Parameter_Name"));
setWarnigText(editingIndex);
setIllegalIndex(editingIndex);
}
}
});

16
designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java

@ -6,6 +6,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.remote.ui.list.AddedMemberList;
@ -138,7 +139,7 @@ public class UserManagerPane extends BasicPane {
sync2AddedMembersFormAdded();
// 不需要重复更新右侧列表显示 但是更新一下计数显示
countLabel.setText(
InterProviderFactory.getProvider().getLocText("Fine-Designer_Remote_Design_Selected_Member_Count",
Toolkit.i18nText("Fine-Design_Remote_Design_Selected_Member_Count",
String.valueOf(addedMembers.size())
)
);
@ -206,7 +207,7 @@ public class UserManagerPane extends BasicPane {
@Override
protected String title4PopupWindow() {
return InterProviderFactory.getProvider().getLocText("Fine-Designer_Remote_Design_Add_Member");
return Toolkit.i18nText("Fine-Design_Remote_Design_Add_Member");
}
private JPanel createLeftPanel() {
@ -216,7 +217,7 @@ public class UserManagerPane extends BasicPane {
BorderFactory.createCompoundBorder(
new EmptyBorder(6, 0, 0, 0),
UITitledBorder.createBorderWithTitle(
InterProviderFactory.getProvider().getLocText("Fine-Designer_Remote_Design_Decision_Member")
Toolkit.i18nText("Fine-Design_Remote_Design_Decision_Member")
)
)
);
@ -228,7 +229,7 @@ public class UserManagerPane extends BasicPane {
keyField.requestFocus();
keyField.addKeyListener(keyFieldKeyListener);
keyField.getDocument().addDocumentListener(documentListener);
keyButton.setText(InterProviderFactory.getProvider().getLocText("Fine-Designer_Remote_Design_Search"));
keyButton.setText(Toolkit.i18nText("Fine-Design_Remote_Design_Search"));
keyButton.addActionListener(keyButtonActionListener);
searchPanel.add(keyField);
searchPanel.add(keyButton);
@ -274,15 +275,14 @@ public class UserManagerPane extends BasicPane {
content.setBorder(
BorderFactory.createCompoundBorder(
new EmptyBorder(6, 0, 0, 0),
UITitledBorder.createBorderWithTitle(
InterProviderFactory.getProvider().getLocText("Fine-Designer_Remote_Design_Selected_Member")
UITitledBorder.createBorderWithTitle(Toolkit.i18nText("Fine-Design_Remote_Design_Selected_Member")
)
)
);
// 计数
countLabel.setText(
InterProviderFactory.getProvider().getLocText("Fine-Designer_Remote_Design_Selected_Member_Count",
Toolkit.i18nText("Fine-Design_Remote_Design_Selected_Member_Count",
String.valueOf(addedMembers.size()))
);
countLabel.setBorder(BorderFactory.createEmptyBorder(7, 12, 8, 0));
@ -328,7 +328,7 @@ public class UserManagerPane extends BasicPane {
addedList.revalidate();
addedList.repaint();
countLabel.setText(
InterProviderFactory.getProvider().getLocText("Fine-Designer_Remote_Design_Selected_Member_Count",
Toolkit.i18nText("Fine-Design_Remote_Design_Selected_Member_Count",
String.valueOf(addedMembers.size())
));
}

8
designer-base/src/main/java/com/fr/env/EnvListPane.java vendored

@ -25,7 +25,7 @@ import java.util.List;
public class EnvListPane extends JListControlPane {
public EnvListPane() {
super();
addEditingListner(new PropertyChangeAdapter() {
addEditingListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
String tempName = getEditingName();
@ -34,13 +34,13 @@ public class EnvListPane extends JListControlPane {
if (StringUtils.isEmpty(tempName)) {
nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(EnvListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Workspace_Empty_Name_Warn_Text"));
setWarnigText(editingIndex);
setIllegalIndex(editingIndex);
return;
}
if (!ComparatorUtils.equals(tempName, selectedName) && isNameRepeted(new List[]{Arrays.asList(allListNames)}, tempName)) {
if (!ComparatorUtils.equals(tempName, selectedName) && isNameRepeated(new List[]{Arrays.asList(allListNames)}, tempName)) {
nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(EnvListPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Workspace_Duplicate_Name_Warn_Text", tempName));
setWarnigText(editingIndex);
setIllegalIndex(editingIndex);
}
}
});

4
designer-base/src/main/java/com/fr/start/BaseDesigner.java

@ -9,6 +9,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerStartOpenFileProcessor;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
@ -18,7 +19,6 @@ import com.fr.file.FILE;
import com.fr.file.FILEFactory;
import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.module.ModuleEvent;
import com.fr.stable.OperatingSystem;
@ -41,7 +41,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
private void init(String[] args) {
//初始化
EventDispatcher.fire(ModuleEvent.MajorModuleStarting, InterProviderFactory.getProvider().getLocText("FR-Designer_Initializing"));
EventDispatcher.fire(ModuleEvent.MajorModuleStarting, Toolkit.i18nText("FR-Design_Initializing"));
// 初始化look and feel.这个在预加载之前执行是因为lookAndFeel里的东西,预加载时也要用到
DesignUtils.initLookAndFeel();
// 初始化Log Handler

Loading…
Cancel
Save