Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~qinghui.liu/design into release/10.0

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
8dd7b88c1c
  1. 25
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 57
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  3. 2
      designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java
  4. 25
      designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java
  5. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java
  6. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java
  7. 5
      designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java
  8. 52
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  9. 28
      designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java
  10. 11
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

25
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -53,6 +53,7 @@ import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.HashSet; import java.util.HashSet;
@ -385,7 +386,7 @@ public class EnvChangeEntrance {
public void doOk() { public void doOk() {
envListOkAction(envListPane, PopTipStrategy.LATER); envListOkAction(envListPane, PopTipStrategy.LATER);
// 切换完成后清理密码 // 切换完成后清理密码
updateSelectEnv(DesignerEnvManager.getEnvManager().getCurEnvName()); updateNotRememberPwdEnv();
} }
@Override @Override
@ -416,7 +417,7 @@ public class EnvChangeEntrance {
if (!envListOkAction(envListPane, PopTipStrategy.NOW)) { if (!envListOkAction(envListPane, PopTipStrategy.NOW)) {
DesignerExiter.getInstance().execute(); DesignerExiter.getInstance().execute();
} else { } else {
updateSelectEnv(DesignerEnvManager.getEnvManager().getCurEnvName()); updateNotRememberPwdEnv();
} }
} }
@ -430,15 +431,17 @@ public class EnvChangeEntrance {
/** /**
* 切换环境后 刷新远程目录需要忘记密码的情况 * 切换环境后 刷新远程目录需要忘记密码的情况
* @param envName 环境名
*/ */
private void updateSelectEnv(String envName) { private void updateNotRememberPwdEnv() {
DesignerEnvManager mgr = DesignerEnvManager.getEnvManager(); DesignerEnvManager mgr = DesignerEnvManager.getEnvManager();
Iterator<String> iterator = mgr.getEnvNameIterator();
while (iterator.hasNext()) {
String envName = iterator.next();
DesignerWorkspaceInfo info = mgr.getWorkspaceInfo(envName); DesignerWorkspaceInfo info = mgr.getWorkspaceInfo(envName);
if (info != null) {
WorkspaceConnectionInfo connection = info.getConnection();
if (connection != null && !connection.isRememberPwd()) {
if (isNotRememberPwd(info)) {
WorkspaceConnectionInfo connection = info.getConnection();
DesignerWorkspaceInfo workspaceInfo = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo( DesignerWorkspaceInfo workspaceInfo = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo(
connection.getUrl(), connection.getUserName(), StringUtils.EMPTY, connection.getCertPath(), connection.getCertSecretKey(), false)); connection.getUrl(), connection.getUserName(), StringUtils.EMPTY, connection.getCertPath(), connection.getCertSecretKey(), false));
mgr.putEnv(envName, workspaceInfo); mgr.putEnv(envName, workspaceInfo);
@ -446,6 +449,14 @@ public class EnvChangeEntrance {
} }
} }
private boolean isNotRememberPwd(DesignerWorkspaceInfo info) {
if (info != null && info.getType() == DesignerWorkspaceType.Remote) {
WorkspaceConnectionInfo connection = info.getConnection();
return connection != null && !connection.isRememberPwd();
}
return false;
}
/** /**
* 提示显示策略 * 提示显示策略

57
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -28,6 +28,7 @@ import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerFrameUpButtonProvider; import com.fr.design.fun.DesignerFrameUpButtonProvider;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.fun.PropertyItemPaneProvider;
import com.fr.design.fun.ReportSupportedFileUIProvider; import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
@ -55,6 +56,14 @@ import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
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 com.fr.plugin.observer.PluginEventType;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.report.cell.Elem; import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.cellattr.CellImage;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -100,7 +109,10 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
protected TimeConsumeTimer consumeTimer = new TimeConsumeTimer(); protected TimeConsumeTimer consumeTimer = new TimeConsumeTimer();
public int resolution = ScreenResolution.getScreenResolution(); public int resolution = ScreenResolution.getScreenResolution();
private PluginEventListener pluginListener;
public JTemplate() { public JTemplate() {
initAndStartPlugin();
} }
public JTemplate(T t, String defaultFileName) { public JTemplate(T t, String defaultFileName) {
@ -129,8 +141,50 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
designModel = createDesignModel(); designModel = createDesignModel();
consumeTimer.setEnabled(shouldInitForCollectInfo(isNewFile)); consumeTimer.setEnabled(shouldInitForCollectInfo(isNewFile));
initAndStartPlugin();
}
private void initAndStartPlugin() {
initPluginPane();
startListenPlugin();
}
private void startListenPlugin() {
PluginFilter filter = new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PropertyItemPaneProvider.XML_TAG);
}
};
this.pluginListener = new PluginEventListener(PropertyItemPaneProvider.LAST) {
@Override
public void on(PluginEvent event) {
PluginContext context = event.getContext();
PluginRuntime runtime = context.getRuntime();
Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
addPane(provider);
}
}
};
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginListener, filter);
}
private void initPluginPane() {
ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<PropertyItemPaneProvider> providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
addPane(provider);
}
} }
protected <R> void addPane(PropertyItemPaneProvider provider) {
// do nothing
}
void onGetFocus() { void onGetFocus() {
consumeTimer.start(); consumeTimer.start();
} }
@ -251,7 +305,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* 模板关闭时 * 模板关闭时
*/ */
public void whenClose() { public void whenClose() {
// do nothing // stop的时候 pluginListener 和 PluginFilter 都会移除
PluginListenerRegistration.getInstance().stopListen(this.pluginListener);
} }
/** /**

2
designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java

@ -211,6 +211,8 @@ public class JVirtualTemplate extends JTemplate {
List<JTemplate<?, ?>> historyList = HistoryTemplateListPane.getInstance().getHistoryList(); List<JTemplate<?, ?>> historyList = HistoryTemplateListPane.getInstance().getHistoryList();
historyList.set(index, jt); historyList.set(index, jt);
DesignerContext.getDesignerFrame().addAndActivateJTemplate(jt); DesignerContext.getDesignerFrame().addAndActivateJTemplate(jt);
// 虚拟模板JVirtualTemplate被激活后 由真实的JTemplate替换 此时调用whenClose 防止JVirtualTemplate无法释放
this.whenClose();
} }
@Override @Override

25
designer-base/src/test/java/com/fr/design/EnvChangeEntranceTest.java

@ -2,6 +2,7 @@ package com.fr.design;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.DesignerWorkspaceType;
import com.fr.design.env.LocalDesignerWorkspaceInfo;
import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.env.RemoteDesignerWorkspaceInfo;
import com.fr.env.CheckServiceDialog; import com.fr.env.CheckServiceDialog;
import com.fr.invoke.Reflect; import com.fr.invoke.Reflect;
@ -58,7 +59,7 @@ public class EnvChangeEntranceTest {
} }
@Test @Test
public void testUpdateSelectEnv() { public void testUpdateNotRememberPwdEnv() {
DesignerEnvManager manager = new DesignerEnvManager(); DesignerEnvManager manager = new DesignerEnvManager();
@ -71,16 +72,32 @@ public class EnvChangeEntranceTest {
manager.putEnv("test1", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true))); manager.putEnv("test1", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)));
manager.putEnv("test2", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", false))); manager.putEnv("test2", RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", false)));
manager.putEnv("test3", LocalDesignerWorkspaceInfo.create("name", "path"));
Reflect.on(entrance).call("updateSelectEnv", "test1"); Reflect.on(entrance).call("updateNotRememberPwdEnv");
Reflect.on(entrance).call("updateSelectEnv", "test2");
Assert.assertEquals(manager.getWorkspaceInfo("test1").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)).getConnection()); Assert.assertEquals(manager.getWorkspaceInfo("test1").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true)).getConnection());
Assert.assertEquals(manager.getWorkspaceInfo("test2").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "", "", "", false)).getConnection()); Assert.assertEquals(manager.getWorkspaceInfo("test2").getConnection(), RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "", "", "", false)).getConnection());
Assert.assertEquals(manager.getWorkspaceInfo("test3").getName(), "name");
Assert.assertEquals(manager.getWorkspaceInfo("test3").getPath(), "path");
PowerMock.verifyAll(); PowerMock.verifyAll();
} }
@Test
public void testIsNotRememberPwd() {
EnvChangeEntrance entrance = EnvChangeEntrance.getInstance();
DesignerWorkspaceInfo info1 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "password", "", "", true));
DesignerWorkspaceInfo info2 = RemoteDesignerWorkspaceInfo.create(new WorkspaceConnectionInfo("url", "userName", "111", "", "", false));
DesignerWorkspaceInfo info3 = LocalDesignerWorkspaceInfo.create("name", "path");
DesignerWorkspaceInfo info4 = null;
Assert.assertFalse((boolean) Reflect.on(entrance).call("isNotRememberPwd", info1).get());
Assert.assertTrue((boolean) Reflect.on(entrance).call("isNotRememberPwd", info2).get());
Assert.assertFalse((boolean) Reflect.on(entrance).call("isNotRememberPwd", info3).get());
Assert.assertFalse((boolean) Reflect.on(entrance).call("isNotRememberPwd", info4).get());
}
} }

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/report/MeterPlotReportDataContentPane.java

@ -27,7 +27,7 @@ import java.awt.Component;
public class MeterPlotReportDataContentPane extends AbstractReportDataContentPane { public class MeterPlotReportDataContentPane extends AbstractReportDataContentPane {
private static final String CATENAME = Toolkit.i18nText("Fine-Design_Chart_Category_Name"); private static final String CATENAME = Toolkit.i18nText("Fine-Design_Chart_Category_Name");
private static final String NVALUE = Toolkit.i18nText("Fine-Design_Chart_Pointer_Value"); private static final String NVALUE = Toolkit.i18nText("Fine-Design_Chart_Value_Pointer");
private static final String TARGET_VALUE = Toolkit.i18nText("Fine-Design_Chart_Target_Value"); private static final String TARGET_VALUE = Toolkit.i18nText("Fine-Design_Chart_Target_Value");
private TinyFormulaPane singCatePane; private TinyFormulaPane singCatePane;

4
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/MeterPlotTableDataContentPane.java

@ -35,8 +35,8 @@ import java.awt.event.ItemListener;
* @version 创建时间2012-12-21 下午04:51:50 * @version 创建时间2012-12-21 下午04:51:50
*/ */
public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane { public class MeterPlotTableDataContentPane extends AbstractTableDataContentPane {
private static final String METER_NAME = Toolkit.i18nText("Fine-Design_Chart_Style_Format_Category_Name"); private static final String METER_NAME = Toolkit.i18nText("Fine-Design_Chart_Category_Name");
private static final String METER_VALUE = Toolkit.i18nText("Fine-Design_Chart_Pointer_Value"); private static final String METER_VALUE = Toolkit.i18nText("Fine-Design_Chart_Value_Pointer");
private static final String TARGET_VALUE = Toolkit.i18nText("Fine-Design_Chart_Target_Value"); private static final String TARGET_VALUE = Toolkit.i18nText("Fine-Design_Chart_Target_Value");
private static final int COMBOBOX_WIDTH = 115; private static final int COMBOBOX_WIDTH = 115;

5
designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java

@ -41,11 +41,14 @@ abstract class ModelUtil {
if (StringUtils.isEmpty(widgetName)) { if (StringUtils.isEmpty(widgetName)) {
widgetName = xCreator.createDefaultName(); widgetName = xCreator.createDefaultName();
} }
//先保存默认名字
String raw = widgetName; String raw = widgetName;
int i = 0; int i = 0;
//先初始化加上索引。
widgetName = widgetName + i;
while (form.isNameExist(widgetName) || duplicated.contains(widgetName)) { while (form.isNameExist(widgetName) || duplicated.contains(widgetName)) {
widgetName = raw + i;
i++; i++;
widgetName = raw + i;
} }
//将名字加入重复集合中 //将名字加入重复集合中
duplicated.add(widgetName); duplicated.add(widgetName);

52
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -70,14 +70,7 @@ import com.fr.form.ui.container.WLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.page.PaperSettingProvider; import com.fr.page.PaperSettingProvider;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
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 com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.report.cell.Elem; import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage; import com.fr.report.cell.cellattr.CellImage;
import com.fr.report.worksheet.FormElementCase; import com.fr.report.worksheet.FormElementCase;
@ -104,7 +97,6 @@ import java.awt.image.BufferedImage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Set;
public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<Form> { public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<Form> {
private static final String FORM_CARD = "FORM"; private static final String FORM_CARD = "FORM";
@ -132,51 +124,15 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
public JForm() { public JForm() {
super(new Form(new WBorderLayout("form")), "Form"); super(new Form(new WBorderLayout("form")), "Form");
initPluginPane();
startListenPlugin();
} }
public JForm(Form form, FILE file) { public JForm(Form form, FILE file) {
super(form, file); super(form, file);
initPluginPane();
startListenPlugin();
} }
private void startListenPlugin() {
PluginFilter filter = new PluginFilter() {
@Override @Override
public boolean accept(PluginContext context) { protected void addPane(PropertyItemPaneProvider provider) {
return context.contain(PropertyItemPaneProvider.XML_TAG);
}
};
this.pluginListener = new PluginEventListener(PropertyItemPaneProvider.LAST) {
@Override
public void on(PluginEvent event) {
PluginContext context = event.getContext();
PluginRuntime runtime = context.getRuntime();
Set<PropertyItemPaneProvider> providers = runtime.get(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
addPane(provider);
}
}
};
PluginListenerRegistration.getInstance().listen(PluginEventType.AfterRun, this.pluginListener, filter);
}
private void initPluginPane() {
ExtraDesignClassManager classManager = PluginModule.getAgent(PluginModule.ExtraDesign);
Set<PropertyItemPaneProvider> providers = classManager.getArray(PropertyItemPaneProvider.XML_TAG);
for (PropertyItemPaneProvider provider : providers) {
addPane(provider);
}
}
private void addPane(PropertyItemPaneProvider provider) {
PaneHolder<FormDesigner> holder = provider.getPaneHolder(FormDesigner.class); PaneHolder<FormDesigner> holder = provider.getPaneHolder(FormDesigner.class);
if (holder != null) { if (holder != null) {
@ -1040,10 +996,4 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
// richer:form文件 daniel 改成三个字 // richer:form文件 daniel 改成三个字
fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.FRM, appName + Toolkit.i18nText("Fine-Design_Report_Template_File"))); fileChooser.addChooseFILEFilter(new ChooseFileFilter(FileExtension.FRM, appName + Toolkit.i18nText("Fine-Design_Report_Template_File")));
} }
@Override
public void whenClose() {
// stop的时候 pluginListener 和 PluginFilter 都会移除
PluginListenerRegistration.getInstance().stopListen(this.pluginListener);
}
} }

28
designer-form/src/test/java/com/fr/design/designer/beans/models/AddingModelTest.java

@ -56,6 +56,9 @@ public class AddingModelTest {
DaoContext.setEntityDao(null); DaoContext.setEntityDao(null);
} }
/**
* 默认名字 + i
*/
@Test @Test
public void testInstantiateCreator() throws Exception { public void testInstantiateCreator() throws Exception {
@ -82,7 +85,7 @@ public class AddingModelTest {
AddingModel addingModel = new AddingModel(xCreator1, 20, 20); AddingModel addingModel = new AddingModel(xCreator1, 20, 20);
Form form = EasyMock.mock(Form.class); Form form = EasyMock.mock(Form.class);
EasyMock.expect(form.isNameExist("test")).andReturn(true).once(); EasyMock.expect(form.isNameExist("test0")).andReturn(true).once();
EasyMock.expect(form.isNameExist("test03")).andReturn(true).once(); EasyMock.expect(form.isNameExist("test03")).andReturn(true).once();
EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes(); EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes();
EasyMock.replay(form); EasyMock.replay(form);
@ -93,9 +96,9 @@ public class AddingModelTest {
addingModel.instantiateCreator(mock); addingModel.instantiateCreator(mock);
//没有默认参数, 但已经存在 test //没有默认参数, 但已经存在 test
Assert.assertEquals("test0", xCreator1.toData().getWidgetName()); Assert.assertEquals("test1", xCreator1.toData().getWidgetName());
//直接返回 //直接返回
Assert.assertEquals("test02", xCreator2.toData().getWidgetName()); Assert.assertEquals("test020", xCreator2.toData().getWidgetName());
//已经存在,后接0 //已经存在,后接0
Assert.assertEquals("test030", xCreator3.toData().getWidgetName()); Assert.assertEquals("test030", xCreator3.toData().getWidgetName());
} }
@ -104,8 +107,8 @@ public class AddingModelTest {
public void testInstantiateCreator_cardLayout() throws Exception { public void testInstantiateCreator_cardLayout() throws Exception {
Form form = EasyMock.mock(Form.class); Form form = EasyMock.mock(Form.class);
EasyMock.expect(form.isNameExist("cardlayout")).andReturn(true).once();
EasyMock.expect(form.isNameExist("cardlayout0")).andReturn(true).once(); EasyMock.expect(form.isNameExist("cardlayout0")).andReturn(true).once();
EasyMock.expect(form.isNameExist("cardlayout1")).andReturn(true).once();
EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes(); EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes();
EasyMock.replay(form); EasyMock.replay(form);
@ -116,13 +119,16 @@ public class AddingModelTest {
WCardLayout wCardLayout = new WCardLayout(20, 20); WCardLayout wCardLayout = new WCardLayout(20, 20);
XWCardLayout xwCardLayout = new XWCardLayout(wCardLayout, new Dimension(40, 40)); XWCardLayout xwCardLayout = new XWCardLayout(wCardLayout, new Dimension(40, 40));
AddingModel addingModel = new AddingModel(mock, xwCardLayout); AddingModel addingModel = new AddingModel(mock, xwCardLayout);
Assert.assertEquals("cardlayout1", xwCardLayout.toData().getWidgetName()); Assert.assertEquals("cardlayout2", xwCardLayout.toData().getWidgetName());
//依赖于 cardlayout 创建 container //依赖于 cardlayout 创建 container
XLayoutContainer parentLayOut = xwCardLayout.initCreatorWrapper(80); XLayoutContainer parentLayOut = xwCardLayout.initCreatorWrapper(80);
//组件默认名 tablelayout2
AddingModel parentModel = new AddingModel(mock, parentLayOut); AddingModel parentModel = new AddingModel(mock, parentLayOut);
Assert.assertEquals("tablayout1", parentLayOut.toData().getWidgetName()); //经过处理 tablayout20
Assert.assertEquals("tabpane1", ((XCreator) (parentLayOut.getComponent(0))).getXCreator().toData().getWidgetName()); Assert.assertEquals("tablayout20", parentLayOut.toData().getWidgetName());
Assert.assertEquals("tabpane20", ((XCreator) (parentLayOut.getComponent(0))).getXCreator().toData().getWidgetName());
Assert.assertEquals("cardlayout20", xwCardLayout.toData().getWidgetName());
} }
@ -130,8 +136,6 @@ public class AddingModelTest {
public void testInstantiateCreator_containsNotXCreator() throws Exception { public void testInstantiateCreator_containsNotXCreator() throws Exception {
Form form = EasyMock.mock(Form.class); Form form = EasyMock.mock(Form.class);
EasyMock.expect(form.isNameExist("cardlayout")).andReturn(true).once();
EasyMock.expect(form.isNameExist("cardlayout0")).andReturn(true).once();
EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes(); EasyMock.expect(form.isNameExist(EasyMock.anyString())).andReturn(false).anyTimes();
EasyMock.replay(form); EasyMock.replay(form);
@ -170,16 +174,16 @@ public class AddingModelTest {
AddingModel chartModel = new AddingModel(mock, xCreator1); AddingModel chartModel = new AddingModel(mock, xCreator1);
Assert.assertEquals("chart", xCreator1.toData().getWidgetName()); Assert.assertEquals("chart0", xCreator1.toData().getWidgetName());
} }
private static class DemoCreator extends XCreator { private static class DemoCreator extends XCreator {
private String widgetName; private String widgetName;
public DemoCreator(Widget ob, Dimension initSize, String widgetName) { public DemoCreator(Widget ob, Dimension initSize, String defaultName) {
super(ob, initSize); super(ob, initSize);
this.widgetName = widgetName; this.widgetName = defaultName;
} }
@Override @Override

11
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -36,6 +36,7 @@ import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.fun.PreviewProvider; import com.fr.design.fun.PreviewProvider;
import com.fr.design.fun.PropertyItemPaneProvider;
import com.fr.design.fun.ReportSupportedFileUIProvider; import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
@ -152,6 +153,15 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
populateReportParameterAttr(); populateReportParameterAttr();
} }
@Override
protected void addPane(PropertyItemPaneProvider provider) {
PaneHolder<JWorkBook> holder = provider.getPaneHolder(JWorkBook.class);
if (holder != null) {
JPanel panel = holder.getInstance(this);
EastRegionContainerPane.getInstance().replaceKeyPane(provider.key(), panel);
}
}
@Override @Override
public void refreshEastPropertiesPane() { public void refreshEastPropertiesPane() {
if (isEditingPolySheet()) { if (isEditingPolySheet()) {
@ -1191,6 +1201,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
@Override @Override
public void whenClose() { public void whenClose() {
super.whenClose();
reportComposite.doRemoveAction(); reportComposite.doRemoveAction();
} }
} }

Loading…
Cancel
Save