Browse Source
* commit '74038a86e79bcc6e27eeb8f942f789eb10143f23': (32 commits) REPORT-20267 非 简繁英日韩 海外版本设计器默认语言问题 update update REPORT-20267 非简繁英日韩 海外版本设计器默认语言问题 && MOBILE-22490 链接修改 REPORT-20303 FR中点击插件管理报错闪退 REPORT-19218 设计器目录树工具栏重命名无法去除多个后缀名 && REPORT-19200 数据表现与处理-其他属性-打印/导出单元格内容/背景 REPORT-19237 权限编辑界面-可见可用逻辑问题 update REPORT-19184 设计器,聚合报表进入编辑状态 REPORT-18720 模板web属性里面采用服务器设置时 工具栏按钮应该是处于灰化且不可点击状态 REPORT-19897 英文版设计器显示问题 REPORT-19873 设计器英文 表单自适应被遮挡 补充单元测试 REPORT-19857 英文版alphafine显示问题 1. 把判断国际化的过程和 点击配置页面才能更新 的逻辑解耦。放到启动的时候做。 2. 配置不依赖于 searchOnline 而是判断中英文。 不ignored异常 加读写锁 初始化时从插件里捞一把 通过监听插件生命周期实现 插件天生可拔插,这里不能用static,应每次调用时获取 REPORT-19733 未装数据集插件的设计器远程设计时 编辑服务器数据集 点击确定会覆盖所有服务器中的插件数据集 ...final/10.0
Kara
5 years ago
38 changed files with 597 additions and 202 deletions
@ -0,0 +1,77 @@ |
|||||||
|
package com.fr.design.gui.itree.filetree; |
||||||
|
|
||||||
|
import com.fr.base.FRContext; |
||||||
|
import com.fr.design.ExtraDesignClassManager; |
||||||
|
import com.fr.design.mainframe.App; |
||||||
|
import com.fr.general.GeneralContext; |
||||||
|
import com.fr.plugin.context.PluginContext; |
||||||
|
import com.fr.plugin.injectable.PluginModule; |
||||||
|
import com.fr.plugin.manage.PluginFilter; |
||||||
|
import com.fr.plugin.observer.PluginEvent; |
||||||
|
import com.fr.plugin.observer.PluginEventListener; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Arrays; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Set; |
||||||
|
import java.util.concurrent.locks.ReadWriteLock; |
||||||
|
import java.util.concurrent.locks.ReentrantReadWriteLock; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by alex sung on 2019/7/23. |
||||||
|
*/ |
||||||
|
public class FileNodeConstants { |
||||||
|
|
||||||
|
private static List<String> supportFileType; |
||||||
|
private static ReadWriteLock rwl = new ReentrantReadWriteLock(); |
||||||
|
|
||||||
|
private FileNodeConstants() { |
||||||
|
} |
||||||
|
|
||||||
|
static { |
||||||
|
initSupportedTypes(); |
||||||
|
|
||||||
|
GeneralContext.listenPluginRunningChanged(new PluginEventListener() { |
||||||
|
@Override |
||||||
|
public void on(PluginEvent pluginEvent) { |
||||||
|
initSupportedTypes(); |
||||||
|
} |
||||||
|
}, new PluginFilter() { |
||||||
|
@Override |
||||||
|
public boolean accept(PluginContext pluginContext) { |
||||||
|
return pluginContext.contain(PluginModule.ExtraDesign); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private static void addAppExtensions(String[] extensions) { |
||||||
|
for (int i = 0, size = extensions.length; i < size; i++) { |
||||||
|
if (!supportFileType.contains(extensions[i])) { |
||||||
|
supportFileType.add(extensions[i]); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static void initSupportedTypes() { |
||||||
|
try { |
||||||
|
rwl.writeLock().lock(); |
||||||
|
supportFileType = new ArrayList<>(Arrays.asList(FRContext.getFileNodes().getSupportedTypes())); |
||||||
|
//通过插件扩展的
|
||||||
|
Set<App> apps = ExtraDesignClassManager.getInstance().getArray(App.MARK_STRING); |
||||||
|
for (App app : apps) { |
||||||
|
addAppExtensions(app.defaultExtensions()); |
||||||
|
} |
||||||
|
} finally { |
||||||
|
rwl.writeLock().unlock(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static String[] getSupportFileTypes() { |
||||||
|
try { |
||||||
|
rwl.readLock().lock(); |
||||||
|
return supportFileType.toArray(new String[0]); |
||||||
|
} finally { |
||||||
|
rwl.readLock().unlock(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
After Width: | Height: | Size: 284 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 6.8 KiB |
@ -0,0 +1,51 @@ |
|||||||
|
package com.fr.design.gui.itree.filetree; |
||||||
|
|
||||||
|
import com.fr.base.extension.FileExtension; |
||||||
|
import com.fr.base.io.BaseBook; |
||||||
|
import com.fr.design.ExtraDesignClassManager; |
||||||
|
import com.fr.design.mainframe.AbstractAppProvider; |
||||||
|
import com.fr.design.mainframe.App; |
||||||
|
import com.fr.design.mainframe.JTemplate; |
||||||
|
import com.fr.file.FILE; |
||||||
|
import com.fr.stable.fun.mark.Mutable; |
||||||
|
import org.easymock.EasyMock; |
||||||
|
import org.junit.Assert; |
||||||
|
import org.junit.Test; |
||||||
|
|
||||||
|
import java.util.HashSet; |
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by alex sung on 2019/7/25. |
||||||
|
*/ |
||||||
|
public class FileNodeConstantsTest { |
||||||
|
@Test |
||||||
|
public void supportFileTypesTest(){ |
||||||
|
ExtraDesignClassManager extra = EasyMock.mock(ExtraDesignClassManager.class); |
||||||
|
Set<Mutable> apps = new HashSet<Mutable>(){{add(new MockCptxApp());}}; |
||||||
|
EasyMock.expect(extra.getArray(App.MARK_STRING)).andReturn(apps).anyTimes(); |
||||||
|
EasyMock.replay(extra); |
||||||
|
|
||||||
|
Assert.assertEquals(1, extra.getArray(App.MARK_STRING).size()); |
||||||
|
App app = (App) extra.getArray(App.MARK_STRING).iterator().next(); |
||||||
|
Assert.assertEquals("cptx", app.defaultExtensions()[0]); |
||||||
|
} |
||||||
|
|
||||||
|
private class MockCptxApp extends AbstractAppProvider{ |
||||||
|
@Override |
||||||
|
public String[] defaultExtensions() { |
||||||
|
return new String[] {FileExtension.CPTX.getExtension()}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public JTemplate openTemplate(FILE tplFile) { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public BaseBook asIOFile(FILE tplFile) { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,46 @@ |
|||||||
|
package com.fr.design.mainframe.alphafine; |
||||||
|
|
||||||
|
import com.fr.design.DesignerEnvManager; |
||||||
|
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; |
||||||
|
import com.fr.general.GeneralContext; |
||||||
|
import org.easymock.EasyMock; |
||||||
|
import org.junit.Assert; |
||||||
|
import org.junit.Test; |
||||||
|
import org.junit.runner.RunWith; |
||||||
|
import org.powermock.api.easymock.PowerMock; |
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest; |
||||||
|
import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; |
||||||
|
import org.powermock.modules.junit4.PowerMockRunner; |
||||||
|
|
||||||
|
import static org.junit.Assert.*; |
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class) |
||||||
|
public class AlphaFineHelperTest { |
||||||
|
|
||||||
|
@Test |
||||||
|
@PrepareForTest({GeneralContext.class, DesignerEnvManager.class}) |
||||||
|
@SuppressStaticInitializationFor("com.fr.design.mainframe.alphafine.AlphaFineHelper") |
||||||
|
public void testSwitchConfig4Locale() throws Exception { |
||||||
|
|
||||||
|
PowerMock.mockStatic(GeneralContext.class); |
||||||
|
EasyMock.expect(GeneralContext.isChineseEnv()).andReturn(true).times(1).andReturn(false).times(1); |
||||||
|
|
||||||
|
DesignerEnvManager manager = EasyMock.mock(DesignerEnvManager.class); |
||||||
|
EasyMock.expect(manager.getAlphaFineConfigManager()).andReturn(new AlphaFineConfigManager()).anyTimes(); |
||||||
|
EasyMock.replay(manager); |
||||||
|
|
||||||
|
PowerMock.mockStatic(DesignerEnvManager.class); |
||||||
|
EasyMock.expect(DesignerEnvManager.getEnvManager()).andReturn(manager).anyTimes(); |
||||||
|
|
||||||
|
PowerMock.replayAll(); |
||||||
|
|
||||||
|
AlphaFineHelper.switchConfig4Locale(); |
||||||
|
AlphaFineConfigManager config = manager.getAlphaFineConfigManager(); |
||||||
|
Assert.assertEquals(true, config.isSearchOnLine()); |
||||||
|
|
||||||
|
AlphaFineHelper.switchConfig4Locale(); |
||||||
|
Assert.assertEquals(false, config.isSearchOnLine()); |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,66 @@ |
|||||||
|
package com.fr.design.widget; |
||||||
|
|
||||||
|
import com.fr.design.ExtraDesignClassManager; |
||||||
|
import com.fr.design.data.DataCreatorUI; |
||||||
|
import com.fr.design.widget.ui.ButtonDefinePane; |
||||||
|
import com.fr.form.ui.Button; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
import org.easymock.EasyMock; |
||||||
|
import org.junit.Assert; |
||||||
|
import org.junit.Test; |
||||||
|
import org.junit.runner.RunWith; |
||||||
|
import org.powermock.api.easymock.PowerMock; |
||||||
|
import org.powermock.core.classloader.annotations.PowerMockIgnore; |
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest; |
||||||
|
import org.powermock.modules.junit4.PowerMockRunner; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class) |
||||||
|
@PowerMockIgnore("javax.swing.*") |
||||||
|
public class WidgetDefinePaneFactoryTest { |
||||||
|
|
||||||
|
@Test |
||||||
|
@PrepareForTest({ExtraDesignClassManager.class, WidgetDefinePaneFactory.class}) |
||||||
|
public void testCreateWidgetDefinePane() throws Exception { |
||||||
|
|
||||||
|
Map<Class<? extends Widget>, Appearance> map = new HashMap<>(); |
||||||
|
ExtraDesignClassManager mockDesignManager = EasyMock.mock(ExtraDesignClassManager.class); |
||||||
|
EasyMock.expect(mockDesignManager.getCellWidgetOptionsMap()).andReturn(map).anyTimes(); |
||||||
|
EasyMock.replay(mockDesignManager); |
||||||
|
|
||||||
|
PowerMock.mockStatic(ExtraDesignClassManager.class); |
||||||
|
EasyMock.expect(ExtraDesignClassManager.getInstance()).andReturn(mockDesignManager).anyTimes(); |
||||||
|
PowerMock.replayAll(ExtraDesignClassManager.class); |
||||||
|
|
||||||
|
Button mockWidget = EasyMock.mock(Button.class); |
||||||
|
EasyMock.replay(mockWidget); |
||||||
|
|
||||||
|
ButtonDefinePane mockPane = EasyMock.mock(ButtonDefinePane.class); |
||||||
|
mockPane.populateBean(EasyMock.anyObject(Button.class)); |
||||||
|
EasyMock.expectLastCall(); |
||||||
|
EasyMock.replay(mockPane); |
||||||
|
|
||||||
|
|
||||||
|
Operator mockOperator = EasyMock.mock(Operator.class); |
||||||
|
mockOperator.did(EasyMock.anyObject(DataCreatorUI.class), EasyMock.anyString()); |
||||||
|
EasyMock.replay(mockOperator); |
||||||
|
|
||||||
|
WidgetDefinePaneFactory.RN rn1 = WidgetDefinePaneFactory.createWidgetDefinePane(mockWidget, mockOperator); |
||||||
|
Assert.assertNull(rn1); |
||||||
|
|
||||||
|
Appearance appearance = new Appearance(ButtonDefinePane.class, "test"); |
||||||
|
map.put(mockWidget.getClass(), appearance); |
||||||
|
|
||||||
|
WidgetDefinePaneFactory.RN rn2 = WidgetDefinePaneFactory.createWidgetDefinePane(mockWidget, mockOperator); |
||||||
|
Assert.assertNotNull(rn2); |
||||||
|
|
||||||
|
map.clear(); |
||||||
|
|
||||||
|
WidgetDefinePaneFactory.RN rn3 = WidgetDefinePaneFactory.createWidgetDefinePane(mockWidget, mockOperator); |
||||||
|
Assert.assertNull(rn3); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue