Browse Source

Merge pull request #574 in BA/design from ~NEIL/design:master to master

* commit '4b9f8760b2af7ca98aaec50ba9f1d1e726ed20dd':
  无JIRA任务, 国际化
  pmd
  无JIRA任务, 冲突修正
master
superman 8 years ago
parent
commit
aabccdadb4
  1. 72
      designer_base/src/com/fr/design/actions/file/PreferencePane.java
  2. 9
      designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java
  3. 2
      designer_base/src/com/fr/design/locale/designer.properties
  4. 2
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  5. 3
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  6. 2
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  7. 2
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  8. 2
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  9. 60
      designer_base/src/com/fr/env/RemoteEnv.java
  10. 49
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

72
designer_base/src/com/fr/design/actions/file/PreferencePane.java

@ -2,6 +2,7 @@ package com.fr.design.actions.file;
import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
@ -28,9 +29,7 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Map;
/**
* 选项对话框
@ -73,14 +72,16 @@ public class PreferencePane extends BasicPane {
private static final String DISPLAY_MINUS = "-";
private static final FRLevel[] LOG = {FRLevel.SEVERE, FRLevel.WARNING, FRLevel.INFO, FRLevel.DEBUG};
private static java.util.List<String> LANGUAGE = new ArrayList<>();
static {
Map<Locale, String> map = Inter.getSupportLocaleMap();
LANGUAGE.add(Inter.getLocText("FR-Designer_Language_Default"));
for(Locale locale : map.keySet()){
LANGUAGE.add(getLocaledLanguage(map.get(locale), locale));
}
private static final String[] LANGUAGE = {Inter.getLocText("FR-Designer_Language_Default"),
getLocaledLanguage("Simplified_Chinese_Language", Locale.SIMPLIFIED_CHINESE),
getLocaledLanguage("English_Language", Locale.ENGLISH),
getLocaledLanguage("Japanese_Language", Locale.JAPAN),
getLocaledLanguage("Traditional_Chinese_Language", Locale.TRADITIONAL_CHINESE),
getLocaledLanguage("Korea_Language",Locale.KOREA),
};
private static int designerEnvLanguageIndex; // 打开设置对话框时,设计器使用的语言
private boolean languageChanged; // 是否修改了设计器语言设置
//设置是否支持undo
private UICheckBox supportUndoCheckBox;
@ -163,10 +164,10 @@ public class PreferencePane extends BasicPane {
}
private static String getLocaledLanguage(String key, Locale locale){
StringBuilder sb = new StringBuilder();
sb.append(Inter.getLocText(key)).append("(");
sb.append(Inter.getLocText(key, locale)).append(")");
return sb.toString();
StringBuilder sb = new StringBuilder();
sb.append(Inter.getLocText(key)).append("(");
sb.append(Inter.getLocText(key, locale)).append(")");
return sb.toString();
}
private void createFunctionPane(JPanel generalPane) {
@ -358,7 +359,7 @@ public class PreferencePane extends BasicPane {
JPanel LanguagePane = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Choose_Language"));
generalPane.add(languageAndDashBoard_pane);
languageAndDashBoard_pane.add(LanguagePane);
languageComboBox = new UIComboBox(LANGUAGE.toArray());
languageComboBox = new UIComboBox(LANGUAGE);
languageComboBox.setFont(FRFont.getInstance("Dialog", Font.PLAIN, 12));//为了在中文系统中显示韩文
ActionLabel languageLabel = new ActionLabel(Inter.getLocText("FR-Designer_Designer_Language"));
languageLabel.addActionListener(new ActionListener() {
@ -527,9 +528,10 @@ public class PreferencePane extends BasicPane {
this.logExportDirectoryField.setText(designerEnvManager.getLogLocation());
this.logLevelComboBox.setSelectedItem(FRLevel.getByLevel(designerEnvManager.getLogLevel()));
this.logLevelComboBox.setSelectedItem(FRLevel.getByLevel(designerEnvManager.getLogLevel()));
this.languageComboBox.setSelectedItem(LANGUAGE.get(designerEnvManager.getLanguage()));
this.languageComboBox.setSelectedItem(LANGUAGE[designerEnvManager.getLanguage()]);
designerEnvLanguageIndex = designerEnvManager.getLanguage();
this.pageLengthComboBox.setSelectedIndex(designerEnvManager.getPageLengthUnit());
this.reportLengthComboBox.setSelectedIndex(designerEnvManager.getReportLengthUnit());
@ -616,12 +618,46 @@ public class PreferencePane extends BasicPane {
private int getLanguageInt() {
int l = 0;
String lang = (String) this.languageComboBox.getSelectedItem();
for (int i = 0; i < LANGUAGE.size(); i++) {
if (ComparatorUtils.equals(lang, LANGUAGE.get(i))) {
for (int i = 0; i < LANGUAGE.length; i++) {
if (ComparatorUtils.equals(lang, LANGUAGE[i])) {
l = i;
break;
}
}
return l;
}
// 如果语言设置改变了,则显示重启对话框
public void showRestartDialog() {
if (!languageChanged) {
return;
}
int rv = JOptionPane.showOptionDialog(
null,
Inter.getLocText("FR-Designer_Language_Change_Successful"),
Inter.getLocText("FR-Designer-Plugin_Warning"),
JOptionPane.YES_NO_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null,
new String[]{Inter.getLocText("FR-Designer-Basic_Restart_Designer"), Inter.getLocText("FR-Designer-Basic_Restart_Designer_Later")},
null
);
if (rv == JOptionPane.OK_OPTION) {
RestartHelper.restart();
}
}
@Override
public BasicDialog showWindow(Window window) {
return showWindow(window, new DialogActionAdapter() {
@Override
public void doOk() {
if (languageComboBox.getSelectedIndex() != designerEnvLanguageIndex) {
languageChanged = true;
} else {
languageChanged = false;
}
}
});
}
}

9
designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java

@ -38,6 +38,7 @@ import java.awt.dnd.DnDConstants;
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@ -275,13 +276,15 @@ public class TableDataTreePane extends BasicTableDataTreePane {
* @param srcName 数据集来源(比如报表块就是报表块的名称)
* @param tableDataSource 数据集
*/
public void addTableData(String srcName, TableDataSource tableDataSource) {
public Map<String, String> addTableData(String srcName, TableDataSource tableDataSource) {
Map<String, String> tdNameMap = new HashMap<>();
allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook());
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
TableDataSource tds = tc.getBook();
Iterator tdIterator = tableDataSource.getTableDataNameIterator();
while (tdIterator.hasNext()) {
String tdName = (String) tdIterator.next();
String oldName = tdName;
TableData td = tableDataSource.getTableData(tdName);
if (tds.getTableData(tdName) != null || isDsNameRepeaded(tdName)) {//如果有同名的就拼上来源名称
tdName = srcName + tdName;
@ -292,8 +295,12 @@ public class TableDataTreePane extends BasicTableDataTreePane {
tdName += i;
}
tds.putTableData(tdName, td);
if (!ComparatorUtils.equals(oldName, tdName)) {
tdNameMap.put(oldName, tdName);
}
}
tc.parameterChanged();
dataTree.refresh();
return Collections.unmodifiableMap(tdNameMap);
}
}

