Browse Source

Merge pull request #236 in DESIGN/design from ~HZZZ/design61:release/10.0 to release/10.0

* commit '760a21e7feba87677bc227b1a8f3ddb50384084c':
  .
  .
  .
  REPORT-9723【阻塞】【10.0二轮回归】切换远程工作目录失败
master
Hzzz 6 years ago
parent
commit
802954eb05
  1. 4
      designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java
  2. 133
      designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java
  3. 12
      designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthorityManagerAction.java
  4. 2
      designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java
  5. 4
      designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java
  6. 19
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

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

@ -114,10 +114,10 @@ public class SwitchExistEnv extends MenuDef {
return;
}
WorkContext.switchTo(workspace, new WorkContextCallback() {
@Override
public void done() {
DesignerEnvManager.getEnvManager().setCurEnvName(envName);
DesignUtils.refreshDesignerFrame();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea();

133
designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java

@ -30,37 +30,37 @@ import java.awt.event.MouseListener;
//TODO: august TemplatePane和TemplateTreePane最好合并成一个类
public class TemplatePane extends JPanel implements MouseListener {
private static final long NUM = 1L;
private static int NUM200 = 200;
public static TemplatePane getInstance() {
return HOLDER.singleton;
}
private static class HOLDER {
private static TemplatePane singleton = new TemplatePane();
}
private static final long serialVersionUID = 2108412478281713143L;
public static final int HEIGHT = 23;// 最好和日志的高度统一 用同一个变量
private static javax.swing.Icon leftIcon = BaseUtils.readIcon("/com/fr/design/images/docking/left.png");
private static javax.swing.Icon rightIcon = BaseUtils.readIcon("/com/fr/design/images/docking/right.png");
private boolean isExpanded = false;
private UIButton editButton;
private UILabel envLabel;
private TemplatePane() {
super();
this.initComponents();
this.setFocusable(true);
@ -69,24 +69,24 @@ public class TemplatePane extends JPanel implements MouseListener {
TemplateTreePane.getInstance().setVisible(isExpanded);
TemplateTreePane.getInstance().setVisible(true);
}
private void initComponents() {
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
public void envChanged() {
setJLabel(DesignerEnvManager.getEnvManager().getCurEnvName());
}
});
this.setLayout(new BorderLayout(25, 0));
editButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/control-center2.png")) {
private static final long serialVersionUID = NUM;
@Override
public Point getToolTipLocation(MouseEvent event) {
return new Point(25, 2);
}
};
@ -98,9 +98,9 @@ public class TemplatePane extends JPanel implements MouseListener {
this.add(new UILabel(" "), BorderLayout.WEST);
this.add(editButton, BorderLayout.EAST);
editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
editItems();
}
});
@ -109,25 +109,25 @@ public class TemplatePane extends JPanel implements MouseListener {
setJLabel(DesignerEnvManager.getEnvManager().getCurEnvName());
this.add(envLabel, BorderLayout.CENTER);
}
/**
* 是否可扩展
*
* @return 同上
*/
public boolean IsExpanded() {
return this.isExpanded;
}
public void setExpand(boolean b) {
this.isExpanded = b;
this.repaint();
}
private boolean envListOkAction(EnvListPane envListPane) {
final String selectedName = envListPane.updateEnvManager();
DesignerEnvManager envManager = DesignerEnvManager.getEnvManager();
DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(selectedName);
@ -141,7 +141,6 @@ public class TemplatePane extends JPanel implements MouseListener {
return false;
}
WorkContext.switchTo(workspace, new WorkContextCallback() {
@Override
public void done() {
DesignerEnvManager.getEnvManager().setCurEnvName(selectedName);
@ -165,33 +164,33 @@ public class TemplatePane extends JPanel implements MouseListener {
}
return true;
}
/**
* 编辑items
*/
public void editItems() {
final EnvListPane envListPane = new EnvListPane();
final BasicDialog envListDialog = envListPane.showWindow(SwingUtilities.getWindowAncestor(DesignerContext.getDesignerFrame()));
envListPane.populateEnvManager(envLabel.getText());
envListDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
envListOkAction(envListPane);
}
public void doCancel() {
envListDialog.setVisible(false);
}
});
envListDialog.setVisible(true);
}
private void setJLabel(String name) {
DesignerWorkspaceInfo config = DesignerEnvManager.getEnvManager().getWorkspaceInfo(name);
if (config != null) {
switch (config.getType()) {
@ -205,26 +204,26 @@ public class TemplatePane extends JPanel implements MouseListener {
}
}
}
envLabel.setText(name);
envLabel.repaint();
}
@Override
public Dimension getPreferredSize() {
return new Dimension(250, HEIGHT);
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
paintBackgroundIcon(g);
}
private void paintBackgroundIcon(Graphics g) {
int w = this.getWidth();
int h = this.getHeight();
Graphics2D g2d = (Graphics2D) g;
@ -239,9 +238,9 @@ public class TemplatePane extends JPanel implements MouseListener {
g2d.drawLine(w - 1, 2, w - 1, h - 1);
Icon icon = !isExpanded ? leftIcon : rightIcon;
icon.paintIcon(this, g2d, 4, 4);
}
/**
* 鼠标点击
*
@ -249,9 +248,9 @@ public class TemplatePane extends JPanel implements MouseListener {
*/
@Override
public void mouseClicked(MouseEvent e) {
}
/**
* 鼠标按下
*
@ -259,7 +258,7 @@ public class TemplatePane extends JPanel implements MouseListener {
*/
@Override
public void mousePressed(MouseEvent e) {
if (e.getX() < NUM200) {
isExpanded = !isExpanded;
TemplateTreePane.getInstance().setVisible(isExpanded);
@ -267,7 +266,7 @@ public class TemplatePane extends JPanel implements MouseListener {
DesignerEnvManager.getEnvManager().setTemplateTreePaneExpanded(isExpanded);
}
}
/**
* 鼠标放开
*
@ -275,9 +274,9 @@ public class TemplatePane extends JPanel implements MouseListener {
*/
@Override
public void mouseReleased(MouseEvent e) {
}
/**
* 鼠标进入
*
@ -285,9 +284,9 @@ public class TemplatePane extends JPanel implements MouseListener {
*/
@Override
public void mouseEntered(MouseEvent e) {
}
/**
* 鼠标离开
*
@ -295,33 +294,33 @@ public class TemplatePane extends JPanel implements MouseListener {
*/
@Override
public void mouseExited(MouseEvent e) {
}
/**
* 处理异常
*/
public void dealEvnExceptionWhenStartDesigner() {
final EnvListPane envListPane = new EnvListPane();
envListPane.populateEnvManager(envLabel.getText());
BasicDialog envListDialog = envListPane.showWindow(SwingUtilities.getWindowAncestor(DesignerContext.getDesignerFrame()));
envListDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
if (!envListOkAction(envListPane)) {
System.exit(0);
}
}
public void doCancel() {
System.exit(0);
}
});
envListDialog.setVisible(true);
}
}
}

