Browse Source

REPORT-36404 远程-服务器断开后设计器未弹出工作目录选择框

feature/big-screen
hades 4 years ago
parent
commit
b170de527b
  1. 38
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java

38
designer-base/src/main/java/com/fr/env/RemoteEnvPane.java vendored

@ -44,6 +44,7 @@ import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.util.function.Supplier;
import static com.fr.design.layout.TableLayout.FILL;
import static com.fr.design.layout.TableLayout.PREFERRED;
@ -439,20 +440,29 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
* 设置 app servlet 默认值
*/
private void setDefaultAppAndServlet() {
String appName;
String servletName;
try {
appName = FRContext.getCommonOperator().getAppName();
} catch (Exception ignored) {
appName = RemoteWorkspaceURL.DEFAULT_WEB_APP_NAME;
}
try {
servletName = ServerConfig.getInstance().getServletName();
} catch (Exception ignored) {
servletName = RemoteWorkspaceURL.DEFAULT_SERVLET_NAME;
}
webAppNameInput.setText(appName);
servletNameInput.setText(servletName);
setWrap(webAppNameInput, () -> FRContext.getCommonOperator().getAppName(), RemoteWorkspaceURL.DEFAULT_WEB_APP_NAME);
setWrap(servletNameInput, () -> ServerConfig.getInstance().getServletName(), RemoteWorkspaceURL.DEFAULT_SERVLET_NAME);
}
private void setWrap(final UITextField textField, final Supplier<String> supplier, final String defaultName) {
new SwingWorker<String, Void>() {
@Override
protected String doInBackground() throws Exception {
return supplier.get();
}
@Override
protected void done() {
String name = defaultName;
try {
name = get();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage() , e);
}
textField.setText(name);
}
}.execute();
}

Loading…
Cancel
Save