forked from fanruan/design
Browse Source
* commit '53493f552f27d0a28bd52bed3fc90174099640ee': REPORT-19897 英文版设计器显示问题 REPORT-19873 设计器英文 表单自适应被遮挡 补充单元测试 REPORT-19857 英文版alphafine显示问题 1. 把判断国际化的过程和 点击配置页面才能更新 的逻辑解耦。放到启动的时候做。 2. 配置不依赖于 searchOnline 而是判断中英文。 不ignored异常 加读写锁 初始化时从插件里捞一把 通过监听插件生命周期实现 插件天生可拔插,这里不能用static,应每次调用时获取 REPORT-19733 未装数据集插件的设计器远程设计时 编辑服务器数据集 点击确定会覆盖所有服务器中的插件数据集 update REPORT-19636 填报属性里,智能添加单元格组时,鼠标连续选中一片单元格,如果拖动稍微快了一点,选择会出现丢失 补充单元测试 REPORT-18362 插件状态根据lic显示-前台 增加插件扩展类型支持 REPORT-19565 设计器英文版-控件的数据字典部分显示问题 REPORT-17881 文档在线预览控件插件无效-外部开发者插件问题 这里保存的不是实时的信息。 无任务,修复新建本地环境可能出现的npe CHART-9445 集群环境地图资源cacheMap同步 REPORT-19381 设计器 右击-剪切功能失效,是粘贴的功能research/10.0
neil
5 years ago
28 changed files with 555 additions and 182 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