2017-03-01 51 views

回答

2

这是相当可能的新动作(标签)添加到HMC,的工具栏但是它不是那么推荐,因为它可能会导致,而迁移一些问题。

  1. 首先,下面的片段添加到**/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() ......

    结果会是这样:

    enter image description here

    +0

    谢谢,它效果很好:)我只是有一些问题:为什么'payment_and_delivery'和'deliveryadministration'? “位置2”是什么意思? –

    +0

    这意味着这个新的'Action按钮'属于Tab:'Payment and Delivery'中的Section:'Delivery',这只是一个例子,使'hidebutton =“false”'并且明白我的意思。 –

    +0

    好吧,我明白了。你知道只有在某些事情是真的时才能显示按钮吗? –

    相关问题