Browse Source

REPORT-9246 设计器中有好多配置修改操作 中夹杂了很多的业务逻辑,将业务逻辑和配置修改剥离出来,Configurations.update操作中尽量只包含修改配置的步骤

master
kerry 6 years ago
parent
commit
ac014703c1
  1. 36
      designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java
  2. 20
      designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java
  3. 42
      designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
  4. 18
      designer-base/src/main/java/com/fr/design/actions/server/ProcedureListAction.java
  5. 29
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java
  6. 398
      designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java
  7. 16
      designer-realize/src/main/java/com/fr/design/actions/report/ReportWebAttrAction.java
  8. 20
      designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java

36
designer-base/src/main/java/com/fr/design/actions/server/ConnectionListAction.java

@ -1,7 +1,6 @@
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fr.config.Configuration;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionManagerPane; import com.fr.design.data.datapane.connect.ConnectionManagerPane;
@ -16,10 +15,11 @@ import com.fr.file.ConnectionConfig;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.locale.InterProviderFactory; import com.fr.locale.InterProviderFactory;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.WorkerFacade;
import javax.swing.*; import javax.swing.KeyStroke;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.util.Map; import java.util.Map;
@ -74,26 +74,27 @@ public class ConnectionListAction extends UpdateAction {
final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null); final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null);
databaseListDialog.addDialogActionListener(new DialogActionAdapter() { databaseListDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() { public void doOk() {
Configurations.update(new Worker() { if (!databaseManagerPane.isNamePermitted()) {
databaseListDialog.setDoOKSucceed(false);
return;
}
Configurations.modify(new WorkerFacade(ConnectionConfig.class) {
@Override @Override
public void run() { public void run() {
if (!databaseManagerPane.isNamePermitted()) { databaseManagerPane.update(datasourceManager);
databaseListDialog.setDoOKSucceed(false);
return;
}
if (!doWithDatasourceManager(datasourceManager, databaseManagerPane, databaseListDialog)) {
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
return;
}
DesignerContext.getDesignerBean("databasename").refreshBeanElement();
} }
}.addCallBack(new CallBackAdaptor() {
@Override @Override
public Class<? extends Configuration>[] targets() { public boolean beforeCommit() {
return new Class[]{ConnectionConfig.class}; //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
return doWithDatasourceManager(datasourceManager, databaseManagerPane, databaseListDialog);
} }
});
@Override
public void afterCommit() {
DesignerContext.getDesignerBean("databasename").refreshBeanElement();
}
}));
} }
}); });
databaseListDialog.setVisible(true); databaseListDialog.setVisible(true);
@ -109,7 +110,6 @@ public class ConnectionListAction extends UpdateAction {
* @return boolean 是否更新成功 * @return boolean 是否更新成功
*/ */
public static boolean doWithDatasourceManager(ConnectionConfig datasourceManager, ConnectionShowPane connectionShowPane, BasicDialog databaseListDialog) { public static boolean doWithDatasourceManager(ConnectionConfig datasourceManager, ConnectionShowPane connectionShowPane, BasicDialog databaseListDialog) {
connectionShowPane.update(datasourceManager);
boolean isFailed = false; boolean isFailed = false;
//存在请重命名则不能更新 //存在请重命名则不能更新
int index = isConnectionMapContainsRename(datasourceManager); int index = isConnectionMapContainsRename(datasourceManager);

20
designer-base/src/main/java/com/fr/design/actions/server/GlobalParameterAction.java

@ -5,7 +5,6 @@ package com.fr.design.actions.server;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.ParameterConfig; import com.fr.base.ParameterConfig;
import com.fr.config.Configuration;
import com.fr.config.ServerPreferenceConfig; import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -16,10 +15,11 @@ import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.parameter.ParameterManagerPane; import com.fr.design.parameter.ParameterManagerPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.WorkerFacade;
import javax.swing.*; import javax.swing.KeyStroke;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -49,23 +49,21 @@ public class GlobalParameterAction extends UpdateAction {
parameterManagerPane.populate(ParameterConfig.getInstance().getGlobalParameters()); parameterManagerPane.populate(ParameterConfig.getInstance().getGlobalParameters());
parameterManagerDialog.addDialogActionListener(new DialogActionAdapter() { parameterManagerDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() { public void doOk() {
Configurations.update(new Worker() { Configurations.modify(new WorkerFacade(ServerPreferenceConfig.class) {
@Override @Override
public void run() { public void run() {
//apply new parameter list.
parameterManagerPane.update(); parameterManagerPane.update();
}
}.addCallBack(new CallBackAdaptor() {
@Override
public void afterCommit() {
DesignModelAdapter<?, ?> model = DesignModelAdapter.getCurrentModelAdapter(); DesignModelAdapter<?, ?> model = DesignModelAdapter.getCurrentModelAdapter();
if (model != null) { if (model != null) {
model.parameterChanged(); model.parameterChanged();
} }
parameterManagerDialog.setDoOKSucceed(!parameterManagerPane.isContainsRename()); parameterManagerDialog.setDoOKSucceed(!parameterManagerPane.isContainsRename());
} }
}));
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{ServerPreferenceConfig.class};
}
});
} }
}); });

42
designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java

@ -21,10 +21,12 @@ import com.fr.file.ProcedureConfig;
import com.fr.file.TableDataConfig; import com.fr.file.TableDataConfig;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.locale.InterProviderFactory; import com.fr.locale.InterProviderFactory;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.Worker;
import com.fr.transaction.WorkerFacade;
import javax.swing.*; import javax.swing.KeyStroke;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -92,33 +94,35 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
globalTableDataDialog.addDialogActionListener(new DialogActionAdapter() { globalTableDataDialog.addDialogActionListener(new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
Configurations.update(new Worker() { if (!globalTableDataPane.isNamePermitted()) {
globalTableDataDialog.setDoOKSucceed(false);
return;
}
DesignTableDataManager.clearGlobalDs();
Configurations.modify(new WorkerFacade(TableDataConfig.class) {
@Override @Override
public void run() { public void run() {
if (!globalTableDataPane.isNamePermitted()) {
globalTableDataDialog.setDoOKSucceed(false);
return;
}
DesignTableDataManager.clearGlobalDs();
globalTableDataPane.update(tableDataConfig); globalTableDataPane.update(tableDataConfig);
if (!doWithDatasourceManager(tableDataConfig, globalTableDataPane, globalTableDataDialog)) {
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
return;
}
// 刷新共有数据集
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
fireDSChanged(globalTableDataPane.getDsChangedNameMap());
} }
}.addCallBack(new CallBackAdaptor() {
@Override @Override
public Class<? extends Configuration>[] targets() { public boolean beforeCommit() {
return new Class[]{TableDataConfig.class}; //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
return doWithDatasourceManager(tableDataConfig, globalTableDataPane, globalTableDataDialog);
} }
});
@Override
public void afterCommit() {
// 刷新共有数据集
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
fireDSChanged(globalTableDataPane.getDsChangedNameMap());
}
}));
} }
}); });
globalTableDataDialog.setVisible(true); globalTableDataDialog.setVisible(true);

18
designer-base/src/main/java/com/fr/design/actions/server/ProcedureListAction.java

@ -1,7 +1,6 @@
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.config.Configuration;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
@ -13,8 +12,9 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
import com.fr.file.ProcedureConfig; import com.fr.file.ProcedureConfig;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.WorkerFacade;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -44,20 +44,18 @@ public class ProcedureListAction extends UpdateAction {
BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null); BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null);
databaseListDialog.addDialogActionListener(new DialogActionAdapter() { databaseListDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() { public void doOk() {
Configurations.update(new Worker() { DesignTableDataManager.clearGlobalDs();
Configurations.modify(new WorkerFacade(ProcedureConfig.class) {
@Override @Override
public void run() { public void run() {
DesignTableDataManager.clearGlobalDs();
databaseManagerPane.update(procedureConfig); databaseManagerPane.update(procedureConfig);
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
} }
}.addCallBack(new CallBackAdaptor() {
@Override @Override
public Class<? extends Configuration>[] targets() { public void afterCommit() {
return new Class[]{ProcedureConfig.class}; TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
} }
}); }));
} }
}); });
databaseListDialog.setVisible(true); databaseListDialog.setVisible(true);

29
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java

@ -1,7 +1,5 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fr.base.FRContext;
import com.fr.config.Configuration;
import com.fr.data.impl.AbstractDatabaseConnection; import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.data.impl.NameDatabaseConnection; import com.fr.data.impl.NameDatabaseConnection;
@ -13,11 +11,12 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.WorkerFacade;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.*; import javax.swing.SwingUtilities;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
@ -100,22 +99,24 @@ public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
connectionListDialog.setDoOKSucceed(false); connectionListDialog.setDoOKSucceed(false);
return; return;
} }
Configurations.update(new Worker() {
Configurations.modify(new WorkerFacade(ConnectionConfig.class) {
@Override @Override
public void run() { public void run() {
if (!ConnectionListAction.doWithDatasourceManager(connectionConfig, connectionListPane, connectionListPane.update(connectionConfig);
connectionListDialog)) { }
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面 }.addCallBack(new CallBackAdaptor() {
return; @Override
} public boolean beforeCommit() {
DesignerContext.getDesignerBean("databasename").refreshBeanElement(); //如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
return ConnectionListAction.doWithDatasourceManager(connectionConfig, connectionListPane, connectionListDialog);
} }
@Override @Override
public Class<? extends Configuration>[] targets() { public void afterCommit() {
return new Class[]{ConnectionConfig.class}; DesignerContext.getDesignerBean("databasename").refreshBeanElement();
} }
}); }));
} }
}); });

