Browse Source

Merge branch 'feature/10.0' of http://cloud.finedevelop.com:2015/scm/~kerry/design_10.0 into feature/10.0

master
kerry 7 years ago
parent
commit
c6f0bd7dc1
  1. 11
      designer-base/src/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  2. 24
      designer-form/src/com/fr/design/mainframe/FormCreatorDropTarget.java
  3. 22
      designer-form/src/com/fr/design/mainframe/FormWidgetDetailPane.java
  4. 10
      designer-form/src/com/fr/design/mainframe/JForm.java
  5. 63
      designer-form/src/com/fr/design/mainframe/ShareWidgetButton.java
  6. 6
      designer-form/src/com/fr/design/mainframe/ShareWidgetPane.java
  7. 7
      designer-form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java
  8. 18
      designer-realize/src/com/fr/design/mainframe/CellElementPropertyPane.java
  9. 240
      designer-realize/src/com/fr/start/module/DesignerEnvProvider.java

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

@ -1,11 +1,9 @@
package com.fr.design.gui.itree.filetree; package com.fr.design.gui.itree.filetree;
import com.fr.base.Env; import com.fr.base.Env;
import com.fr.core.env.EnvContext; import com.fr.base.operator.file.FileOperator;
import com.fr.core.env.proxy.EnvProxy; import com.fr.core.env.proxy.EnvProxy;
import com.fr.core.env.resource.EnvConfigUtils;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.env.operator.file.TplFileOperator;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -103,10 +101,9 @@ public class TemplateFileTree extends EnvFileTree {
return null; return null;
} }
public FileNode[] listFile(String path) { public FileNode[] listFile(String path) throws Exception {
String username = EnvConfigUtils.getUsername(EnvContext.currentEnv()); String extra = EnvProxy.get(FileOperator.class).readExtraResourcePath(path);
String extra = EnvProxy.get(TplFileOperator.class).readExtraResourcePath(path); return EnvProxy.get(FileOperator.class).list(extra, path);
return EnvProxy.get(TplFileOperator.class).list(username, extra, path);
} }
/* /*

24
designer-form/src/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -8,21 +8,31 @@ import com.fr.design.designer.beans.HoverPainter;
import com.fr.design.designer.beans.Painter; import com.fr.design.designer.beans.Painter;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.beans.models.AddingModel;
import com.fr.design.designer.creator.*; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.form.share.SharableEditorProvider;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo;
import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.SharableElementCaseEditor; import com.fr.form.ui.SharableWidgetBindInfo;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JWindow;
import java.awt.Color;
import java.awt.Component;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.dnd.DropTarget; import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetDropEvent;
@ -84,8 +94,8 @@ public class FormCreatorDropTarget extends DropTarget {
Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData(); Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData();
if (addingXCreator.isShared()) { if (addingXCreator.isShared()) {
String shareId = addingXCreator.getShareId(); String shareId = addingXCreator.getShareId();
SharableElementCaseEditor sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(shareId); SharableEditorProvider sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(shareId);
ElCaseBindInfo bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId); SharableWidgetBindInfo bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId);
if (sharableEditor != null && bindInfo != null) { if (sharableEditor != null && bindInfo != null) {
Map<String, String> tdNameMap = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(), sharableEditor.getTableDataSource()); Map<String, String> tdNameMap = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(), sharableEditor.getTableDataSource());
//合并数据集之后,可能会有数据集名称变化,做一下联动 //合并数据集之后,可能会有数据集名称变化,做一下联动

22
designer-form/src/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -3,17 +3,15 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
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.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.SharableWidgetBindInfo;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory;
import com.fr.share.ShareConstants; import com.fr.share.ShareConstants;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -42,7 +40,7 @@ public class FormWidgetDetailPane extends FormDockView{
private UIScrollPane downPane; private UIScrollPane downPane;
private JPanel reuWidgetPanel; private JPanel reuWidgetPanel;
private UIComboBox comboBox; private UIComboBox comboBox;
private ElCaseBindInfo[] elCaseBindInfoList; private SharableWidgetBindInfo[] elCaseBindInfoList;
private UIButton deleteButton; private UIButton deleteButton;
private UIButton resetButton; private UIButton resetButton;
private JPanel editPanel; private JPanel editPanel;
@ -119,21 +117,7 @@ public class FormWidgetDetailPane extends FormDockView{
initReuWidgetPanel(); initReuWidgetPanel();
initMenuPanel(); initMenuPanel();
card = new CardLayout(); add(reuWidgetPanel, BorderLayout.CENTER);
tabbedPane = new JPanel();
tabbedPane.setLayout(card);
tabbedPane.add(REPORT_TAB, reuWidgetPanel);
tabbedPane.add(CHART_TAB, new JPanel());
UIHeadGroup tabsHeaderIconPane = new UIHeadGroup(new String[] {REPORT_TAB, CHART_TAB}) {
@Override
public void tabChanged(int index) {
card.show(tabbedPane, labelButtonList.get(index).getText());
}
};
tabsHeaderIconPane.setNeedLeftRightOutLine(false);
add(tabsHeaderIconPane, BorderLayout.NORTH);
add(tabbedPane, BorderLayout.CENTER);
} }

10
designer-form/src/com/fr/design/mainframe/JForm.java

@ -557,9 +557,9 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override @Override
protected void applyUndoState(FormUndoState u) { protected void applyUndoState(FormUndoState u) {
try { try {
//JForm的target重置
this.setTarget((Form) u.getForm().clone());
if (this.index == FORM_TAB) { if (this.index == FORM_TAB) {
//JForm的target重置
this.setTarget((Form) u.getForm().clone());
JForm.this.refreshRoot(); JForm.this.refreshRoot();
this.formDesign.getArea().setAreaSize(u.getAreaSize(), u.getHorizontalValue(), u.getVerticalValue(), u.getWidthValue(), u.getHeightValue(), u.getSlideValue()); this.formDesign.getArea().setAreaSize(u.getAreaSize(), u.getHorizontalValue(), u.getVerticalValue(), u.getWidthValue(), u.getHeightValue(), u.getSlideValue());
//撤销的时候要重新选择的body布局 //撤销的时候要重新选择的body布局
@ -567,9 +567,12 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
formDesign.getRootComponent() == selectedBodyLayout() ? u.getSelectWidgets() : new Widget[]{selectedBodyLayout().toData()})); formDesign.getRootComponent() == selectedBodyLayout() ? u.getSelectWidgets() : new Widget[]{selectedBodyLayout().toData()}));
refreshToolArea(); refreshToolArea();
} else { } else {
// 只在报表块里撤销是不需要修改外部form对象的, 因为编辑的是当前报表块.
// 修改了JForm的Target需要同步修改formDesign的Target.
Form undoForm = (Form) u.getForm().clone();
String widgetName = this.formDesign.getElementCaseContainerName(); String widgetName = this.formDesign.getElementCaseContainerName();
//这儿太坑了,u.getForm() 与 getTarget内容不一样 //这儿太坑了,u.getForm() 与 getTarget内容不一样
FormElementCaseProvider dataTable = getTarget().getElementCaseByName(widgetName); FormElementCaseProvider dataTable = undoForm.getElementCaseByName(widgetName);
this.reportComposite.setSelectedWidget(dataTable); this.reportComposite.setSelectedWidget(dataTable);
//下面这句话是防止撤销之后直接退出编辑再编辑撤销的东西会回来,因为撤销不会保存EC //下面这句话是防止撤销之后直接退出编辑再编辑撤销的东西会回来,因为撤销不会保存EC
formDesign.setElementCase(dataTable); formDesign.setElementCase(dataTable);
@ -583,7 +586,6 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
} else { } else {
this.undoState = u; this.undoState = u;
} }
} }
@Override @Override

63
designer-form/src/com/fr/design/mainframe/ShareWidgetButton.java

@ -1,24 +1,44 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.*; import com.fr.base.BaseUtils;
import com.fr.base.iofileattr.SharableAttrMark;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.share.ShareConstants;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.form.ui.SharableWidgetBindInfo;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.share.ShareConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.*; import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.AlphaComposite;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Composite;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.LayoutManager;
import java.awt.Rectangle;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.dnd.*; import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragSource;
import java.awt.dnd.DragSourceAdapter;
import java.awt.dnd.DragSourceDragEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
@ -31,7 +51,8 @@ import java.io.Serializable;
* Time: 16:14 * Time: 16:14
*/ */
public class ShareWidgetButton extends JPanel implements MouseListener, MouseMotionListener, Serializable { public class ShareWidgetButton extends JPanel implements MouseListener, MouseMotionListener, Serializable {
private ElCaseBindInfo bindInfo; private static final Dimension TAB_DEFAULT_SIZE = new Dimension(500, 300);
private SharableWidgetBindInfo bindInfo;
private MouseEvent lastPressEvent; private MouseEvent lastPressEvent;
private JPanel reportPane; private JPanel reportPane;
private boolean isEdit; private boolean isEdit;
@ -50,7 +71,7 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
} }
}; };
public ShareWidgetButton(ElCaseBindInfo bindInfo) { public ShareWidgetButton(SharableWidgetBindInfo bindInfo) {
this.bindInfo = bindInfo; this.bindInfo = bindInfo;
this.setPreferredSize(new Dimension(108, 68)); this.setPreferredSize(new Dimension(108, 68));
initUI(); initUI();
@ -127,11 +148,11 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
}; };
} }
public ElCaseBindInfo getBindInfo() { public SharableWidgetBindInfo getBindInfo() {
return bindInfo; return bindInfo;
} }
public void setBindInfo(ElCaseBindInfo bindInfo) { public void setBindInfo(SharableWidgetBindInfo bindInfo) {
this.bindInfo = bindInfo; this.bindInfo = bindInfo;
} }
@ -194,13 +215,21 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
} }
shareId = no.getBindInfo().getId(); shareId = no.getBindInfo().getId();
creatorSource = ShareLoader.getLoader().getElCaseEditorById(shareId); creatorSource = ShareLoader.getLoader().getElCaseEditorById(shareId);
} if (creatorSource != null) {
if (creatorSource != null) { ((AbstractBorderStyleWidget)creatorSource).addWidgetAttrMark(new SharableAttrMark(true));
XCreator xCreator = XCreatorUtils.createXCreator(creatorSource); //tab布局WCardMainBorderLayout通过反射出来的大小是960*480
xCreator.setShareId(shareId); XCreator xCreator = null;
WidgetToolBarPane.getTarget().startDraggingBean(xCreator); if (creatorSource instanceof WCardMainBorderLayout) {
lastPressEvent = null; xCreator = XCreatorUtils.createXCreator(creatorSource, TAB_DEFAULT_SIZE);
this.setBorder(null); } else {
xCreator = XCreatorUtils.createXCreator(creatorSource);
}
xCreator.setBackupBound(new Rectangle(no.getBindInfo().getWidth(), no.getBindInfo().getHeight()));
xCreator.setShareId(shareId);
WidgetToolBarPane.getTarget().startDraggingBean(xCreator);
lastPressEvent = null;
this.setBorder(null);
}
} }
} }

6
designer-form/src/com/fr/design/mainframe/ShareWidgetPane.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.SharableWidgetBindInfo;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -12,12 +12,12 @@ import java.awt.*;
*/ */
public class ShareWidgetPane extends JPanel { public class ShareWidgetPane extends JPanel {
public ShareWidgetPane(ElCaseBindInfo[] elCaseBindInfoList, boolean isEdit) { public ShareWidgetPane(SharableWidgetBindInfo[] elCaseBindInfoList, boolean isEdit) {
this.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离 this.setBorder(BorderFactory.createEmptyBorder(10, 3, 0, 0));// 设置面板的边框 ,距离上、左、下、右 的距离
if (elCaseBindInfoList != null) { if (elCaseBindInfoList != null) {
int rowCount = (elCaseBindInfoList.length + 1) / 2; int rowCount = (elCaseBindInfoList.length + 1) / 2;
this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10)); this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 10));
for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { for (SharableWidgetBindInfo rbModuleInfo : elCaseBindInfoList) {
ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo);
widgetButton.setElementCaseEdit(isEdit); widgetButton.setElementCaseEdit(isEdit);
this.add(widgetButton); this.add(widgetButton);

7
designer-form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java

@ -7,8 +7,8 @@ import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.AbstractMarginWidget;
import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.PaddingMargin;
import com.fr.form.ui.RichStyleWidgetProvider;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -74,8 +74,7 @@ public class PaddingBoundPane extends BasicPane{
return panel; return panel;
} }
public void update(RichStyleWidgetProvider marginWidget) {
public void update(AbstractMarginWidget marginWidget) {
marginWidget.setMargin(new PaddingMargin((int)top.getValue(), (int)left.getValue(), (int)bottom.getValue(), (int)right.getValue() )); marginWidget.setMargin(new PaddingMargin((int)top.getValue(), (int)left.getValue(), (int)bottom.getValue(), (int)right.getValue() ));
} }
@ -83,7 +82,7 @@ public class PaddingBoundPane extends BasicPane{
return "PaddingBoundPane"; return "PaddingBoundPane";
} }
public void populate(AbstractMarginWidget marginWidget) { public void populate(RichStyleWidgetProvider marginWidget) {
PaddingMargin paddingMargin = marginWidget.getMargin(); PaddingMargin paddingMargin = marginWidget.getMargin();
top.setValue(paddingMargin.getTop()); top.setValue(paddingMargin.getTop());
bottom.setValue(paddingMargin.getBottom()); bottom.setValue(paddingMargin.getBottom());

18
designer-realize/src/com/fr/design/mainframe/CellElementPropertyPane.java

@ -3,11 +3,8 @@
*/ */
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.*;
import javax.swing.*;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.fun.BackgroundQuickUIProvider;
import com.fr.design.fun.CellAttributeProvider; import com.fr.design.fun.CellAttributeProvider;
import com.fr.design.fun.PresentKindProvider; import com.fr.design.fun.PresentKindProvider;
import com.fr.design.gui.frpane.UITitlePanel; import com.fr.design.gui.frpane.UITitlePanel;
@ -28,6 +25,13 @@ import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.Elem; import com.fr.report.cell.Elem;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Dimension;
/** /**
* 所有组件一次全部加载不存在延迟加载 原因设计器打开第一张模板的时候会初始化许多许多东西这个过程需要很长时间快的3-5s * 所有组件一次全部加载不存在延迟加载 原因设计器打开第一张模板的时候会初始化许多许多东西这个过程需要很长时间快的3-5s
@ -54,8 +58,10 @@ public class CellElementPropertyPane extends DockingView {
@Override @Override
public boolean accept(PluginContext context) { public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, PresentKindProvider.MARK_STRING) || return context.contain(PluginModule.ExtraDesign, BackgroundQuickUIProvider.MARK_STRING)
context.contain(PluginModule.ExtraDesign, CellAttributeProvider.MARK_STRING); || context.contain(PluginModule.ExtraDesign, PresentKindProvider.MARK_STRING)
|| context.contain(PluginModule.ExtraDesign, CellAttributeProvider.MARK_STRING);
} }
}); });
} }

240
designer-realize/src/com/fr/start/module/DesignerEnvProvider.java

@ -7,12 +7,6 @@ import com.fr.base.TableData;
import com.fr.base.env.serializer.OldSerializerAdapter; import com.fr.base.env.serializer.OldSerializerAdapter;
import com.fr.base.env.serializer.ProcedureDataModelSerializer; import com.fr.base.env.serializer.ProcedureDataModelSerializer;
import com.fr.base.env.user.RemoteUserCenter; import com.fr.base.env.user.RemoteUserCenter;
import com.fr.base.operator.connection.DataConnectionOperator;
import com.fr.base.operator.connection.LocalDataConnectionOperator;
import com.fr.base.operator.file.FileOperator;
import com.fr.base.operator.file.LocalFileOperator;
import com.fr.core.env.operator.envinfo.EnvInfoOperator;
import com.fr.core.env.operator.envinfo.LocalEnvInfoOperator;
import com.fr.core.env.operator.user.UserCenter; import com.fr.core.env.operator.user.UserCenter;
import com.fr.core.env.proxy.EnvProxy; import com.fr.core.env.proxy.EnvProxy;
import com.fr.data.core.db.TableProcedure; import com.fr.data.core.db.TableProcedure;
@ -26,7 +20,6 @@ import com.fr.general.ComparatorUtils;
import com.fr.module.Activator; import com.fr.module.Activator;
import com.fr.start.EnvSwitcher; import com.fr.start.EnvSwitcher;
import com.fr.start.StartServer; import com.fr.start.StartServer;
import com.fr.startup.opeartors.LocalUserCenter;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
@ -50,151 +43,182 @@ public class DesignerEnvProvider extends Activator {
} }
} }
} }
getRoot().setSingleton(EnvSwitcher.class, new EnvSwitcher()); initDesignerEnv();
initEnvOperators();
getRoot().setSingleton(EnvSwitcher.class, new EnvSwitcher());
//设置好环境即可,具体跟环境有关的模块会自动调用 //设置好环境即可,具体跟环境有关的模块会自动调用
getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv(); getRoot().getSingleton(EnvSwitcher.class).switch2LastEnv();
} }
@Override private void initDesignerEnv() {
public void stop() {
//清空模块
getRoot().removeSingleton(EnvSwitcher.class);
}
private void initEnvOperators() {
addSerializers(); addSerializers();
EnvProxy.addLocalService(FileOperator.class, new LocalFileOperator());
EnvProxy.addLocalService(DataConnectionOperator.class, new LocalDataConnectionOperator());
EnvProxy.addLocalService(EnvInfoOperator.class, new LocalEnvInfoOperator());
EnvProxy.addLocalService(UserCenter.class, new LocalUserCenter());
EnvProxy.addRemoteService(UserCenter.class, new RemoteUserCenter()); EnvProxy.addRemoteService(UserCenter.class, new RemoteUserCenter());
} }
private void addSerializers() { private void addSerializers() {
EnvProxy.addSerializer(ProcedureDataModel[].class, new ProcedureDataModelSerializer()); EnvProxy.addSerializer(ProcedureDataModel[].class, new ProcedureDataModelSerializer());
EnvProxy.addSerializer(ModifiedTable.class, new OldSerializerAdapter<ModifiedTable>( EnvProxy.addSerializer(ModifiedTable.class, new OldSerializerAdapter<ModifiedTable>(
new OldSerializerAdapter.OldSerializer<ModifiedTable>() { new OldSerializerAdapter.OldSerializer<ModifiedTable>() {
@Override
public void serializer(ModifiedTable obj, OutputStream out) throws Exception { @Override
DavXMLUtils.writeXMLModifiedTables(obj, out); public void serializer(ModifiedTable obj, OutputStream out) throws Exception {
}
}, DavXMLUtils.writeXMLModifiedTables(obj, out);
new OldSerializerAdapter.OldDeserializer<ModifiedTable>() { }
@Override },
public ModifiedTable desializer(InputStream in) throws Exception { new OldSerializerAdapter.OldDeserializer<ModifiedTable>() {
return DavXMLUtils.readXMLModifiedTables(in);
} @Override
public ModifiedTable deserializer(InputStream in) throws Exception {
return DavXMLUtils.readXMLModifiedTables(in);
} }
}
)); ));
EnvProxy.addSerializer(com.fr.data.impl.Connection.class, new OldSerializerAdapter<com.fr.data.impl.Connection>( EnvProxy.addSerializer(com.fr.data.impl.Connection.class, new OldSerializerAdapter<com.fr.data.impl.Connection>(
new OldSerializerAdapter.OldSerializer<Connection>() { new OldSerializerAdapter.OldSerializer<Connection>() {
@Override
public void serializer(Connection obj, OutputStream out) { @Override
DavXMLUtils.writeXMLFileDatabaseConnection(obj, out); public void serializer(Connection obj, OutputStream out) {
}
}, DavXMLUtils.writeXMLFileDatabaseConnection(obj, out);
new OldSerializerAdapter.OldDeserializer<Connection>() { }
@Override },
public Connection desializer(InputStream in) throws Exception { new OldSerializerAdapter.OldDeserializer<Connection>() {
return DavXMLUtils.readXMLDatabaseConnection(in);
} @Override
public Connection deserializer(InputStream in) throws Exception {
return DavXMLUtils.readXMLDatabaseConnection(in);
} }
}
)); ));
EnvProxy.addSerializer(FileNode[].class, new OldSerializerAdapter<FileNode[]>( EnvProxy.addSerializer(FileNode[].class, new OldSerializerAdapter<FileNode[]>(
new OldSerializerAdapter.OldSerializer<FileNode[]>() { new OldSerializerAdapter.OldSerializer<FileNode[]>() {
@Override
public void serializer(FileNode[] obj, OutputStream out) { @Override
DavXMLUtils.writeXMLFileNodes(obj, out); public void serializer(FileNode[] obj, OutputStream out) {
}
}, DavXMLUtils.writeXMLFileNodes(obj, out);
new OldSerializerAdapter.OldDeserializer<FileNode[]>() { }
@Override },
public FileNode[] desializer(InputStream in) { new OldSerializerAdapter.OldDeserializer<FileNode[]>() {
return DavXMLUtils.readXMLFileNodes(in);
} @Override
public FileNode[] deserializer(InputStream in) {
return DavXMLUtils.readXMLFileNodes(in);
} }
}
)); ));
EnvProxy.addSerializer(TableProcedure[].class, new OldSerializerAdapter<TableProcedure[]>( EnvProxy.addSerializer(TableProcedure[].class, new OldSerializerAdapter<TableProcedure[]>(
new OldSerializerAdapter.OldSerializer<TableProcedure[]>() { new OldSerializerAdapter.OldSerializer<TableProcedure[]>() {
@Override
public void serializer(TableProcedure[] obj, OutputStream out) { @Override
DavXMLUtils.writeXMLFileSQLTable(obj, out); public void serializer(TableProcedure[] obj, OutputStream out) {
}
}, DavXMLUtils.writeXMLFileSQLTable(obj, out);
new OldSerializerAdapter.OldDeserializer<TableProcedure[]>() { }
@Override },
public TableProcedure[] desializer(InputStream in) throws Exception { new OldSerializerAdapter.OldDeserializer<TableProcedure[]>() {
return DavXMLUtils.readXMLSQLTables(in);
} @Override
public TableProcedure[] deserializer(InputStream in) throws Exception {
return DavXMLUtils.readXMLSQLTables(in);
} }
}
)); ));
EnvProxy.addSerializer(TableData.class, new OldSerializerAdapter<TableData>( EnvProxy.addSerializer(TableData.class, new OldSerializerAdapter<TableData>(
new OldSerializerAdapter.OldSerializer<TableData>() { new OldSerializerAdapter.OldSerializer<TableData>() {
@Override
public void serializer(TableData obj, OutputStream out) { @Override
DavXMLUtils.writeXMLFileTableData(obj, out); public void serializer(TableData obj, OutputStream out) {
}
}, DavXMLUtils.writeXMLFileTableData(obj, out);
new OldSerializerAdapter.OldDeserializer<TableData>() { }
@Override },
public TableData desializer(InputStream in) throws Exception { new OldSerializerAdapter.OldDeserializer<TableData>() {
return DavXMLUtils.readXMLTableData(in);
} @Override
public TableData deserializer(InputStream in) throws Exception {
return DavXMLUtils.readXMLTableData(in);
} }
}
)); ));
EnvProxy.addSerializer(Parameter[].class, new OldSerializerAdapter<Parameter[]>( EnvProxy.addSerializer(Parameter[].class, new OldSerializerAdapter<Parameter[]>(
new OldSerializerAdapter.OldSerializer<Parameter[]>() { new OldSerializerAdapter.OldSerializer<Parameter[]>() {
@Override
public void serializer(Parameter[] obj, OutputStream out) { @Override
DavXMLUtils.writeXMLFileParameters(obj, out); public void serializer(Parameter[] obj, OutputStream out) {
}
}, DavXMLUtils.writeXMLFileParameters(obj, out);
new OldSerializerAdapter.OldDeserializer<Parameter[]>() { }
@Override },
public Parameter[] desializer(InputStream in) throws Exception { new OldSerializerAdapter.OldDeserializer<Parameter[]>() {
return DavXMLUtils.readXMLParameters(in);
} @Override
public Parameter[] deserializer(InputStream in) throws Exception {
return DavXMLUtils.readXMLParameters(in);
} }
}
)); ));
EnvProxy.addSerializer(StoreProcedure.class, new OldSerializerAdapter<StoreProcedure>( EnvProxy.addSerializer(StoreProcedure.class, new OldSerializerAdapter<StoreProcedure>(
new OldSerializerAdapter.OldSerializer<StoreProcedure>() { new OldSerializerAdapter.OldSerializer<StoreProcedure>() {
@Override
public void serializer(StoreProcedure obj, OutputStream out) { @Override
DavXMLUtils.writeXMLFileStoreProcedure(obj, out); public void serializer(StoreProcedure obj, OutputStream out) {
}
}, DavXMLUtils.writeXMLFileStoreProcedure(obj, out);
new OldSerializerAdapter.OldDeserializer<StoreProcedure>() { }
@Override },
public StoreProcedure desializer(InputStream in) throws Exception { new OldSerializerAdapter.OldDeserializer<StoreProcedure>() {
return DavXMLUtils.readXMLStoreProcedure(in);
} @Override
public StoreProcedure deserializer(InputStream in) throws Exception {
return DavXMLUtils.readXMLStoreProcedure(in);
} }
}
)); ));
EnvProxy.addSerializer(StoreProcedureParameter[].class, new OldSerializerAdapter<StoreProcedureParameter[]>( EnvProxy.addSerializer(StoreProcedureParameter[].class, new OldSerializerAdapter<StoreProcedureParameter[]>(
new OldSerializerAdapter.OldSerializer<StoreProcedureParameter[]>() { new OldSerializerAdapter.OldSerializer<StoreProcedureParameter[]>() {
@Override
public void serializer(StoreProcedureParameter[] obj, OutputStream out) { @Override
DavXMLUtils.writeXMLFileParameters(obj, out); public void serializer(StoreProcedureParameter[] obj, OutputStream out) {
}
}, DavXMLUtils.writeXMLFileParameters(obj, out);
new OldSerializerAdapter.OldDeserializer<StoreProcedureParameter[]>() { }
@Override },
public StoreProcedureParameter[] desializer(InputStream in) throws Exception { new OldSerializerAdapter.OldDeserializer<StoreProcedureParameter[]>() {
return DavXMLUtils.readXMLStoreProcedureParameters(in);
} @Override
public StoreProcedureParameter[] deserializer(InputStream in) throws Exception {
return DavXMLUtils.readXMLStoreProcedureParameters(in);
} }
}
)); ));
} }
@Override
public void stop() {
//清空模块
getRoot().removeSingleton(EnvSwitcher.class);
}
} }

Loading…
Cancel
Save