|
|
@ -3,39 +3,22 @@ package com.fr.design.fun.impl; |
|
|
|
import com.fr.design.fun.MenuHandler; |
|
|
|
import com.fr.design.fun.MenuHandler; |
|
|
|
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; |
|
|
|
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; |
|
|
|
import com.fr.design.menu.ShortCut; |
|
|
|
import com.fr.design.menu.ShortCut; |
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
import com.fr.stable.fun.impl.AbstractProvider; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author richie |
|
|
|
* @author richie |
|
|
|
* @date 2015-05-13 |
|
|
|
* @date 2015-05-13 |
|
|
|
* @since 8.0 |
|
|
|
* @since 8.0 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public abstract class AbstractMenuHandler implements MenuHandler { |
|
|
|
public abstract class AbstractMenuHandler extends AbstractProvider implements MenuHandler { |
|
|
|
|
|
|
|
|
|
|
|
public int currentAPILevel() { |
|
|
|
public int currentAPILevel() { |
|
|
|
return CURRENT_LEVEL; |
|
|
|
return CURRENT_LEVEL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean equals(Object obj) { |
|
|
|
public String mark4Provider() { |
|
|
|
return obj instanceof AbstractMenuHandler |
|
|
|
return this.getClass().getName(); |
|
|
|
&& ComparatorUtils.equals(category(), ((AbstractMenuHandler) obj).category()) |
|
|
|
|
|
|
|
&& shortCutEquals(this, (AbstractMenuHandler)obj); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean shortCutEquals(AbstractMenuHandler target, AbstractMenuHandler self){ |
|
|
|
|
|
|
|
ShortCut targetShortCut = target.shortcut(); |
|
|
|
|
|
|
|
ShortCut selfShortCut = self.shortcut(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (targetShortCut == null && selfShortCut == null){ |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (targetShortCut != null && selfShortCut != null){ |
|
|
|
|
|
|
|
return ComparatorUtils.equals(targetShortCut.getClass(), selfShortCut.getClass()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -43,9 +26,8 @@ public abstract class AbstractMenuHandler implements MenuHandler { |
|
|
|
* 不需要选中对象, (文件, 服务器, 关于) |
|
|
|
* 不需要选中对象, (文件, 服务器, 关于) |
|
|
|
* |
|
|
|
* |
|
|
|
* @return 菜单Action |
|
|
|
* @return 菜单Action |
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public ShortCut shortcut(){ |
|
|
|
public ShortCut shortcut() { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -53,11 +35,9 @@ public abstract class AbstractMenuHandler implements MenuHandler { |
|
|
|
* 获取当前菜单对应的Action |
|
|
|
* 获取当前菜单对应的Action |
|
|
|
* |
|
|
|
* |
|
|
|
* @param plus 当前选中的对象(模板) |
|
|
|
* @param plus 当前选中的对象(模板) |
|
|
|
* |
|
|
|
|
|
|
|
* @return 菜单Action |
|
|
|
* @return 菜单Action |
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public ShortCut shortcut(ToolBarMenuDockPlus plus){ |
|
|
|
public ShortCut shortcut(ToolBarMenuDockPlus plus) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |