Browse Source

继续移植插件监听

master
juhaoyu 8 years ago
parent
commit
1f70c2dd16
  1. 2
      designer_base/src/com/fr/design/ExtraDesignClassManager.java
  2. 21
      designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java
  3. 57
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  4. 26
      designer_base/src/com/fr/design/mainframe/WestRegionContainerPane.java
  5. 19
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

2
designer_base/src/com/fr/design/ExtraDesignClassManager.java

@ -40,7 +40,7 @@ public class ExtraDesignClassManager extends AbstractExtraClassManager implement
} }
static { static {
StableFactory.registerMarkedObject(PluginModule.EXTRA_DESIGN.getAgentName(), classManager); StableFactory.registerMarkedObject(PluginModule.ExtraDesign.getAgentName(), classManager);
} }
public TableDataNameObjectCreator[] getReportTableDataCreators() { public TableDataNameObjectCreator[] getReportTableDataCreators() {

21
designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java

@ -14,6 +14,7 @@ import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.fun.TableDataDefineProvider;
import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
@ -29,6 +30,13 @@ 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.NameObject; import com.fr.general.NameObject;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginListenerPriority;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.stable.plugin.PluginReadListener; import com.fr.stable.plugin.PluginReadListener;
@ -82,12 +90,21 @@ public class TableDataTreePane extends BasicTableDataTreePane {
createAddMenuDef(); createAddMenuDef();
GeneralContext.addPluginReadListener(new PluginReadListener() { PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener(PluginListenerPriority.TableDataTreePane) {
@Override @Override
public void success(Status status) { public void on(PluginEvent event) {
addMenuDef.clearShortCuts(); addMenuDef.clearShortCuts();
createAddMenuDef(); createAddMenuDef();
} }
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign, TableDataDefineProvider.XML_TAG);
}
}); });
editAction = new EditAction(); editAction = new EditAction();

57
designer_base/src/com/fr/design/mainframe/DesignerFrame.java

@ -15,11 +15,7 @@ import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.*;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.NewTemplatePane;
import com.fr.design.file.SaveSomeTemplatePane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.fun.TitlePlaceProcessor;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuHighLight; import com.fr.design.gui.imenu.UIMenuHighLight;
@ -40,12 +36,16 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.stable.CoreConstants; import com.fr.stable.CoreConstants;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.image4j.codec.ico.ICODecoder;
import com.fr.stable.plugin.PluginReadListener;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import javax.swing.*; import javax.swing.*;
@ -53,20 +53,8 @@ import javax.swing.border.MatteBorder;
import java.awt.*; import java.awt.*;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.dnd.DnDConstants; import java.awt.dnd.*;
import java.awt.dnd.DropTarget; import java.awt.event.*;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -186,24 +174,41 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
//hugh: private修改为protected方便oem的时候修改右上的组件构成 //hugh: private修改为protected方便oem的时候修改右上的组件构成
//顶部日志+登陆按钮 //顶部日志+登陆按钮
final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
GeneralContext.addPluginReadListener(new PluginReadListener() {
PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener() {
@Override @Override
public void success(Status status) { public void on(PluginEvent event) {
TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING);
if (processor == null) { refreshNorthEastPane(northEastPane, ad);
processor = new DefaultTitlePlace();
} }
processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane()); }, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(TitlePlaceProcessor.MARK_STRING);
} }
}); });
if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isEnabled()) { if (DesignerEnvManager.getEnvManager().getAlphafineConfigManager().isEnabled()) {
northEastPane.add(ad.createAlphafinePane(), BorderLayout.CENTER); northEastPane.add(ad.createAlphafinePane(), BorderLayout.CENTER);
} }
refreshNorthEastPane(northEastPane, ad);
return northEastPane; return northEastPane;
} }
private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) {
TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING);
if (processor == null) {
processor = new DefaultTitlePlace();
}
processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane());
}
public DesignerFrame(ToolBarMenuDock ad) { public DesignerFrame(ToolBarMenuDock ad) {
setName(DESIGNER_FRAME_NAME); setName(DESIGNER_FRAME_NAME);
this.ad = ad; this.ad = ad;
this.initTitleIcon(); this.initTitleIcon();

26
designer_base/src/com/fr/design/mainframe/WestRegionContainerPane.java

@ -3,10 +3,15 @@ package com.fr.design.mainframe;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.icontainer.UIResizableContainer; import com.fr.design.gui.icontainer.UIResizableContainer;
import com.fr.general.GeneralContext; import com.fr.plugin.context.PluginContext;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginListenerPriority;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.plugin.PluginReadListener;
public class WestRegionContainerPane extends UIResizableContainer { public class WestRegionContainerPane extends UIResizableContainer {
@ -27,12 +32,25 @@ public class WestRegionContainerPane extends UIResizableContainer {
public WestRegionContainerPane() { public WestRegionContainerPane() {
super(DesignerFrameFileDealerPane.getInstance(), Constants.RIGHT); super(DesignerFrameFileDealerPane.getInstance(), Constants.RIGHT);
GeneralContext.addPluginReadListener(new PluginReadListener() {
setDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener(PluginListenerPriority.WestRegionContainerPane) {
@Override @Override
public void success(Status status) { public void on(PluginEvent event) {
setDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); setDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
} }
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(TableDataPaneProcessor.XML_TAG);
}
}); });
setContainerWidth(165); setContainerWidth(165);
} }
} }

19
designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

@ -23,7 +23,13 @@ import com.fr.form.ui.ChartEditor;
import com.fr.general.GeneralContext; 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.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.injectable.PluginSingleInjection; import com.fr.plugin.injectable.PluginSingleInjection;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginListenerRegistration;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
@ -55,15 +61,22 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
StableFactory.registerMarkedObject(XML_TAG, classManager); StableFactory.registerMarkedObject(XML_TAG, classManager);
} }
// TODO: 2017/3/8
static { static {
GeneralContext.addPluginReadListener(new PluginReadListener() {
PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener() {
@Override @Override
public void success() { public void on(PluginEvent event) {
//重新注册designModuleFactory //重新注册designModuleFactory
DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption()); DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption());
} }
}, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraChartType);
}
}); });
} }

Loading…
Cancel
Save