Browse Source

Merge branch 'feature/10.0' of http://cloud.finedevelop.com:2015/scm/~plough/10-design into feature/10.0

master
plough 7 years ago
parent
commit
ed5c8d9567
  1. 6
      designer-base/src/com/fr/design/DesignerEnvManager.java
  2. 4
      designer-base/src/com/fr/design/actions/file/SwitchExistEnv.java
  3. 47
      designer-base/src/com/fr/design/extra/PluginUtils.java
  4. 7
      designer-base/src/com/fr/design/extra/PluginWebBridge.java
  5. 76
      designer-base/src/com/fr/design/extra/PluginWebPane.java
  6. 6
      designer-base/src/com/fr/design/extra/WebViewDlgHelper.java
  7. 40
      designer-base/src/com/fr/design/extra/exe/GetInstalledPluginsExecutor.java
  8. 170
      designer-base/src/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  9. 2
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java
  10. 4
      designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java
  11. 2
      designer-base/src/com/fr/design/remote/RemoteDesignAuthorityCreator.java
  12. 72
      designer-base/src/com/fr/design/remote/RemoteMember.java
  13. 47
      designer-base/src/com/fr/design/remote/Utils.java
  14. 18
      designer-base/src/com/fr/design/remote/action/RemoteDesignAuthorityManagerAction.java
  15. 59
      designer-base/src/com/fr/design/remote/button/IconButton.java
  16. 18
      designer-base/src/com/fr/design/remote/ui/AuthorityEditorPane.java
  17. 24
      designer-base/src/com/fr/design/remote/ui/AuthorityListControlPane.java
  18. 3
      designer-base/src/com/fr/design/remote/ui/AuthorityManagerPane.java
  19. 78
      designer-base/src/com/fr/design/remote/ui/UserManagerPane.java
  20. 25
      designer-base/src/com/fr/design/remote/ui/list/AddedMemberList.java
  21. 21
      designer-base/src/com/fr/design/remote/ui/list/AddedMemberListCellRender.java
  22. 21
      designer-base/src/com/fr/design/remote/ui/list/AddingMemberList.java
  23. 11
      designer-base/src/com/fr/design/remote/ui/list/AddingMemberListCellRender.java
  24. 2
      designer-base/src/com/fr/design/remote/ui/list/AuthorityListCellRenderer.java
  25. 11
      designer-base/src/com/fr/design/remote/ui/list/MemberList.java
  26. 4
      designer-base/src/com/fr/env/EnvListPane.java
  27. 3
      designer-base/src/com/fr/env/LocalEnvPane.java
  28. 6
      designer-base/src/com/fr/env/RemoteEnv.java
  29. 4
      designer-base/src/com/fr/env/RemoteEnvPane.java
  30. 6
      designer-base/src/com/fr/env/SignIn.java

6
designer-base/src/com/fr/design/DesignerEnvManager.java

@ -6,10 +6,10 @@ package com.fr.design;
import com.fr.base.BaseXMLUtils;
import com.fr.base.FRContext;
import com.fr.base.Utils;
import com.fr.base.env.resource.EnvConfigUtils;
import com.fr.base.env.resource.LocalEnvConfig;
import com.fr.base.env.resource.RemoteEnvConfig;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.resource.EnvConfigUtils;
import com.fr.core.env.resource.LocalEnvConfig;
import com.fr.core.env.resource.RemoteEnvConfig;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.constants.UIConstants;
import com.fr.env.SignIn;

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

@ -1,9 +1,9 @@
package com.fr.design.actions.file;
import com.fr.base.BaseUtils;
import com.fr.base.env.resource.LocalEnvConfig;
import com.fr.base.env.resource.RemoteEnvConfig;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.resource.LocalEnvConfig;
import com.fr.core.env.resource.RemoteEnvConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.DesignTableDataManager;

47
designer-base/src/com/fr/design/extra/PluginUtils.java

@ -24,6 +24,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -205,4 +207,49 @@ public class PluginUtils {
private static boolean isCompatibleCurrentEnv(String envVersion){
return VersionIntervalFactory.create(envVersion).contain(Version.currentEnvVersion());
}
public static JSONArray transferPluginToJson(PluginContext [] pluginContexts){
JSONArray ja = JSONArray.create();
try {
for(PluginContext pluginContext : pluginContexts){
JSONObject jo = JSONObject.create();
jo.put("id", pluginContext.getID());
jo.put("name", pluginContext.getName());
jo.put("version", pluginContext.getVersion());
jo.put("envVersion", pluginContext.getEnvVersion());
jo.put("description", pluginContext.getDescription());
jo.put("changeNotes", pluginContext.getChangeNotes());
jo.put("vendor", pluginContext.getVendor());
jo.put("price", pluginContext.getPrice());
jo.put("jarTime", pluginContext.getRequiredJarTime());
jo.put("isActive", pluginContext.isActive());
jo.put("isHidden", pluginContext.isHidden());
jo.put("isFree", pluginContext.isFree());
jo.put("isLicDamage", pluginContext.isLicDamaged());
jo.put("isAvailable", pluginContext.isAvailable());
jo.put("leftTime", String.valueOf(pluginContext.getLeftDays()));
jo.put("isTrial", pluginContext.isOnTrial());
jo.put("deadline", getDeadline(pluginContext));
jo.put("isRegisterFailed", pluginContext.isRegisterFailed());
ja.put(jo);
}
}catch (Exception e){
}
return ja;
}
private static String getDeadline(PluginContext plugin) {
int leftDays = plugin.getLeftDays();
if (leftDays == Integer.MAX_VALUE) {
return Inter.getLocText("FR-Plugin-Store_Permanent");
}
Calendar deadline = Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
deadline.add(Calendar.DATE, leftDays);
return format.format(deadline.getTime());
}
}

7
designer-base/src/com/fr/design/extra/PluginWebBridge.java

