![]() |
#1 |
Участник
|
a33ik: Action button - Process Guide Framework
Источник: http://daxonline.org/1951-action-but...framework.html
============== WHS Mobile Device Development – Process Guide Framework Adding an action button to the existing process. Action class: #VKProcessGuideSort/// /// An action class for the Back button./// [ProcessGuideActionName(#VKWHSProcessGuideSortPositionChangeItemAction)]public class VKWHSProcessGuideSortPositionChangeItemAction extends ProcessGuideAction{ public str label() { return "Change item"; } public void doExecute() { step.vkExecuteChangeItemAction(); }}#VKProcessGuideSort macros // action name#define.VKWHSProcessGuideSortPositionChangeItemAction('VKWHSProcessGuideSortPositionChangeItemAction')// internal class names, where even classStr function gives warning, that it will be converted into error in future#define.WHSProcessGuidePopulateLPAndSortPositionPageBuilder('WHSProcessGuidePopulateLPAndSortPositionPageBuilder')#define.WHSProcessGuidePopulateLPAndSortPositionStep('WHSProcessGuidePopulateLPAndSortPositionStep') ProcessGuideStep extension. The extension should be done on the actual step class, but in my case WHSProcessGuidePopulateLPAndSortPositionStep is internal and it is the only possible way /// /// CoC for ProcessGuideStep class/// [ExtensionOf(classstr(ProcessGuideStep))]final class VKProcessGuideStepCls_Extension{ #VKProcessGuideSort /// /// Method to execute change item action /// public final void vkExecuteChangeItemAction() { if (ClassId2Name(classIdGet(this)) == #WHSProcessGuidePopulateLPAndSortPositionStep) { WhsrfPassthrough pass = controller.parmSessionState().parmPass(); if (pass.exists(ProcessGuideDataTypeNames::ItemId)) { pass.remove(ProcessGuideDataTypeNames::ItemId); } if (pass.exists(ProcessGuideDataTypeNames::ColorId)) { pass.remove(ProcessGuideDataTypeNames::ColorId); } if (pass.exists(ProcessGuideDataTypeNames::SizeId)) { pass.remove(ProcessGuideDataTypeNames::SizeId); } if (pass.exists(ProcessGuideDataTypeNames::StyleId)) { pass.remove(ProcessGuideDataTypeNames::StyleId); } if (pass.exists(ProcessGuideDataTypeNames::SerialId)) { pass.remove(ProcessGuideDataTypeNames::SerialId); } if (pass.exists(ProcessGuideDataTypeNames::BatchId)) { pass.remove(ProcessGuideDataTypeNames::BatchId); } this.markAsCompleted(); } }}Adding an action button to the page. It should be an extension of the PageBuilder class, however in my case WHSProcessGuidePopulateLPAndSortPositionPageBuilder class is internal and it the only possible way to implement it. /// /// CoC for ProcessGuidePageBuilder class/// [ExtensionOf(classstr(ProcessGuidePageBuilder))]final class VKProcessGuidePageBuilderCls_Extension{ #ProcessGuideActionNames #VKProcessGuideSort /// /// Adds the controls to the page. /// /// /// The ProcessGuidePage class to which the controls should be added. /// protected void addControls(ProcessGuidePage _page) { next addControls(_page); if (ClassId2Name(classIdGet(this)) == #WHSProcessGuidePopulateLPAndSortPositionPageBuilder) { _page.addButton(step.createAction(#VKWHSProcessGuideSortPositionChangeItemAction)); } }} Источник: http://daxonline.org/1951-action-but...framework.html |
|
|
|