Browse Source

Merge remote-tracking branch 'origin/release/10.0' into release/10.0

feature/big-screen
alex.sung 5 years ago
parent
commit
f72647e405
  1. 15
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 8
      designer-base/src/main/java/com/fr/design/fun/ReportSupportedFileUIProvider.java
  3. 7
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportSupportedFileUIProvider.java
  4. 8
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java
  5. 1
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  6. 20
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  7. 2
      designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrPane.java
  8. 2
      designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateFitAttrPane.java
  9. 57
      designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java
  10. 78
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java
  11. 8
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  12. 28
      designer-base/src/test/java/com/fr/design/gui/itree/filetree/FileNodeConstantsTest.java
  13. 5
      designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java
  14. 4
      designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java
  15. 2
      designer-realize/src/main/java/com/fr/design/webattr/EventPane.java

15
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -1,6 +1,7 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import com.fr.cluster.ClusterBridge; import com.fr.cluster.ClusterBridge;
import com.fr.cluster.engine.base.FineClusterConfig;
import com.fr.config.Configuration; import com.fr.config.Configuration;
import com.fr.config.ServerPreferenceConfig; import com.fr.config.ServerPreferenceConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
@ -263,7 +264,7 @@ public class PreferencePane extends BasicPane {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
boolean selected = vcsEnableCheckBox.isSelected(); boolean selected = vcsEnableCheckBox.isSelected();
if (selected) { if (selected && vcsEnableCheckBox.isEnabled()) {
saveCommitCheckBox.setEnabled(true); saveCommitCheckBox.setEnabled(true);
saveIntervalEditor.setEnabled(true); saveIntervalEditor.setEnabled(true);
useIntervalCheckBox.setEnabled(true); useIntervalCheckBox.setEnabled(true);
@ -307,14 +308,9 @@ public class PreferencePane extends BasicPane {
gcEnableCheckBox.addChangeListener(new ChangeListener() { gcEnableCheckBox.addChangeListener(new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
gcButton.setEnabled(gcEnableCheckBox.isSelected()); gcButton.setEnabled(gcEnableCheckBox.isSelected() && gcEnableCheckBox.isEnabled());
} }
}); });
//集群下禁用
if (ClusterBridge.isClusterMode()) {
gcEnableCheckBox.setEnabled(false);
gcButton.setEnabled(false);
}
return gcControlPane; return gcControlPane;
} }
@ -672,6 +668,11 @@ public class PreferencePane extends BasicPane {
defaultStringToFormulaBox.setSelected(false); defaultStringToFormulaBox.setSelected(false);
} }
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager();
if (FineClusterConfig.getInstance().isCluster()) {
vcsEnableCheckBox.setEnabled(false);
gcEnableCheckBox.setEnabled(false);
}
if (VcsHelper.getInstance().needInit()) { if (VcsHelper.getInstance().needInit()) {
vcsEnableCheckBox.setSelected(vcsConfigManager.isVcsEnable()); vcsEnableCheckBox.setSelected(vcsConfigManager.isVcsEnable());
} else { } else {

8
designer-base/src/main/java/com/fr/design/fun/ReportSupportedFileUIProvider.java

@ -1,6 +1,5 @@
package com.fr.design.fun; package com.fr.design.fun;
import com.fr.base.extension.FileExtension;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.file.FILEChooserPane; import com.fr.file.FILEChooserPane;
import com.fr.stable.fun.mark.Mutable; import com.fr.stable.fun.mark.Mutable;
@ -24,13 +23,6 @@ public interface ReportSupportedFileUIProvider extends Mutable {
void addChooseFileFilter(FILEChooserPane fileChooser, String suffix); void addChooseFileFilter(FILEChooserPane fileChooser, String suffix);
/**
* 获取可支持的文件类型
* @return 文件扩展
*/
FileExtension[] getFileExtensions();
/** /**
* 获取文件关联的icon * 获取文件关联的icon
* @param path 文件路径 * @param path 文件路径

7
designer-base/src/main/java/com/fr/design/fun/impl/AbstractReportSupportedFileUIProvider.java

@ -1,6 +1,5 @@
package com.fr.design.fun.impl; package com.fr.design.fun.impl;
import com.fr.base.extension.FileExtension;
import com.fr.design.fun.ReportSupportedFileUIProvider; import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.file.FILEChooserPane; import com.fr.file.FILEChooserPane;
@ -19,12 +18,6 @@ public abstract class AbstractReportSupportedFileUIProvider extends AbstractProv
} }
@Override
public FileExtension[] getFileExtensions() {
return new FileExtension[0];
}
@Override @Override
public Icon getFileIcon(String path, boolean isShowLock) { public Icon getFileIcon(String path, boolean isShowLock) {
return null; return null;

8
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileNodeConstants.java

@ -2,14 +2,14 @@ package com.fr.design.gui.itree.filetree;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.ReportSupportedFileUIProvider;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventListener;
import com.fr.report.ExtraReportClassManager;
import com.fr.report.fun.ReportSupportedFileProvider;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -58,8 +58,8 @@ public class FileNodeConstants {
rwl.writeLock().lock(); rwl.writeLock().lock();
supportFileType = new ArrayList<String>(); supportFileType = new ArrayList<String>();
//通过插件扩展的 //通过插件扩展的
Set<ReportSupportedFileUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG); Set<ReportSupportedFileProvider> providers = ExtraReportClassManager.getInstance().getArray(ReportSupportedFileProvider.XML_TAG);
for (ReportSupportedFileUIProvider provider : providers) { for (ReportSupportedFileProvider provider : providers) {
addAppExtensions(provider.getFileExtensions()); addAppExtensions(provider.getFileExtensions());
} }
supportFileType.addAll(Arrays.asList(FRContext.getFileNodes().getSupportedTypes())); supportFileType.addAll(Arrays.asList(FRContext.getFileNodes().getSupportedTypes()));

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

@ -661,6 +661,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
result = result || this.saveFile(); result = result || this.saveFile();
//更换最近打开 //更换最近打开
DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(oldName, this.getPath()); DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(oldName, this.getPath());
this.refreshToolArea();
} }
return result; return result;
} }

20
designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.ui.util.UIUtil;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.log.Log4jConfig; import com.fr.general.log.Log4jConfig;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -199,6 +200,7 @@ public class DesignerLogHandler {
jTextArea.addMouseListener(new MouseAdapter() { jTextArea.addMouseListener(new MouseAdapter() {
// check for right click // check for right click
@Override
public void mousePressed(MouseEvent event) { public void mousePressed(MouseEvent event) {
if (event.getButton() == MouseEvent.BUTTON3) { if (event.getButton() == MouseEvent.BUTTON3) {
@ -219,6 +221,7 @@ public class DesignerLogHandler {
ActionMap actionMap = resultPane.getActionMap(); ActionMap actionMap = resultPane.getActionMap();
actionMap.put("clear", new AbstractAction() { actionMap.put("clear", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
resultPane.setText(""); resultPane.setText("");
@ -260,21 +263,25 @@ public class DesignerLogHandler {
printMessage(message, intLevel, date, null); printMessage(message, intLevel, date, null);
} }
private void printMessage(String msg, int intLevel, Date date, Throwable e) { private void printMessage(final String msg, final int intLevel, final Date date, final Throwable e) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
this.log(LOG_SIMPLE_DATE_FORMAT.format(date) + "\n", 0); @Override
public void run() {
LogHandlerArea.this.log(LOG_SIMPLE_DATE_FORMAT.format(date) + "\n", 0);
String message = appendLocaleMark(msg, intLevel); String message = appendLocaleMark(msg, intLevel);
this.log(message, intLevel); LogHandlerArea.this.log(message, intLevel);
setMessage(message, intLevel); setMessage(message, intLevel);
if (e == null) { if (e == null) {
return; return;
} }
StackTraceElement[] traceElements = e.getStackTrace(); StackTraceElement[] traceElements = e.getStackTrace();
for (int i = 0; i < traceElements.length; i++) { for (StackTraceElement traceElement : traceElements) {
this.log("\t" + "at " + traceElements[i].toString() + "\n", 0); LogHandlerArea.this.log("\t" + "at " + traceElement.toString() + "\n", 0);
} }
} }
});
}
private void log(String str, int style) { private void log(String str, int style) {
@ -346,6 +353,7 @@ public class DesignerLogHandler {
ActionListener popupListener = new ActionListener() { ActionListener popupListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.selectAll.getText())) { if (ComparatorUtils.equals(evt.getActionCommand(), LogHandlerArea.this.selectAll.getText())) {

2
designer-base/src/main/java/com/fr/design/report/fit/menupane/ReportFitAttrPane.java

@ -50,7 +50,7 @@ public class ReportFitAttrPane extends BasicBeanPane<ReportFitAttr> {
* @return 标题 * @return 标题
*/ */
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Attr"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Element_Case_Fit_Attr");
} }
} }