398
designer-base/src/test/java/com/fr/env/RemoteEnvURLTest.java vendored

@ -1,199 +1,199 @@
package com.fr.env; //package com.fr.env;
//
import org.junit.Assert; //import org.junit.Assert;
import org.junit.Test; //import org.junit.Test;
//
import static org.junit.Assert.assertEquals; //import static org.junit.Assert.assertEquals;
//
/** ///**
* @author yaohwu // * @author yaohwu
*/ // */
public class RemoteEnvURLTest { //public class RemoteEnvURLTest {
//
@Test // @Test
public void testURLParser() { // public void testURLParser() {
//
String a; // String a;
RemoteEnvURL b; // RemoteEnvURL b;
//
// https or http begin // // https or http begin
a = "www.baidu.com:9090/web/servlet/a"; // a = "www.baidu.com:9090/web/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
Assert.assertFalse(b.getHttps()); // Assert.assertFalse(b.getHttps());
//
a = "http://www.baidu.com:9090/web/servlet/a"; // a = "http://www.baidu.com:9090/web/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
Assert.assertFalse(b.getHttps()); // Assert.assertFalse(b.getHttps());
//
a = "https://www.baidu.com:9090/web/servlet/a"; // a = "https://www.baidu.com:9090/web/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
Assert.assertTrue(b.getHttps()); // Assert.assertTrue(b.getHttps());
// https or http end // // https or http end
//
// host begin // // host begin
a = "https://www.baidu.com/web/servlet/a"; // a = "https://www.baidu.com/web/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("www.baidu.com", b.getHost()); // assertEquals("www.baidu.com", b.getHost());
//
a = "https://baidu.com/web/servlet/a"; // a = "https://baidu.com/web/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("baidu.com", b.getHost()); // assertEquals("baidu.com", b.getHost());
//
a = "https://192.168.1/web/servlet/a"; // a = "https://192.168.1/web/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("192.168.1", b.getHost()); // assertEquals("192.168.1", b.getHost());
//
a = "https://中文·o((⊙﹏⊙))o囖/web/servlet/a"; // a = "https://中文·o((⊙﹏⊙))o囖/web/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("中文·o((⊙﹏⊙))o囖", b.getHost()); // assertEquals("中文·o((⊙﹏⊙))o囖", b.getHost());
//
a = "https://a.b.c.d.e.f/web/servlet/a"; // a = "https://a.b.c.d.e.f/web/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("a.b.c.d.e.f", b.getHost()); // assertEquals("a.b.c.d.e.f", b.getHost());
// host end // // host end
//
//port begin // //port begin
a = "https://www.baidu.com:9090/web/servlet/a"; // a = "https://www.baidu.com:9090/web/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("9090", b.getPort()); // assertEquals("9090", b.getPort());
//
a = "https://www.baidu.com:/web/servlet/a"; // a = "https://www.baidu.com:/web/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("", b.getPort()); // assertEquals("", b.getPort());
//
a = "https://www.baidu.com/web/servlet/a"; // a = "https://www.baidu.com/web/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("", b.getPort()); // assertEquals("", b.getPort());
//
a = "https://www.baidu.com:kk/web/servlet/a"; // a = "https://www.baidu.com:kk/web/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("kk", b.getPort()); // assertEquals("kk", b.getPort());
//
a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖/web/servlet/a"; // a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖/web/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); // assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort());
//
a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖"; // a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); // assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort());
//
a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖///////"; // a = "https://www.baidu.com:中文·o((⊙﹏⊙))o囖///////";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort()); // assertEquals("中文·o((⊙﹏⊙))o囖", b.getPort());
//port end // //port end
//
//
//web begin // //web begin
//
a = "https://www.baidu.com:9090///"; // a = "https://www.baidu.com:9090///";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("", b.getWeb()); // assertEquals("", b.getWeb());
//
a = "https://www.baidu.com:9090"; // a = "https://www.baidu.com:9090";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("", b.getWeb()); // assertEquals("", b.getWeb());
//
a = "https://www.baidu.com:9090/"; // a = "https://www.baidu.com:9090/";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("", b.getWeb()); // assertEquals("", b.getWeb());
//
a = "https://www.baidu.com:9090///web///servlet/a"; // a = "https://www.baidu.com:9090///web///servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("web", b.getWeb()); // assertEquals("web", b.getWeb());
//
a = "https://www.baidu.com:9090/web/servlet/a"; // a = "https://www.baidu.com:9090/web/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("web", b.getWeb()); // assertEquals("web", b.getWeb());
//
a = "https://www.baidu.com:9090/中文·o((⊙﹏⊙))o囖/servlet/a"; // a = "https://www.baidu.com:9090/中文·o((⊙﹏⊙))o囖/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("中文·o((⊙﹏⊙))o囖", b.getWeb()); // assertEquals("中文·o((⊙﹏⊙))o囖", b.getWeb());
//
a = "https://www.baidu.com:9090/web///servlet/a"; // a = "https://www.baidu.com:9090/web///servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("web", b.getWeb()); // assertEquals("web", b.getWeb());
//
a = "https://www.baidu.com:9090///web/servlet/a"; // a = "https://www.baidu.com:9090///web/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("web", b.getWeb()); // assertEquals("web", b.getWeb());
//web end // //web end
//
//servlet begin // //servlet begin
a = "https://www.baidu.com:9090///web////servlet/a"; // a = "https://www.baidu.com:9090///web////servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("servlet", b.getServlet()); // assertEquals("servlet", b.getServlet());
//
a = "https://www.baidu.com:9090"; // a = "https://www.baidu.com:9090";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("", b.getServlet()); // assertEquals("", b.getServlet());
//
a = "https://www.baidu.com:9090/"; // a = "https://www.baidu.com:9090/";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("", b.getServlet()); // assertEquals("", b.getServlet());
//
a = "https://www.baidu.com:9090//"; // a = "https://www.baidu.com:9090//";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("", b.getServlet()); // assertEquals("", b.getServlet());
//
a = "https://www.baidu.com:9090//web"; // a = "https://www.baidu.com:9090//web";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("", b.getServlet()); // assertEquals("", b.getServlet());
//
a = "https://www.baidu.com:9090//web//"; // a = "https://www.baidu.com:9090//web//";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("", b.getServlet()); // assertEquals("", b.getServlet());
//
a = "https://www.baidu.com:9090//web/"; // a = "https://www.baidu.com:9090//web/";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("", b.getServlet()); // assertEquals("", b.getServlet());
//
a = "https://www.baidu.com:9090//web//"; // a = "https://www.baidu.com:9090//web//";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("", b.getServlet()); // assertEquals("", b.getServlet());
//
a = "https://www.baidu.com:9090//web/a/"; // a = "https://www.baidu.com:9090//web/a/";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("a", b.getServlet()); // assertEquals("a", b.getServlet());
//
a = "https://www.baidu.com:9090//web/a"; // a = "https://www.baidu.com:9090//web/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("a", b.getServlet()); // assertEquals("a", b.getServlet());
//
//
a = "https://www.baidu.com:9090//web/a//"; // a = "https://www.baidu.com:9090//web/a//";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("a", b.getServlet()); // assertEquals("a", b.getServlet());
//
a = "https://www.baidu.com:9090//web/中文·o((⊙﹏⊙))o囖//"; // a = "https://www.baidu.com:9090//web/中文·o((⊙﹏⊙))o囖//";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("中文·o((⊙﹏⊙))o囖", b.getServlet()); // assertEquals("中文·o((⊙﹏⊙))o囖", b.getServlet());
//
a = "https://www.baidu.com//web//"; // a = "https://www.baidu.com//web//";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("", b.getServlet()); // assertEquals("", b.getServlet());
//
a = "https://www.baidu.com//web/a/"; // a = "https://www.baidu.com//web/a/";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("a", b.getServlet()); // assertEquals("a", b.getServlet());
//
a = "https://www.baidu.com//web/a"; // a = "https://www.baidu.com//web/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("a", b.getServlet()); // assertEquals("a", b.getServlet());
//
//
a = "https://www.baidu.com//web/a//"; // a = "https://www.baidu.com//web/a//";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
assertEquals("a", b.getServlet()); // assertEquals("a", b.getServlet());
// servlet end // // servlet end
//
//others begin // //others begin
a = "https://www.baidu.com/web/servlet/ahttps://www.baidu.com/web/servlet/a"; // a = "https://www.baidu.com/web/servlet/ahttps://www.baidu.com/web/servlet/a";
b = new RemoteEnvURL(a); // b = new RemoteEnvURL(a);
Assert.assertTrue(b.getHttps()); // Assert.assertTrue(b.getHttps());
assertEquals("www.baidu.com", b.getHost()); // assertEquals("www.baidu.com", b.getHost());
assertEquals("", b.getPort()); // assertEquals("", b.getPort());
assertEquals("web", b.getWeb()); // assertEquals("web", b.getWeb());
assertEquals("servlet", b.getServlet()); // assertEquals("servlet", b.getServlet());
//others begin // //others begin
} // }
} //}

