From 63bc6e2fea9465cc900ce5d84ac534fef40d091f Mon Sep 17 00:00:00 2001 From: ju Date: Fri, 15 Jun 2018 16:48:08 +0800 Subject: [PATCH] f --- .../fr/design/actions/file/LocalePane.java | 10 +++--- .../fr/design/data/datapane/ChoosePane.java | 4 +-- .../tabledatapane/ClassNameSelectPane.java | 16 ++++------ .../wrapper/StoreProcedureNameWrapper.java | 2 -- .../design/file/HistoryTemplateListPane.java | 4 +-- .../com/fr/design/file/TemplateTreePane.java | 6 ++-- .../com/fr/design/formula/JavaEditorPane.java | 5 ++- .../gui/itree/filetree/EnvFileTree.java | 7 ++--- .../itree/filetree/FileNodeComparator.java | 18 +++++------ .../gui/itree/filetree/FileTreeIcon.java | 14 ++++----- .../gui/itree/filetree/ReportletPane.java | 31 ++++++++----------- .../gui/itree/filetree/TemplateFileTree.java | 5 ++- .../fr/design/mainframe/DesignerFrame.java | 2 +- .../com/fr/design/mainframe/JTemplate.java | 4 +-- .../loghandler/socketio/DesignerSocketIO.java | 10 ++---- .../mainframe/toolbar/ToolBarMenuDock.java | 3 +- .../design/remote/ui/AuthorityEditorPane.java | 7 ++--- .../design/roleAuthority/RoleDataWrapper.java | 2 +- .../com/fr/design/widget/IconDefinePane.java | 8 ++--- .../src/com/fr/file/FILEChooserPane.java | 8 ++--- .../src/com/fr/file/FileNodeFILE.java | 2 +- .../map/server/ChartMapEditorAction.java | 6 ++-- .../design/parameter/FormParameterReader.java | 2 +- .../alphafine/component/AlphaFineDialog.java | 7 ++--- .../manager/impl/FileSearchManager.java | 30 ++++++++---------- .../parameter/WorkBookParameterReader.java | 2 +- .../src/com/fr/start/Designer.java | 10 ++---- 27 files changed, 90 insertions(+), 135 deletions(-) diff --git a/designer-base/src/com/fr/design/actions/file/LocalePane.java b/designer-base/src/com/fr/design/actions/file/LocalePane.java index 20573d34c..b17e66e73 100644 --- a/designer-base/src/com/fr/design/actions/file/LocalePane.java +++ b/designer-base/src/com/fr/design/actions/file/LocalePane.java @@ -4,13 +4,13 @@ package com.fr.design.actions.file; -import com.fr.base.Env; import com.fr.base.FRContext; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itextfield.UITextField; import com.fr.file.filetree.FileNode; +import com.fr.general.Env; import com.fr.general.GeneralUtils; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; @@ -180,11 +180,8 @@ public class LocalePane extends BasicPane { } private void initCustomProperties() throws Exception { - Env env = FRContext.getCurrentEnv(); - if (env == null) { - return; - } - FileNode[] fileNodes = env.getFileOperator().list(ProjectConstants.LOCALE_NAME); + + FileNode[] fileNodes = FRContext.getFileOperator().list(ProjectConstants.LOCALE_NAME); if (ArrayUtils.getLength(fileNodes) == 0) { return; } @@ -220,6 +217,7 @@ public class LocalePane extends BasicPane { * */ public void save() { + Env env = FRContext.getCurrentEnv(); if (env == null) { return; diff --git a/designer-base/src/com/fr/design/data/datapane/ChoosePane.java b/designer-base/src/com/fr/design/data/datapane/ChoosePane.java index 8db095733..6fd557fa0 100644 --- a/designer-base/src/com/fr/design/data/datapane/ChoosePane.java +++ b/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.DBTableData; import com.fr.data.operator.DataOperator; -import com.fr.dav.LocalEnv; import com.fr.design.DesignerEnvManager; import com.fr.design.beans.BasicBeanPane; import com.fr.design.data.DesignTableDataManager; @@ -37,6 +36,7 @@ import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; +import com.fr.workspace.WorkContext; import javax.swing.*; import javax.swing.event.ChangeEvent; @@ -463,7 +463,7 @@ public class ChoosePane extends BasicBeanPane implements Refresha // 显示Table数据. TableData tableData = null; - if (FRContext.getCurrentEnv() instanceof LocalEnv) { + if (WorkContext.getCurrent().isLocal()) { tableData = new DBTableData(database, DataCoreUtils.createSelectSQL(paras.getSchemaName(), paras.getTableName(), DialectFactory.getDialectByName(paras.getDatabaseName()))); } else { diff --git a/designer-base/src/com/fr/design/data/tabledata/tabledatapane/ClassNameSelectPane.java b/designer-base/src/com/fr/design/data/tabledata/tabledatapane/ClassNameSelectPane.java index 1eed1bb42..876c956a7 100644 --- a/designer-base/src/com/fr/design/data/tabledata/tabledatapane/ClassNameSelectPane.java +++ b/designer-base/src/com/fr/design/data/tabledata/tabledatapane/ClassNameSelectPane.java @@ -1,19 +1,15 @@ package com.fr.design.data.tabledata.tabledatapane; -import java.awt.BorderLayout; - -import javax.swing.BorderFactory; +import com.fr.design.dialog.BasicPane; 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.layout.FRGUIPaneFactory; -import com.fr.design.dialog.BasicPane; import com.fr.general.Inter; +import javax.swing.*; +import javax.swing.tree.TreeSelectionModel; +import java.awt.*; + public class ClassNameSelectPane extends BasicPane { private ClassFileTree classFileTree; @@ -27,7 +23,7 @@ public class ClassNameSelectPane extends BasicPane { Inter.getLocText("Function-Choose_Function_Class") + ":")); classFileTree = new ClassFileTree(); - classFileTree.refreshEnv(FRContext.getCurrentEnv()); + classFileTree.refreshEnv(); classFileTree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION); this.add(new JScrollPane(classFileTree), BorderLayout.CENTER); diff --git a/designer-base/src/com/fr/design/data/tabledata/wrapper/StoreProcedureNameWrapper.java b/designer-base/src/com/fr/design/data/tabledata/wrapper/StoreProcedureNameWrapper.java index 26b58cd35..9e52524c1 100644 --- a/designer-base/src/com/fr/design/data/tabledata/wrapper/StoreProcedureNameWrapper.java +++ b/designer-base/src/com/fr/design/data/tabledata/wrapper/StoreProcedureNameWrapper.java @@ -1,7 +1,6 @@ package com.fr.design.data.tabledata.wrapper; import com.fr.base.BaseUtils; -import com.fr.base.Env; import com.fr.base.FRContext; import com.fr.base.TableData; import com.fr.data.impl.storeproc.ProcedureDataModel; @@ -94,7 +93,6 @@ public final class StoreProcedureNameWrapper implements TableDataWrapper { return columnNameList; } columnNameList = new ArrayList(); - Env env = FRContext.getCurrentEnv(); if (!WorkContext.getCurrent().isLocal()) { try { createStore(false); diff --git a/designer-base/src/com/fr/design/file/HistoryTemplateListPane.java b/designer-base/src/com/fr/design/file/HistoryTemplateListPane.java index 2c2137384..3fc3f1d72 100644 --- a/designer-base/src/com/fr/design/file/HistoryTemplateListPane.java +++ b/designer-base/src/com/fr/design/file/HistoryTemplateListPane.java @@ -1,6 +1,5 @@ package com.fr.design.file; -import com.fr.base.Env; import com.fr.base.FRContext; import com.fr.base.chart.chartdata.CallbackEvent; import com.fr.design.DesignModelAdapter; @@ -366,8 +365,7 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C */ public void openContainerFolder() { FileNode fileNode = new FileNode(((JTemplate) list.getSelectedValue()).getEditingFILE().getPath(), false); - Env env = FRContext.getCurrentEnv(); - if (env.isLocalEnv()) { + if (WorkContext.getCurrent().isLocal()) { IOUtils.openWindowsFolder(StableUtils.pathJoin(WorkContext.getCurrent().getPath(), fileNode.getEnvPath())); } } diff --git a/designer-base/src/com/fr/design/file/TemplateTreePane.java b/designer-base/src/com/fr/design/file/TemplateTreePane.java index 6d5063fd6..78905c32a 100644 --- a/designer-base/src/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/com/fr/design/file/TemplateTreePane.java @@ -3,7 +3,6 @@ */ package com.fr.design.file; -import com.fr.base.Env; import com.fr.base.FRContext; import com.fr.base.io.FileAssistUtils; import com.fr.design.gui.icontainer.UIScrollPane; @@ -100,7 +99,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { */ public void refreshDockingView() { 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() { FileNode fn = TemplateTreePane.this.reportletsTree.getSelectedFileNode(); - Env localEnv = FRContext.getCurrentEnv(); - String filePath = StableUtils.pathJoin(localEnv.getPath(), fn.getEnvPath()); + String filePath = StableUtils.pathJoin(WorkContext.getCurrent().getPath(), fn.getEnvPath()); filePath = filePath.substring(0, filePath.lastIndexOf(CoreConstants.SEPARATOR)); try { Desktop.getDesktop().open(new File(filePath)); diff --git a/designer-base/src/com/fr/design/formula/JavaEditorPane.java b/designer-base/src/com/fr/design/formula/JavaEditorPane.java index 2a5836f0f..9c8fab0f0 100644 --- a/designer-base/src/com/fr/design/formula/JavaEditorPane.java +++ b/designer-base/src/com/fr/design/formula/JavaEditorPane.java @@ -1,6 +1,5 @@ package com.fr.design.formula; -import com.fr.base.Env; import com.fr.base.FRContext; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; @@ -176,8 +175,8 @@ public class JavaEditorPane extends BasicPane { @Override protected JavaCompileInfo doInBackground() throws Exception { - Env env = FRContext.getCurrentEnv(); - return env.getCommonOperator().compile(javaText.getText()); + + return FRContext.getCommonOperator().compile(javaText.getText()); } public void done() { diff --git a/designer-base/src/com/fr/design/gui/itree/filetree/EnvFileTree.java b/designer-base/src/com/fr/design/gui/itree/filetree/EnvFileTree.java index c7a6f4c82..0eae91dee 100644 --- a/designer-base/src/com/fr/design/gui/itree/filetree/EnvFileTree.java +++ b/designer-base/src/com/fr/design/gui/itree/filetree/EnvFileTree.java @@ -1,6 +1,5 @@ package com.fr.design.gui.itree.filetree; -import com.fr.base.Env; import com.fr.base.FRContext; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ilable.UILabel; @@ -28,7 +27,6 @@ import java.util.Arrays; public class EnvFileTree extends RefreshableJTree { protected FileNodeFilter filter; - protected Env env; protected String treeRootPath = ""; protected String[] subPathes; @@ -191,7 +189,7 @@ public class EnvFileTree extends RefreshableJTree { FileNode[] res_fns = null; 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) { FRContext.getLogger().error(e.getMessage(), e); } @@ -239,8 +237,7 @@ public class EnvFileTree extends RefreshableJTree { /* * 改变Env后,根据构造函数时设置的RootPathes,重新加载 */ - public void refreshEnv(Env env) { - this.env = env; + public void refreshEnv() { DefaultTreeModel m_model = (DefaultTreeModel) this.getModel(); ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) m_model.getRoot(); diff --git a/designer-base/src/com/fr/design/gui/itree/filetree/FileNodeComparator.java b/designer-base/src/com/fr/design/gui/itree/filetree/FileNodeComparator.java index a6608b6b5..2be086502 100644 --- a/designer-base/src/com/fr/design/gui/itree/filetree/FileNodeComparator.java +++ b/designer-base/src/com/fr/design/gui/itree/filetree/FileNodeComparator.java @@ -1,9 +1,9 @@ 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.general.adaptor.WorkspaceAdaptor; + +import java.util.Comparator; /** * FileTreeNode compare... @@ -26,8 +26,6 @@ public class FileNodeComparator implements Comparator { * v1 is equal to v2, or < 0 if v1 is less than v2. * It must handle null values for the comparison values. * - * @param v1 comparison value. - * @param v2 comparison value. * @return < 0, 0, or > 0 for v1v2. */ public int compare(FileNode nameNode1, FileNode nameNode2) { @@ -60,14 +58,14 @@ public class FileNodeComparator implements Comparator { */ private int groupByFileType(FileNode nameNode1, FileNode nameNode2, int i) { - if(i< LocalEnv.FILE_TYPE.length){ - if(nameNode1.isFileType(LocalEnv.FILE_TYPE[i])) - if(nameNode2.isFileType(LocalEnv.FILE_TYPE[i])) + + if (i < WorkspaceAdaptor.FILE_TYPE.length) { + if (nameNode1.isFileType(WorkspaceAdaptor.FILE_TYPE[i])) + if (nameNode2.isFileType(WorkspaceAdaptor.FILE_TYPE[i])) return nameNode1.getName().toLowerCase().compareTo(nameNode2.getName().toLowerCase()); else return-1; - else - if(nameNode2.isFileType(LocalEnv.FILE_TYPE[i])) + else if (nameNode2.isFileType(WorkspaceAdaptor.FILE_TYPE[i])) return 1; else{ return groupByFileType(nameNode1, nameNode2, i+1); diff --git a/designer-base/src/com/fr/design/gui/itree/filetree/FileTreeIcon.java b/designer-base/src/com/fr/design/gui/itree/filetree/FileTreeIcon.java index 83f31067f..b6ea37817 100644 --- a/designer-base/src/com/fr/design/gui/itree/filetree/FileTreeIcon.java +++ b/designer-base/src/com/fr/design/gui/itree/filetree/FileTreeIcon.java @@ -1,17 +1,15 @@ 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.FRContext; -import com.fr.dav.LocalEnv; import com.fr.design.icon.LockIcon; import com.fr.file.filetree.FileNode; 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 { private FileTreeIcon() {} @@ -118,7 +116,7 @@ public class FileTreeIcon { public static Icon getIcon(FileNode node, boolean isShowLock) { 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); if (ff.exists()) { if(node.isDirectory()){ diff --git a/designer-base/src/com/fr/design/gui/itree/filetree/ReportletPane.java b/designer-base/src/com/fr/design/gui/itree/filetree/ReportletPane.java index b98b8e200..6259667e4 100644 --- a/designer-base/src/com/fr/design/gui/itree/filetree/ReportletPane.java +++ b/designer-base/src/com/fr/design/gui/itree/filetree/ReportletPane.java @@ -1,23 +1,18 @@ 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.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.itextarea.UITextArea; 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.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 { private TemplateFileTree templateReportletTree; @@ -60,8 +55,8 @@ public class ReportletPane extends BasicPane { cardPane.add(t_panel = new JScrollPane(templateReportletTree), "TEMPLATE"); classReportletTree = new ClassFileTree(); cardPane.add(c_panel = new JScrollPane(classReportletTree), "CLASS"); - - this.refreshEnv(FRContext.getCurrentEnv()); + + this.refreshEnv(); } /* @@ -92,11 +87,11 @@ public class ReportletPane extends BasicPane { /** * 刷新Env - * @param env 环境 */ - public void refreshEnv(Env env) { - this.templateReportletTree.refreshEnv(env); - this.classReportletTree.refreshEnv(env); + public void refreshEnv() { + + this.templateReportletTree.refreshEnv(); + this.classReportletTree.refreshEnv(); } @Override diff --git a/designer-base/src/com/fr/design/gui/itree/filetree/TemplateFileTree.java b/designer-base/src/com/fr/design/gui/itree/filetree/TemplateFileTree.java index 26b9095d8..451a381ec 100644 --- a/designer-base/src/com/fr/design/gui/itree/filetree/TemplateFileTree.java +++ b/designer-base/src/com/fr/design/gui/itree/filetree/TemplateFileTree.java @@ -1,6 +1,5 @@ package com.fr.design.gui.itree.filetree; -import com.fr.base.Env; import com.fr.base.FRContext; import com.fr.base.extension.FileExtension; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; @@ -102,7 +101,7 @@ public class TemplateFileTree extends EnvFileTree { } public FileNode[] listFile(String path) throws Exception { - return FRContext.getCurrentEnv().getFileOperator().list( + return FRContext.getFileOperator().list( path, new FileExtension[]{FileExtension.CPT, FileExtension.FRM, FileExtension.CPTX, FileExtension.FRMX}); } @@ -110,7 +109,7 @@ public class TemplateFileTree extends EnvFileTree { /* * 改变Env后,根据构造函数时设置的RootPaths,重新加载 */ - public void refreshEnv(Env env) { + public void refreshEnv() { DefaultTreeModel defaultTreeModel = (DefaultTreeModel) this.getModel(); ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) defaultTreeModel.getRoot(); diff --git a/designer-base/src/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/com/fr/design/mainframe/DesignerFrame.java index 402603f9b..7719d06a4 100644 --- a/designer-base/src/com/fr/design/mainframe/DesignerFrame.java +++ b/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(); DesignerWorkspaceInfo env = DesignerEnvManager.getEnvManager().getWorkspaceInfo(envName); if (env != null) { -// defaultTitleSB.append(env.getDescription(envName)); + defaultTitleSB.append(WorkContext.getCurrent().getDescription()); if (editingTemplate != null) { String path = editingTemplate.getEditingFILE().getPath(); if (!editingTemplate.getEditingFILE().exists()) { diff --git a/designer-base/src/com/fr/design/mainframe/JTemplate.java b/designer-base/src/com/fr/design/mainframe/JTemplate.java index 8ab0c4756..f39775ba4 100644 --- a/designer-base/src/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/com/fr/design/mainframe/JTemplate.java @@ -544,7 +544,7 @@ public abstract class JTemplate> boolean access = false; try { - access = FRContext.getCurrentEnv().getOrganizationOperator().canAccess(this.getEditingFILE().getPath()); + access = FRContext.getOrganizationOperator().canAccess(this.getEditingFILE().getPath()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -594,7 +594,7 @@ public abstract class JTemplate> if (isOkOperation(chooseResult)) { boolean access = false; try { - access = FRContext.getCurrentEnv().getOrganizationOperator().canAccess(fileChooser.getSelectedFILE().getPath()); + access = FRContext.getOrganizationOperator().canAccess(fileChooser.getSelectedFILE().getPath()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java b/designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java index 9051b0ac7..c98eee7d5 100644 --- a/designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java +++ b/designer-base/src/com/fr/design/mainframe/loghandler/socketio/DesignerSocketIO.java @@ -1,7 +1,5 @@ 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.event.Event; import com.fr.event.EventDispatcher; @@ -10,15 +8,13 @@ import com.fr.general.LogRecordTime; import com.fr.general.LogUtils; import com.fr.log.FineLoggerFactory; 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.WorkspaceEvent; -import io.socket.client.IO; import io.socket.client.Socket; import io.socket.emitter.Emitter; import java.io.ByteArrayInputStream; -import java.net.URI; public class DesignerSocketIO { @@ -61,8 +57,8 @@ public class DesignerSocketIO { } private static void updateSocket() { - Env env = FRContext.getCurrentEnv(); - if (env.isLocalEnv()) { + + if (WorkContext.getCurrent().isLocal()) { return; } try { diff --git a/designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 35278c8cc..45c0e1e6d 100644 --- a/designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -434,7 +434,8 @@ public abstract class ToolBarMenuDock { } 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() { diff --git a/designer-base/src/com/fr/design/remote/ui/AuthorityEditorPane.java b/designer-base/src/com/fr/design/remote/ui/AuthorityEditorPane.java index bb9c9cc40..f43b5e881 100644 --- a/designer-base/src/com/fr/design/remote/ui/AuthorityEditorPane.java +++ b/designer-base/src/com/fr/design/remote/ui/AuthorityEditorPane.java @@ -1,6 +1,5 @@ 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; @@ -13,10 +12,10 @@ import com.fr.general.Inter; import com.fr.report.DesignAuthority; import com.fr.stable.CoreConstants; -import javax.swing.BorderFactory; +import javax.swing.*; import javax.swing.border.EmptyBorder; import javax.swing.tree.TreePath; -import java.awt.BorderLayout; +import java.awt.*; import java.util.ArrayList; import java.util.List; @@ -40,7 +39,7 @@ public class AuthorityEditorPane extends BasicBeanPane { tree.setDigIn(true); tree.setFileNodeFilter(filter); this.add(new UIScrollPane(tree), BorderLayout.CENTER); - tree.refreshEnv(FRContext.getCurrentEnv()); + tree.refreshEnv(); } diff --git a/designer-base/src/com/fr/design/roleAuthority/RoleDataWrapper.java b/designer-base/src/com/fr/design/roleAuthority/RoleDataWrapper.java index 253f6d8c2..f5c3dda23 100644 --- a/designer-base/src/com/fr/design/roleAuthority/RoleDataWrapper.java +++ b/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; /** * 将权限细粒度的角色数据包装一下,区分报表平台管理角色和数据决策系统角色 *

* Author : daisy * Date: 13-8-30 * Time: 下午3:42 */ public class RoleDataWrapper implements ChildrenNodesLoader { private List rolelist = new ArrayList(); 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 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; } } \ No newline at end of file +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; /** * 将权限细粒度的角色数据包装一下,区分报表平台管理角色和数据决策系统角色 *

* Author : daisy * Date: 13-8-30 * Time: 下午3:42 */ public class RoleDataWrapper implements ChildrenNodesLoader { private List rolelist = new ArrayList(); 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 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; } } \ No newline at end of file diff --git a/designer-base/src/com/fr/design/widget/IconDefinePane.java b/designer-base/src/com/fr/design/widget/IconDefinePane.java index f441d1c60..6bcc649a4 100644 --- a/designer-base/src/com/fr/design/widget/IconDefinePane.java +++ b/designer-base/src/com/fr/design/widget/IconDefinePane.java @@ -1,15 +1,13 @@ package com.fr.design.widget; -import com.fr.base.Env; -import com.fr.base.FRContext; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; 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.general.Inter; diff --git a/designer-base/src/com/fr/file/FILEChooserPane.java b/designer-base/src/com/fr/file/FILEChooserPane.java index d5e6d8e55..24e191bc0 100644 --- a/designer-base/src/com/fr/file/FILEChooserPane.java +++ b/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.FRContext; import com.fr.base.extension.FileExtension; -import com.fr.dav.LocalEnv; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; 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.GeneralContext; import com.fr.general.Inter; +import com.fr.general.adaptor.WorkspaceAdaptor; import com.fr.log.FineLoggerFactory; import com.fr.stable.CoreConstants; import com.fr.stable.OperatingSystem; @@ -545,7 +545,7 @@ public class FILEChooserPane extends BasicPane { return; } if (editing == null || !editing.isChartBook()) { - String[] fileSuffix_local = LocalEnv.FILE_TYPE; + String[] fileSuffix_local = WorkspaceAdaptor.FILE_TYPE; EnumSet fileExtensions = EnumSet.of(FileExtension.CPT, FileExtension.CPTX, FileExtension.FRM, FileExtension.FRMX, FileExtension.CHT); if (type == JFileChooser.OPEN_DIALOG) { if (FRContext.getCurrentEnv().isSupportLocalFileOperate()) { //本地连接 @@ -686,7 +686,7 @@ public class FILEChooserPane extends BasicPane { boolean access = false; try { - access = FRContext.getCurrentEnv().getOrganizationOperator().canAccess(selectedFile.getPath()); + access = FRContext.getOrganizationOperator().canAccess(selectedFile.getPath()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -1404,7 +1404,7 @@ public class FILEChooserPane extends BasicPane { boolean access = false; try { - access = FRContext.getCurrentEnv().getOrganizationOperator().canAccess(currentDirectory.getPath()); + access = FRContext.getOrganizationOperator().canAccess(currentDirectory.getPath()); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-base/src/com/fr/file/FileNodeFILE.java b/designer-base/src/com/fr/file/FileNodeFILE.java index 7fead4ce0..984e88ec6 100644 --- a/designer-base/src/com/fr/file/FileNodeFILE.java +++ b/designer-base/src/com/fr/file/FileNodeFILE.java @@ -181,7 +181,7 @@ public class FileNodeFILE implements FILE { */ private FileNode[] listFile(String rootFilePath) { try { - return FRContext.getCurrentEnv().getFileOperator().list(rootFilePath); + return FRContext.getFileOperator().list(rootFilePath); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } diff --git a/designer-chart/src/com/fr/van/chart/map/server/ChartMapEditorAction.java b/designer-chart/src/com/fr/van/chart/map/server/ChartMapEditorAction.java index fb0ef8372..381006aa2 100644 --- a/designer-chart/src/com/fr/van/chart/map/server/ChartMapEditorAction.java +++ b/designer-chart/src/com/fr/van/chart/map/server/ChartMapEditorAction.java @@ -1,7 +1,5 @@ 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.design.DesignerEnvManager; import com.fr.design.actions.UpdateAction; @@ -9,6 +7,7 @@ import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.general.Inter; import com.fr.start.ServerStarter; +import com.fr.workspace.WorkContext; import java.awt.event.ActionEvent; @@ -26,8 +25,7 @@ public class ChartMapEditorAction extends UpdateAction { int port = DesignerEnvManager.getEnvManager().getEmbedServerPort(); String web = GeneralContext.getCurrentAppNameOfEnv(); String serverlet = ServerConfig.getInstance().getReportServletName(); - Env env = FRContext.getCurrentEnv(); - ServerStarter.browserURLWithLocalEnv(env.isLocalEnv() ? String.format("http://localhost:%d/%s/%s?op=map", port, web, serverlet) : env.getPath() + "?op=map"); + ServerStarter.browserURLWithLocalEnv(WorkContext.getCurrent().isLocal() ? String.format("http://localhost:%d/%s/%s?op=map", port, web, serverlet) : WorkContext.getCurrent().getPath() + "?op=map"); } } diff --git a/designer-form/src/com/fr/design/parameter/FormParameterReader.java b/designer-form/src/com/fr/design/parameter/FormParameterReader.java index 6c60a97cb..dbceb3ee3 100644 --- a/designer-form/src/com/fr/design/parameter/FormParameterReader.java +++ b/designer-form/src/com/fr/design/parameter/FormParameterReader.java @@ -17,7 +17,7 @@ public class FormParameterReader extends AbstractParameterReader { public Parameter[] readParameterFromPath(String tplPath) { if (accept(tplPath, ".frm", ".form")) { try { - Form form = FormIO.readForm(FRContext.getCurrentEnv(), tplPath); + Form form = FormIO.readForm(tplPath); return form.getParameters(); } catch (Exception e1) { FRContext.getLogger().error(e1.getMessage(), e1); diff --git a/designer-realize/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer-realize/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index 33dd2893e..67be7e1d6 100644 --- a/designer-realize/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer-realize/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -1,7 +1,6 @@ package com.fr.design.mainframe.alphafine.component; import com.bulenkov.iconloader.IconLoader; -import com.fr.base.FRContext; import com.fr.config.MarketConfig; import com.fr.design.DesignerEnvManager; 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.FormIO; import com.fr.general.ComparatorUtils; -import com.fr.log.FineLoggerFactory; import com.fr.general.Inter; import com.fr.general.http.HttpClient; import com.fr.io.TemplateWorkBookIO; import com.fr.io.exporter.ImageExporter; import com.fr.json.JSONException; import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; import com.fr.main.impl.WorkBook; import com.fr.stable.CodeUtils; import com.fr.stable.StringUtils; @@ -507,7 +506,7 @@ public class AlphaFineDialog extends UIDialog { protected BufferedImage doInBackground() { Form form = null; try { - form = FormIO.readForm(FRContext.getCurrentEnv(), fileName); + form = FormIO.readForm(fileName); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage()); } @@ -539,7 +538,7 @@ public class AlphaFineDialog extends UIDialog { protected BufferedImage doInBackground() { WorkBook workBook = null; try { - workBook = (WorkBook) TemplateWorkBookIO.readTemplateWorkBook(FRContext.getCurrentEnv(), fileName); + workBook = (WorkBook) TemplateWorkBookIO.readTemplateWorkBook(fileName); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage()); } diff --git a/designer-realize/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java b/designer-realize/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java index e1deba46a..2bbbb36bb 100644 --- a/designer-realize/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java +++ b/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; -import com.fr.base.Env; import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; 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"))); return lessModelList; } - Env env = FRContext.getCurrentEnv(); fileNodes = new ArrayList<>(); - fileNodes = listTpl(env, ProjectConstants.REPORTLETS_NAME, true); + fileNodes = listTpl(ProjectConstants.REPORTLETS_NAME, true); AlphaFineHelper.checkCancel(); isContainCpt = true; isContainFrm = true; - doSearch(this.searchText, true, env); + doSearch(this.searchText, true); if (stopSearch) { 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)); @@ -109,21 +107,20 @@ public class FileSearchManager implements AlphaFineSearchProvider { } this.filterModelList = new SearchResult(); this.moreModelList = new SearchResult(); - Env env = FRContext.getCurrentEnv(); AlphaFineHelper.checkCancel(); isContainCpt = true; isContainFrm = true; - doSearch(this.searchText, false, env); + doSearch(this.searchText, false); moreModelList.addAll(filterModelList.subList(AlphaFineConstants.SHOW_SIZE, filterModelList.size())); return moreModelList; } - - private void doSearch(String searchText, boolean needMore, Env env) { + + private void doSearch(String searchText, boolean needMore) { for (FileNode node : fileNodes) { boolean isAlreadyContain = false; isAlreadyContain = searchFile(searchText, node, isAlreadyContain, needMore); 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) { return; @@ -150,7 +147,7 @@ public class FileSearchManager implements AlphaFineSearchProvider { * @param node * @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 { 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"); @@ -210,15 +207,14 @@ public class FileSearchManager implements AlphaFineSearchProvider { /** * 获取工作目录下所有符合要求的模板 * - * @param env * @param rootFilePath * @param recurse * @return */ - private List listTpl(Env env, String rootFilePath, boolean recurse) { + private List listTpl(String rootFilePath, boolean recurse) { List fileNodeList = new ArrayList(); try { - listAll(env, rootFilePath, fileNodeList, recurse); + listAll(rootFilePath, fileNodeList, recurse); } catch (Exception e) { FRContext.getLogger().error("file search error: " + e.getMessage(), e); } @@ -228,19 +224,19 @@ public class FileSearchManager implements AlphaFineSearchProvider { /** * 获取当前工作目录下所有模板 * - * @param env * @param rootFilePath * @param nodeList * @param recurse * @throws Exception */ - private void listAll(Env env, String rootFilePath, List nodeList, boolean recurse) throws Exception { - FileNode[] fns = env.getFileOperator().list(rootFilePath); + private void listAll(String rootFilePath, List nodeList, boolean recurse) throws Exception { + + FileNode[] fns = FRContext.getFileOperator().list(rootFilePath); for (int i = 0; i < fns.length; i++) { FileNode fileNode = fns[i]; if (fileNode.isDirectory()) { if (recurse) { - listAll(env, rootFilePath + File.separator + fns[i].getName(), nodeList, true); + listAll(rootFilePath + File.separator + fns[i].getName(), nodeList, true); } else { nodeList.add(fns[i]); } diff --git a/designer-realize/src/com/fr/design/parameter/WorkBookParameterReader.java b/designer-realize/src/com/fr/design/parameter/WorkBookParameterReader.java index ae676f44f..c678f3156 100644 --- a/designer-realize/src/com/fr/design/parameter/WorkBookParameterReader.java +++ b/designer-realize/src/com/fr/design/parameter/WorkBookParameterReader.java @@ -17,7 +17,7 @@ public class WorkBookParameterReader extends AbstractParameterReader { public Parameter[] readParameterFromPath(String tplPath) { if (accept(tplPath, ".cpt")) { try { - TemplateWorkBook template = TemplateWorkBookIO.readTemplateWorkBook(FRContext.getCurrentEnv(), tplPath); + TemplateWorkBook template = TemplateWorkBookIO.readTemplateWorkBook(tplPath); return template.getParameters(); } catch (Exception e1) { FRContext.getLogger().error(e1.getMessage(), e1); diff --git a/designer-realize/src/com/fr/start/Designer.java b/designer-realize/src/com/fr/start/Designer.java index d3a9d6306..348c04d7c 100644 --- a/designer-realize/src/com/fr/start/Designer.java +++ b/designer-realize/src/com/fr/start/Designer.java @@ -1,9 +1,7 @@ package com.fr.start; import com.fr.base.BaseUtils; -import com.fr.base.Env; import com.fr.base.FRContext; -import com.fr.dav.LocalEnv; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.core.ActionFactory; 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.preload.ImagePreLoader; import com.fr.start.server.ServerTray; +import com.fr.workspace.WorkContext; import javax.swing.JComponent; import javax.swing.JPanel; @@ -104,7 +103,7 @@ public class Designer extends BaseDesigner { //传递启动参数 designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args)); designerRoot.start(); - if (FRContext.getCurrentEnv() instanceof LocalEnv) { + if (WorkContext.getCurrent().isLocal()) { //初始化一下serverTray ServerTray.init(); } @@ -533,11 +532,6 @@ public class Designer extends BaseDesigner { InformationCollector collector = InformationCollector.getInstance(); collector.collectStopTime(); collector.saveXMLFile(); - Env currentEnv = FRContext.getCurrentEnv(); - if (currentEnv == null) { - return; - } - currentEnv.doWhenServerShutDown(); } }