Browse Source

Merge pull request #59 in DESIGN/design from ~HZZZ/design61:feature/10.0 to feature/10.0

* commit '7fb2911df8e9ee17dee53888855c7131695e596c':
  fix
  fix
master
superman 7 years ago
parent
commit
654027516b
  1. 60
      designer-base/src/com/fr/design/actions/file/SwitchExistEnv.java
  2. 16
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java
  3. 5
      designer-base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  4. 1456
      designer-base/src/com/fr/env/RemoteEnv.java

60
designer-base/src/com/fr/design/actions/file/SwitchExistEnv.java

@ -1,14 +1,13 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Env; import com.fr.base.env.resource.LocalEnvConfig;
import com.fr.base.FRContext; import com.fr.base.env.resource.RemoteEnvConfig;
import com.fr.dav.LocalEnv; import com.fr.core.env.EnvConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.ResponseDataSourceChange; import com.fr.design.data.tabledata.ResponseDataSourceChange;
import com.fr.design.dialog.InformationWarnPane;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
@ -18,21 +17,17 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.env.RemoteEnv; import com.fr.env.RemoteEnv;
import com.fr.env.SignIn; import com.fr.env.SignIn;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JOptionPane;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
public class SwitchExistEnv extends MenuDef { public class SwitchExistEnv extends MenuDef {
public SwitchExistEnv() { public SwitchExistEnv() {
@ -41,18 +36,20 @@ public class SwitchExistEnv extends MenuDef {
this.setHasScrollSubMenu(true); this.setHasScrollSubMenu(true);
initMenuDef(); initMenuDef();
JTemplate<?, ?> t = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate<?, ?> t = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if(t != null) { if (t != null) {
GeneralContext.addEnvWillChangedListener(t.getFullPathName(), new EnvChangedListener() { GeneralContext.addEnvWillChangedListener(
public void envChanged() { t.getFullPathName(),
SwitchExistEnv.this.clearShortCuts(); new EnvChangedListener() {
initMenuDef(); public void envChanged() {
} SwitchExistEnv.this.clearShortCuts();
}); initMenuDef();
}
});
} }
} }
private void initMenuDef() { private void initMenuDef() {
//ButtonGroup group = new ButtonGroup(); // ButtonGroup group = new ButtonGroup();
Iterator<String> nameIt = DesignerEnvManager.getEnvManager().getEnvNameIterator(); Iterator<String> nameIt = DesignerEnvManager.getEnvManager().getEnvNameIterator();
while (nameIt.hasNext()) { while (nameIt.hasNext()) {
String name = nameIt.next(); String name = nameIt.next();
@ -65,15 +62,14 @@ public class SwitchExistEnv extends MenuDef {
public static class GetExistEnvAction extends UpdateAction implements ResponseDataSourceChange { public static class GetExistEnvAction extends UpdateAction implements ResponseDataSourceChange {
public GetExistEnvAction() { public GetExistEnvAction() {
} }
public GetExistEnvAction(String envName) { public GetExistEnvAction(String envName) {
this.setName(envName); this.setName(envName);
Env env = DesignerEnvManager.getEnvManager().getEnv(envName); EnvConfig env = DesignerEnvManager.getEnvManager().getEnv(envName);
if (env instanceof LocalEnv) { if (env instanceof LocalEnvConfig) {
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/localconnect.png")); this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/localconnect.png"));
} else if (env instanceof RemoteEnv) { } else if (env instanceof RemoteEnvConfig) {
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/distanceconnect.png")); this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/data/bind/distanceconnect.png"));
} }
} }
@ -101,28 +97,24 @@ public class SwitchExistEnv extends MenuDef {
*/ */
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
Env selectedEnv = envManager.getEnv(this.getName()); EnvConfig selectedEnv = envManager.getEnv(this.getName());
try { try {
if (selectedEnv instanceof RemoteEnv && !((RemoteEnv) selectedEnv).testServerConnection()) { if (selectedEnv instanceof RemoteEnv && !((RemoteEnv) selectedEnv).testServerConnection()) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"})); JOptionPane.showMessageDialog(
return; DesignerContext.getDesignerFrame(),
} Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
String remoteVersion = selectedEnv.getDesignerVersion();
if (StringUtils.isBlank(remoteVersion) || ComparatorUtils.compare(remoteVersion, ProductConstants.DESIGNER_VERSION) < 0) {
String infor = Inter.getLocText("Server-version-tip");
String moreInfo = Inter.getLocText("Server-version-tip-moreInfo");
FineLoggerFactory.getLogger().error(infor);
new InformationWarnPane(infor, moreInfo, Inter.getLocText("Tooltips")).show();
return; return;
} }
SignIn.signIn(selectedEnv); SignIn.signIn(selectedEnv);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea();
fireDSChanged(); fireDSChanged();
} catch (Exception em) { } catch (Exception em) {
FRContext.getLogger().error(em.getMessage(), em); FineLoggerFactory.getLogger().error(em.getMessage(), em);
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"})); JOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Inter.getLocText(new String[]{"M-SwitchWorkspace", "Failed"}));
TemplatePane.getInstance().editItems(); TemplatePane.getInstance().editItems();
} }
} }
} }
} }

16
designer-base/src/com/fr/design/mainframe/DesignerFrame.java

@ -35,6 +35,7 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.MenuManager; import com.fr.design.menu.MenuManager;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.EventDispatcher;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FILEFactory; import com.fr.file.FILEFactory;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
@ -43,8 +44,6 @@ import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.env.EnvContext;
import com.fr.log.FineLoggerFactory;
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;
@ -83,6 +82,9 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import static com.fr.core.env.EnvEvents.AFTER_SIGN_OUT;
import static com.fr.core.env.EnvEvents.BEFORE_SIGN_OUT;
public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener { public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener {
public static final String DESIGNER_FRAME_NAME = "designer_frame"; public static final String DESIGNER_FRAME_NAME = "designer_frame";
public static final Dimension MIN_SIZE = new Dimension(100, 100); public static final Dimension MIN_SIZE = new Dimension(100, 100);
@ -351,7 +353,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
.getResourceAsStream("/com/fr/base/images/oem/logo.ico")); .getResourceAsStream("/com/fr/base/images/oem/logo.ico"));
this.setIconImages(image); this.setIconImages(image);
} catch (IOException e) { } catch (IOException e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png")); this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png"));
} }
} }
@ -965,11 +967,11 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
Env currentEnv = FRContext.getCurrentEnv(); Env currentEnv = FRContext.getCurrentEnv();
try { try {
EnvContext.fireBeforeSignOut(); EventDispatcher.fire(BEFORE_SIGN_OUT);
currentEnv.signOut(); currentEnv.signOut();
EnvContext.fireAfterSignOut(); EventDispatcher.fire(AFTER_SIGN_OUT);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
this.setVisible(false); this.setVisible(false);
this.dispose(); this.dispose();
@ -1025,7 +1027,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
} }
} }
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
event.dropComplete(true); event.dropComplete(true);

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

@ -9,6 +9,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.LogRecordTime;
import com.fr.general.log.Log4jConfig; import com.fr.general.log.Log4jConfig;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.log.LogHandler; import com.fr.log.LogHandler;
@ -341,4 +342,8 @@ public class DesignerLogHandler {
}; };
} }
public void printRemoteLog(LogRecordTime logRecordTime) {
logHandlerArea.printStackTrace(logRecordTime);
}
} }

1456
designer-base/src/com/fr/env/RemoteEnv.java vendored

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save