IDEMPIERE-3549:allow IAction decorate toolbar button
This commit is contained in:
parent
c7745182f1
commit
1e17b5af6f
|
@ -13,6 +13,8 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.adempiere.webui.action;
|
package org.adempiere.webui.action;
|
||||||
|
|
||||||
|
import org.zkoss.zul.Toolbarbutton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom UI action provided through OSGi service. Implementation must be thread safe.
|
* Custom UI action provided through OSGi service. Implementation must be thread safe.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
|
@ -24,4 +26,12 @@ public interface IAction {
|
||||||
* @param target
|
* @param target
|
||||||
*/
|
*/
|
||||||
public void execute(Object target);
|
public void execute(Object target);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* you can customize toolbar button like add style, client javascript,...
|
||||||
|
* @param toolbarButton
|
||||||
|
*/
|
||||||
|
public default void decorate(Toolbarbutton toolbarButton) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,8 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
|
||||||
if (button.isCustomization()) {
|
if (button.isCustomization()) {
|
||||||
String actionId = button.getActionClassName();
|
String actionId = button.getActionClassName();
|
||||||
IServiceHolder<IAction> serviceHolder = Actions.getAction(actionId);
|
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 labelKey = actionId + ".label";
|
||||||
String tooltipKey = actionId + ".tooltip";
|
String tooltipKey = actionId + ".tooltip";
|
||||||
String label = Msg.getMsg(Env.getCtx(), labelKey);
|
String label = Msg.getMsg(Env.getCtx(), labelKey);
|
||||||
|
@ -273,6 +274,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
|
||||||
toolbarCustomButtons.add(toolbarCustomBtn);
|
toolbarCustomButtons.add(toolbarCustomBtn);
|
||||||
|
|
||||||
this.appendChild(btn);
|
this.appendChild(btn);
|
||||||
|
action.decorate(btn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (buttons.get(button.getComponentName()) != null) {
|
if (buttons.get(button.getComponentName()) != null) {
|
||||||
|
|
Loading…
Reference in New Issue