16
designer-realize/src/main/java/com/fr/design/actions/report/ReportWebAttrAction.java

@ -3,7 +3,6 @@
*/ */
package com.fr.design.actions.report; package com.fr.design.actions.report;
import com.fr.config.Configuration;
import com.fr.design.actions.JWorkBookAction; import com.fr.design.actions.JWorkBookAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -13,8 +12,9 @@ import com.fr.design.menu.KeySetUtils;
import com.fr.design.webattr.ReportWebAttrPane; import com.fr.design.webattr.ReportWebAttrPane;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.main.TemplateWorkBook; import com.fr.main.TemplateWorkBook;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.WorkerFacade;
import com.fr.web.attr.ReportWebAttr; import com.fr.web.attr.ReportWebAttr;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -56,19 +56,17 @@ public class ReportWebAttrAction extends JWorkBookAction {
dialog.addDialogActionListener(new DialogActionAdapter() { dialog.addDialogActionListener(new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
Configurations.update(new Worker() { Configurations.modify(new WorkerFacade(ReportWebAttr.class) {
@Override @Override
public void run() { public void run() {
wbTpl.setReportWebAttr(reportWebAttrPane.update()); wbTpl.setReportWebAttr(reportWebAttrPane.update());
jwb.fireTargetModified();
} }
}.addCallBack(new CallBackAdaptor() {
@Override @Override
public Class<? extends Configuration>[] targets() { public void afterCommit() {
return new Class[]{ReportWebAttr.class}; jwb.fireTargetModified();
} }
}); }));
} }
}); });

