a way to add an event on next button in a jface wizard? - jface

I am developing a jface wizard , and I need to do some treatement when I click on the next Button on the wizardPage , not on the finish button on the wizard.
Is there an event to use to do so ? My wizard page extends WizardPage.
Thanks for your help

The way to go about this is in your Page that extends WizardPage in the default Constructor set a unique name for that page. Then in the Wizard class override this method:
public IWizardPage getNextPage(IWizardPage page) {
return super.getNextPage(page);
}
then based on the page.getName() you can see if its the page you want to do processing on when the user clicks next. You can cast it to your specific wizard page and here you have control to either add error message, setPageComplete to false or do anything you need to. That is the best approach. If you override getNextPage() on the wizard page itself it will get called before the page is shown and not a good approach.

Related

Prestashop 1.6: how to load a different template after an admin form submission?

I'm new to Prestashop and currently working on a custom admin module in 1.6.
My scenario is, users can load orders to this module/admin controller and from the list they can select which ever order they like using 'Select All' checkbox selector.
And then these selected order ids are submitted back to admin controller to be displayed on a different template with full information in a form.
And then again this form will be submitted to a third party API for further processing.
Now my problem is I can get the order listing to my admin controller and get them submitted back to the same controller. But I do not know how to switch to a different template to display in a form.
And also how to call a different method to process and export once second form substitution is done.
Any advice would be greatly appreciated.
Thanks in advance
Roshan
In your AdminController extend the method initContent with a condition that is you need to check if a certain button was pressed. Something like
public function initContent()
{
if (Tools::isSubmit('the_button')) {
'do what you want to do'
}
parent::initContent();
}
if you want to redirect to a different controller use Tools::redirectAdmin() and set the path of redirection like Context::getContext()->link->getAdminLink('your_another_controller', true), also you can send all necessary data with the third parameter of the method(array)
public function initContent()
{
if (Tools::isSubmit('the_button')) {
Tools::redirectAdmin(
Context::getContext()->link->getAdminLink('your_another_controller', true, $orders)
);
}
parent::initContent();
}
You can use as many conditions, inside the method, as you need so I hope it will help you in all your cases.

Changing default dropdown value in sap crm web ui

I want to change default values which gets populated in the below picture.
I tried modifying get_v_role method but it didn't serve my purpose.
Please help.
In personalize->personalize settings, there is sort option. It sometimes overwrites this arrangement of values of get_v method.
Also code can be written in inbound plug of this view. I did it for overview page drop down and it worked. You can try for your search page.
For filtering/changing drop-down value of search parameter, You've to Re-define GET_DQUERY_DEFINITIONS method of ZCL_XXX_IMPL class of component. GET_V_XX methods are only used to modify drop-down/F4 help of view pages not the search view.
STEPS:
Click F2 while placing the cursor on Account ID(for which parameter you want
to modify) drop-down.
Go to BSP Component using t-code - BSP_WD_CMPWB
Enter the component name and Enhancement set
Select the view.
Go to Implementation class .
If your component is enhanced then it will be having ZCL_XXX_IMPL class. otherwise you've to enhance that component. Click on that class.
After that find GET_DQUERY_DEFINITIONS method and implement same way as
GET_V_XXX.

Sugarcrm : modify actions on Dashlet quickEdit button