12
designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthorityManagerAction.java

@ -32,7 +32,7 @@ public class RemoteDesignAuthorityManagerAction extends UpdateAction {
final AuthorityManagerPane managerPane = new AuthorityManagerPane();
BasicDialog dialog = managerPane.showWindow(DesignerContext.getDesignerFrame());
if (!WorkContext.getCurrent().isLocal()) {
try {
// 远程设计获取全部设计成员的权限列表
@ -44,12 +44,12 @@ public class RemoteDesignAuthorityManagerAction extends UpdateAction {
FineLoggerFactory.getLogger().error(exception.getMessage(), exception);
}
}
dialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
DesignAuthority[] authorities = managerPane.update();
if (!WorkContext.getCurrent().isLocal()) {
boolean success = false;
@ -61,10 +61,10 @@ public class RemoteDesignAuthorityManagerAction extends UpdateAction {
FineLoggerFactory.getLogger().info("update remote design authority: " + success);
}
}
@Override
public void doCancel() {
super.doCancel();
}
});

2
designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java

@ -18,12 +18,12 @@ import com.fr.design.remote.RemoteDesignAuthorityCreator;
import com.fr.design.remote.ui.list.AuthorityList;
import com.fr.design.remote.ui.list.AuthorityListCellRenderer;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.workspace.server.authority.RemoteDesignMember;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.report.DesignAuthority;
import com.fr.stable.ArrayUtils;
import com.fr.workspace.server.authority.RemoteDesignMember;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;

4
designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java

@ -13,12 +13,12 @@ import com.fr.design.remote.ui.list.AddedMemberListCellRender;
import com.fr.design.remote.ui.list.AddingMemberList;
import com.fr.design.remote.ui.list.AddingMemberListCellRender;
import com.fr.design.remote.ui.list.MemberListSelectedChangeListener;
import com.fr.workspace.server.authority.RemoteDesignMember;
import com.fr.workspace.server.authority.decision.DecisionOperator;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import com.fr.third.guava.collect.ImmutableList;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.authority.RemoteDesignMember;
import com.fr.workspace.server.authority.decision.DecisionOperator;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;

19
designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

@ -27,7 +27,14 @@ import java.net.URL;
public class DesignerSocketIO {
enum Status {
Connected,
Disconnected,
Disconnecting
}
private static Optional<Socket> socketIO = Optional.absent();
public static Status status = Status.Disconnected;
private static final Emitter.Listener printLog = new Emitter.Listener() {
@Override
@ -45,8 +52,10 @@ public class DesignerSocketIO {
public static void close() {
if (socketIO.isPresent()) {
status = Status.Disconnecting;
socketIO.get().close();
socketIO = Optional.absent();
status = Status.Disconnected;
}
}
@ -70,11 +79,15 @@ public class DesignerSocketIO {
socketIO.get().on(Socket.EVENT_DISCONNECT, new Emitter.Listener() {
@Override
public void call(Object... objects) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Disconnected"}),
null, 0, UIManager.getIcon("OptionPane.errorIcon"));
if (status != Status.Disconnecting) {
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Disconnected"}),
null, 0, UIManager.getIcon("OptionPane.errorIcon"));
status = Status.Disconnected;
}
}
});
socketIO.get().connect();
status = Status.Connected;
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
@ -91,4 +104,4 @@ public class DesignerSocketIO {
DecisionServiceConstants.WEB_SOCKET_TOKEN_NAME,
RemoteCallClient.getInstance().getToken());
}
}
}

Loading…
Cancel
Save