2
designer_base/src/com/fr/design/locale/designer.properties

@ -481,3 +481,5 @@ FR-Designer_Data_Analysis_Settings=Data Analysis Settings
FR-Designer_Browser_Background=Browser Background
FR-Designer_Import_Css=Import Css
FR-Designer_Import_JavaScript=Import JavaScript
FR-Designer_Event=
FR-Designer_Properties=

2
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -480,3 +480,5 @@ FR-Designer_Data_Analysis_Settings=Data Analysis Settings
FR-Designer_Browser_Background=Browser Background
FR-Designer_Import_Css=Reference Css
FR-Designer_Import_JavaScript=Reference JavaScript
FR-Designer_Event=Event
FR-Designer_Properties=Properties

3
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -458,3 +458,6 @@ FR-Designer_Data_Analysis_Settings=\u30C7\u30FC\u30BF\u5206\u6790\u8A2D\u5B9A
FR-Designer_Browser_Background=\u30D6\u30E9\u30A6\u30B6\u80CC\u666F
FR-Designer_Import_Css=Css\u5F15\u7528
FR-Designer_Import_JavaScript=JavaScript\u5F15\u7528
FR-Designer_Event=\
FR-Designer_Properties=FR-Designer_Properties=\
\

2
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -454,3 +454,5 @@ FR-Designer_Data_Analysis_Settings=\uB370\uC774\uD130\uBD84\uC11D\uC124\uC815
FR-Designer_Browser_Background=\uC6F9\uBE0C\uB77C\uC6B0\uC800\uBC30\uACBD
FR-Designer_Import_Css=Css\uC778\uC6A9
FR-Designer_Import_JavaScript=JavaScript\uC778\uC6A9
FR-Designer_Event=\
FR-Designer_Properties=\

2
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -484,3 +484,5 @@ FR-Designer_Data_Analysis_Settings=\u6570\u636E\u5206\u6790\u8BBE\u7F6E
FR-Designer_Browser_Background=\u6D4F\u89C8\u5668\u80CC\u666F
FR-Designer_Import_Css=\u5F15\u7528Css
FR-Designer_Import_JavaScript=\u5F15\u7528JavaScript
FR-Designer_Event=\u4E8B\u4EF6
FR-Designer_Properties=\u5C5E\u6027

2
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -472,3 +472,5 @@ FR-Designer_Data_Analysis_Settings=\u8CC7\u6599\u5206\u6790\u8A2D\u5B9A
FR-Designer_Browser_Background=\u700F\u89BD\u5668\u80CC\u666F
FR-Designer_Import_Css=\u5F15\u7528Css
FR-Designer_Import_JavaScript=\u5F15\u7528JavaScript
FR-Designer_Properties=\u5C6C\u6027
FR-Designer_Event=\u4E8B\u4EF6

60
designer_base/src/com/fr/env/RemoteEnv.java vendored

@ -2114,6 +2114,7 @@ public class RemoteEnv implements Env {
StableUtils.mkdirs(target);
File cacheDir = null;
File zip = null;
OutputStream out = null;
try {
HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "fr_remote_design");
@ -2122,16 +2123,15 @@ public class RemoteEnv implements Env {
para.put("currentUsername", this.getUser());
HttpClient client = createHttpMethod(para);
InputStream input = client.getResponseStream();
InputStream input = client.getResponseStream();//拿到服务端传过来的整个共享文件夹的压缩文件的文件流
zip = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "share.zip");
cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), ShareConstants.DIR_SHARE_CACHE);
StableUtils.deleteFile(cacheDir);
StableUtils.mkdirs(cacheDir);
StableUtils.makesureFileExist(zip);
FileOutputStream out = new FileOutputStream(zip);
IOUtils.copyBinaryTo(input, out);
out.flush();
out.close();
out = new FileOutputStream(zip);
IOUtils.copyBinaryTo(input, out);//放到本地缓存目录下
IOUtils.unzip(zip, cacheDir.getAbsolutePath(), EncodeConstants.ENCODING_GBK);//先解压到临时目录
if (cacheDir.exists() && cacheDir.isDirectory()) {
return cacheDir.listFiles(new FilenameFilter() {
@ -2144,6 +2144,10 @@ public class RemoteEnv implements Env {
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
} finally {
if (out != null) {
out.flush();
out.close();
}
StableUtils.deleteFile(zip);
}
return new File[0];
@ -2151,25 +2155,33 @@ public class RemoteEnv implements Env {
@Override
public boolean installREUFile(File reuFile) {
// if (reuFile == null) {
// return false;
// }
// try {
// HashMap<String, String> para = new HashMap<String, String>();
// para.put("op", "fr_remote_design");
// para.put("cmd", "design_install_reufile");
// para.put("current_uid", this.createUserID());
// para.put("currentUsername", this.getUser());
// para.put("reuFileName", reuFile.getName());
//
// HttpClient client = createHttpMethod(para);
// client.setContent(IOUtils.inputStream2Bytes(new FileInputStream(reuFile)));
// InputStream input = execute4InputStream(client);
// return ComparatorUtils.equals(stream2String(input), "true");
// } catch (Exception e) {
// return false;
// }
return false;
if (reuFile == null) {
return false;
}
File tempFile = new File(CacheManager.getProviderInstance().getCacheDirectory(), "temp_remote");
IOUtils.unzip(reuFile, tempFile.getAbsolutePath());
String shareXMLName = StableUtils.pathJoin(tempFile.getAbsolutePath(), ShareConstants.NAME_XML_MODULE);
String helpXMLName = StableUtils.pathJoin(tempFile.getAbsolutePath(), ShareConstants.NAME_XML_HELP);
try {
HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "fr_remote_design");
para.put("cmd", "design_install_reufile");
para.put("current_uid", this.createUserID());
para.put("currentUsername", this.getUser());
para.put("reuFileName", reuFile.getName());
HttpClient client = createHttpMethod(para);
client.setContent(IOUtils.inputStream2Bytes(new FileInputStream(new File(shareXMLName))));
InputStream input = execute4InputStream(client);
client.release();
para.put("isComplete", "true");
HttpClient client1 = createHttpMethod(para);
client1.setContent(IOUtils.inputStream2Bytes(new FileInputStream(new File(helpXMLName))));
InputStream input1 = execute4InputStream(client1);
return ComparatorUtils.equals(stream2String(input), "true") && ComparatorUtils.equals(stream2String(input1), "true");
} catch (Exception e) {
return false;
}
}
@Override

49
designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

@ -10,18 +10,15 @@ import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.properties.EventPropertyTable;
import com.fr.design.designer.properties.WidgetPropertyTable;
import com.fr.design.designer.treeview.ComponentTreeModel;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*;
@ -38,7 +35,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
private EventPropertyTable eventTable;
private List<AbstractPropertyTable> widgetPropertyTables;
private FormDesigner designer;
private ComponentTree componentTree;
private JPanel wsp;
private MobileWidgetTable mobileWidgetTable;
private MobileBodyWidgetTable mobileBodyWidgetTable;
@ -115,15 +111,12 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
@Override
public void refreshDockingView() {
designer = this.getEditingFormDesigner();
removeAll();
if (designer == null) {
clearDockingView();
return;
}
componentTree = new ComponentTree(designer);
widgetPropertyTables = new ArrayList<AbstractPropertyTable>();
propertyTable = new WidgetPropertyTable(designer);
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable));
@ -135,7 +128,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
eventTable.setBorder(null);
UIScrollPane esp = new UIScrollPane(eventTable);
esp.setBorder(null);
wsp = FRGUIPaneFactory.createBorderLayout_S_Pane();
wsp.setBorder(null);
mobileWidgetTable = new MobileWidgetTable(designer);
@ -147,7 +139,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
centerPane.add(mobileBodyWidgetTable,BODY);
if(hasSelectParaPane(designer)){
cardLayout.show(centerPane,PARA);
} else {
cardLayout.show(centerPane,BODY);
}
@ -156,19 +147,23 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
wsp.add(downPanel,BorderLayout.CENTER);
UITabbedPane tabbedPane = new UITabbedPane();
tabbedPane.setOpaque(true);
tabbedPane.setBorder(null);
tabbedPane.setTabPlacement(SwingConstants.BOTTOM);
tabbedPane.addTab(Inter.getLocText("Form-Properties"), psp);
tabbedPane.addTab(Inter.getLocText("Form-Events"), esp);
tabbedPane.addTab(Inter.getLocText("FR-Widget_Mobile_Terminal"), wsp);
initTabPane(psp, esp, tabbedPane);
WidgetPropertyUIProvider[] widgetAttrProviders = getExtraPropertyUIProviders();
addWidgetAttr(widgetAttrProviders);
add(tabbedPane, BorderLayout.CENTER);
propertyTable.initPropertyGroups(null);
eventTable.refresh();
for (AbstractPropertyTable propertyTable : widgetPropertyTables) {
propertyTable.initPropertyGroups(designer);
}
isrefresh = false;
}
private void addWidgetAttr(WidgetPropertyUIProvider[] widgetAttrProviders) {
if (widgetAttrProviders.length == 0) {
UILabel upLabel = new UILabel(Inter.getLocText("FR-Widget_Mobile_Table"),SwingConstants.CENTER);
UILabel upLabel = new UILabel(Inter.getLocText("FR-Widget_Mobile_Table"), SwingConstants.CENTER);
upLabel.setBorder(BorderFactory.createEmptyBorder(6,0,6,0));
wsp.add(upLabel,BorderLayout.NORTH);
wsp.add(upLabel, BorderLayout.NORTH);
} else {
for (WidgetPropertyUIProvider widgetAttrProvider : widgetAttrProviders) {
AbstractPropertyTable propertyTable = widgetAttrProvider.createWidgetAttrTable();
@ -180,13 +175,15 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
}
}
add(tabbedPane, BorderLayout.CENTER);
propertyTable.initPropertyGroups(null);
eventTable.refresh();
for (AbstractPropertyTable propertyTable : widgetPropertyTables) {
propertyTable.initPropertyGroups(designer);
}
isrefresh = false;
}
private void initTabPane(UIScrollPane psp, UIScrollPane esp, UITabbedPane tabbedPane) {
tabbedPane.setOpaque(true);
tabbedPane.setBorder(null);
tabbedPane.setTabPlacement(SwingConstants.BOTTOM);
tabbedPane.addTab(Inter.getLocText("FR-Designer_Properties"), psp);
tabbedPane.addTab(Inter.getLocText("FR-Designer_Event"), esp);
tabbedPane.addTab(Inter.getLocText("FR-Widget_Mobile_Terminal"), wsp);
}
//

Loading…
Cancel
Save