Browse Source

Merge branch 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~wim.zhai/design into release/10.0

final/10.0
Wim.Zhai 6 years ago
parent
commit
f4a1fa118b
  1. 71
      designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java
  2. 21
      designer-base/src/main/java/com/fr/design/i18n/Toolkit.java
  3. 11
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  4. 4
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

71
designer-base/src/main/java/com/fr/design/i18n/DesignI18nImpl.java

@ -0,0 +1,71 @@
package com.fr.design.i18n;
import com.fr.general.GeneralContext;
import com.fr.general.log.MessageFormatter;
import com.fr.locale.DesignI18nProvider;
import com.fr.locale.InterProviderFactory;
import com.fr.locale.LocaleBundle;
import com.fr.locale.LocaleFiles;
import com.fr.locale.LocaleManager;
import com.fr.locale.impl.FineLocaleManager;
import java.util.List;
import java.util.Locale;
public class DesignI18nImpl implements DesignI18nProvider {
private static DesignI18nImpl instance = new DesignI18nImpl();
public static DesignI18nImpl getInstance() {
return instance;
}
private LocaleManager localeManager = FineLocaleManager.create();
private DesignI18nImpl() {
addResource("com/fr/design/i18n/main");
InterProviderFactory.registerDesignI18nProvider(this);
}
@Override
public String i18nText(String key) {
return localeManager.getLocalBundle(GeneralContext.getLocale()).getText(localeManager, key);
}
@Override
public String i18nText(String key, Object... args) {
String format = InterProviderFactory.getProvider().getLocText(key);
MessageFormatter.FormattingTuple tuple = MessageFormatter.arrayFormat(format, args);
return localeManager.getLocalBundle(GeneralContext.getLocale()).getText(localeManager, tuple.getMessage());
}
@Override
public void addResource(String path) {
localeManager.addResource(path);
}
@Override
public void removeResource(String path) {
localeManager.removeResource(path);
}
@Override
public LocaleBundle getLocalBundle(Locale locale) {
return localeManager.getLocalBundle(locale);
}
@Override
public List<LocaleFiles> getReverseList() {
return localeManager.getReverseList();
}
@Override
public List<LocaleFiles> getList() {
return localeManager.getList();
}
@Override
public void clear() {
localeManager.clear();
}
}

21
designer-base/src/main/java/com/fr/design/i18n/Toolkit.java

@ -1,27 +1,12 @@
package com.fr.design.i18n;
import com.fr.general.GeneralContext;
import com.fr.general.log.MessageFormatter;
import com.fr.locale.InterProviderFactory;
import com.fr.locale.LocaleManager;
import com.fr.locale.impl.FineLocaleManager;
/**
* 设计器国际化类后面会不再依赖InterProviderFactory
*/
public class Toolkit {
private static LocaleManager localeManager = FineLocaleManager.create();
static {
addResource("com/fr/design/i18n/main");
}
public static void addResource(String path) {
localeManager.addResource(path);
}
/**
* 设计器国际化方法
*
@ -29,7 +14,7 @@ public class Toolkit {
* @return 国际化值
*/
public static String i18nText(String key) {
return localeManager.getLocalBundle(GeneralContext.getLocale()).getText(localeManager, key);
return DesignI18nImpl.getInstance().i18nText(key);
}
/**
@ -41,9 +26,7 @@ public class Toolkit {
* @return 国际化值
*/
public static String i18nText(String key, Object... args) {
String format = InterProviderFactory.getProvider().getLocText(key);
MessageFormatter.FormattingTuple tuple = MessageFormatter.arrayFormat(format, args);
return localeManager.getLocalBundle(GeneralContext.getLocale()).getText(localeManager, tuple.getMessage());
return DesignI18nImpl.getInstance().i18nText(key, args);
}
/**

11
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -24,6 +24,7 @@ import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetHelpDialog;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.event.Listener;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
@ -168,8 +169,14 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
//新tab默认都有标题
borderStyle.setType(LayoutBorderStyle.TITLE);
}
cardLayout.setWidgetName(XWCardLayout.DEFAULT_NAME + tabpaneName.replaceAll(XWCardTagLayout.DEFAULT_NAME, ""));
wCardTitleLayout.setCardName(cardLayout.getWidgetName());
String newCardLayoutName = XWCardLayout.DEFAULT_NAME + tabpaneName.replaceAll(XWCardTagLayout.DEFAULT_NAME, "");
cardLayout.setWidgetName(newCardLayoutName);
//修改cardswitchbutton所绑定的cardlayoutname
for (int i = 0, len = wCardTagLayout.getWidgetCount(); i < len; i++) {
CardSwitchButton button = wCardTagLayout.getSwitchButton(i);
button.setCardLayoutName(newCardLayoutName);
}
wCardTitleLayout.setCardName(newCardLayoutName);
wCardTagLayout.setNewTab(true);
//这边需要设置成默认值兼容之前的title高度(不知道为啥之前的title的高度会改变)
if(this.toData().getNorthSize() != 0){

4
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -27,7 +27,7 @@ import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.hyperlink.ReportletHyperlinkPane;
import com.fr.design.hyperlink.WebHyperlinkPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.i18n.DesignI18nImpl;
import com.fr.design.javascript.EmailPane;
import com.fr.design.javascript.JavaScriptImplPane;
import com.fr.design.javascript.ParameterJavaScriptPane;
@ -124,7 +124,7 @@ public class DesignerActivator extends Activator {
List<LocaleMarker> markers = rightCollectMutable(InterMutableKey.Path);
for (LocaleMarker marker : markers) {
if (marker.match(LocaleScope.DESIGN)) {
Toolkit.addResource(marker.getPath());
DesignI18nImpl.getInstance().addResource(marker.getPath());
}
}
designerModuleStart();

Loading…
Cancel
Save