@ -5,6 +5,7 @@ import com.fr.config.MarketConfig;
import com.fr.design.RestartHelper;
import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.GetInstalledPluginsExecutor;
import com.fr.design.extra.exe.GetPluginCategoriesExecutor;
import com.fr.design.extra.exe.GetPluginFromStoreExecutor;
import com.fr.design.extra.exe.GetPluginPrefixExecutor;
@ -301,9 +302,9 @@ public class PluginWebBridge {
*
* @return 已安装的插件组成的数组
*/
public PluginContext[] getInstalledPlugins() {
List<PluginContext> plugins = PluginManager.getContexts();
return plugins.toArray(new PluginContext[plugins.size()]);
public void getInstalledPlugins(final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetInstalledPluginsExecutor());
threadPoolExecutor.submit(task);
}
private String[] jsObjectToStringArray(JSObject obj) {

76
designer-base/src/com/fr/design/extra/PluginWebPane.java

@ -1,5 +1,10 @@
package com.fr.design.extra;
import com.fr.base.FRContext;
import com.fr.base.TemplateUtils;
import com.fr.general.IOUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.event.EventHandler;
@ -10,16 +15,24 @@ import javafx.scene.web.WebEvent;
import javafx.scene.web.WebView;
import netscape.javascript.JSObject;
import javax.swing.*;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
/**
* Created by richie on 16/3/19.
*/
public class PluginWebPane extends JFXPanel {
private static final String RESOURCE_URL = "resourceURL";
private WebEngine webEngine;
public PluginWebPane(final String mainJs) {
public PluginWebPane(final String installHome, final String mainJs) {
Platform.setImplicitExit(false);
Platform.runLater(new Runnable() {
@Override
@ -29,21 +42,56 @@ public class PluginWebPane extends JFXPanel {
PluginWebPane.this.setScene(scene);
WebView webView = new WebView();
webEngine = webView.getEngine();
webEngine.load("file:///" + mainJs);
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() {
@Override
public void handle(WebEvent<String> event) {
showAlert(event.getData());
}
});
JSObject obj = (JSObject) webEngine.executeScript("window");
obj.setMember("PluginHelper", PluginWebBridge.getHelper(webEngine));
webView.setContextMenuEnabled(false);//屏蔽右键
root.setCenter(webView);
try{
String htmlString = getRenderedHtml(installHome, mainJs);
webEngine.loadContent(htmlString);
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() {
@Override
public void handle(WebEvent<String> event) {
showAlert(event.getData());
}
});
JSObject obj = (JSObject) webEngine.executeScript("window");
obj.setMember("PluginHelper", PluginWebBridge.getHelper(webEngine));
webView.setContextMenuEnabled(false);//屏蔽右键
root.setCenter(webView);
}catch (Exception e){
FRContext.getLogger().error(e.getMessage(), e);
}
}
});
}
private String getRenderedHtml(String installHome, String mainJs) throws IOException {
InputStream inp = IOUtils.readResource(StableUtils.pathJoin(installHome, mainJs));
if (inp == null) {
throw new IOException("Not found template: " + mainJs);
}
BufferedReader reader = new BufferedReader(new InputStreamReader(inp, StableUtils.RESOURCE_ENCODER));
BufferedReader read = new BufferedReader(reader);
StringBuffer sb = new StringBuffer();
String line;
Map<String, Object> map4Tpl = new HashMap<String, Object>();
map4Tpl.put(RESOURCE_URL, "file:///" + URLEncoder.encode(installHome, "UTF-8"));
while ((line = read.readLine()) != null) {
if (sb.length() > 0) {
sb.append('\n');
}
sb.append(line);
}
String htmlString = StringUtils.EMPTY;
try{
htmlString = TemplateUtils.renderParameter4Tpl(sb.toString(), map4Tpl);
}catch (Exception e){
FRContext.getLogger().error(e.getMessage(), e);
}
reader.close();
inp.close();
return htmlString;
}
private void showAlert(final String message) {
SwingUtilities.invokeLater(new Runnable() {
@Override

6
designer-base/src/com/fr/design/extra/WebViewDlgHelper.java

@ -73,7 +73,7 @@ public class WebViewDlgHelper {
String indexPath = "plugin.html";
String mainIndexPath = StableUtils.pathJoin(installHome, indexPath);
checkAndCopyMainFile(mainIndexPath, mainJsPath);
showPluginDlg(mainIndexPath);
showPluginDlg(indexPath);
updateShopScripts(SHOP_SCRIPTS);
}
} else {
@ -188,8 +188,8 @@ public class WebViewDlgHelper {
private static void showPluginDlg(String mainJsPath) {
try {
Class<?> clazz = Class.forName("com.fr.design.extra.PluginWebPane");
Constructor constructor = clazz.getConstructor(String.class);
Component webPane = (Component) constructor.newInstance(mainJsPath);
Constructor constructor = clazz.getConstructor(String.class, String.class);
Component webPane = (Component) constructor.newInstance(installHome, mainJsPath);
BasicPane managerPane = new ShopManagerPane(webPane);
UIDialog dlg = new ShopDialog(DesignerContext.getDesignerFrame(), managerPane);

40
designer-base/src/com/fr/design/extra/exe/GetInstalledPluginsExecutor.java

@ -0,0 +1,40 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.PluginUtils;
import com.fr.design.extra.Process;
import com.fr.json.JSONArray;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.manage.PluginManager;
import java.util.List;
/**
* @author kerry
* @date 2018/6/1
*/
public class GetInstalledPluginsExecutor implements Executor {
private String result ="[]";
@Override
public String getTaskFinishMessage() {
return result;
}
@Override
public Command[] getCommands() {
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return null;
}
@Override
public void run(Process<String> process) {
List<PluginContext> plugins = PluginManager.getContexts();
JSONArray ja = PluginUtils.transferPluginToJson(plugins.toArray(new PluginContext[plugins.size()]));
result = ja.toString();
}
}
};
}
}

170
designer-base/src/com/fr/design/gui/itree/filetree/TemplateFileTree.java

@ -1,20 +1,29 @@
package com.fr.design.gui.itree.filetree;
import com.fr.base.Env;
import com.fr.base.env.EnvContext;
import com.fr.base.env.proxy.EnvProxy;
import com.fr.base.env.resource.EnvConfigUtils;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.env.operator.file.TplFileOperator;
import com.fr.file.filetree.FileNode;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
import javax.swing.text.Position;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/*
* 显示Env下的reportlets目录下面的所有cpt文件
*/
public class TemplateFileTree extends EnvFileTree {
public TemplateFileTree() {
super(ProjectConstants.REPORTLETS_NAME, null, null);
@ -42,33 +51,32 @@ public class TemplateFileTree extends EnvFileTree {
return null;
}
public String[] getSelectedTemplatePaths(){
TreePath[] selectedTreePaths = this.getSelectionPaths();
if (ArrayUtils.isEmpty(selectedTreePaths)) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
List<String> selectedPathList = new ArrayList<String>();
for(TreePath treepath : selectedTreePaths){
ExpandMutableTreeNode currentTreeNode = (ExpandMutableTreeNode) treepath.getLastPathComponent();
Object userObject = currentTreeNode.getUserObject();
if (userObject instanceof FileNode) {
FileNode fn = (FileNode) userObject;
if (!fn.isDirectory()) {
String envPath = fn.getEnvPath();
if (envPath.startsWith(ProjectConstants.REPORTLETS_NAME)) {
selectedPathList.add(envPath.substring(ProjectConstants.REPORTLETS_NAME.length()));
}
}
}
}
return selectedPathList.toArray(new String[0]);
public String[] getSelectedTemplatePaths() {
TreePath[] selectedTreePaths = this.getSelectionPaths();
if (ArrayUtils.isEmpty(selectedTreePaths)) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
List<String> selectedPathList = new ArrayList<String>();
for (TreePath treepath : selectedTreePaths) {
ExpandMutableTreeNode currentTreeNode = (ExpandMutableTreeNode) treepath.getLastPathComponent();
Object userObject = currentTreeNode.getUserObject();
if (userObject instanceof FileNode) {
FileNode fn = (FileNode) userObject;
if (!fn.isDirectory()) {
String envPath = fn.getEnvPath();
if (envPath.startsWith(ProjectConstants.REPORTLETS_NAME)) {
selectedPathList.add(envPath.substring(ProjectConstants.REPORTLETS_NAME.length()));
}
}
}
}
return selectedPathList.toArray(new String[0]);
}
public TreePath getNextMatch(String prefix, int startingRow,
Position.Bias bias) {
public TreePath getNextMatch(String prefix, int startingRow, Position.Bias bias) {
int max = getRowCount();
if (prefix == null) {
@ -78,9 +86,7 @@ public class TemplateFileTree extends EnvFileTree {
throw new IllegalArgumentException();
}
prefix = prefix.toUpperCase();
// start search from the next/previous element froom the
// selected element
// start search from the next/previous element from the selected element
int increment = (bias == Position.Bias.Forward) ? 1 : -1;
int row = startingRow;
do {
@ -96,4 +102,110 @@ public class TemplateFileTree extends EnvFileTree {
} while (row != startingRow);
return null;
}
public FileNode[] listFile(String path) {
String username = EnvConfigUtils.getUsername(EnvContext.currentEnv());
String extra = EnvProxy.get(TplFileOperator.class).readExtraResourcePath(path);
return EnvProxy.get(TplFileOperator.class).list(username, extra, path);
}
/*
* 改变Env后,根据构造函数时设置的RootPaths,重新加载
*/
public void refreshEnv(Env env) {
DefaultTreeModel defaultTreeModel = (DefaultTreeModel) this.getModel();
ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) defaultTreeModel.getRoot();
rootTreeNode.removeAllChildren();
FileNode[] fns;
// 如果rootPaths是null的话列出所有文件
if (subPathes == null) {
fns = listFileNodes(this.treeRootPath);
} else {
// 重新加载新的FileDirectoryNode
fns = new FileNode[subPathes.length];
for (int i = 0; i < subPathes.length; i++) {
fns[i] = new FileNode(StableUtils.pathJoin(this.treeRootPath, subPathes[i]), true);
}
}
ExpandMutableTreeNode[] subTreeNodes = fileNodeArray2TreeNodeArray(fns);
for (ExpandMutableTreeNode node : subTreeNodes) {
rootTreeNode.add(node);
}
defaultTreeModel.reload(rootTreeNode);
}
protected ExpandMutableTreeNode[] loadChildTreeNodes(ExpandMutableTreeNode treeNode) {
FileNode[] fn_array = listFileNodes(treeNode);
return fileNodeArray2TreeNodeArray(fn_array);
}
/*
* 把FileNode[]转成ExpandMutableTreeNode[]
*/
private ExpandMutableTreeNode[] fileNodeArray2TreeNodeArray(FileNode[] fileNodes) {
ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[fileNodes.length];
for (int i = 0; i < res.length; i++) {
FileNode fn = fileNodes[i];
res[i] = new ExpandMutableTreeNode(fn);
if (fn.isDirectory()) {
res[i].add(new ExpandMutableTreeNode());
}
}
return res;
}
private FileNode[] listFileNodes(String filePath) {
FileNode[] fileNodes = null;
try {
fileNodes = listFile(filePath);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
if (fileNodes == null) {
fileNodes = new FileNode[0];
}
// 用FileNodeFilter过滤一下
if (filter != null) {
List<FileNode> list = new ArrayList<FileNode>();
for (FileNode fileNode : fileNodes) {
if (filter.accept(fileNode)) {
list.add(fileNode);
}
}
fileNodes = list.toArray(new FileNode[list.size()]);
}
Arrays.sort(fileNodes, new FileNodeComparator());
return fileNodes;
}
/*
* 求当前TreeNode下所有的FileNode.
*/
private FileNode[] listFileNodes(ExpandMutableTreeNode currentTreeNode) {
if (currentTreeNode == null) {
return new FileNode[0];
}
Object object = currentTreeNode.getUserObject();
if (object instanceof FileNode) {
return this.listFileNodes(((FileNode) object).getEnvPath());
}
return new FileNode[0];
}
}

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

@ -6,8 +6,8 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.env.resource.EnvConfigUtils;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.resource.EnvConfigUtils;
import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignState;
import com.fr.design.DesignerEnvManager;

4
designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java

@ -1,10 +1,10 @@
package com.fr.design.mainframe.loghandler.socketio;
import com.fr.base.env.EnvContext;
import com.fr.base.env.resource.LocalEnvConfig;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.EnvConstants;
import com.fr.core.env.EnvContext;
import com.fr.core.env.EnvEvent;
import com.fr.core.env.resource.LocalEnvConfig;
import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.event.Event;

2
designer-base/src/com/fr/design/remote/RemoteDesignAuthorityCreator.java

@ -3,7 +3,7 @@ package com.fr.design.remote;
import com.fr.design.beans.BasicBeanPane;
import com.fr.report.DesignAuthority;
import javax.swing.*;
import javax.swing.Icon;
public class RemoteDesignAuthorityCreator {

72
designer-base/src/com/fr/design/remote/RemoteMember.java

@ -1,72 +0,0 @@
package com.fr.design.remote;
import com.fr.general.Inter;
public class RemoteMember {
public static final RemoteMember DEFAULT_MEMBER =
new RemoteMember(Inter.getLocText("FR-Designer_Remote_Design_Loading"));
private String username;
private String realName;
private String userId;
private boolean selected;
public RemoteMember() {
}
public RemoteMember(String username) {
this.username = username;
}
public RemoteMember username(String username) {
this.username = username;
return this;
}
public RemoteMember realName(String realName) {
this.realName = realName;
return this;
}
public RemoteMember userId(String userId) {
this.userId = userId;
return this;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public boolean isSelected() {
return selected;
}
public void setSelected(boolean selected) {
this.selected = selected;
}
}

47
designer-base/src/com/fr/design/remote/Utils.java

@ -1,47 +0,0 @@
package com.fr.design.remote;
import com.fr.base.FRContext;
import com.fr.decision.webservice.bean.user.UserAdditionBean;
import com.fr.decision.webservice.v10.user.UserService;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
public class Utils {
private Utils() {
}
public static Collection<? extends RemoteMember> getRemoteMember(String keyword) {
List<UserAdditionBean> userBeans = new ArrayList<>();
try {
Map<String, Object> result =
UserService.getInstance().getAllUsers(
FRContext.getCurrentEnv().getUser(),
1,
10,
keyword,
"",
true);
userBeans = (List<UserAdditionBean>) result.get("items");
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage());
}
List<RemoteMember> res = new ArrayList<>();
for (UserAdditionBean userBean : userBeans) {
res.add(
new RemoteMember()
.username(userBean.getUsername())
.realName(userBean.getRealName())
.userId(userBean.getId())
);
}
return res;
}
}

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

@ -2,13 +2,15 @@ package com.fr.design.remote.action;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.env.proxy.EnvProxy;
import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.remote.ui.AuthorityManagerPane;
import com.fr.env.RemoteEnv;
import com.fr.env.operator.authority.AuthorityOperator;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.report.DesignAuthority;
import java.awt.event.ActionEvent;
@ -20,7 +22,7 @@ public class RemoteDesignAuthorityManagerAction extends UpdateAction {
public RemoteDesignAuthorityManagerAction() {
this.setName(Inter.getLocText("FR-Designer_Remote_Design_Authority_Manager"));
this.setName(Inter.getLocText("Fine-Designer_Remote_Design_Authority_Manager"));
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/remote/images/icon_Remote_Design_Permission_Manager_normal@1x.png"));
}
@ -34,12 +36,13 @@ public class RemoteDesignAuthorityManagerAction extends UpdateAction {
if (!FRContext.getCurrentEnv().isLocalEnv()) {
try {
DesignAuthority[] authorities = ((RemoteEnv) FRContext.getCurrentEnv()).getAuthorities();
// 远程设计获取全部设计成员的权限列表
DesignAuthority[] authorities = EnvProxy.get(AuthorityOperator.class).getAuthorities();
if (authorities != null && authorities.length != 0) {
managerPane.populate(authorities);
}
} catch (Exception exception) {
FRContext.getLogger().error(exception.getMessage());
FineLoggerFactory.getLogger().error(exception.getMessage(), exception);
}
}
@ -48,7 +51,12 @@ public class RemoteDesignAuthorityManagerAction extends UpdateAction {
public void doOk() {
DesignAuthority[] authorities = managerPane.update();
if (!FRContext.getCurrentEnv().isLocalEnv()) {
boolean success = ((RemoteEnv) FRContext.getCurrentEnv()).updateAuthorities(authorities);
boolean success = false;
try {
success = EnvProxy.get(AuthorityOperator.class).updateAuthorities(authorities);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
FRContext.getLogger().info("update remote design authority: " + success);
}
}

59
designer-base/src/com/fr/design/remote/button/IconButton.java

@ -0,0 +1,59 @@
package com.fr.design.remote.button;
import com.fr.base.BaseUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;
import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
public final class IconButton extends JButton {
public IconButton() {
super(StringUtils.EMPTY);
setContentAreaFilled(false);
setFocusPainted(false);
setIcon(BaseUtils.readIcon("com/fr/design/remote/images/icon_Remove_x.png"));
setBorder(null);
}
@Override
protected void paintBorder(Graphics g) {
}
@Override
protected void paintComponent(Graphics g) {
final Graphics2D g2 = (Graphics2D) g.create();
g2.setPaint(
new GradientPaint(
new Point(0, 0),
new Color(0xF5F5F7),
new Point(0, getPreferredSize().height),
new Color(0xF5F5F7)
)
);
g2.fillRect(0, 0, getPreferredSize().width, getPreferredSize().height);
g2.dispose();
super.paintComponent(g);
}
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(null);
IconButton a = new IconButton();
a.setBounds(0, 0, a.getPreferredSize().width, a.getPreferredSize().height);
content.add(a);
GUICoreUtils.centerWindow(jf);
jf.setSize(400, 400);
jf.setVisible(true);
}
}

18
designer-base/src/com/fr/design/remote/ui/AuthorityEditorPane.java

@ -2,8 +2,8 @@ package com.fr.design.remote.ui;
import com.fr.base.FRContext;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.remote.ui.tree.FileAuthorityTree;
@ -14,23 +14,28 @@ import com.fr.report.DesignAuthority;
import com.fr.stable.CoreConstants;
import javax.swing.BorderFactory;
import javax.swing.border.EmptyBorder;
import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class AuthorityEditorPane extends BasicBeanPane<DesignAuthority> {
private UILabel label = new UILabel();
private FileAuthorityTree tree = new FileAuthorityTree();
public AuthorityEditorPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder());
this.add(label, BorderLayout.NORTH);
this.setBorder(
BorderFactory.createCompoundBorder(
new EmptyBorder(6, 0, 6, 6),
UITitledBorder.createBorderWithTitle(
Inter.getLocText("Fine-Designer_Remote_Design_Template_Authority_Config")
)
)
);
IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{".cpt", ".class", ".frm", ".form"});
tree.setDigIn(true);
tree.setFileNodeFilter(filter);
@ -41,7 +46,7 @@ public class AuthorityEditorPane extends BasicBeanPane<DesignAuthority> {
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Remote_Design_Configure_Authority");
return Inter.getLocText("Fine-Designer_Remote_Design_Configure_Authority");
}
@Override
@ -49,7 +54,6 @@ public class AuthorityEditorPane extends BasicBeanPane<DesignAuthority> {
if (ob == null) {
return;
}
label.setText(ob.getUsername());
DesignAuthority.Item[] items = ob.getItems();
if (items == null) {

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

@ -15,12 +15,13 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.remote.RemoteDesignAuthorityCreator;
import com.fr.design.remote.RemoteMember;
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.env.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;
@ -77,7 +78,7 @@ public class AuthorityListControlPane extends BasicPane {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.authorityCreators = new RemoteDesignAuthorityCreator[]{
new RemoteDesignAuthorityCreator(
Inter.getLocText("FR-Designer_Remote_Design_User"),
Inter.getLocText("Fine-Designer_Remote_Design_User"),
BaseUtils.readIcon("com/fr/design/remote/images/icon_Member_normal@1x.png"),
DesignAuthority.class,
AuthorityEditorPane.class)
@ -92,8 +93,8 @@ public class AuthorityListControlPane extends BasicPane {
// 右侧卡片布局
cardLayout = new CardLayout();
cardPane = new JPanel(cardLayout);
UILabel selectLabel = new UILabel();
cardPane.add(selectLabel, UNSELECTED_EDITOR_NAME);
UILabel emptyLabel = new UILabel();
cardPane.add(emptyLabel, UNSELECTED_EDITOR_NAME);
cardPane.add(editorCtrl, SELECTED_EDITOR_NAME);
// 左右分割布局
@ -169,7 +170,7 @@ public class AuthorityListControlPane extends BasicPane {
for (int i = 0, len = listModel.getSize(); i < len; i++) {
res.add((DesignAuthority) listModel.getElementAt(i));
}
return res.toArray(new DesignAuthority[0]);
return res.toArray(new DesignAuthority[res.size()]);
}
public void populate(DesignAuthority[] authorities) {
@ -231,6 +232,12 @@ public class AuthorityListControlPane extends BasicPane {
public void addAuthority(DesignAuthority authority, int index) {
DefaultListModel<DesignAuthority> model = (DefaultListModel<DesignAuthority>) authorityList.getModel();
for (int i = 0; i < model.size(); i++) {
if (model.get(i).getUserId().equals(authority.getUserId())) {
return;
}
}
model.add(index, authority);
authorityList.setSelectedIndex(index);
authorityList.ensureIndexIsVisible(index);
@ -318,7 +325,7 @@ public class AuthorityListControlPane extends BasicPane {
if (p[i] != null) {
try {
p[i].checkValid();
} catch (Exception e) {
} catch (Exception ignore) {
return i;
}
}
@ -333,6 +340,7 @@ public class AuthorityListControlPane extends BasicPane {
try {
checkValid();
} catch (Exception exp) {
FineLoggerFactory.getLogger().error(exp.getMessage(), exp);
JOptionPane.showMessageDialog(AuthorityListControlPane.this, exp.getMessage());
authorityList.setSelectedIndex(idx);
return true;
@ -476,8 +484,8 @@ public class AuthorityListControlPane extends BasicPane {
@Override
public void doOk() {
// 获取添加的用户到权限编辑面板
List<RemoteMember> members = userManagerPane.update();
for (RemoteMember member : members) {
List<RemoteDesignMember> members = userManagerPane.update();
for (RemoteDesignMember member : members) {
DesignAuthority authority = new DesignAuthority();
authority.setUsername(member.getUsername());
authority.setUserId(member.getUserId());

3
designer-base/src/com/fr/design/remote/ui/AuthorityManagerPane.java

@ -6,7 +6,6 @@ import com.fr.report.DesignAuthority;
import javax.swing.BorderFactory;
import java.awt.BorderLayout;
import java.util.Arrays;
public class AuthorityManagerPane extends BasicPane {
@ -24,7 +23,7 @@ public class AuthorityManagerPane extends BasicPane {
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Remote_Design_Authority_Manager");
return Inter.getLocText("Fine-Designer_Remote_Design_Authority_Manager");
}
public void populate(DesignAuthority[] authorities) {

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

@ -1,5 +1,8 @@
package com.fr.design.remote.ui;
import com.fr.base.env.EnvContext;
import com.fr.base.env.proxy.EnvProxy;
import com.fr.base.env.resource.EnvConfigUtils;
import com.fr.design.border.UITitledBorder;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
@ -8,13 +11,13 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
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.env.RemoteDesignMember;
import com.fr.env.operator.decision.DecisionOperator;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import com.fr.third.guava.collect.ImmutableList;
@ -26,6 +29,7 @@ import javax.swing.ListSelectionModel;
import javax.swing.SwingWorker;
import javax.swing.border.EmptyBorder;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
@ -46,16 +50,16 @@ public class UserManagerPane extends BasicPane {
/**
* 获取的决策平台成员
*/
private List<RemoteMember> addingMembers = new ArrayList<>();
private List<RemoteDesignMember> addingMembers = new ArrayList<>();
/**
* 添加到设计的决策平台成员
*/
private List<RemoteMember> addedMembers = new ArrayList<>();
private List<RemoteDesignMember> addedMembers = new ArrayList<>();
/**
* 决策平台成员列表model
*/
private DefaultListModel<RemoteMember> addingListModel = new DefaultListModel<>();
private DefaultListModel<RemoteDesignMember> addingListModel = new DefaultListModel<>();
/**
* 搜索输入框
*/
@ -95,18 +99,25 @@ public class UserManagerPane extends BasicPane {
/**
* 添加到设计的决策成员计数标签
*/
private DefaultListModel<RemoteMember> addedListModel;
private DefaultListModel<RemoteDesignMember> addedListModel;
/**
* 左侧列表变动事件
*/
private MemberListSelectedChangeListener addingListChangeListener = new MemberListSelectedChangeListener() {
@Override
public void selectedChange() {
resetAddedMembers();
// 右侧列表发生变化后,将右侧列表中选中但是在左侧列表中没有的成员添加进来,同时移除取消选中的
sync2AddedMembersFromAdding();
// 刷新右侧列表显示
addToAddedMemberList();
}
};
/**
* 右侧列表变动事件
*/
private MemberListSelectedChangeListener addedListChangeListener = new MemberListSelectedChangeListener() {
@Override
public void selectedChange() {
@ -116,10 +127,12 @@ public class UserManagerPane extends BasicPane {
sync2AddedMembersFormAdded();
// 不需要重复更新右侧列表显示 但是更新一下计数显示
countLabel.setText(
Inter.getLocText("FR-Designer_Remote_Design_Selected_Member_Count",
Inter.getLocText("Fine-Designer_Remote_Design_Selected_Member_Count",
String.valueOf(addedMembers.size())
)
);
// 刷新左侧列表显示
addToMemberList();
}
};
@ -144,7 +157,7 @@ public class UserManagerPane extends BasicPane {
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Remote_Design_Add_Member");
return Inter.getLocText("Fine-Designer_Remote_Design_Add_Member");
}
private JPanel createLeftPanel() {
@ -154,7 +167,7 @@ public class UserManagerPane extends BasicPane {
BorderFactory.createCompoundBorder(
new EmptyBorder(6, 0, 0, 0),
UITitledBorder.createBorderWithTitle(
Inter.getLocText("FR-Designer_Remote_Design_Decision_Member")
Inter.getLocText("Fine-Designer_Remote_Design_Decision_Member")
)
)
);
@ -162,10 +175,10 @@ public class UserManagerPane extends BasicPane {
// 搜索
JPanel searchPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
searchPanel.setBorder(BorderFactory.createEmptyBorder());
keyField.setPreferredSize(new Dimension(200, 20));
keyField.setPreferredSize(new Dimension(250, 20));
keyField.requestFocus();
keyField.addKeyListener(keyFieldKeyListener);
keyButton.setText(Inter.getLocText("FR-Designer_Remote_Design_Search"));
keyButton.setText(Inter.getLocText("Fine-Designer_Remote_Design_Search"));
keyButton.addActionListener(keyButtonActionListener);
searchPanel.add(keyField);
searchPanel.add(keyButton);
@ -194,16 +207,18 @@ public class UserManagerPane extends BasicPane {
BorderFactory.createCompoundBorder(
new EmptyBorder(6, 0, 0, 0),
UITitledBorder.createBorderWithTitle(
Inter.getLocText("FR-Designer_Remote_Design_Selected_Member")
Inter.getLocText("Fine-Designer_Remote_Design_Selected_Member")
)
)
);
// 计数
countLabel.setText(
Inter.getLocText("FR-Designer_Remote_Design_Selected_Member_Count",
Inter.getLocText("Fine-Designer_Remote_Design_Selected_Member_Count",
String.valueOf(addedMembers.size()))
);
countLabel.setBorder(BorderFactory.createEmptyBorder(7, 12, 8, 0));
countLabel.setForeground(new Color(0x8F8F92));
addedListModel = new DefaultListModel<>();
addedList = new AddedMemberList(addedListModel);
@ -224,7 +239,13 @@ public class UserManagerPane extends BasicPane {
private void addToMemberList() {
addingListModel.clear();
for (RemoteMember member : addingMembers) {
for (RemoteDesignMember member : addingMembers) {
// 如果包含在右侧列表中,那么左侧列表默认选中
if (addedMembers.contains(member)) {
member.setSelected(true);
} else {
member.setSelected(false);
}
addingListModel.addElement(member);
}
addingList.revalidate();
@ -233,20 +254,20 @@ public class UserManagerPane extends BasicPane {
private void addToAddedMemberList() {
addedListModel.clear();
for (RemoteMember member : addedMembers) {
for (RemoteDesignMember member : addedMembers) {
addedListModel.addElement(member);
}
addedList.revalidate();
addedList.repaint();
countLabel.setText(
Inter.getLocText("FR-Designer_Remote_Design_Selected_Member_Count",
Inter.getLocText("Fine-Designer_Remote_Design_Selected_Member_Count",
String.valueOf(addedMembers.size())
));
}
private void resetMembers() {
addingMembers.clear();
addingMembers.add(RemoteMember.DEFAULT_MEMBER);
addingMembers.add(RemoteDesignMember.DEFAULT_MEMBER);
}
private void resetAddedMembers() {
@ -256,11 +277,12 @@ public class UserManagerPane extends BasicPane {
private void searchAddingMembers(final String keyword) {
final SwingWorker getMemberWorker = new SwingWorker<List<RemoteMember>, Void>() {
final SwingWorker getMemberWorker = new SwingWorker<List<RemoteDesignMember>, Void>() {
@Override
protected List<RemoteMember> doInBackground() {
protected List<RemoteDesignMember> doInBackground() {
addingMembers.clear();
addingMembers.addAll(Utils.getRemoteMember(keyword));
String username = EnvConfigUtils.getUsername(EnvContext.currentEnv());
addingMembers.addAll(EnvProxy.get(DecisionOperator.class).getMembers(username, keyword));
return addingMembers;
}
@ -274,25 +296,29 @@ public class UserManagerPane extends BasicPane {
private void sync2AddedMembersFromAdding() {
RemoteMember[] members = new RemoteMember[addingListModel.getSize()];
RemoteDesignMember[] members = new RemoteDesignMember[addingListModel.getSize()];
// shallow copy
addingListModel.copyInto(members);
for (RemoteMember member : members) {
if (member.isSelected()) {
for (RemoteDesignMember member : members) {
if (!member.isSelected()) {
addedMembers.remove(member);
}
if (member.isSelected() && !addedMembers.contains(member)) {
addedMembers.add(member);
}
}
}
private void sync2AddedMembersFormAdded() {
RemoteMember[] members = new RemoteMember[addedListModel.getSize()];
RemoteDesignMember[] members = new RemoteDesignMember[addedListModel.getSize()];
// shallow copy
addedListModel.copyInto(members);
addedMembers.addAll(Arrays.asList(members));
}
public ImmutableList<RemoteMember> update() {
public ImmutableList<RemoteDesignMember> update() {
return ImmutableList.copyOf(addedMembers);
}
}

25
designer-base/src/com/fr/design/remote/ui/list/AddedMemberList.java

@ -1,8 +1,9 @@
package com.fr.design.remote.ui.list;
import com.fr.design.remote.RemoteMember;
import com.fr.env.RemoteDesignMember;
import javax.swing.*;
import javax.swing.DefaultListModel;
import java.awt.Point;
import java.awt.event.MouseEvent;
import java.util.Vector;
@ -12,30 +13,38 @@ public class AddedMemberList extends MemberList {
super();
}
public AddedMemberList(DefaultListModel<RemoteMember> dataModel) {
public AddedMemberList(DefaultListModel<RemoteDesignMember> dataModel) {
super(dataModel);
}
public AddedMemberList(RemoteMember[] listData) {
public AddedMemberList(RemoteDesignMember[] listData) {
super(listData);
}
public AddedMemberList(Vector<? extends RemoteMember> listData) {
public AddedMemberList(Vector<? extends RemoteDesignMember> listData) {
super(listData);
}
@Override
protected boolean shouldDisplaySelected(MouseEvent e) {
return true;
Point point = e.getPoint();
int rX = point.x;
int rY = point.y;
int index = this.getSelectedIndex();
int x = 280;
int y = 25 * index;
int width = 20;
int height = 25;
return x <= rX && rX <= x + width && y <= rY && rY <= y + height;
}
@Override
protected void displaySelected() {
RemoteMember member = getSelectedValue();
RemoteDesignMember member = getSelectedValue();
if (member != null) {
member.setSelected(!member.isSelected());
((DefaultListModel<RemoteMember>) getModel()).removeElement(member);
((DefaultListModel<RemoteDesignMember>) getModel()).removeElement(member);
}
revalidate();
repaint();

21
designer-base/src/com/fr/design/remote/ui/list/AddedMemberListCellRender.java

@ -1,45 +1,44 @@
package com.fr.design.remote.ui.list;
import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.remote.RemoteMember;
import com.fr.design.remote.button.IconButton;
import com.fr.env.RemoteDesignMember;
import javax.swing.BorderFactory;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
public class AddedMemberListCellRender extends JPanel implements ListCellRenderer<RemoteMember> {
public class AddedMemberListCellRender extends JPanel implements ListCellRenderer<RemoteDesignMember> {
private UILabel label;
private UIButton uiButton;
public AddedMemberListCellRender() {
this.setBorder(BorderFactory.createEmptyBorder());
this.setLayout(new FlowLayout(FlowLayout.LEFT));
label = new UILabel();
label.setIcon(BaseUtils.readIcon("com/fr/design/remote/images/icon_Member_normal@1x.png"));
uiButton = new UIButton();
uiButton.setIcon(BaseUtils.readIcon("com/fr/design/remote/images/icon_Remove_x.png"));
label.setPreferredSize(new Dimension(270, 20));
this.setPreferredSize(new Dimension(this.getPreferredSize().width, 25));
this.add(label);
this.add(uiButton);
this.add(new IconButton());
}
@Override
public Component getListCellRendererComponent(JList<? extends RemoteMember> list, RemoteMember member, int index, boolean isSelected, boolean cellHasFocus) {
this.setLabelText(member.getUsername());
public Component getListCellRendererComponent(JList<? extends RemoteDesignMember> list, RemoteDesignMember member, int index, boolean isSelected, boolean cellHasFocus) {
this.setLabelText(member.getRealName() + "(" + member.getUsername() + ")");
return this;
}
private void setLabelText(String name) {
label.setText(name);
}
}

21
designer-base/src/com/fr/design/remote/ui/list/AddingMemberList.java

@ -1,8 +1,9 @@
package com.fr.design.remote.ui.list;
import com.fr.design.remote.RemoteMember;
import com.fr.env.RemoteDesignMember;
import javax.swing.DefaultListModel;
import java.awt.Point;
import java.awt.event.MouseEvent;
import java.util.Vector;
@ -13,23 +14,23 @@ public class AddingMemberList extends MemberList {
super();
}
public AddingMemberList(DefaultListModel<RemoteMember> dataModel) {
public AddingMemberList(DefaultListModel<RemoteDesignMember> dataModel) {
super(dataModel);
}
public AddingMemberList(RemoteMember[] listData) {
public AddingMemberList(RemoteDesignMember[] listData) {
super(listData);
}
public AddingMemberList(Vector<? extends RemoteMember> listData) {
public AddingMemberList(Vector<? extends RemoteDesignMember> listData) {
super(listData);
}
@Override
protected void displaySelected() {
RemoteMember member = getSelectedValue();
RemoteDesignMember member = getSelectedValue();
member.setSelected(!member.isSelected());
revalidate();
repaint();
@ -38,7 +39,15 @@ public class AddingMemberList extends MemberList {
@Override
protected boolean shouldDisplaySelected(MouseEvent e) {
return true;
Point point = e.getPoint();
int rX = point.x;
int rY = point.y;
int index = this.getSelectedIndex();
int x = 280;
int y = 25 * index;
int width = 25;
int height = 25;
return x <= rX && rX <= x + width && y <= rY && rY <= y + height;
}
}

11
designer-base/src/com/fr/design/remote/ui/list/AddingMemberListCellRender.java

@ -3,16 +3,17 @@ package com.fr.design.remote.ui.list;
import com.fr.base.BaseUtils;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.remote.RemoteMember;
import com.fr.env.RemoteDesignMember;
import javax.swing.BorderFactory;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
public class AddingMemberListCellRender extends JPanel implements ListCellRenderer<RemoteMember> {
public class AddingMemberListCellRender extends JPanel implements ListCellRenderer<RemoteDesignMember> {
private UILabel label;
private UICheckBox check;
@ -23,6 +24,8 @@ public class AddingMemberListCellRender extends JPanel implements ListCellRender
this.setLayout(new FlowLayout(FlowLayout.LEFT));
label = new UILabel();
label.setPreferredSize(new Dimension(270, 20));
this.setPreferredSize(new Dimension(this.getPreferredSize().width, 25));
label.setIcon(BaseUtils.readIcon("com/fr/design/remote/images/icon_Member_normal@1x.png"));
check = new UICheckBox();
@ -35,8 +38,8 @@ public class AddingMemberListCellRender extends JPanel implements ListCellRender
@Override
public Component getListCellRendererComponent(JList list, RemoteMember member, int index, boolean isSelected, boolean cellHasFocus) {
this.setLabelText(member.getUsername());
public Component getListCellRendererComponent(JList list, RemoteDesignMember member, int index, boolean isSelected, boolean cellHasFocus) {
this.setLabelText(member.getRealName() + "(" + member.getUsername() + ")");
check.setSelected(member.isSelected());
return this;
}

2
designer-base/src/com/fr/design/remote/ui/list/AuthorityListCellRenderer.java

@ -82,7 +82,7 @@ public class AuthorityListCellRenderer extends
setBorder(border);
this.setIcon(BaseUtils.readIcon("com/fr/design/remote/images/icon_Member_normal@1x.png"));
this.setText(authority.getUsername());
this.setText(authority.getRealName() + "(" + authority.getUsername() + ")");
return this;
}

11
designer-base/src/com/fr/design/remote/ui/list/MemberList.java

@ -1,6 +1,7 @@
package com.fr.design.remote.ui.list;
import com.fr.design.remote.RemoteMember;
import com.fr.env.RemoteDesignMember;
import javax.swing.DefaultListModel;
import javax.swing.JList;
@ -12,19 +13,19 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Vector;
public abstract class MemberList extends JList<RemoteMember> {
public abstract class MemberList extends JList<RemoteDesignMember> {
public MemberList(DefaultListModel<RemoteMember> dataModel) {
public MemberList(DefaultListModel<RemoteDesignMember> dataModel) {
super(dataModel);
init();
}
public MemberList(RemoteMember[] listData) {
public MemberList(RemoteDesignMember[] listData) {
super(listData);
init();
}
public MemberList(Vector<? extends RemoteMember> listData) {
public MemberList(Vector<? extends RemoteDesignMember> listData) {
super(listData);
init();
}

4
designer-base/src/com/fr/env/EnvListPane.java vendored

@ -1,8 +1,8 @@
package com.fr.env;
import com.fr.base.env.resource.LocalEnvConfig;
import com.fr.base.env.resource.RemoteEnvConfig;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.resource.LocalEnvConfig;
import com.fr.core.env.resource.RemoteEnvConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;

3
designer-base/src/com/fr/env/LocalEnvPane.java vendored

@ -1,7 +1,6 @@
package com.fr.env;
import com.fr.base.env.resource.LocalEnvConfig;
import com.fr.dav.LocalEnv;
import com.fr.core.env.resource.LocalEnvConfig;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea;

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

@ -1,15 +1,15 @@
package com.fr.env;
import com.fr.base.env.old.AbstractEnv;
import com.fr.base.EnvException;
import com.fr.base.TableData;
import com.fr.base.env.EnvContext;
import com.fr.base.env.resource.RemoteEnvConfig;
import com.fr.base.remote.RemoteDeziConstants;
import com.fr.core.env.EnvConstants;
import com.fr.core.env.EnvContext;
import com.fr.core.env.resource.RemoteEnvConfig;
import com.fr.data.TableDataSource;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.dav.AbstractEnv;
import com.fr.dav.DavXMLUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.DesignerContext;

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

@ -1,8 +1,8 @@
package com.fr.env;
import com.fr.base.FRContext;
import com.fr.base.env.resource.EnvConfigUtils;
import com.fr.base.env.resource.RemoteEnvConfig;
import com.fr.core.env.resource.EnvConfigUtils;
import com.fr.core.env.resource.RemoteEnvConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder;

6
designer-base/src/com/fr/env/SignIn.java vendored

@ -2,11 +2,11 @@ package com.fr.env;
import com.fr.base.FRContext;
import com.fr.base.env.EnvContext;
import com.fr.base.env.resource.EnvConfigUtils;
import com.fr.base.env.resource.RemoteEnvConfig;
import com.fr.core.env.EnvConfig;
import com.fr.core.env.EnvContext;
import com.fr.core.env.EnvEvent;
import com.fr.core.env.resource.EnvConfigUtils;
import com.fr.core.env.resource.RemoteEnvConfig;
import com.fr.dav.LocalEnv;
import com.fr.design.utils.DesignUtils;
import com.fr.event.Event;

Loading…
Cancel
Save