kerry 8 years ago
parent
commit
6932d7a125
  1. 4
      designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java
  2. 2
      designer_base/src/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java
  3. 2
      designer_base/src/com/fr/design/extra/exe/callback/InstallOnlineCallback.java
  4. 2
      designer_base/src/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java
  5. 2
      designer_base/src/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java
  6. 2
      designer_base/src/com/fr/design/extra/tradition/callback/UpdateOnlineCallback.java
  7. 3
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  8. 5
      designer_base/src/com/fr/design/mainframe/WestRegionContainerPane.java
  9. 84
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  10. 9
      designer_base/src/com/fr/design/menu/MenuDef.java
  11. 4
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java
  12. 31
      designer_chart/src/com/fr/design/extra/ChartTypeInterfaceCloseableHandler.java

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

@ -27,6 +27,7 @@ import com.fr.design.menu.MenuDef;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import com.fr.plugin.context.PluginContext;
@ -34,7 +35,6 @@ 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.PluginListenerRegistration;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
@ -88,7 +88,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
createAddMenuDef();
PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) {
GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) {
@Override
public void on(PluginEvent event) {

2
designer_base/src/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java

@ -34,7 +34,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
if (result.isSuccess()) {
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) {
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport) {
int rv = JOptionPane.showOptionDialog(
null,
Inter.getLocText(Inter.getLocText("FR-Designer-Plugin_Install_Dependence")),

2
designer_base/src/com/fr/design/extra/exe/callback/InstallOnlineCallback.java

@ -33,7 +33,7 @@ public class InstallOnlineCallback extends AbstractPluginTaskCallback {
if (result.isSuccess()) {
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) {
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport) {
int rv = JOptionPane.showOptionDialog(
null,
Inter.getLocText(Inter.getLocText("FR-Designer-Plugin_Install_Dependence")),

2
designer_base/src/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java

@ -34,7 +34,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
if (result.isSuccess()) {
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Install_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) {
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport) {
int rv = JOptionPane.showOptionDialog(
null,
Inter.getLocText(Inter.getLocText("FR-Designer-Plugin_Install_Dependence")),

2
designer_base/src/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java

@ -34,7 +34,7 @@ public class UpdateOnlineCallback extends AbstractPluginTaskCallback {
if (result.isSuccess()) {
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) {
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport) {
int rv = JOptionPane.showOptionDialog(
null,
Inter.getLocText(Inter.getLocText("FR-Designer-Plugin_Install_Dependence")),

2
designer_base/src/com/fr/design/extra/tradition/callback/UpdateOnlineCallback.java

@ -32,7 +32,7 @@ public class UpdateOnlineCallback implements ProgressCallback {
if (result.isSuccess()) {
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin_Update_Success"));
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Plugin_Install_Successful"));
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport.getCode()) {
} else if (result.errorCode() == PluginErrorCode.OperationNotSupport) {
int rv = JOptionPane.showOptionDialog(
null,
Inter.getLocText(Inter.getLocText("FR-Designer-Plugin_Install_Dependence")),

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

@ -40,7 +40,6 @@ 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.OperatingSystem;
import com.fr.stable.ProductConstants;
@ -175,7 +174,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
//顶部日志+登陆按钮
final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {

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

@ -5,12 +5,11 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.fun.TableDataPaneProcessor;
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;
public class WestRegionContainerPane extends UIResizableContainer {
@ -35,7 +34,7 @@ public class WestRegionContainerPane extends UIResizableContainer {
setDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener(TableDataTreePane.PLUGIN_LISTENER_PRIORITY - 1) {
GeneralContext.listenPluginRunningChanged(new PluginEventListener(TableDataTreePane.PLUGIN_LISTENER_PRIORITY - 1) {
@Override
public void on(PluginEvent event) {

84
designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -11,9 +11,9 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.community.*;
import com.fr.design.actions.file.*;
import com.fr.design.actions.help.AboutAction;
import com.fr.design.actions.help.alphafine.AlphafineAction;
import com.fr.design.actions.help.TutorialAction;
import com.fr.design.actions.help.WebDemoAction;
import com.fr.design.actions.help.alphafine.AlphafineAction;
import com.fr.design.actions.server.*;
import com.fr.design.file.NewTemplatePane;
import com.fr.design.fun.MenuHandler;
@ -31,7 +31,14 @@ import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.env.RemoteEnv;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.Inter;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginRuntime;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.ArrayUtils;
import com.fr.stable.ProductConstants;
@ -570,17 +577,56 @@ public abstract class ToolBarMenuDock {
protected void insertMenu(MenuDef menuDef, String anchor) {
insertMenu(menuDef, anchor, new NoTargetAction());
}
protected void insertMenu(MenuDef menuDef, String anchor, ShortCutMethodAction action) {
// 下面是插件接口接入点
Set<MenuHandler> set = ExtraDesignClassManager.getInstance().getArray(MenuHandler.MARK_STRING);
java.util.List<MenuHandler> target = new ArrayList<>();
listenPluginMenuChange(menuDef, anchor, action);
addExtraMenus(menuDef, anchor, action, ExtraDesignClassManager.getInstance().getArray(MenuHandler.MARK_STRING));
}
private void listenPluginMenuChange(MenuDef menuDef, String anchor, ShortCutMethodAction action) {
PluginFilter filter = new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(MenuHandler.MARK_STRING);
}
};
GeneralContext.listenPlugin(PluginEventType.BeforeStop, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
PluginRuntime runtime = event.getContext().getRuntime();
Set<MenuHandler> menuHandlers = runtime.get(MenuHandler.MARK_STRING);
removeExtraMenus(menuDef, anchor, action, menuHandlers);
}
}, filter);
GeneralContext.listenPlugin(PluginEventType.AfterRun, new PluginEventListener() {
@Override
public void on(PluginEvent event) {
PluginRuntime runtime = event.getContext().getRuntime();
Set<MenuHandler> menuHandlers = runtime.get(MenuHandler.MARK_STRING);
addExtraMenus(menuDef, anchor, action, menuHandlers);
}
}, filter);
}
private void removeExtraMenus(MenuDef menuDef, String anchor, ShortCutMethodAction action, Set<MenuHandler> set) {
List<MenuHandler> target = new ArrayList<>();
for (MenuHandler handler : set) {
if (ComparatorUtils.equals(handler.category(), anchor)) {
target.add(handler);
}
}
for (MenuHandler handler : target) {
int insertPosition = handler.insertPosition(menuDef.getShortCutCount());
if (insertPosition == MenuHandler.HIDE) {
@ -590,7 +636,29 @@ public abstract class ToolBarMenuDock {
if (shortCut == null){
continue;
}
menuDef.removeShortCut(shortCut);
}
}
private void addExtraMenus(MenuDef menuDef, String anchor, ShortCutMethodAction action, Set<MenuHandler> set) {
List<MenuHandler> target = new ArrayList<>();
for (MenuHandler handler : set) {
if (ComparatorUtils.equals(handler.category(), anchor)) {
target.add(handler);
}
}
for (MenuHandler handler : target) {
int insertPosition = handler.insertPosition(menuDef.getShortCutCount());
if (insertPosition == MenuHandler.HIDE) {
return;
}
ShortCut shortCut = action.methodAction(handler);
if (shortCut == null){
continue;
}
if (insertPosition == MenuHandler.LAST) {
if (handler.insertSeparatorBefore()) {
menuDef.addShortCut(SeparatorDef.DEFAULT);
@ -609,7 +677,7 @@ public abstract class ToolBarMenuDock {
}
}
}
/**
* 设计器退出时, 做的一些操作.
*

9
designer_base/src/com/fr/design/menu/MenuDef.java

@ -117,6 +117,11 @@ public class MenuDef extends ShortCut {
this.shortcutList.add(i);
}
}
public void removeShortCut(ShortCut shortCut) {
this.shortcutList.remove(shortCut);
}
/**
* 清理
@ -349,6 +354,6 @@ public class MenuDef extends ShortCut {
public void setPopupMenu(JPopupMenu popupMenu) {
this.popupMenu = popupMenu;
}
}

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

@ -20,6 +20,7 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.module.DesignModuleFactory;
import com.fr.form.ui.ChartEditor;
import com.fr.general.GeneralContext;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.plugin.context.PluginContext;
@ -28,7 +29,6 @@ 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.StringUtils;
import com.fr.stable.bridge.StableFactory;
@ -61,7 +61,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr
static {
PluginListenerRegistration.getInstance().listenRunningChanged(new PluginEventListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {

31
designer_chart/src/com/fr/design/extra/ChartTypeInterfaceCloseableHandler.java

@ -1,31 +0,0 @@
package com.fr.design.extra;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.plugin.proxy.CloseableInvocationHandler;
/**
* Created by juhaoyu on 2016/12/27.
*/
public class ChartTypeInterfaceCloseableHandler extends CloseableInvocationHandler {
private final String plotID;
public ChartTypeInterfaceCloseableHandler(String plotID) throws NoSuchMethodException {
super();
this.plotID = plotID;
}
@Override
protected boolean invokeIsClosed() {
//UI对应的chart如果关闭或者不存在,则UI关闭
return super.invokeIsClosed() || !containsChart();
}
private boolean containsChart() {
return ChartTypeManager.getInstance().containsPlot(plotID);
}
}
Loading…
Cancel
Save