From 9b99bfb7cc025ddd89b202507da820a5a95a87ef Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 21 May 2018 02:05:42 +0800 Subject: [PATCH] remote design pilot --- .../CheckBoxTreeCellRenderer.java | 26 ++++------ .../mainframe/toolbar/ToolBarMenuDock.java | 48 ++++--------------- .../remote/ui/AuthorityListControlPane.java | 2 +- .../fr/design/remote/ui/UserManagerPane.java | 20 ++------ .../remote/ui/list/AddedMemberList.java | 8 ++-- .../ui/list/AuthorityListCellRenderer.java | 10 +--- 6 files changed, 32 insertions(+), 82 deletions(-) diff --git a/designer-base/src/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java b/designer-base/src/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java index 2c7b899dd..9684d3947 100644 --- a/designer-base/src/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java +++ b/designer-base/src/com/fr/design/gui/itree/checkboxtree/CheckBoxTreeCellRenderer.java @@ -6,24 +6,18 @@ package com.fr.design.gui.itree.checkboxtree; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Point; -import java.awt.event.MouseEvent; -import java.io.Serializable; - -import javax.swing.BorderFactory; -import javax.swing.JComponent; +import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import javax.swing.JTree; +import com.fr.design.layout.FRGUIPaneFactory; + +import javax.swing.*; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreePath; - -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.layout.FRGUIPaneFactory; +import java.awt.*; +import java.awt.event.MouseEvent; +import java.io.Serializable; /** @@ -52,7 +46,7 @@ public class CheckBoxTreeCellRenderer extends NullPanel implements TreeCellRende public CheckBoxTreeCellRenderer() { this(null); } - + public CheckBoxTreeCellRenderer(TreeCellRenderer renderer) { if (noFocusBorder == null) { noFocusBorder = new EmptyBorder(1, 1, 1, 1); @@ -84,8 +78,7 @@ public class CheckBoxTreeCellRenderer extends NullPanel implements TreeCellRende if (selectionModel.isPathSelected(path, selectionModel.isDigIn())) { _checkBox.setState(TristateCheckBox.SELECTED); _checkBox.setSelected(true); - } - else { + } else { _checkBox.setState(selectionModel.isDigIn() && selectionModel.isPartiallySelected(path) ? null : TristateCheckBox.NOT_SELECTED); _checkBox.setSelected(false); } @@ -102,6 +95,7 @@ public class CheckBoxTreeCellRenderer extends NullPanel implements TreeCellRende Border border = treeCellRendererComponent.getBorder(); setBorder(border); treeCellRendererComponent.setBorder(BorderFactory.createEmptyBorder()); + //todo 可能会发生数组越界,需要处理一下 if (getComponentCount() == 2) { remove(1); } diff --git a/designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 95d8c87f5..5b43eb21c 100644 --- a/designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -8,31 +8,14 @@ import com.fr.base.FRContext; import com.fr.design.DesignState; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; -import com.fr.design.actions.community.BBSAction; -import com.fr.design.actions.community.BugAction; -import com.fr.design.actions.community.NeedAction; -import com.fr.design.actions.community.QuestionAction; -import com.fr.design.actions.community.SignAction; -import com.fr.design.actions.community.UpAction; -import com.fr.design.actions.community.VideoAction; -import com.fr.design.actions.file.CloseCurrentTemplateAction; -import com.fr.design.actions.file.ExitDesignerAction; -import com.fr.design.actions.file.OpenRecentReportMenuDef; -import com.fr.design.actions.file.OpenTemplateAction; -import com.fr.design.actions.file.PreferenceAction; -import com.fr.design.actions.file.SwitchExistEnv; +import com.fr.design.actions.community.*; +import com.fr.design.actions.file.*; import com.fr.design.actions.help.AboutAction; import com.fr.design.actions.help.TutorialAction; import com.fr.design.actions.help.WebDemoAction; import com.fr.design.actions.help.alphafine.AlphaFineAction; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; -import com.fr.design.actions.server.ConnectionListAction; -import com.fr.design.actions.server.FunctionManagerAction; -import com.fr.design.actions.server.GlobalParameterAction; -import com.fr.design.actions.server.GlobalTableDataAction; -import com.fr.design.actions.server.PlatformManagerAction; -import com.fr.design.actions.server.PluginManagerAction; -import com.fr.design.remote.action.RemoteDesignAuthorityManagerAction; +import com.fr.design.actions.server.*; import com.fr.design.file.NewTemplatePane; import com.fr.design.fun.MenuHandler; import com.fr.design.fun.TableDataPaneProcessor; @@ -47,6 +30,7 @@ import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; +import com.fr.design.remote.action.RemoteDesignAuthorityManagerAction; import com.fr.design.utils.ThemeUtils; import com.fr.env.RemoteEnv; import com.fr.general.ComparatorUtils; @@ -61,23 +45,10 @@ import com.fr.plugin.observer.PluginEventType; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JMenuBar; -import javax.swing.JPanel; -import javax.swing.SwingConstants; -import javax.swing.UIManager; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Font; -import java.util.ArrayList; -import java.util.Arrays; +import javax.swing.*; +import java.awt.*; +import java.util.*; import java.util.List; -import java.util.Locale; -import java.util.Set; /** * @author richer @@ -443,9 +414,8 @@ public abstract class ToolBarMenuDock { return processor == null ? new GlobalTableDataAction() : processor.createServerTDAction(); } - protected boolean shouldShowRemotePermission() { - // todo 依据是否是远程设计 并且当前登录的用户是否是管理员 进行判断 是否展示远程设计权限管理 - return true; + private boolean shouldShowRemotePermission() { + return FRContext.getCurrentEnv() != null && FRContext.getCurrentEnv().isRoot(); } protected boolean shouldShowPlugin() { diff --git a/designer-base/src/com/fr/design/remote/ui/AuthorityListControlPane.java b/designer-base/src/com/fr/design/remote/ui/AuthorityListControlPane.java index c37e0e69f..3a117ecde 100644 --- a/designer-base/src/com/fr/design/remote/ui/AuthorityListControlPane.java +++ b/designer-base/src/com/fr/design/remote/ui/AuthorityListControlPane.java @@ -49,7 +49,7 @@ public class AuthorityListControlPane extends BasicPane { private AuthorityList authorityList; - private static final int SHORT_WIDTH = 30; + private static final int SHORT_WIDTH = 90; private ListEditorControlPane editorCtrl; diff --git a/designer-base/src/com/fr/design/remote/ui/UserManagerPane.java b/designer-base/src/com/fr/design/remote/ui/UserManagerPane.java index df8f87afc..41e1cfe07 100644 --- a/designer-base/src/com/fr/design/remote/ui/UserManagerPane.java +++ b/designer-base/src/com/fr/design/remote/ui/UserManagerPane.java @@ -10,25 +10,14 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.remote.RemoteMember; import com.fr.design.remote.Utils; -import com.fr.design.remote.ui.list.AddedMemberList; -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.design.remote.ui.list.*; import com.fr.general.Inter; import com.fr.stable.StringUtils; import com.fr.third.guava.collect.ImmutableList; -import javax.swing.BorderFactory; -import javax.swing.DefaultListModel; -import javax.swing.JPanel; -import javax.swing.ListSelectionModel; -import javax.swing.SwingWorker; +import javax.swing.*; import javax.swing.border.EmptyBorder; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -114,7 +103,8 @@ public class UserManagerPane extends BasicPane { addingList.repaint(); resetAddedMembers(); sync2AddedMembersFormAdded(); - // 不需要重复更新右侧列表显示 + // 不需要重复更新右侧列表显示 但是更新一下计数显示 + countLabel.setText(Inter.getLocText("已选择{R1}人", String.valueOf(addedMembers.size()))); } }; diff --git a/designer-base/src/com/fr/design/remote/ui/list/AddedMemberList.java b/designer-base/src/com/fr/design/remote/ui/list/AddedMemberList.java index 28affa826..fd02aa75b 100644 --- a/designer-base/src/com/fr/design/remote/ui/list/AddedMemberList.java +++ b/designer-base/src/com/fr/design/remote/ui/list/AddedMemberList.java @@ -2,7 +2,7 @@ package com.fr.design.remote.ui.list; import com.fr.design.remote.RemoteMember; -import javax.swing.DefaultListModel; +import javax.swing.*; import java.awt.event.MouseEvent; import java.util.Vector; @@ -33,8 +33,10 @@ public class AddedMemberList extends MemberList { @Override protected void displaySelected() { RemoteMember member = getSelectedValue(); - member.setSelected(!member.isSelected()); - ((DefaultListModel) getModel()).removeElement(member); + if (member != null) { + member.setSelected(!member.isSelected()); + ((DefaultListModel) getModel()).removeElement(member); + } revalidate(); repaint(); fireSelectedChange(); diff --git a/designer-base/src/com/fr/design/remote/ui/list/AuthorityListCellRenderer.java b/designer-base/src/com/fr/design/remote/ui/list/AuthorityListCellRenderer.java index 46809ba26..2d3c407f1 100644 --- a/designer-base/src/com/fr/design/remote/ui/list/AuthorityListCellRenderer.java +++ b/designer-base/src/com/fr/design/remote/ui/list/AuthorityListCellRenderer.java @@ -4,17 +4,11 @@ import com.fr.base.BaseUtils; import com.fr.design.remote.RemoteDesignAuthority; import sun.swing.DefaultLookup; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.ListCellRenderer; +import javax.swing.*; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; -import java.awt.Color; -import java.awt.Component; +import java.awt.*; -/* - * NameableListCellRenderer - */ public class AuthorityListCellRenderer extends JLabel implements ListCellRenderer {