2
designer-base/src/main/java/com/fr/design/report/fit/menupane/TemplateFitAttrPane.java

@ -50,6 +50,6 @@ public class TemplateFitAttrPane extends BasicBeanPane<ReportFitAttr> {
* @return 标题 * @return 标题
*/ */
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-Attr"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_PC_Fit_Attr");
} }
} }

57
designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java

@ -143,7 +143,6 @@ public class RestoreResultDialog extends JDialog {
jTextArea.setFont(new Font("Default", Font.PLAIN, 12)); jTextArea.setFont(new Font("Default", Font.PLAIN, 12));
infoPane.add(jTextArea); infoPane.add(jTextArea);
pane.add(infoPane, BorderLayout.CENTER); pane.add(infoPane, BorderLayout.CENTER);
this.setSize(RESTORE_OLD_VERSION); this.setSize(RESTORE_OLD_VERSION);
this.setTitle(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Updater_Restore_to_V8")); this.setTitle(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Updater_Restore_to_V8"));
} }
@ -162,34 +161,68 @@ public class RestoreResultDialog extends JDialog {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
String installHome = StableUtils.getInstallHome(); String installHome = StableUtils.getInstallHome();
putJarBackupFilesToInstallLib(installHome, map, list); filesToMove(installHome, map);
putJarBackupFilesToInstallEnv(installHome, map, list); filesToDelete(installHome, list);
RestartHelper.saveFilesWhichToMove(map); RestartHelper.saveFilesWhichToMove(map);
RestartHelper.saveFilesWhichToDelete(list.toArray(new String[list.size()])); RestartHelper.saveFilesWhichToDelete(list.toArray(new String[list.size()]));
} }
private void putJarBackupFilesToInstallLib(String installHome, Map<String, String> map, List<String> list) { private void filesToMove(String installHome, Map<String, String> map) {
String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR; String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR;
String envHome = WorkContext.getCurrent().getPath();
File installLib = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, UpdateConstants.DESIGNERBACKUPPATH)); File installLib = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, UpdateConstants.DESIGNERBACKUPPATH));
File[] files = installLib.listFiles(); File envLib = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, UpdateConstants.BACKUPPATH));
File[] files;
if (installLib.exists() && envLib.exists()) {
files = installLib.listFiles();
if (files != null) { if (files != null) {
for (File file : files) { for (File file : files) {
map.put(file.getAbsolutePath(), map.put(file.getAbsolutePath(),
StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName())); StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName()));
list.add(StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName())); }
}
files = envLib.listFiles();
if (files != null) {
for (File file : files) {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(envHome, ProjectConstants.LIB_NAME, file.getName()));
}
}
} else {
installLib = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir));
files = installLib.listFiles();
if (files != null) {
for (File file : files) {
if (file.getName().contains(UpdateConstants.DESIGNER) || file.getName().equals(UpdateConstants.ASPECTJRT)) {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName()));
} else {
map.put(file.getAbsolutePath(),
StableUtils.pathJoin(envHome, ProjectConstants.LIB_NAME, file.getName()));
}
}
} }
} }
} }
private void putJarBackupFilesToInstallEnv(String installHome, Map<String, String> map, List<String> list) { private void filesToDelete(String installHome, List<String> list) {
String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR; String envHome = WorkContext.getCurrent().getPath();
File installEnv = new File(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, UpdateConstants.BACKUPPATH)); File installEnv = new File(StableUtils.pathJoin(envHome,ProjectConstants.LIB_NAME));
File[] files = installEnv.listFiles(); File[] files = installEnv.listFiles();
if (files != null) { if (files != null) {
for (File file : files) { for (File file : files) {
map.put(file.getAbsolutePath(), if (file.getName().startsWith(UpdateConstants.FINE)) {
StableUtils.pathJoin(WorkContext.getCurrent().getPath(), ProjectConstants.LIB_NAME, file.getName())); list.add(StableUtils.pathJoin(envHome, ProjectConstants.LIB_NAME, file.getName()));
list.add(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), ProjectConstants.LIB_NAME, file.getName())); }
}
}
installEnv = new File(StableUtils.pathJoin(installHome,ProjectConstants.LIB_NAME));
files = installEnv.listFiles();
if (files != null) {
for (File file : files) {
if (file.getName().startsWith(UpdateConstants.FINE) || file.getName().equals(UpdateConstants.ASPECTJRT)) {
list.add(StableUtils.pathJoin(installHome, ProjectConstants.LIB_NAME, file.getName()));
}
} }
} }
} }

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

