Changing button icon of SplitApp master view - sapui5

How can one change the default button icon of the SplitApp master view?
Let's say I want to use this icon instead of the default:
"sap-icon://filter"
I was trying setHomeIcon property of SplitApp but it did not work.
Here is jsbin example, which I found. It would be nice to change icon there. Thanks for any hint.

The icon you would like to customize belongs to the master button of the SplitContainer which is the base for the SplitApp.
SplitContainer does not provide an API for setting the masterButton icon. However you can register for the master button event and obtain the button there. This works only with the following conditions:
You need to prepend the view ID to the SplitApp control ID using this.createId("mySplitApp"). If you use XML views this is done automatically.
You rely on the naming of the button. If SAP decides to change the name this won't work.
The following event handler implementation will do the job:
oSplitApp.attachMasterButton(function(event) {
if (event.getParameter("show")) {
const button = this.byId(this.createId("mySplitApp-MasterBtn"));
if (button) {
button.setIcon("sap-icon://filter");
}
}
}, this);
The example can be found here.

Related

How can I make use of Event Delegation in a parent Svelte Component

In this example, if I click the Tutorial NavItem I get to the Tutorial
section. Here I forward an custom click event on every Nav Item, where I set the segment which has been clicked. In the app.svelte I pull in the NavItem component and set the segment to current, which tells the Nav Component (through Props), which segment is current and needs to be active.
My question is how Can i Make use of event Delegation, so the Nav Component listen for the click Event, so it doesn't feel so repetitiv
The minimal Example goes like that, I want the parent to handle the event?:
https://svelte.dev/repl/691e82ee168549c782b61c355e78cf9b?version=3.12.1
Here is a complex Ex. the Repl:
https://svelte.dev/repl/691e82ee168549c782b61c355e78cf9b?version=3.12.1
I see you already use the getContext and setContext functionality. Instead of firing the event you can simply update that context:
in NavItem.svelte
function setSegment(){
current.set(segment);
}

Can I change "OK" button style in Select Dialog to emphasized?

anyone know if sapui5 provide solution/function to change button style in select dialog? I've checked the SAPUI5 sdk but there is none for this solution.
If you are OK with using "private" properties then you can use _oOkButton property of SelectDialog or else you can use _getOkButton function which also is kind of "private" and returns ok button instance.
Just use the instance of the Select Dialog and get all buttons using the following methods. Select Dialog is a dialog only, you can use the methods of sap.m.Dialog
Let say you have the instance of the dialog as oSlectDialog then
oSlectDialog.getButtons() - will return all the Buttons in the footer. You can use loop them and give custom class accordingly.
var oBtns = oSlectDialog.getButtons()
for(var b in oBtns) {
var oBtn = oBtns[b];//You can check for button instance, if you want to add custom class differently.
oBtn.addStyleClass("YourCustomClass");
}
You can also use the sap.m.Dialog methods like oSlectDialog.getBeginButton(), oSlectDialog.getEndButton().
Since UI5 1.62.0, the primary action OK (later renamed to Select) is automatically emphasized if the theme is sap_fiori_3.
https://openui5.hana.ondemand.com/#/entity/sap.m.SelectDialog/sample/sap.m.sample.SelectDialog
If it's not urgent, I'd suggest to avoid relying on private methods/ properties, but update to the latest UI5 version and themes.
Update: and since 1.70 (commit:1f421b0), the button is automatically emphasized in other supported themes too, such as sap_belize, sap_belize_plus
Related Github issue: https://github.com/SAP/openui5/issues/2254

Customizing properties dialog screen in IBM Content Navigator

I need to develop a functionality in IBM Content Navigator where after search for an item, right click it-> Properties, I need to either:
1 - add a button in properties dialog screen that will call a service and open another dialog;
2 - or extend the Save button functionality to also call a service and open another dialog;
What's quickest way to achieve that ?
Have a look # ecm.widget.dialog.EditPropertiesDialog and onSave() method. This might help you to extend save button functionality.
You can add your customized code by using aspect before/after:
(choose either depending on your functionality)
aspect.after(ecm.widget.dialog.EditPropertiesDialog.prototype,"onSave", function(event){
......
});
aspect.before(ecm.widget.dialog.EditPropertiesDialog.prototype,"onSave", function(event){
......
});

Ionic2: Reload the ion content when back button is pressed

How do I reload the content sitting under <ion-content> tag when back button is pressed?
The answer which is there is correct, however, it is outdated. Here is the updated answer.
Link to the Life Cycle just scroll down and you should see it.
Example:
ionViewWillEnter() {
console.log('Runs when the page is about to enter and become the active page.');
}
Just use a View Lifecycle Hook in the view you are going back you have to use for example:
onPageWillEnter() {
// You can execute what you want here and it will be executed right before you enter the view
}
Or you use a lifecycle hook on the page you are leaving then just replace onPageWillEnter() with onPageWillLeave()
With ionic beta 8 the lifecylcle events changed their names. Check out the official ionic blog for the full list of the lifecycle events.

Change menus and menu items programmatically in Eclipse E4

I am having trouble removing existing menus from the model, in a running app.
For example:
MMenu menu = modelService.findElements(app, "idMenuFoo", MMenu.class,
Collections.<String>emptyList(), EModelService.IN_MAIN_MENU).get(0);
menu.setLabel("X");
menu.setVisible(false);
menu.setToBeRendered(false);
After this code gets executed:
The label has been changed to 'X'
But the menu entry is still visible/rendered
If I start the app without clearPersistedState, then restart it, the menu has disappeared. This leads me to be believe the the visibility and rendering attributes were set in the first place, but not applied to the model (unlike the label attribute).
How can I programmatically trigger a main menu bar "refresh" after such changes?
As a Greg in the comment above posted, there is an open bug filed to address this issue. An easy to implement a workaround involves manually refreshing the underlying SWT menu. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=365724#c9 for details. In a gist:
// retrieve the main menu, containing the top-level menu element that needs to be refreshed
MMenu mainMenu = ...
// org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRenderer
MenuManagerRender renderer = (MenuManagerRenderer)mainMenu.getRenderer();
renderer.getManager(mainMenu).update(true);