Browse Source

REPORT-60538 改用LocaleCenter国际化接口

feature/x
方磊 3 years ago
parent
commit
2aa50641b5
  1. 26
      designer-base/src/main/java/com/fr/design/locale/impl/OnlineWidgetsMark.java
  2. 11
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java

26
designer-base/src/main/java/com/fr/design/locale/impl/OnlineWidgetsMark.java

@ -0,0 +1,26 @@
package com.fr.design.locale.impl;
import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleMark;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
public class OnlineWidgetsMark implements LocaleMark<Boolean> {
private Map<Locale, Boolean> map = new HashMap<>();
public OnlineWidgetsMark() {
map.put(Locale.CHINA, true);
map.put(Locale.TAIWAN, true);
map.put(Locale.US, false);
map.put(Locale.KOREA, false);
map.put(Locale.JAPAN, false);
}
@Override
public Boolean getValue() {
Boolean result = map.get(GeneralContext.getLocale());
return result == null ? false : result;
}
}

11
designer-form/src/main/java/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -6,10 +6,13 @@ import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.locale.impl.OnlineWidgetsMark;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo; import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo;
import com.fr.design.mainframe.share.collect.ComponentCollector; import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane; import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane; import com.fr.design.mainframe.share.ui.online.OnlineWidgetRepoPane;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
@ -173,7 +176,13 @@ public class FormWidgetDetailPane extends FormDockView{
private void initPaneList() { private void initPaneList() {
paneList = new ArrayList<>(); paneList = new ArrayList<>();
paneList.add(LocalWidgetRepoPane.getInstance()); paneList.add(LocalWidgetRepoPane.getInstance());
paneList.add(OnlineWidgetRepoPane.getInstance()); if (isShowOnlineWidgetRepoPane()) {
paneList.add(OnlineWidgetRepoPane.getInstance());
}
} }
private boolean isShowOnlineWidgetRepoPane() {
LocaleMark<Boolean> mark = LocaleCenter.getMark(OnlineWidgetsMark.class);
return mark.getValue();
}
} }

Loading…
Cancel
Save