@ -52,15 +52,16 @@ import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.io.File; import java.io.File;
import java.util.concurrent.ExecutionException;
import static com.fr.design.layout.TableLayout.FILL; import static com.fr.design.layout.TableLayout.FILL;
import static com.fr.design.layout.TableLayout.PREFERRED; import static com.fr.design.layout.TableLayout.PREFERRED;
import static com.fr.env.TestConnectionResult.AUTH_FAILED;
import static com.fr.third.guava.base.Optional.fromNullable; import static com.fr.third.guava.base.Optional.fromNullable;
/** /**
* @author yaohwu * @author yaohwu
*/ */
@SuppressWarnings("squid:MaximumInheritanceDepth")
public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> { public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92); private static final Color TIPS_FONT_COLOR = new Color(0x8f8f92);
@ -118,6 +119,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
/** /**
* 主机位置 * 主机位置
*/ */
@SuppressWarnings("squid:S1948")
private RemoteWorkspaceURL remoteWorkspaceURL = new RemoteWorkspaceURL(""); private RemoteWorkspaceURL remoteWorkspaceURL = new RemoteWorkspaceURL("");
/** /**
* https 配置面板 * https 配置面板
@ -138,6 +140,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
/** /**
* 主机名web应用Servlet端口监听器 * 主机名web应用Servlet端口监听器
*/ */
@SuppressWarnings("squid:S1948")
private DocumentListener individualDocListener = new DocumentListener() { private DocumentListener individualDocListener = new DocumentListener() {
@Override @Override
@ -148,19 +151,32 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
updateRemoteURL(); changedUpdate(e);
fillRemoteEnvURLField();
} }
@Override @Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
updateRemoteURL(); changedUpdate(e);
fillRemoteEnvURLField(); }
private void updateRemoteURL() {
boolean isHttps = httpsCheckbox.isSelected();
String host = hostNameInput.getText();
String port = portInput.getText();
String web = webAppNameInput.getText();
String servlet = servletNameInput.getText();
remoteWorkspaceURL.setHttps(isHttps);
remoteWorkspaceURL.setHost(host);
remoteWorkspaceURL.setPort(port);
remoteWorkspaceURL.setWeb(web);
remoteWorkspaceURL.setServlet(servlet);
remoteWorkspaceURL.resetUrl();
} }
}; };
/** /**
* 路径输入框监听器 * 路径输入框监听器
*/ */
@SuppressWarnings("squid:S1948")
private DocumentListener overallDocListener = new DocumentListener() { private DocumentListener overallDocListener = new DocumentListener() {
@Override @Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
@ -169,7 +185,6 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
@Override @Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
actionURLInputChange(); actionURLInputChange();
} }
@ -177,10 +192,22 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
public void changedUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) {
actionURLInputChange(); actionURLInputChange();
} }
private void actionURLInputChange() {
remoteWorkspaceURL = new RemoteWorkspaceURL(remoteEnvURLInput.getText());
fillIndividualField();
httpsCheckbox.setSelected(remoteWorkspaceURL.getHttps());
boolean isHttps = httpsCheckbox.isSelected();
DesignerEnvManager.getEnvManager().setHttps(isHttps);
fileChooserButton.setEnabled(isHttps);
updateHttpsConfigPanel();
}
}; };
/** /**
* https checkbox listener * https checkbox listener
*/ */
@SuppressWarnings("squid:S1948")
private ActionListener httpsCheckboxListener = new ActionListener() { private ActionListener httpsCheckboxListener = new ActionListener() {
@Override @Override
@ -523,17 +550,17 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
final RemoteDesignerWorkspaceInfo remoteEnv = updateBean(); final RemoteDesignerWorkspaceInfo remoteEnv = updateBean();
final WorkspaceConnectionInfo connection = remoteEnv.getConnection(); final WorkspaceConnectionInfo connection = remoteEnv.getConnection();
final SwingWorker<Boolean, Void> worker = new SwingWorker<Boolean, Void>() { final SwingWorker<TestConnectionResult, Void> worker = new SwingWorker<TestConnectionResult, Void>() {
@Override @Override
protected Boolean doInBackground() throws Exception { protected TestConnectionResult doInBackground() throws Exception {
DesignerEnvManager.getEnvManager().setCertificatePath(connection.getCertPath()); DesignerEnvManager.getEnvManager().setCertificatePath(connection.getCertPath());
DesignerEnvManager.getEnvManager().setCertificatePass(connection.getCertSecretKey()); DesignerEnvManager.getEnvManager().setCertificatePass(connection.getCertSecretKey());
try { try {
return WorkContext.getConnector().testConnection(connection); return TestConnectionResult.parse(WorkContext.getConnector().testConnection(connection), connection);
} catch (WorkspaceAuthException ignored) { } catch (WorkspaceAuthException ignored) {
return null; return AUTH_FAILED;
} }
} }
@ -541,14 +568,13 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
protected void done() { protected void done() {
okButton.setEnabled(true); okButton.setEnabled(true);
try { try {
TestConnectionResult result = TestConnectionResult.parse(get(), connection); TestConnectionResult result = get();
message.setText(result.getText()); message.setText(result.getText());
uiLabel.setIcon(result.getIcon()); uiLabel.setIcon(result.getIcon());
} catch (InterruptedException | ExecutionException e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage()); FineLoggerFactory.getLogger().error(e, e.getMessage());
message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed")); message.setText(Toolkit.i18nText("Fine-Design_Basic_Remote_Connect_Failed"));
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon")); uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
Thread.currentThread().interrupt();
} }
dialogDownPane.remove(cancelButton); dialogDownPane.remove(cancelButton);
dialogDownPane.revalidate(); dialogDownPane.revalidate();
@ -633,36 +659,10 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
enableSubDocListener(); enableSubDocListener();
} }
private void updateRemoteURL() {
boolean isHttps = httpsCheckbox.isSelected();
String host = hostNameInput.getText();
String port = portInput.getText();
String web = webAppNameInput.getText();
String servlet = servletNameInput.getText();
remoteWorkspaceURL.setHttps(isHttps);
remoteWorkspaceURL.setHost(host);
remoteWorkspaceURL.setPort(port);
remoteWorkspaceURL.setWeb(web);
remoteWorkspaceURL.setServlet(servlet);
remoteWorkspaceURL.resetUrl();
}
private void updateHttpsConfigPanel() { private void updateHttpsConfigPanel() {
httpsConfigPanel.removeAll(); httpsConfigPanel.removeAll();
packHttpsConfigPanel(); packHttpsConfigPanel();
httpsConfigPanel.revalidate(); httpsConfigPanel.revalidate();
httpsConfigPanel.repaint(); httpsConfigPanel.repaint();
} }
private void actionURLInputChange() {
remoteWorkspaceURL = new RemoteWorkspaceURL(remoteEnvURLInput.getText());
fillIndividualField();
httpsCheckbox.setSelected(remoteWorkspaceURL.getHttps());
boolean isHttps = httpsCheckbox.isSelected();
DesignerEnvManager.getEnvManager().setHttps(isHttps);
fileChooserButton.setEnabled(isHttps);
updateHttpsConfigPanel();
}
} }

8
designer-base/src/main/java/com/fr/file/FILEChooserPane.java

@ -33,6 +33,8 @@ import com.fr.file.filter.FILEFilter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.ExtraReportClassManager;
import com.fr.report.fun.ReportSupportedFileProvider;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -480,7 +482,9 @@ public class FILEChooserPane extends BasicPane {
Object ss = postfixComboBox.getSelectedItem(); Object ss = postfixComboBox.getSelectedItem();
if (ss instanceof ChooseFileFilter) { if (ss instanceof ChooseFileFilter) {
setFILEFilter((ChooseFileFilter) ss); setFILEFilter((ChooseFileFilter) ss);
if (fileNameTextField.isShowing()) {
fileNameTextField.setText(calProperFileName(fileNameTextField.getText(), (ChooseFileFilter) ss)); fileNameTextField.setText(calProperFileName(fileNameTextField.getText(), (ChooseFileFilter) ss));
}
} else { } else {
setFILEFilter(null); setFILEFilter(null);
} }
@ -740,8 +744,8 @@ public class FILEChooserPane extends BasicPane {
if (type == JFileChooser.OPEN_DIALOG) { if (type == JFileChooser.OPEN_DIALOG) {
ChooseFileFilter supportedTypes = new ChooseFileFilter(FRContext.getFileNodes().getSupportedTypes(), appName + Toolkit.i18nText("Fine-Design_Report_Template_File")); ChooseFileFilter supportedTypes = new ChooseFileFilter(FRContext.getFileNodes().getSupportedTypes(), appName + Toolkit.i18nText("Fine-Design_Report_Template_File"));
Set<ReportSupportedFileUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ReportSupportedFileUIProvider.XML_TAG); Set<ReportSupportedFileProvider> providers = ExtraReportClassManager.getInstance().getArray(ReportSupportedFileProvider.XML_TAG);
for (ReportSupportedFileUIProvider provider : providers) { for (ReportSupportedFileProvider provider : providers) {
for (FileExtension fileExtension : provider.getFileExtensions()){ for (FileExtension fileExtension : provider.getFileExtensions()){
supportedTypes.addExtension(fileExtension.getExtension()); supportedTypes.addExtension(fileExtension.getExtension());
} }

28
designer-base/src/test/java/com/fr/design/gui/itree/filetree/FileNodeConstantsTest.java

@ -1,9 +1,9 @@
package com.fr.design.gui.itree.filetree; package com.fr.design.gui.itree.filetree;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.design.ExtraDesignClassManager; import com.fr.report.ExtraReportClassManager;
import com.fr.design.fun.ReportSupportedFileUIProvider; import com.fr.report.fun.ReportSupportedFileProvider;
import com.fr.design.fun.impl.AbstractReportSupportedFileUIProvider; import com.fr.report.fun.impl.AbstractReportSupportedFileProvider;
import com.fr.stable.fun.mark.Mutable; import com.fr.stable.fun.mark.Mutable;
import org.easymock.EasyMock; import org.easymock.EasyMock;
import org.junit.Assert; import org.junit.Assert;
@ -19,38 +19,38 @@ import java.util.Set;
* Created by alex sung on 2019/7/25. * Created by alex sung on 2019/7/25.
*/ */
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest(ExtraDesignClassManager.class) @PrepareForTest(ExtraReportClassManager.class)
public class FileNodeConstantsTest { public class FileNodeConstantsTest {
@Test @Test
public void supportFileTypesTest() { public void supportFileTypesTest() {
ExtraDesignClassManager extra = mockExtraDesignClassManager(); ExtraReportClassManager extra = mockExtraReportClassManager();
Assert.assertEquals(1, extra.getArray(ReportSupportedFileUIProvider.XML_TAG).size()); Assert.assertEquals(1, extra.getArray(ReportSupportedFileProvider.XML_TAG).size());
ReportSupportedFileUIProvider option = (ReportSupportedFileUIProvider) extra.getArray(ReportSupportedFileUIProvider.XML_TAG).iterator().next(); ReportSupportedFileProvider option = (ReportSupportedFileProvider) extra.getArray(ReportSupportedFileProvider.XML_TAG).iterator().next();
Assert.assertEquals(FileExtension.CPTX, option.getFileExtensions()[0]); Assert.assertEquals(FileExtension.CPTX, option.getFileExtensions()[0]);
} }
@Test @Test
public void testSupportFileTypesOrder() { public void testSupportFileTypesOrder() {
ExtraDesignClassManager extra = mockExtraDesignClassManager(); ExtraReportClassManager extra = mockExtraReportClassManager();
PowerMock.mockStatic(ExtraDesignClassManager.class); PowerMock.mockStatic(ExtraReportClassManager.class);
EasyMock.expect(ExtraDesignClassManager.getInstance()).andReturn(extra).once(); EasyMock.expect(ExtraReportClassManager.getInstance()).andReturn(extra).once();
PowerMock.replayAll(); PowerMock.replayAll();
String[] fileTypes = FileNodeConstants.getSupportFileTypes(); String[] fileTypes = FileNodeConstants.getSupportFileTypes();
Assert.assertEquals("cptx", fileTypes[0]); Assert.assertEquals("cptx", fileTypes[0]);
Assert.assertEquals("cpt", fileTypes[1]); Assert.assertEquals("cpt", fileTypes[1]);
} }
private ExtraDesignClassManager mockExtraDesignClassManager() { private ExtraReportClassManager mockExtraReportClassManager() {
ExtraDesignClassManager extra = EasyMock.mock(ExtraDesignClassManager.class); ExtraReportClassManager extra = EasyMock.mock(ExtraReportClassManager.class);
Set<Mutable> options = new HashSet<Mutable>() {{ Set<Mutable> options = new HashSet<Mutable>() {{
add(new MockNewTemplateFileOption()); add(new MockNewTemplateFileOption());
}}; }};
EasyMock.expect(extra.getArray(ReportSupportedFileUIProvider.XML_TAG)).andReturn(options).anyTimes(); EasyMock.expect(extra.getArray(ReportSupportedFileProvider.XML_TAG)).andReturn(options).anyTimes();
EasyMock.replay(extra); EasyMock.replay(extra);
return extra; return extra;
} }
private class MockNewTemplateFileOption extends AbstractReportSupportedFileUIProvider { private class MockNewTemplateFileOption extends AbstractReportSupportedFileProvider {
@Override @Override
public FileExtension[] getFileExtensions() { public FileExtension[] getFileExtensions() {

5
designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java

@ -110,7 +110,10 @@ public class CellWidgetPropertyPane extends BasicPane {
if (tplEC.getTemplateCellElement(cellElement.getColumn(), cellElement.getRow()) == null) {//cellElement未加入到report中时要添加进去 if (tplEC.getTemplateCellElement(cellElement.getColumn(), cellElement.getRow()) == null) {//cellElement未加入到report中时要添加进去
tplEC.addCellElement(cellElement); tplEC.addCellElement(cellElement);
} else { } else {
cellElement = tplEC.getTemplateCellElement(finalCS.getColumn(), finalCS.getRow()); TemplateCellElement newCellElement = tplEC.getTemplateCellElement(finalCS.getColumn(), finalCS.getRow());
if (newCellElement != null) {
cellElement = newCellElement;
}
} }
setCellWidget(cellWidget, cellElement); setCellWidget(cellWidget, cellElement);
} else { } else {

4
designer-realize/src/main/java/com/fr/design/report/freeze/RepeatAndFreezeSettingPane.java

@ -69,6 +69,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
soverlapRowStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Title_Start_Row_Form"))); soverlapRowStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Title_Start_Row_Form")));
repeatTitleRowPane = new RepeatRowPane(); repeatTitleRowPane = new RepeatRowPane();
soverlapRowStartPane.add(repeatTitleRowPane); soverlapRowStartPane.add(repeatTitleRowPane);
soverlapRowStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Row")));
return soverlapRowStartPane; return soverlapRowStartPane;
} }
@ -85,6 +86,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
// 重复打印标题的结束列 // 重复打印标题的结束列
repeatTitleColPane = new RepeatColPane(); repeatTitleColPane = new RepeatColPane();
soverlapColStartPane.add(repeatTitleColPane); soverlapColStartPane.add(repeatTitleColPane);
soverlapColStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column")));
return soverlapColStartPane; return soverlapColStartPane;
} }
@ -100,6 +102,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
foverlapRowStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Finis_Start_Row_Form"))); foverlapRowStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Finis_Start_Row_Form")));
repeatFinisRowPane = new RepeatRowPane(); repeatFinisRowPane = new RepeatRowPane();
foverlapRowStartPane.add(repeatFinisRowPane); foverlapRowStartPane.add(repeatFinisRowPane);
foverlapRowStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Row")));
return foverlapRowStartPane; return foverlapRowStartPane;
} }
@ -115,6 +118,7 @@ public class RepeatAndFreezeSettingPane extends BasicPane {
foverlapColStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Finis_Start_Column_Form"))); foverlapColStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Finis_Start_Column_Form")));
repeatFinisColPane = new RepeatColPane(); repeatFinisColPane = new RepeatColPane();
foverlapColStartPane.add(repeatFinisColPane); foverlapColStartPane.add(repeatFinisColPane);
foverlapColStartPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Column")));
return foverlapColStartPane; return foverlapColStartPane;
} }

2
designer-realize/src/main/java/com/fr/design/webattr/EventPane.java

@ -168,7 +168,7 @@ public class EventPane extends BasicPane {
return; return;
} }
int val = JOptionPane.showConfirmDialog(EventPane.this, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Are_You_Sure_To_Delete_The_Data") + "?", "Message", int val = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(EventPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Are_You_Sure_To_Delete_The_Data") + "?", "Message",
JOptionPane.YES_NO_OPTION); JOptionPane.YES_NO_OPTION);
if (val != JOptionPane.YES_OPTION) { if (val != JOptionPane.YES_OPTION) {
return; return;

Loading…
Cancel
Save