IDEMPIERE-3549:allow IAction decorate toolbar button

This commit is contained in:
hieplq 2017-11-07 20:52:49 +07:00
parent c7745182f1
commit 1e17b5af6f
2 changed files with 13 additions and 1 deletions

View File

@ -13,6 +13,8 @@
*****************************************************************************/
package org.adempiere.webui.action;
import org.zkoss.zul.Toolbarbutton;
/**
* Custom UI action provided through OSGi service. Implementation must be thread safe.
* @author hengsin
@ -24,4 +26,12 @@ public interface IAction {
* @param target
*/
public void execute(Object target);
/**
* you can customize toolbar button like add style, client javascript,...
* @param toolbarButton
*/
public default void decorate(Toolbarbutton toolbarButton) {
}
}

View File

@ -245,7 +245,8 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
if (button.isCustomization()) {
String actionId = button.getActionClassName();
IServiceHolder<IAction> serviceHolder = Actions.getAction(actionId);
if (serviceHolder != null && serviceHolder.getService() != null) {
IAction action = serviceHolder.getService();
if (serviceHolder != null && action != null) {
String labelKey = actionId + ".label";
String tooltipKey = actionId + ".tooltip";
String label = Msg.getMsg(Env.getCtx(), labelKey);
@ -273,6 +274,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
toolbarCustomButtons.add(toolbarCustomBtn);
this.appendChild(btn);
action.decorate(btn);
}
}
if (buttons.get(button.getComponentName()) != null) {