最佳答案
很有可能向 HMC 的工具栏添加新操作(标签),但是不建议这样做,因为这可能会在迁移时导致一些问题。
- 首先,将以下代码段添加到您的 **/hmc.xml 中:
<type name="AbstractOrder" mode="append">
<organizer mode="append" >
<editor>
<tab name="payment_and_delivery" position="2" mode="append">
<section name="deliveryadministration" mode="append" >
<table>
<tr>
<td width="16px">
</td>
<td>
<!-- here is the interesting part -->
<action type="item"
classname="com.foo.bar.MyNewAction"
name="action.my_new_action"
toolbaricon="my_new_action"
icon="images/icons/my_new_action_icon.gif"
autosave="true"
showtoolbarlabel="true"
hidebutton="true"
/>
</td>
</tr>
</table>
</section>
</tab>
</editor>
</organizer>
</type>
- 然后,定义单击新标签时要执行的新操作:
添加一个名为MyNewAction.java
的新类,该类从ItemAction
扩展并实现方法ActionResult Perform(ActionEvent event)
:
public MyNewAction extends ItemAction {
@Override
public ActionResult perform(ActionEvent actionEvent) throws JaloBusinessException {
//what the new action should do here ...
}
}
注意:您可以在操作执行时重写其他有趣的方法作为触发器:boolean needConfirmation()
或 String getConfirmationMessage()
...
结果会是这样的:
关于button - Hybris HMC : adding a button to ToolBarChip/Editor window next to the save button,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42528745/