hzzz 6 years ago
parent
commit
fff4fa85fd
  1. 99
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 31
      designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java
  3. 43
      designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java
  4. 4
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  5. 16
      designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java
  6. 10
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java
  7. 2
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  8. 20
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  9. 4
      designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java
  10. 142
      designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java
  11. 13
      designer-base/src/main/java/com/fr/design/remote/action/RemoteDesignAuthorityManagerAction.java
  12. 1
      designer-base/src/main/java/com/fr/design/remote/ui/AuthorityListControlPane.java
  13. 5
      designer-base/src/main/java/com/fr/design/remote/ui/UserManagerPane.java
  14. 1
      designer-base/src/main/java/com/fr/design/remote/ui/list/AddedMemberList.java
  15. 8
      designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java
  16. 35
      designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java
  17. 4
      designer-base/src/main/java/com/fr/file/FILEFactory.java
  18. 13
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/DesignerSocketIO.java

99
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -52,6 +52,7 @@ import java.io.StringReader;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -75,7 +76,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private Rectangle windowBounds = null; // window bounds.
private String DialogCurrentDirectory = null;
private String CurrentDirectoryPrefix = null;
private List<String> recentOpenedFilePathList = new ArrayList<String>();
private Map<String, List<String>> recentOpenedFileListMap = new HashMap<>();
private List<String> tempRecentOpenedFilePathList = new ArrayList<String>();
private boolean showPaintToolBar = true;
private int maxNumberOrPreviewRow = 200;
// name和Env的键值对
@ -193,7 +195,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
return designerEnvManager;
}
public ColorSelectConfigManager getColorConfigManager(){
public ColorSelectConfigManager getColorConfigManager() {
return this.configManager;
}
@ -201,7 +203,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (designerEnvManager == null || designerEnvManager.nameEnvMap.size() > 0) {
return;
}
String installHome = StableUtils.getInstallHome();
String installHome = StableUtils.getInstallHome();
if (installHome != null && !".".equals(installHome)) {
String name = Inter.getLocText("FR-Engine_DEFAULT");
String envPath = designerEnvManager.getDefaultenvPath(installHome);
@ -339,7 +341,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
// 清空前一个版本中的工作目录和最近打开
nameEnvMap = new ListMap<String, DesignerWorkspaceInfo>();
recentOpenedFilePathList = new ArrayList<String>();
curEnvName = null;
designerEnvManager.saveXMLFile();
}
@ -533,10 +534,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
private String getDefaultenvPath(String installHome){
private String getDefaultenvPath(String installHome) {
//这里需要转成反斜杠和生成默认路径一致
return new File(StableUtils.pathJoin(installHome, WEB_NAME, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME)).getPath();
return new File(StableUtils.pathJoin(installHome, WEB_NAME, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME)).getPath();
}
/**
* 设置当前环境为默认
*/
@ -825,7 +827,17 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* 返回最近打开的文件路径列表
*/
public List<String> getRecentOpenedFilePathList() {
return this.recentOpenedFilePathList;
if (StringUtils.isEmpty(getCurEnvName())) {
return tempRecentOpenedFilePathList;
} else {
if (!recentOpenedFileListMap.containsKey(getCurEnvName())) {
recentOpenedFileListMap.put(getCurEnvName(), tempRecentOpenedFilePathList);
}
}
return recentOpenedFileListMap.get(getCurEnvName());
}
/**
@ -835,11 +847,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
*/
public void addRecentOpenedFilePath(String filePath) {
// 先删除.
if (this.recentOpenedFilePathList.contains(filePath)) {
this.recentOpenedFilePathList.remove(filePath);
if (getRecentOpenedFilePathList().contains(filePath)) {
getRecentOpenedFilePathList().remove(filePath);
}
this.recentOpenedFilePathList.add(0, filePath);
getRecentOpenedFilePathList().add(0, filePath);
checkRecentOpenedFileNum();
}
@ -850,19 +862,21 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* @param newPath 新的路径
*/
public void replaceRecentOpenedFilePath(String oldPath, String newPath) {
if (this.recentOpenedFilePathList.contains(oldPath)) {
int index = recentOpenedFilePathList.indexOf(oldPath);
this.recentOpenedFilePathList.remove(oldPath);
this.recentOpenedFilePathList.add(index, newPath);
List<String> list = getRecentOpenedFilePathList();
if (list.contains(oldPath)) {
int index = getRecentOpenedFilePathList().indexOf(oldPath);
list.remove(oldPath);
list.add(index, newPath);
}
}
private void checkRecentOpenedFileNum() {
if (this.recentOpenedFilePathList == null) {
List<String> list = getRecentOpenedFilePathList();
if (list == null) {
return;
}
while (this.recentOpenedFilePathList.size() > MAX_SHOW_NUM) {
this.recentOpenedFilePathList.remove(this.recentOpenedFilePathList.size() - 1);
while (list.size() > MAX_SHOW_NUM) {
list.remove(list.size() - 1);
}
}
@ -872,8 +886,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* @param filePath 文件路径
*/
public void removeRecentOpenedFilePath(String filePath) {
if (this.recentOpenedFilePathList.contains(filePath)) {
this.recentOpenedFilePathList.remove(filePath);
if (getRecentOpenedFilePathList().contains(filePath)) {
getRecentOpenedFilePathList().remove(filePath);
}
}
@ -1311,7 +1325,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
}
private void readRecentColor(XMLableReader reader){
private void readRecentColor(XMLableReader reader) {
reader.readXMLObject(this.configManager);
}
@ -1332,7 +1346,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.readAttributes(reader);
} else if (name.equals("ReportPaneAttributions")) {
this.readReportPaneAttributions(reader);
} else if ("RecentOpenedFilePathList".equals(name) || "ResentOpenedFilePathList".equals(name)) {
} else if ("RecentOpenedFilePath".equals(name)) {
this.readRecentOpenFileList(reader);
} else if ("EnvConfigMap".equals(name)) {
this.readEnvConfigMap(reader);
@ -1368,8 +1382,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readAlphaFineAttr(reader);
} else if (name.equals("RecentColors")) {
readRecentColor(reader);
}
else {
} else {
readLayout(reader, name);
}
}
@ -1518,21 +1531,32 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private void readRecentOpenFileList(XMLableReader reader) {
reader.readXMLObject(new XMLReadable() {
@Override
public void readXML(XMLableReader reader) {
if (reader.isAttr()) {
DesignerEnvManager.this.recentOpenedFilePathList.clear();
DesignerEnvManager.this.recentOpenedFileListMap.clear();
}
if (reader.isChildNode()) {
String tmpVal;
String name = reader.getTagName();
// alex:以前一直是写ResentOpenedFilePath
if ("ResentOpenedFilePath".equals(name) || "Path".equals(name)) { // description.
if ((tmpVal = reader.getElementValue()) != null) {
DesignerEnvManager.this.recentOpenedFilePathList.add(tmpVal);
}
if ("Env".equals(name)) {
final String envName = reader.getAttrAsString("name", StringUtils.EMPTY);
final List<String> recentOpenedFileList = new ArrayList<>();
reader.readXMLObject(new XMLReadable() {
@Override
public void readXML(XMLableReader reader) {
if (reader.isChildNode()) {
String n = reader.getTagName();
if ("Path".equals(n)) {
String path = reader.getElementValue();
if (StringUtils.isNotEmpty(path)) {
recentOpenedFileList.add(path);
}
}
}
}
});
DesignerEnvManager.this.recentOpenedFileListMap.put(envName, recentOpenedFileList);
}
}
}
@ -1623,10 +1647,15 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private void writeRecentOpenFileAndEnvList(XMLPrintWriter writer) {
checkRecentOpenedFileNum();
writer.startTAG("RecentOpenedFilePathList");
int resentOpenedFilePathCount = Math.min(12, this.recentOpenedFilePathList.size());
for (int i = 0; i < resentOpenedFilePathCount; i++) {
writer.startTAG("Path").textNode(recentOpenedFilePathList.get(i)).end();
writer.startTAG("RecentOpenedFilePath");
for (Entry<String, List<String>> entry : recentOpenedFileListMap.entrySet()) {
writer.startTAG("Env").attr("name", entry.getKey());
List<String> paths = entry.getValue();
int count = Math.min(12, paths.size());
for (int i = 0; i < count; i++) {
writer.startTAG("Path").textNode(paths.get(i)).end();
}
writer.end();
}
writer.end();

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

@ -22,7 +22,7 @@ import com.fr.workspace.WorkContextCallback;
import com.fr.workspace.Workspace;
import com.fr.workspace.connect.AuthException;
import javax.swing.JOptionPane;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.util.HashMap;
import java.util.Iterator;
@ -38,7 +38,7 @@ public class SwitchExistEnv extends MenuDef {
JTemplate<?, ?> t = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (t != null) {
GeneralContext.addEnvWillChangedListener(
t.getFullPathName(),
t.getPath(),
new EnvChangedListener() {
public void envChanged() {
SwitchExistEnv.this.clearShortCuts();
@ -107,21 +107,28 @@ public class SwitchExistEnv extends MenuDef {
Workspace workspace;
try {
workspace = DesignerWorkspaceGenerator.generate(selectedEnv);
if (workspace == null) {
JOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Inter.getLocText(new String[]{"FR-Designer_M-SwitchWorkspace", "Failed"}));
return;
}
WorkContext.switchTo(workspace, new WorkContextCallback() {
@Override
public void done() {
DesignerEnvManager.getEnvManager().setCurEnvName(envName);
DesignUtils.refreshDesignerFrame();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea();
fireDSChanged();
}
});
} catch (AuthException exception) {
JOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Inter.getLocText(new String[]{"Fine-Designer_Basic_Remote_Connect_Auth_Failed"}));
return;
}
WorkContext.switchTo(workspace, new WorkContextCallback() {
@Override
public void done() {
DesignerEnvManager.getEnvManager().setCurEnvName(envName);
DesignUtils.refreshDesignerFrame();
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea();
fireDSChanged();
}
});
}
}
}

43
designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java

@ -33,7 +33,8 @@ public class AboutPane extends JPanel {
private static final int DEFAULT_GAP = 12;
private static final String COPYRIGHT_LABEL = "\u00A9 ";
private static final String BUILD_PREFIX = " ";
private static final String COMPANY_TELEPHONE = CloudCenter.getInstance().acquireUrlByKind("company_telephone");
private static final String COMPANY_TELEPHONE = CloudCenter.getInstance().acquireUrlByKind("help.compNo");
private static final String PRESIDENT_PHONE = CloudCenter.getInstance().acquireUrlByKind("help.PNo");
public AboutPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -79,6 +80,9 @@ public class AboutPane extends JPanel {
contentPane.add(urlActionPane);
contentPane.add(emailPane);
contentPane.add(getRemarkPane());
if (shouldShowThanks()) {
addThankPane(contentPane);
}
@ -111,6 +115,43 @@ public class AboutPane extends JPanel {
return true;
}
private JPanel getRemarkPane(){
String remark = Inter.getLocText("Fine-Designer_About_Remark_Info",PRESIDENT_PHONE);
UILabel label = new UILabel();
label.setSize(new Dimension(580,30));
//用THML标签进行拼接,以实现自动换行
StringBuilder builder = new StringBuilder("<html>");
char[] chars = remark.toCharArray();
//获取字体计算大小
FontMetrics fontMetrics = label.getFontMetrics(label.getFont());
int start = 0;
int len = 0;
while (start + len < remark.length()) {
while (true) {
len++;
if (start + len > remark.length())
break;
if (fontMetrics.charsWidth(chars, start, len)
> label.getWidth()) {
break;
}
}
builder.append(chars, start, len-1).append("<br/>");
start = start + len - 1;
len = 0;
}
//拼接剩余部分
builder.append(chars, start, remark.length()-start);
builder.append("</html>");
JPanel jPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
label.setText(builder.toString());
jPanel.add(label);
return jPanel;
}
//添加鸣谢面板
private void addThankPane(JPanel contentPane) {
BBSGuestPaneProvider pane = StableFactory.getMarkedInstanceObjectFromClass(BBSGuestPaneProvider.XML_TAG, BBSGuestPaneProvider.class);

4
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -105,7 +105,7 @@ public abstract class DesignTableDataManager {
public static void closeTemplate(JTemplate<?, ?> template) {
if (template != null) {
dsListenersMap.remove(template.getFullPathName());
dsListenersMap.remove(template.getPath());
}
}
@ -164,7 +164,7 @@ public abstract class DesignTableDataManager {
JTemplate<?, ?> template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
String key = StringUtils.EMPTY;
if (template != null) {
key = template.getFullPathName();
key = template.getPath();
}
List<ChangeListener> dsListeners = dsListenersMap.get(key);
if (dsListeners == null) {

16
designer-base/src/main/java/com/fr/design/env/RemoteWorkspace.java vendored

@ -1,6 +1,7 @@
package com.fr.design.env;
import com.fr.locale.InterProviderFactory;
import com.fr.stable.AssistUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace;
import com.fr.workspace.connect.WorkspaceClient;
@ -17,10 +18,13 @@ public class RemoteWorkspace implements Workspace {
private final String address;
private final WorkspaceConnection connection;
RemoteWorkspace(WorkspaceClient client, WorkspaceConnection connection) {
this.client = client;
this.address = connection.getUrl();
this.connection = connection;
}
@Override
@ -61,4 +65,16 @@ public class RemoteWorkspace implements Workspace {
return client.getPool().get(type);
}
@Override
public int hashCode() {
return connection.hashCode();
}
@Override
public boolean equals(Object obj) {
return obj != null && obj instanceof RemoteWorkspace && AssistUtils.equals(((RemoteWorkspace) obj).connection, this.connection);
}
}

10
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java

@ -114,7 +114,7 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
public void closeSelectedReport(JTemplate<?, ?> selected) {
DesignModuleFactory.clearChartPropertyPane();
DesignTableDataManager.closeTemplate(selected);
GeneralContext.removeEnvWillChangedListener(selected.getFullPathName());
GeneralContext.removeEnvWillChangedListener(selected.getPath());
if (contains(selected) == -1) {
return;
}
@ -139,7 +139,7 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
public void closeVirtualSelectedReport(JTemplate<?, ?> selected) {
DesignModuleFactory.clearChartPropertyPane();
DesignTableDataManager.closeTemplate(selected);
GeneralContext.removeEnvWillChangedListener(selected.getFullPathName());
GeneralContext.removeEnvWillChangedListener(selected.getPath());
if (contains(selected) == -1) {
return;
}
@ -185,7 +185,7 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
if (editingTemplate == null) {
return;
}
DesignerEnvManager.getEnvManager().addRecentOpenedFilePath(editingTemplate.getFullPathName());
DesignerEnvManager.getEnvManager().addRecentOpenedFilePath(editingTemplate.getPath());
((HistoryListDataMode) list.getModel()).add(editingTemplate);
}
@ -246,7 +246,7 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
*/
public int contains(String filename) {
for (int i = 0; i < historyList.size(); i++) {
String historyPath = historyList.get(i).getFullPathName();
String historyPath = historyList.get(i).getPath();
if (ComparatorUtils.equals(historyPath, filename)) {
return i;
}
@ -261,7 +261,7 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
* @return 是则返回TRUE
*/
public boolean isCurrentEditingFile(String filename) {
String editingFileName = editingTemplate.getFullPathName();
String editingFileName = editingTemplate.getPath();
return ComparatorUtils.equals(filename, editingFileName);
}

2
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -218,7 +218,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
MutilTempalteTabPane.getInstance().setSelectedIndex(index - 1);
}
JTemplate selectedfile = MutilTempalteTabPane.getInstance().getSelectedFile();
if (!HistoryTemplateListPane.getInstance().isCurrentEditingFile(selectedfile.getFullPathName())) {
if (!HistoryTemplateListPane.getInstance().isCurrentEditingFile(selectedfile.getPath())) {
//如果此时面板上的实时刷新的selectedIndex得到的和历史的不一样
DesignerContext.getDesignerFrame().activateJTemplate(selectedfile);
}

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

@ -40,7 +40,6 @@ import com.fr.design.write.submit.DBManipulationInWidgetEventPane;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.file.FILE;
import com.fr.file.FILEChooserPane;
import com.fr.file.FileNodeFILE;
import com.fr.file.MemFILE;
import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget;
@ -50,17 +49,14 @@ import com.fr.log.FineLoggerFactory;
import com.fr.report.cell.Elem;
import com.fr.report.cell.cellattr.CellImage;
import com.fr.stable.ArrayUtils;
import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.stable.core.UUID;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.undo.UndoManager;
import java.awt.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Set;
@ -202,16 +198,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return -1;
}
public String getFullPathName() {
String editingFileName = getEditingFILE().getPath();
if (editingFileName.startsWith(ProjectConstants.REPORTLETS_NAME)) {
editingFileName = ((FileNodeFILE) getEditingFILE()).getEnvPath() + File.separator + editingFileName;
}
if (OperatingSystem.isWindows()) {
return editingFileName.replaceAll("/", "\\\\");
} else {
return editingFileName.replaceAll("\\\\", "/");
}
public String getPath() {
return getEditingFILE().getPath();
}
protected abstract JComponent createCenterPane();
@ -579,7 +567,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* @return
*/
public boolean saveAsTemplate(boolean isShowLoc, String fileName) {
String oldName = this.getFullPathName();
String oldName = this.getPath();
// alex:如果是SaveAs的话需要让用户来选择路径了
FILEChooserPane fileChooser = getFILEChooserPane(isShowLoc);
fileChooser.setFileNameTextField(fileName, this.suffix());
@ -618,7 +606,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
collectInfo();
}
//更换最近打开
DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(oldName, this.getFullPathName());
DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(oldName, this.getPath());
return result;
}

4
designer-base/src/main/java/com/fr/design/mainframe/JVirtualTemplate.java

@ -37,7 +37,7 @@ public class JVirtualTemplate extends JTemplate {
}
@Override
public String getFullPathName() {
public String getPath() {
String editingFileName = getEditingFILE().getPath();
if (editingFileName.startsWith(ProjectConstants.REPORTLETS_NAME)) {
editingFileName = ((FileNodeFILE) getEditingFILE()).getEnvPath() + File.separator + editingFileName;
@ -258,7 +258,7 @@ public class JVirtualTemplate extends JTemplate {
@Override
public Icon getIcon() {
if (getFullPathName().endsWith("cpt")) {
if (getPath().endsWith("cpt")) {
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/newcpts.png");
} else {
return BaseUtils.readIcon("/com/fr/web/images/form/new_form3.png");

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

@ -19,6 +19,7 @@ import com.fr.general.Inter;
import com.fr.stable.EnvChangedListener;
import com.fr.workspace.WorkContext;
import com.fr.workspace.WorkContextCallback;
import com.fr.workspace.Workspace;
import javax.swing.*;
import java.awt.*;
@ -29,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);
@ -68,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);
}
};
@ -97,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();
}
});
@ -108,31 +109,38 @@ 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);
GeneralContext.fireEnvWillChangeListener();
try {
WorkContext.switchTo(DesignerWorkspaceGenerator.generate(selectedEnv), new WorkContextCallback() {
Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv);
if (workspace == null) {
JOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
Inter.getLocText(new String[]{"FR-Designer_M-SwitchWorkspace", "Failed"}));
return false;
}
WorkContext.switchTo(workspace, new WorkContextCallback() {
@Override
public void done() {
DesignerEnvManager.getEnvManager().setCurEnvName(selectedName);
@ -156,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()) {
@ -196,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;
@ -230,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);
}
/**
* 鼠标点击
*
@ -240,9 +248,9 @@ public class TemplatePane extends JPanel implements MouseListener {
*/
@Override
public void mouseClicked(MouseEvent e) {
}
/**
* 鼠标按下
*
@ -250,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);
@ -258,7 +266,7 @@ public class TemplatePane extends JPanel implements MouseListener {
DesignerEnvManager.getEnvManager().setTemplateTreePaneExpanded(isExpanded);
}
}
/**
* 鼠标放开
*
@ -266,9 +274,9 @@ public class TemplatePane extends JPanel implements MouseListener {
*/
@Override
public void mouseReleased(MouseEvent e) {
}
/**
* 鼠标进入
*
@ -276,9 +284,9 @@ public class TemplatePane extends JPanel implements MouseListener {
*/
@Override
public void mouseEntered(MouseEvent e) {
}
/**
* 鼠标离开
*
@ -286,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);
}
}
}

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

@ -6,6 +6,7 @@ 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.workspace.server.authority.AuthorityOperator;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.report.DesignAuthority;
@ -32,7 +33,7 @@ public class RemoteDesignAuthorityManagerAction extends UpdateAction {
final AuthorityManagerPane managerPane = new AuthorityManagerPane();
BasicDialog dialog = managerPane.showWindow(DesignerContext.getDesignerFrame());
if (!WorkContext.getCurrent().isLocal()) {
try {
// 远程设计获取全部设计成员的权限列表
@ -44,12 +45,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 +62,10 @@ public class RemoteDesignAuthorityManagerAction extends UpdateAction {
FineLoggerFactory.getLogger().info("update remote design authority: " + success);
}
}
@Override
public void doCancel() {
super.doCancel();
}
});

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

@ -18,6 +18,7 @@ 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;

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

@ -13,6 +13,11 @@ 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;
<<<<<<< HEAD
=======
import com.fr.workspace.server.authority.RemoteDesignMember;
import com.fr.workspace.server.authority.decision.DecisionOperator;
>>>>>>> 8346e043d684a530c688bfed0ed064c99655d1f6
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import com.fr.third.guava.collect.ImmutableList;

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

@ -1,6 +1,5 @@
package com.fr.design.remote.ui.list;
import com.fr.workspace.server.authority.RemoteDesignMember;
import javax.swing.DefaultListModel;

8
designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java

@ -259,6 +259,14 @@ public class NumberEditorValidatePane extends JPanel {
ob.setAllowNegative(allowNegativeCheckBox.isSelected());
if (setMinValueCheckBox.isSelected()) {
ob.setMinValue(minValueSpinner.getValue());
}
if (setMaxValueCheckBox.isSelected()) {
ob.setMaxValue(maxValueSpinner.getValue());
}
if(setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()){
errorMsgTextFieldPane.setVisible(true);
}else{

35
designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java

@ -310,7 +310,7 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
protected void setBorderAndLayout(JPanel jPanel){
jPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
jPanel.setBorder(BorderFactory.createTitledBorder(
new ModLineBorder(ModLineBorder.TOP), Inter.getLocText(new String[]{"Submit", "Condition"})));
new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("Fine-Designer_Submit_Condition")));
}
protected void addComponent(JPanel mainPane,JScrollPane addPane){
@ -368,12 +368,12 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
Object ob = e.getItem();
if ((ComparatorUtils.equals(ob,DML_CONFIG_TYPES[0])) || ComparatorUtils.equals(ob,DML_CONFIG_TYPES[3])) {
checkBoxUpdatePane.setVisible(true);
} else if ((ComparatorUtils.equals(ob,DML_CONFIG_TYPES[1])) || ComparatorUtils.equals(ob,DML_CONFIG_TYPES[2])){
checkBoxUpdatePane.setVisible(false);
}
Object ob = e.getItem();
if ((ComparatorUtils.equals(ob, DML_CONFIG_TYPES[0])) || ComparatorUtils.equals(ob, DML_CONFIG_TYPES[3])) {
checkBoxUpdatePane.setVisible(true);
} else if ((ComparatorUtils.equals(ob, DML_CONFIG_TYPES[1])) || ComparatorUtils.equals(ob, DML_CONFIG_TYPES[2])) {
checkBoxUpdatePane.setVisible(false);
}
}
}
});
@ -465,6 +465,11 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
// Richie:初始化
int returnValue = DEFAULT_RETURN_VALUE;
int coverNumber = 0;
if (!keyColumnNameValueList.isEmpty()) {
//如果存在先前项,设置状态为5
returnValue = 5 ;
}
for (int i = 0; i < selected.length; i++) {
if (returnValue == 0 || returnValue == 3) {
break;
@ -512,7 +517,7 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
for (int j = 0; j < keyColumnNameValueList.size(); j++) {
if (ComparatorUtils.equals(selected[i], keyColumnNameValueList.get(j).cn)) {
newKeyColumnNameValueList.remove(i);
newKeyColumnNameValueList.add(i, keyColumnNameValueList.get(j));
newKeyColumnNameValueList.add(i, keyColumnNameValueList.get(j));
}
}
@ -523,10 +528,15 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
}
} else if (returnValue == 1 || returnValue == 2) {
for (int i = 0; i < selected.length; i++) {
model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i));
}
}
for (int i = 0; i < selected.length; i++) {
model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i));
}
} else if (returnValue == 5){
//新选项和原来没有重复项的情况,产品确认:只做全量增加,原有的清除
for (int i = 0; i < selected.length; i++) {
model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i));
}
}
// Richie:初始化
if (keyColumnNameValueList.isEmpty()) {
@ -535,6 +545,7 @@ public class DBManipulationPane extends BasicBeanPane<DBManipulation> {
model.addKeyColumnNameValue(new KeyColumnNameValue(false, (ColumnName)selected[i], new ColumnValue(""), false));
}
}
model.fireTableDataChanged();
keyColumnValuesTable.validate();
}

4
designer-base/src/main/java/com/fr/file/FILEFactory.java

@ -35,7 +35,7 @@ public class FILEFactory {
} else if (path.startsWith(FILE_PREFIX)) {
return new FileFILE(new java.io.File(path.substring(FILE_PREFIX.length())));
} else {
return new FileFILE(new java.io.File(path));
return new FileNodeFILE(new FileNode(path, WorkContext.getWorkResource().isDirectory(path)));
}
}
@ -52,7 +52,7 @@ public class FILEFactory {
} else if (path.startsWith(FILE_PREFIX)) {
return new FileFILE(new java.io.File(path.substring(FILE_PREFIX.length())));
} else {
return new FileFILE(new java.io.File(path));
return new FileNodeFILE(new FileNode(path, WorkContext.getWorkResource().isDirectory(path)));
}
}
}

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

@ -1,8 +1,11 @@
package com.fr.design.mainframe.socketio;
import com.fr.config.RemoteConfigEvent;
import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.workspace.server.socket.SocketInfoOperator;
import com.fr.event.EventDispatcher;
import com.fr.general.Inter;
import com.fr.general.LogRecordTime;
import com.fr.general.LogUtils;
@ -58,6 +61,14 @@ public class DesignerSocketIO {
String uri = getSocketUri(current);
socketIO = Optional.of(IO.socket(new URI(uri)));
socketIO.get().on(WorkspaceConstants.WS_LOGRECORD, printLog);
socketIO.get().on(WorkspaceConstants.CONFIG_MODIFY, new Emitter.Listener() {
@Override
public void call(Object... objects) {
assert objects != null && objects.length == 1;
String param = (String) objects[0];
EventDispatcher.fire(RemoteConfigEvent.EDIT, param);
}
});
socketIO.get().on(Socket.EVENT_DISCONNECT, new Emitter.Listener() {
@Override
public void call(Object... objects) {
@ -82,4 +93,4 @@ public class DesignerSocketIO {
DecisionServiceConstants.WEB_SOCKET_TOKEN_NAME,
RemoteCallClient.getInstance().getToken());
}
}
}

Loading…
Cancel
Save