20
designer-realize/src/main/java/com/fr/design/actions/server/WidgetManagerAction.java

@ -1,7 +1,6 @@
package com.fr.design.actions.server; package com.fr.design.actions.server;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.config.Configuration;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
@ -12,10 +11,11 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.design.webattr.WidgetManagerPane; import com.fr.design.webattr.WidgetManagerPane;
import com.fr.form.ui.WidgetInfoConfig; import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.transaction.CallBackAdaptor;
import com.fr.transaction.Configurations; import com.fr.transaction.Configurations;
import com.fr.transaction.Worker; import com.fr.transaction.WorkerFacade;
import javax.swing.*; import javax.swing.KeyStroke;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
public class WidgetManagerAction extends UpdateAction { public class WidgetManagerAction extends UpdateAction {
@ -45,22 +45,22 @@ public class WidgetManagerAction extends UpdateAction {
BasicDialog widgetConfigDialog = widgetManagerPane.showLargeWindow(designerFrame, new DialogActionAdapter() { BasicDialog widgetConfigDialog = widgetManagerPane.showLargeWindow(designerFrame, new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
Configurations.update(new Worker() {
Configurations.modify(new WorkerFacade(WidgetInfoConfig.class) {
@Override @Override
public void run() { public void run() {
widgetManagerPane.update(widgetManager); widgetManagerPane.update(widgetManager);
}
}.addCallBack(new CallBackAdaptor() {
@Override
public void afterCommit() {
DesignModelAdapter model = DesignModelAdapter.getCurrentModelAdapter(); DesignModelAdapter model = DesignModelAdapter.getCurrentModelAdapter();
if (model != null) { if (model != null) {
model.widgetConfigChanged(); model.widgetConfigChanged();
} }
designerFrame.getSelectedJTemplate().refreshToolArea(); designerFrame.getSelectedJTemplate().refreshToolArea();
} }
}));
@Override
public Class<? extends Configuration>[] targets() {
return new Class[]{WidgetInfoConfig.class};
}
});
} }
}); });

Loading…
Cancel
Save