ju 7 years ago
parent
commit
63bc6e2fea
  1. 10
      designer-base/src/com/fr/design/actions/file/LocalePane.java
  2. 4
      designer-base/src/com/fr/design/data/datapane/ChoosePane.java
  3. 16
      designer-base/src/com/fr/design/data/tabledata/tabledatapane/ClassNameSelectPane.java
  4. 2
      designer-base/src/com/fr/design/data/tabledata/wrapper/StoreProcedureNameWrapper.java
  5. 4
      designer-base/src/com/fr/design/file/HistoryTemplateListPane.java
  6. 6
      designer-base/src/com/fr/design/file/TemplateTreePane.java
  7. 5
      designer-base/src/com/fr/design/formula/JavaEditorPane.java
  8. 7
      designer-base/src/com/fr/design/gui/itree/filetree/EnvFileTree.java
  9. 18
      designer-base/src/com/fr/design/gui/itree/filetree/FileNodeComparator.java
  10. 14
      designer-base/src/com/fr/design/gui/itree/filetree/FileTreeIcon.java
  11. 29
      designer-base/src/com/fr/design/gui/itree/filetree/ReportletPane.java
  12. 5
      designer-base/src/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  13. 2
      designer-base/src/com/fr/design/mainframe/DesignerFrame.java
  14. 4
      designer-base/src/com/fr/design/mainframe/JTemplate.java
  15. 10
      designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java
  16. 3
      designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  17. 7
      designer-base/src/com/fr/design/remote/ui/AuthorityEditorPane.java
  18. 2
      designer-base/src/com/fr/design/roleAuthority/RoleDataWrapper.java
  19. 8
      designer-base/src/com/fr/design/widget/IconDefinePane.java
  20. 8
      designer-base/src/com/fr/file/FILEChooserPane.java
  21. 2
      designer-base/src/com/fr/file/FileNodeFILE.java
  22. 6
      designer-chart/src/com/fr/van/chart/map/server/ChartMapEditorAction.java
  23. 2
      designer-form/src/com/fr/design/parameter/FormParameterReader.java
  24. 7
      designer-realize/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java
  25. 28
      designer-realize/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java
  26. 2
      designer-realize/src/com/fr/design/parameter/WorkBookParameterReader.java
  27. 10
      designer-realize/src/com/fr/start/Designer.java

10
designer-base/src/com/fr/design/actions/file/LocalePane.java