I have a very specific question on Sugarcrm.
I'm using version Enterprise 6.5.16, and i'm coming to a dead-end.
What i currently have :
When the user is on his homepage, he has a Dashlet called "My open Cases", which displays every open Cases assigned to/or created by him.
For each row of this dashlet, we have a quickEdit icon displayed. (you know, the little pen).
When the user clicks on that little icon, it opens the quickcreate (or quickedit?) popup.
What i want to achieve is :
I want, when the user clicks on the icon, that Sugar does not open a popup, but opens a new browser tab on EditView.
So basically, when on Home, when the user wants to edit "Case01--Issue" from the dashlet, instead of poping the quickcreate (or quickedit) form, i want to open a new browser tab with the complete edit view of "Case01 -- Issue".
What do i have to do? I did not see the definition of the icon in custom/modules/Cases/metadata/dashletviewdefs.php nor elsewhere.
Thanks by advance for your help and time!
Gaƫlle
The "My Cases" dashlet, and most dashlets, extend the DashletGeneric class, found in /include/Dashlets/DashletGeneric.php. This uses the template file DashletGenericDisplay.tpl in the same directory, and this is the template that displays the quick edit button.
To remove or alter the quick edit button, you would extend My Cases and insist that it use a custom smarty template of your own creation. In /custom/modules/Cases/Dashlets/CustomMyCasesDashlet/CustomMyCasesDashlet.php you might have the following:
<?php
require_once('modules/Cases/Dashlets/MyCasesDashlet/MyCasesDashlet.php');
class CustomMyCasesDashlet extends MyCasesDashlet{
$displayTpl = 'custom/modules/Cases/Dashlets/CustomMyCasesDashlet/CustomMyCasesDashlet.tpl';
}
You would then copy the original template to the new file and location referenced by CustomMyCasesDashlet::displayTpl and adjust as desired.
For your Dashlet to register correctly with the system, you'll also need your CustomMyCasesDashlet.meta.php file. Copy the original to your custom directory and adjust labels as necessary -- the key is to replace references to MyCasesDashlet with CustomMyCasesDashlet.
You should create your own dashlet (with copying existing one in "custom" folder), replace all standart entries to your own. Add copy of DashletGenericDisplay.tpl too and name it like CustomMyCasesDashlet.tpl.
It's not necessary to extend MyCasesDashlet class. You can leave "extends DashletGeneric".
In constructor function CustomMyCasesDashlet() just add the line:
$this->displayTpl = 'custom/modules/Cases/Dashlets/CustomMyCasesDashlet/CustomMyCasesDashlet.tpl';
Pay attention to $this->. Its necessary to override DashletGeneric field.
Copy the file from modules/Cases/Dashlets/MyCasesDashlet/MyCasesDashlet.php and paste it to custom/modules/Cases/Dashlets/MyCasesDashlet/MyCasesDashlet
If you don't have Cases folder inside the custom directory, create one.
After copying the file, add a property to load your custom TPL file.
Default DashletGenericDisplay.tpl file located at include/Dashlets/
class MyCasesDashlet extends DashletGeneric {
var $displayTpl = "custom/modules/Cases/Dashlets/DashletGenericDisplay.tpl";

check if save button is clicked in eclipse plugin development

Im trying to add decorators (eg. adding a suffix to a file) Whenever a save button click happens within a file that is currently open, I search but is having a hard time figuring it out Heres my code
public void decorate(Object resource, IDecoration decoration) {
if () //I'm having trouble with this check
{
decoration.addSuffix("--Modified");
}
}
Help would be appreciated
There is an IEditorPartListener that listens to if editor is "dirty" meaning unsaved or not dirty meaning saved you need to get a reference to the IEditorPart and add the correct listener than you can decorate you navigator as you please.

End conversation when leave page in Seam

I have a wizard in my Seam project which has four pages. When user starts the wizard by coming to the first page (wizard1.xhtml) I start a conversation. To do that in my pages.xml I have following code.
<page view-id="/pages/wizard1.xhtml">
<begin-conversation join="true"/>
</page>
At the final page of the wizard (wizard4.xhtml) I have a save button and I end the conversation by using #End annotation.
#End
public String save() {}
However while moving through the wizard, the user can redirect to a page outside the wizard by clicking a link. Note that if this happens the conversation is not yet ended.
What I want is to immediately end the conversation as soon as the user is no longer on a wizard page (wizard1.xhtml,wizard2.xhtml,wizard3.xhtml or wizard4.xhtml). I found this post but a timeout is not a good choise in my case since I want to end the conversation immediately.
I think the most straight forward and natural solution of your problem is to make your click-able link like this:
<s:link value="here is the link" view="/expectedView.xhtml"
action ="#{targetBean.endingConversation()}"/>
And your endingConversation() method can be like this:
#End
public void endingConversation(){
//do cleanup code
}
The idea is simple, you should employ a guard in every possible exiting points.
Not sure if it will work, just a thought.
Create some javascript function using a4j:jsFunction that calls a method that's annotated with #End.
You then add this jsFunction as an onClick handler to all Your links. (Not sure if onClick is the best handler though).
When the user navigates away from Your wizard the method is called and the conversation should be ended.
If you are using pages.xml (or the per-page page.xml files) to implement page navigation in your application, then you have to specify redirect behavior, for each page, based on the action string. In the navigation rule for each redirect that is not continuing your wizard conversation, you can add <end-conversation />. This is similar to other suggestions, but the result would be navigation rules files which illustrate your applications page flow including the demarcation of your long-running conversations.