@ -4,13 +4,13 @@
package com.fr.design.actions.file; package com.fr.design.actions.file;
import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.Env;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -180,11 +180,8 @@ public class LocalePane extends BasicPane {
} }
private void initCustomProperties() throws Exception { private void initCustomProperties() throws Exception {
Env env = FRContext.getCurrentEnv();
if (env == null) { FileNode[] fileNodes = FRContext.getFileOperator().list(ProjectConstants.LOCALE_NAME);
return;
}
FileNode[] fileNodes = env.getFileOperator().list(ProjectConstants.LOCALE_NAME);
if (ArrayUtils.getLength(fileNodes) == 0) { if (ArrayUtils.getLength(fileNodes) == 0) {
return; return;
} }
@ -220,6 +217,7 @@ public class LocalePane extends BasicPane {
* *
*/ */
public void save() { public void save() {
Env env = FRContext.getCurrentEnv(); Env env = FRContext.getCurrentEnv();
if (env == null) { if (env == null) {
return; return;

4
designer-base/src/com/fr/design/data/datapane/ChoosePane.java

@ -10,7 +10,6 @@ import com.fr.data.core.db.dialect.DialectFactory;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.data.impl.DBTableData; import com.fr.data.impl.DBTableData;
import com.fr.data.operator.DataOperator; import com.fr.data.operator.DataOperator;
import com.fr.dav.LocalEnv;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
@ -37,6 +36,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
@ -463,7 +463,7 @@ public class ChoosePane extends BasicBeanPane<DataBaseItems> implements Refresha
// 显示Table数据. // 显示Table数据.
TableData tableData = null; TableData tableData = null;
if (FRContext.getCurrentEnv() instanceof LocalEnv) { if (WorkContext.getCurrent().isLocal()) {
tableData = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), tableData = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(),
DialectFactory.getDialectByName(paras.getDatabaseName()))); DialectFactory.getDialectByName(paras.getDatabaseName())));
} else { } else {

16
designer-base/src/com/fr/design/data/tabledata/tabledatapane/ClassNameSelectPane.java

@ -1,19 +1,15 @@
package com.fr.design.data.tabledata.tabledatapane; package com.fr.design.data.tabledata.tabledatapane;
import java.awt.BorderLayout; import com.fr.design.dialog.BasicPane;
import javax.swing.BorderFactory;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.tree.TreeSelectionModel;
import com.fr.base.FRContext;
import com.fr.design.gui.itree.filetree.ClassFileTree; import com.fr.design.gui.itree.filetree.ClassFileTree;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.tree.TreeSelectionModel;
import java.awt.*;
public class ClassNameSelectPane extends BasicPane { public class ClassNameSelectPane extends BasicPane {
private ClassFileTree classFileTree; private ClassFileTree classFileTree;
@ -27,7 +23,7 @@ public class ClassNameSelectPane extends BasicPane {
Inter.getLocText("Function-Choose_Function_Class") + ":")); Inter.getLocText("Function-Choose_Function_Class") + ":"));
classFileTree = new ClassFileTree(); classFileTree = new ClassFileTree();
classFileTree.refreshEnv(FRContext.getCurrentEnv()); classFileTree.refreshEnv();
classFileTree.getSelectionModel().setSelectionMode( classFileTree.getSelectionModel().setSelectionMode(
TreeSelectionModel.SINGLE_TREE_SELECTION); TreeSelectionModel.SINGLE_TREE_SELECTION);
this.add(new JScrollPane(classFileTree), BorderLayout.CENTER); this.add(new JScrollPane(classFileTree), BorderLayout.CENTER);

2
designer-base/src/com/fr/design/data/tabledata/wrapper/StoreProcedureNameWrapper.java

@ -1,7 +1,6 @@
package com.fr.design.data.tabledata.wrapper; package com.fr.design.data.tabledata.wrapper;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.data.impl.storeproc.ProcedureDataModel;
@ -94,7 +93,6 @@ public final class StoreProcedureNameWrapper implements TableDataWrapper {
return columnNameList; return columnNameList;
} }
columnNameList = new ArrayList<String>(); columnNameList = new ArrayList<String>();
Env env = FRContext.getCurrentEnv();
if (!WorkContext.getCurrent().isLocal()) { if (!WorkContext.getCurrent().isLocal()) {
try { try {
createStore(false); createStore(false);

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

@ -1,6 +1,5 @@
package com.fr.design.file; package com.fr.design.file;
import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.base.chart.chartdata.CallbackEvent;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
@ -366,8 +365,7 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C
*/ */
public void openContainerFolder() { public void openContainerFolder() {
FileNode fileNode = new FileNode(((JTemplate<?, ?>) list.getSelectedValue()).getEditingFILE().getPath(), false); FileNode fileNode = new FileNode(((JTemplate<?, ?>) list.getSelectedValue()).getEditingFILE().getPath(), false);
Env env = FRContext.getCurrentEnv(); if (WorkContext.getCurrent().isLocal()) {
if (env.isLocalEnv()) {
IOUtils.openWindowsFolder(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), fileNode.getEnvPath())); IOUtils.openWindowsFolder(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), fileNode.getEnvPath()));
} }
} }

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

@ -3,7 +3,6 @@
*/ */
package com.fr.design.file; package com.fr.design.file;
import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.io.FileAssistUtils; import com.fr.base.io.FileAssistUtils;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
@ -100,7 +99,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
*/ */
public void refreshDockingView() { public void refreshDockingView() {
reportletsTree.setFileNodeFilter(new IOFileNodeFilter(FRContext.getCurrentEnv().getSupportedTypes())); reportletsTree.setFileNodeFilter(new IOFileNodeFilter(FRContext.getCurrentEnv().getSupportedTypes()));
reportletsTree.refreshEnv(FRContext.getCurrentEnv()); reportletsTree.refreshEnv();
} }
/* /*
@ -141,8 +140,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
*/ */
public void openContainerFolder() { public void openContainerFolder() {
FileNode fn = TemplateTreePane.this.reportletsTree.getSelectedFileNode(); FileNode fn = TemplateTreePane.this.reportletsTree.getSelectedFileNode();
Env localEnv = FRContext.getCurrentEnv(); String filePath = StableUtils.pathJoin(WorkContext.getCurrent().getPath(), fn.getEnvPath());
String filePath = StableUtils.pathJoin(localEnv.getPath(), fn.getEnvPath());
filePath = filePath.substring(0, filePath.lastIndexOf(CoreConstants.SEPARATOR)); filePath = filePath.substring(0, filePath.lastIndexOf(CoreConstants.SEPARATOR));
try { try {
Desktop.getDesktop().open(new File(filePath)); Desktop.getDesktop().open(new File(filePath));

5
designer-base/src/com/fr/design/formula/JavaEditorPane.java

@ -1,6 +1,5 @@
package com.fr.design.formula; package com.fr.design.formula;
import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
@ -176,8 +175,8 @@ public class JavaEditorPane extends BasicPane {
@Override @Override
protected JavaCompileInfo doInBackground() throws Exception { protected JavaCompileInfo doInBackground() throws Exception {
Env env = FRContext.getCurrentEnv();
return env.getCommonOperator().compile(javaText.getText()); return FRContext.getCommonOperator().compile(javaText.getText());
} }
public void done() { public void done() {

7
designer-base/src/com/fr/design/gui/itree/filetree/EnvFileTree.java

@ -1,6 +1,5 @@
package com.fr.design.gui.itree.filetree; package com.fr.design.gui.itree.filetree;
import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -28,7 +27,6 @@ import java.util.Arrays;
public class EnvFileTree extends RefreshableJTree { public class EnvFileTree extends RefreshableJTree {
protected FileNodeFilter filter; protected FileNodeFilter filter;
protected Env env;
protected String treeRootPath = ""; protected String treeRootPath = "";
protected String[] subPathes; protected String[] subPathes;
@ -191,7 +189,7 @@ public class EnvFileTree extends RefreshableJTree {
FileNode[] res_fns = null; FileNode[] res_fns = null;
try { try {
res_fns = env == null ? new FileNode[0] : env.getFileOperator().list(filePath); res_fns = FRContext.getCurrentEnv() == null ? new FileNode[0] : FRContext.getFileOperator().list(filePath);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
} }
@ -239,8 +237,7 @@ public class EnvFileTree extends RefreshableJTree {
/* /*
* 改变Env后,根据构造函数时设置的RootPathes,重新加载 * 改变Env后,根据构造函数时设置的RootPathes,重新加载
*/ */
public void refreshEnv(Env env) { public void refreshEnv() {
this.env = env;
DefaultTreeModel m_model = (DefaultTreeModel) this.getModel(); DefaultTreeModel m_model = (DefaultTreeModel) this.getModel();
ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) m_model.getRoot(); ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) m_model.getRoot();

18
designer-base/src/com/fr/design/gui/itree/filetree/FileNodeComparator.java

@ -1,9 +1,9 @@
package com.fr.design.gui.itree.filetree; package com.fr.design.gui.itree.filetree;
import java.util.Comparator;
import com.fr.dav.LocalEnv;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.adaptor.WorkspaceAdaptor;
import java.util.Comparator;
/** /**
* FileTreeNode compare... * FileTreeNode compare...
@ -26,8 +26,6 @@ public class FileNodeComparator implements Comparator<FileNode> {
* v1 is equal to v2, or < 0 if v1 is less than v2. * v1 is equal to v2, or < 0 if v1 is less than v2.
* It must handle null values for the comparison values. * It must handle null values for the comparison values.
* *
* @param v1 comparison value.
* @param v2 comparison value.
* @return < 0, 0, or > 0 for v1<v2, v1==v2, or v1>v2. * @return < 0, 0, or > 0 for v1<v2, v1==v2, or v1>v2.
*/ */
public int compare(FileNode nameNode1, FileNode nameNode2) { public int compare(FileNode nameNode1, FileNode nameNode2) {
@ -60,14 +58,14 @@ public class FileNodeComparator implements Comparator<FileNode> {
*/ */
private int groupByFileType(FileNode nameNode1, FileNode nameNode2, private int groupByFileType(FileNode nameNode1, FileNode nameNode2,
int i) { int i) {
if(i< LocalEnv.FILE_TYPE.length){
if(nameNode1.isFileType(LocalEnv.FILE_TYPE[i])) if (i < WorkspaceAdaptor.FILE_TYPE.length) {
if(nameNode2.isFileType(LocalEnv.FILE_TYPE[i])) if (nameNode1.isFileType(WorkspaceAdaptor.FILE_TYPE[i]))
if (nameNode2.isFileType(WorkspaceAdaptor.FILE_TYPE[i]))
return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase()); return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase());
else else
return-1; return-1;
else else if (nameNode2.isFileType(WorkspaceAdaptor.FILE_TYPE[i]))
if(nameNode2.isFileType(LocalEnv.FILE_TYPE[i]))
return 1; return 1;
else{ else{
return groupByFileType(nameNode1, nameNode2, i+1); return groupByFileType(nameNode1, nameNode2, i+1);

14
designer-base/src/com/fr/design/gui/itree/filetree/FileTreeIcon.java

@ -1,17 +1,15 @@
package com.fr.design.gui.itree.filetree; package com.fr.design.gui.itree.filetree;
import java.io.File;
import javax.swing.Icon;
import javax.swing.UIManager;
import javax.swing.filechooser.FileSystemView;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.dav.LocalEnv;
import com.fr.design.icon.LockIcon; import com.fr.design.icon.LockIcon;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext;
import javax.swing.*;
import javax.swing.filechooser.FileSystemView;
import java.io.File;
public class FileTreeIcon { public class FileTreeIcon {
private FileTreeIcon() {} private FileTreeIcon() {}
@ -118,7 +116,7 @@ public class FileTreeIcon {
public static Icon getIcon(FileNode node, boolean isShowLock) { public static Icon getIcon(FileNode node, boolean isShowLock) {
String path = StableUtils.pathJoin(new String[]{FRContext.getCurrentEnv().getPath(), node.getEnvPath()}); String path = StableUtils.pathJoin(new String[]{FRContext.getCurrentEnv().getPath(), node.getEnvPath()});
if (FRContext.getCurrentEnv() instanceof LocalEnv) { if (WorkContext.getCurrent().isLocal()) {
File ff = new File(path); File ff = new File(path);
if (ff.exists()) { if (ff.exists()) {
if(node.isDirectory()){ if(node.isDirectory()){

29
designer-base/src/com/fr/design/gui/itree/filetree/ReportletPane.java

@ -1,23 +1,18 @@
package com.fr.design.gui.itree.filetree; package com.fr.design.gui.itree.filetree;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.filetree.IOFileNodeFilter; import com.fr.file.filetree.IOFileNodeFilter;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ReportletPane extends BasicPane { public class ReportletPane extends BasicPane {
private TemplateFileTree templateReportletTree; private TemplateFileTree templateReportletTree;
@ -61,7 +56,7 @@ public class ReportletPane extends BasicPane {
classReportletTree = new ClassFileTree(); classReportletTree = new ClassFileTree();
cardPane.add(c_panel = new JScrollPane(classReportletTree), "CLASS"); cardPane.add(c_panel = new JScrollPane(classReportletTree), "CLASS");
this.refreshEnv(FRContext.getCurrentEnv()); this.refreshEnv();
} }
/* /*
@ -92,11 +87,11 @@ public class ReportletPane extends BasicPane {
/** /**
* 刷新Env * 刷新Env
* @param env 环境
*/ */
public void refreshEnv(Env env) { public void refreshEnv() {
this.templateReportletTree.refreshEnv(env);
this.classReportletTree.refreshEnv(env); this.templateReportletTree.refreshEnv();
this.classReportletTree.refreshEnv();
} }
@Override @Override

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

@ -1,6 +1,5 @@
package com.fr.design.gui.itree.filetree; package com.fr.design.gui.itree.filetree;
import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
@ -102,7 +101,7 @@ public class TemplateFileTree extends EnvFileTree {
} }
public FileNode[] listFile(String path) throws Exception { public FileNode[] listFile(String path) throws Exception {
return FRContext.getCurrentEnv().getFileOperator().list( return FRContext.getFileOperator().list(
path, path,
new FileExtension[]{FileExtension.CPT, FileExtension.FRM, FileExtension.CPTX, FileExtension.FRMX}); new FileExtension[]{FileExtension.CPT, FileExtension.FRM, FileExtension.CPTX, FileExtension.FRMX});
} }
@ -110,7 +109,7 @@ public class TemplateFileTree extends EnvFileTree {
/* /*
* 改变Env后,根据构造函数时设置的RootPaths,重新加载 * 改变Env后,根据构造函数时设置的RootPaths,重新加载
*/ */
public void refreshEnv(Env env) { public void refreshEnv() {
DefaultTreeModel defaultTreeModel = (DefaultTreeModel) this.getModel(); DefaultTreeModel defaultTreeModel = (DefaultTreeModel) this.getModel();
ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) defaultTreeModel.getRoot(); ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) defaultTreeModel.getRoot();

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

@ -652,7 +652,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
String envName = DesignerEnvManager.getEnvManager().getCurEnvName(); String envName = DesignerEnvManager.getEnvManager().getCurEnvName();
DesignerWorkspaceInfo env = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName); DesignerWorkspaceInfo env = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName);
if (env != null) { if (env != null) {
// defaultTitleSB.append(env.getDescription(envName)); defaultTitleSB.append(WorkContext.getCurrent().getDescription());
if (editingTemplate != null) { if (editingTemplate != null) {
String path = editingTemplate.getEditingFILE().getPath(); String path = editingTemplate.getEditingFILE().getPath();
if (!editingTemplate.getEditingFILE().exists()) { if (!editingTemplate.getEditingFILE().exists()) {

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

@ -544,7 +544,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
boolean access = false; boolean access = false;
try { try {
access = FRContext.getCurrentEnv().getOrganizationOperator().canAccess(this.getEditingFILE().getPath()); access = FRContext.getOrganizationOperator().canAccess(this.getEditingFILE().getPath());
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
@ -594,7 +594,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
if (isOkOperation(chooseResult)) { if (isOkOperation(chooseResult)) {
boolean access = false; boolean access = false;
try { try {
access = FRContext.getCurrentEnv().getOrganizationOperator().canAccess(fileChooser.getSelectedFILE().getPath()); access = FRContext.getOrganizationOperator().canAccess(fileChooser.getSelectedFILE().getPath());
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }

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

@ -1,7 +1,5 @@
package com.fr.design.mainframe.loghandler.socketio; package com.fr.design.mainframe.loghandler.socketio;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.design.mainframe.loghandler.DesignerLogHandler; import com.fr.design.mainframe.loghandler.DesignerLogHandler;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
@ -10,15 +8,13 @@ import com.fr.general.LogRecordTime;
import com.fr.general.LogUtils; import com.fr.general.LogUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.third.guava.base.Optional; import com.fr.third.guava.base.Optional;
import com.fr.web.WebSocketConfig; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.WorkspaceEvent;
import io.socket.client.IO;
import io.socket.client.Socket; import io.socket.client.Socket;
import io.socket.emitter.Emitter; import io.socket.emitter.Emitter;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.net.URI;
public class DesignerSocketIO { public class DesignerSocketIO {
@ -61,8 +57,8 @@ public class DesignerSocketIO {
} }
private static void updateSocket() { private static void updateSocket() {
Env env = FRContext.getCurrentEnv();
if (env.isLocalEnv()) { if (WorkContext.getCurrent().isLocal()) {
return; return;
} }
try { try {

3
designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -434,7 +434,8 @@ public abstract class ToolBarMenuDock {
} }
private boolean shouldShowRemotePermission() { private boolean shouldShowRemotePermission() {
return FRContext.getCurrentEnv() != null && !FRContext.getCurrentEnv().isLocalEnv() && FRContext.getCurrentEnv().isRoot();
return WorkContext.getCurrent() != null && !WorkContext.getCurrent().isLocal() && FRContext.getCurrentEnv().isRoot();
} }
private boolean shouldShowPlugin() { private boolean shouldShowPlugin() {

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

@ -1,6 +1,5 @@
package com.fr.design.remote.ui; package com.fr.design.remote.ui;
import com.fr.base.FRContext;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder; import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
@ -13,10 +12,10 @@ import com.fr.general.Inter;
import com.fr.report.DesignAuthority; import com.fr.report.DesignAuthority;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import javax.swing.BorderFactory; import javax.swing.*;
import javax.swing.border.EmptyBorder; import javax.swing.border.EmptyBorder;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import java.awt.BorderLayout; import java.awt.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -40,7 +39,7 @@ public class AuthorityEditorPane extends BasicBeanPane<DesignAuthority> {
tree.setDigIn(true); tree.setDigIn(true);
tree.setFileNodeFilter(filter); tree.setFileNodeFilter(filter);
this.add(new UIScrollPane(tree), BorderLayout.CENTER); this.add(new UIScrollPane(tree), BorderLayout.CENTER);
tree.refreshEnv(FRContext.getCurrentEnv()); tree.refreshEnv();
} }

2
designer-base/src/com/fr/design/roleAuthority/RoleDataWrapper.java

@ -1 +1 @@
package com.fr.design.roleAuthority; import com.fr.base.FRContext; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.loader.ChildrenNodesLoader; import com.fr.general.Inter; import com.fr.log.FineLoggerFactory; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * 将权限细粒度的角色数据包装一下,区分报表平台管理角色和数据决策系统角色 * <p/> * Author : daisy * Date: 13-8-30 * Time: 下午3:42 */ public class RoleDataWrapper implements ChildrenNodesLoader { private List<String> rolelist = new ArrayList<String>(); private String roleTypename = null; public RoleDataWrapper(String roleName) { roleTypename = roleName; } /** * 在此计算并获得与管理类型相对应的 */ private void calculateRoleList() { try { Collections.addAll(rolelist, FRContext.getCurrentEnv().getOrganizationOperator().getRoleGroup()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } //加载所有的角色列表 public ExpandMutableTreeNode[] load() { calculateRoleList(); return this.load(this.rolelist); } //从workbook中读取的角色列表 public ExpandMutableTreeNode[] load(List<String> rolelist) { this.rolelist = rolelist; ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[rolelist.size()]; for (int i = 0; i < res.length; i++) { res[i] = new ExpandMutableTreeNode(rolelist.get(i)); } return res; } public String getRoleTypename(){ return roleTypename; } } package com.fr.design.roleAuthority; import com.fr.base.FRContext; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.loader.ChildrenNodesLoader; import com.fr.general.Inter; import com.fr.log.FineLoggerFactory; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * 将权限细粒度的角色数据包装一下,区分报表平台管理角色和数据决策系统角色 * <p/> * Author : daisy * Date: 13-8-30 * Time: 下午3:42 */ public class RoleDataWrapper implements ChildrenNodesLoader { private List<String> rolelist = new ArrayList<String>(); private String roleTypename = null; public RoleDataWrapper(String roleName) { roleTypename = roleName; } /** * 在此计算并获得与管理类型相对应的 */ private void calculateRoleList() { try { Collections.addAll(rolelist, FRContext.getOrganizationOperator().getRoleGroup()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } } //加载所有的角色列表 public ExpandMutableTreeNode[] load() { calculateRoleList(); return this.load(this.rolelist); } //从workbook中读取的角色列表 public ExpandMutableTreeNode[] load(List<String> rolelist) { this.rolelist = rolelist; ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[rolelist.size()]; for (int i = 0; i < res.length; i++) { res[i] = new ExpandMutableTreeNode(rolelist.get(i)); } return res; } public String getRoleTypename(){ return roleTypename; } }

8
designer-base/src/com/fr/design/widget/IconDefinePane.java

@ -1,15 +1,13 @@
package com.fr.design.widget; package com.fr.design.widget;
import com.fr.base.Env; import com.fr.design.dialog.BasicDialog;
import com.fr.base.FRContext; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.web.CustomIconPane; import com.fr.design.web.CustomIconPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.form.ui.WidgetInfoConfig; import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.Inter; import com.fr.general.Inter;

8
designer-base/src/com/fr/file/FILEChooserPane.java

@ -3,7 +3,6 @@ package com.fr.file;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.dav.LocalEnv;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
@ -26,6 +25,7 @@ import com.fr.file.filter.FILEFilter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.adaptor.WorkspaceAdaptor;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
@ -545,7 +545,7 @@ public class FILEChooserPane extends BasicPane {
return; return;
} }
if (editing == null || !editing.isChartBook()) { if (editing == null || !editing.isChartBook()) {
String[] fileSuffix_local = LocalEnv.FILE_TYPE; String[] fileSuffix_local = WorkspaceAdaptor.FILE_TYPE;
EnumSet<FileExtension> fileExtensions = EnumSet.of(FileExtension.CPT, FileExtension.CPTX, FileExtension.FRM, FileExtension.FRMX, FileExtension.CHT); EnumSet<FileExtension> fileExtensions = EnumSet.of(FileExtension.CPT, FileExtension.CPTX, FileExtension.FRM, FileExtension.FRMX, FileExtension.CHT);
if (type == JFileChooser.OPEN_DIALOG) { if (type == JFileChooser.OPEN_DIALOG) {
if (FRContext.getCurrentEnv().isSupportLocalFileOperate()) { //本地连接 if (FRContext.getCurrentEnv().isSupportLocalFileOperate()) { //本地连接
@ -686,7 +686,7 @@ public class FILEChooserPane extends BasicPane {
boolean access = false; boolean access = false;
try { try {
access = FRContext.getCurrentEnv().getOrganizationOperator().canAccess(selectedFile.getPath()); access = FRContext.getOrganizationOperator().canAccess(selectedFile.getPath());
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
@ -1404,7 +1404,7 @@ public class FILEChooserPane extends BasicPane {
boolean access = false; boolean access = false;
try { try {
access = FRContext.getCurrentEnv().getOrganizationOperator().canAccess(currentDirectory.getPath()); access = FRContext.getOrganizationOperator().canAccess(currentDirectory.getPath());
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }

2
designer-base/src/com/fr/file/FileNodeFILE.java

@ -181,7 +181,7 @@ public class FileNodeFILE implements FILE {
*/ */
private FileNode[] listFile(String rootFilePath) { private FileNode[] listFile(String rootFilePath) {
try { try {
return FRContext.getCurrentEnv().getFileOperator().list(rootFilePath); return FRContext.getFileOperator().list(rootFilePath);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }

6
designer-chart/src/com/fr/van/chart/map/server/ChartMapEditorAction.java

@ -1,7 +1,5 @@
package com.fr.van.chart.map.server; package com.fr.van.chart.map.server;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.ServerConfig; import com.fr.base.ServerConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -9,6 +7,7 @@ import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.start.ServerStarter; import com.fr.start.ServerStarter;
import com.fr.workspace.WorkContext;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -26,8 +25,7 @@ public class ChartMapEditorAction extends UpdateAction {
int port = DesignerEnvManager.getEnvManager().getEmbedServerPort(); int port = DesignerEnvManager.getEnvManager().getEmbedServerPort();
String web = GeneralContext.getCurrentAppNameOfEnv(); String web = GeneralContext.getCurrentAppNameOfEnv();
String serverlet = ServerConfig.getInstance().getReportServletName(); String serverlet = ServerConfig.getInstance().getReportServletName();
Env env = FRContext.getCurrentEnv(); ServerStarter.browserURLWithLocalEnv(WorkContext.getCurrent().isLocal() ? String.format("http://localhost:%d/%s/%s?op=map", port, web, serverlet) : WorkContext.getCurrent().getPath() + "?op=map");
ServerStarter.browserURLWithLocalEnv(env.isLocalEnv() ? String.format("http://localhost:%d/%s/%s?op=map", port, web, serverlet) : env.getPath() + "?op=map");
} }
} }

2
designer-form/src/com/fr/design/parameter/FormParameterReader.java

@ -17,7 +17,7 @@ public class FormParameterReader extends AbstractParameterReader {
public Parameter[] readParameterFromPath(String tplPath) { public Parameter[] readParameterFromPath(String tplPath) {
if (accept(tplPath, ".frm", ".form")) { if (accept(tplPath, ".frm", ".form")) {
try { try {
Form form = FormIO.readForm(FRContext.getCurrentEnv(), tplPath); Form form = FormIO.readForm(tplPath);
return form.getParameters(); return form.getParameters();
} catch (Exception e1) { } catch (Exception e1) {
FRContext.getLogger().error(e1.getMessage(), e1); FRContext.getLogger().error(e1.getMessage(), e1);

7
designer-realize/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java

@ -1,7 +1,6 @@
package com.fr.design.mainframe.alphafine.component; package com.fr.design.mainframe.alphafine.component;
import com.bulenkov.iconloader.IconLoader; import com.bulenkov.iconloader.IconLoader;
import com.fr.base.FRContext;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
@ -32,13 +31,13 @@ import com.fr.design.mainframe.alphafine.search.manager.impl.RecommendSearchMana
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.main.FormIO; import com.fr.form.main.FormIO;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.io.TemplateWorkBookIO; import com.fr.io.TemplateWorkBookIO;
import com.fr.io.exporter.ImageExporter; import com.fr.io.exporter.ImageExporter;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.stable.CodeUtils; import com.fr.stable.CodeUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -507,7 +506,7 @@ public class AlphaFineDialog extends UIDialog {
protected BufferedImage doInBackground() { protected BufferedImage doInBackground() {
Form form = null; Form form = null;
try { try {
form = FormIO.readForm(FRContext.getCurrentEnv(), fileName); form = FormIO.readForm(fileName);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }
@ -539,7 +538,7 @@ public class AlphaFineDialog extends UIDialog {
protected BufferedImage doInBackground() { protected BufferedImage doInBackground() {
WorkBook workBook = null; WorkBook workBook = null;
try { try {
workBook = (WorkBook) TemplateWorkBookIO.readTemplateWorkBook(FRContext.getCurrentEnv(), fileName); workBook = (WorkBook) TemplateWorkBookIO.readTemplateWorkBook(fileName);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage()); FineLoggerFactory.getLogger().error(e.getMessage());
} }

28
designer-realize/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java

@ -1,6 +1,5 @@
package com.fr.design.mainframe.alphafine.search.manager.impl; package com.fr.design.mainframe.alphafine.search.manager.impl;
import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineConstants;
@ -81,13 +80,12 @@ public class FileSearchManager implements AlphaFineSearchProvider {
lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer_Templates"))); lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer_Templates")));
return lessModelList; return lessModelList;
} }
Env env = FRContext.getCurrentEnv();
fileNodes = new ArrayList<>(); fileNodes = new ArrayList<>();
fileNodes = listTpl(env, ProjectConstants.REPORTLETS_NAME, true); fileNodes = listTpl(ProjectConstants.REPORTLETS_NAME, true);
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
isContainCpt = true; isContainCpt = true;
isContainFrm = true; isContainFrm = true;
doSearch(this.searchText, true, env); doSearch(this.searchText, true);
if (stopSearch) { if (stopSearch) {
lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.FILE)); lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.FILE));
lessModelList.addAll(filterModelList.subList(0, AlphaFineConstants.SHOW_SIZE)); lessModelList.addAll(filterModelList.subList(0, AlphaFineConstants.SHOW_SIZE));
@ -109,21 +107,20 @@ public class FileSearchManager implements AlphaFineSearchProvider {
} }
this.filterModelList = new SearchResult(); this.filterModelList = new SearchResult();
this.moreModelList = new SearchResult(); this.moreModelList = new SearchResult();
Env env = FRContext.getCurrentEnv();
AlphaFineHelper.checkCancel(); AlphaFineHelper.checkCancel();
isContainCpt = true; isContainCpt = true;
isContainFrm = true; isContainFrm = true;
doSearch(this.searchText, false, env); doSearch(this.searchText, false);
moreModelList.addAll(filterModelList.subList(AlphaFineConstants.SHOW_SIZE, filterModelList.size())); moreModelList.addAll(filterModelList.subList(AlphaFineConstants.SHOW_SIZE, filterModelList.size()));
return moreModelList; return moreModelList;
} }
private void doSearch(String searchText, boolean needMore, Env env) { private void doSearch(String searchText, boolean needMore) {
for (FileNode node : fileNodes) { for (FileNode node : fileNodes) {
boolean isAlreadyContain = false; boolean isAlreadyContain = false;
isAlreadyContain = searchFile(searchText, node, isAlreadyContain, needMore); isAlreadyContain = searchFile(searchText, node, isAlreadyContain, needMore);
if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent() && node.getLock() == null) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent() && node.getLock() == null) {
searchFileContent(env, searchText, node, isAlreadyContain, needMore); searchFileContent(searchText, node, isAlreadyContain, needMore);
} }
if (filterModelList.size() > AlphaFineConstants.SHOW_SIZE && stopSearch) { if (filterModelList.size() > AlphaFineConstants.SHOW_SIZE && stopSearch) {
return; return;
@ -150,7 +147,7 @@ public class FileSearchManager implements AlphaFineSearchProvider {
* @param node * @param node
* @param isAlreadyContain * @param isAlreadyContain
*/ */
private void searchFileContent(Env env, String searchText, FileNode node, boolean isAlreadyContain, boolean needMore) { private void searchFileContent(String searchText, FileNode node, boolean isAlreadyContain, boolean needMore) {
try { try {
InputStream inputStream = new ByteArrayInputStream(WorkContext.getWorkResource().readFully(StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, node.getEnvPath().substring(ProjectConstants.REPORTLETS_NAME.length() + 1)))); InputStream inputStream = new ByteArrayInputStream(WorkContext.getWorkResource().readFully(StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, node.getEnvPath().substring(ProjectConstants.REPORTLETS_NAME.length() + 1))));
InputStreamReader isr = new InputStreamReader(inputStream, "UTF-8"); InputStreamReader isr = new InputStreamReader(inputStream, "UTF-8");
@ -210,15 +207,14 @@ public class FileSearchManager implements AlphaFineSearchProvider {
/** /**
* 获取工作目录下所有符合要求的模板 * 获取工作目录下所有符合要求的模板
* *
* @param env
* @param rootFilePath * @param rootFilePath
* @param recurse * @param recurse
* @return * @return
*/ */
private List<FileNode> listTpl(Env env, String rootFilePath, boolean recurse) { private List<FileNode> listTpl(String rootFilePath, boolean recurse) {
List<FileNode> fileNodeList = new ArrayList<FileNode>(); List<FileNode> fileNodeList = new ArrayList<FileNode>();
try { try {
listAll(env, rootFilePath, fileNodeList, recurse); listAll(rootFilePath, fileNodeList, recurse);
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error("file search error: " + e.getMessage(), e); FRContext.getLogger().error("file search error: " + e.getMessage(), e);
} }
@ -228,19 +224,19 @@ public class FileSearchManager implements AlphaFineSearchProvider {
/** /**
* 获取当前工作目录下所有模板 * 获取当前工作目录下所有模板
* *
* @param env
* @param rootFilePath * @param rootFilePath
* @param nodeList * @param nodeList
* @param recurse * @param recurse
* @throws Exception * @throws Exception
*/ */
private void listAll(Env env, String rootFilePath, List<FileNode> nodeList, boolean recurse) throws Exception { private void listAll(String rootFilePath, List<FileNode> nodeList, boolean recurse) throws Exception {
FileNode[] fns = env.getFileOperator().list(rootFilePath);
FileNode[] fns = FRContext.getFileOperator().list(rootFilePath);
for (int i = 0; i < fns.length; i++) { for (int i = 0; i < fns.length; i++) {
FileNode fileNode = fns[i]; FileNode fileNode = fns[i];
if (fileNode.isDirectory()) { if (fileNode.isDirectory()) {
if (recurse) { if (recurse) {
listAll(env, rootFilePath + File.separator + fns[i].getName(), nodeList, true); listAll(rootFilePath + File.separator + fns[i].getName(), nodeList, true);
} else { } else {
nodeList.add(fns[i]); nodeList.add(fns[i]);
} }

2
designer-realize/src/com/fr/design/parameter/WorkBookParameterReader.java

@ -17,7 +17,7 @@ public class WorkBookParameterReader extends AbstractParameterReader {
public Parameter[] readParameterFromPath(String tplPath) { public Parameter[] readParameterFromPath(String tplPath) {
if (accept(tplPath, ".cpt")) { if (accept(tplPath, ".cpt")) {
try { try {
TemplateWorkBook template = TemplateWorkBookIO.readTemplateWorkBook(FRContext.getCurrentEnv(), tplPath); TemplateWorkBook template = TemplateWorkBookIO.readTemplateWorkBook(tplPath);
return template.getParameters(); return template.getParameters();
} catch (Exception e1) { } catch (Exception e1) {
FRContext.getLogger().error(e1.getMessage(), e1); FRContext.getLogger().error(e1.getMessage(), e1);

10
designer-realize/src/com/fr/start/Designer.java

@ -1,9 +1,7 @@
package com.fr.start; package com.fr.start;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.Env;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.dav.LocalEnv;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.file.WebPreviewUtils; import com.fr.design.actions.file.WebPreviewUtils;
@ -56,6 +54,7 @@ import com.fr.start.jni.SplashMac;
import com.fr.start.module.StartupArgs; import com.fr.start.module.StartupArgs;
import com.fr.start.preload.ImagePreLoader; import com.fr.start.preload.ImagePreLoader;
import com.fr.start.server.ServerTray; import com.fr.start.server.ServerTray;
import com.fr.workspace.WorkContext;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -104,7 +103,7 @@ public class Designer extends BaseDesigner {
//传递启动参数 //传递启动参数
designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args)); designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args));
designerRoot.start(); designerRoot.start();
if (FRContext.getCurrentEnv() instanceof LocalEnv) { if (WorkContext.getCurrent().isLocal()) {
//初始化一下serverTray //初始化一下serverTray
ServerTray.init(); ServerTray.init();
} }
@ -533,11 +532,6 @@ public class Designer extends BaseDesigner {
InformationCollector collector = InformationCollector.getInstance(); InformationCollector collector = InformationCollector.getInstance();
collector.collectStopTime(); collector.collectStopTime();
collector.saveXMLFile(); collector.saveXMLFile();
Env currentEnv = FRContext.getCurrentEnv();
if (currentEnv == null) {
return;
}
currentEnv.doWhenServerShutDown();
} }
} }

Loading…
Cancel
Save