Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Update the Client view any time later after the first time?(How to Update the Client view any time later after the first time?)
Update the Client view any time later after the first time? [message #1062194] Thu, 06 June 2013 13:27 Go to next message
Ferran Siles Vila is currently offline Ferran Siles VilaFriend
Messages: 11
Registered: March 2013
Junior Member
Hello,

I am struggling with an issue, after loading through the Client's Desktop object some inner specific objects (subclasses of AbstractMenu), which make displaying menu options, and just like that, their drill down suboptions inside of them (which are implemented with the same AbstractMenu superclass), why when the parent menu´s execAction() method is executed, which is called from within any of its suboptions, can't fulfill the reloading of text in these submenus through the respective call of their own getConfiguredText()?
In order to get the expected changes at the display of Desktop after the first load of it, what has to be called instead from the menu's (SwitchLDAPLibrary) method 'execAction()' when this is called from any of the submenu's widgets.

Thank you for your time.

Here it is the "Desktop" class'code snippet to clarify my question:


...

import org.eclipse.scout.rt.client.ui.action.menu.AbstractMenu;
import org.eclipse.scout.rt.client.ui.action.menu.IMenu;
import org.eclipse.scout.rt.client.ui.desktop.AbstractDesktop;
import org.eclipse.scout.rt.client.ui.desktop.IDesktop;
import org.eclipse.scout.rt.client.ui.desktop.outline.IOutline;
import org.eclipse.scout.rt.client.ui.desktop.outline.pages.IPage;
....


public class Desktop extends AbstractDesktop implements IDesktop {

private static IScoutLogger logger = ScoutLogManager.getLogger(Desktop.class);

public Desktop() {
}
...
@Override
protected void execOpened() throws ProcessingException {
...
}
...

@Order(22.0)
//option in Menu Bar
public class SwitchLDAPLibrary extends AbstractMenu {

private boolean mozillaL = true;

@Override
protected String getConfiguredText() {
return "Switch LDAP Library";
}

//// //!!Why does this not work, later after loading the Desktop View the first time, when we try to load again this Desktop View!!?

@Override
public void execAction() throws ProcessingException {

//!! maybe "getChildActions()" is the misused critical one
MozillaLibrary mozL = (MozillaLibrary) this.getChildActions().get(0);
ApacheLibrary apaL = (ApacheLibrary) this.getChildActions().get(1);

mozL.getConfiguredText();
apaL.getConfiguredText();

ArrayList<IMenu> newChildActions = new ArrayList<IMenu>();
newChildActions.add(0, mozL);
newChildActions.add(1, apaL);

this.setChildActions(newChildActions);

}

@Order(100.0)
//suboption1 in Menu Bar
public class MozillaLibrary extends AbstractMenu {


@Override
protected String getConfiguredText() {
...
return text;// variable 'text' is different depending on the casuistry
}

@Override

//!!!when this MozillaLibrary submenu is clicked calls this execAction(),
// which calls parent SwitchLDAPLibrary.this.execAction(); ->

public void execAction() throws ProcessingException {
mozillaL = true;
SERVICES.getService(ILDAPOutlineService.class).switchToMozillaLDAPLibrary();
SwitchLDAPLibrary.this.execAction();
}
}

@Order(120.0)
//subtion2 (analogous to the suboption2) in Menu Bar
public class ApacheLibrary extends AbstractMenu {
....
}

}

}
Re: Update the Client view any time later after the first time? [message #1062234 is a reply to message #1062194] Thu, 06 June 2013 16:05 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
I am not sure I understood exactly what you are doing, but I wanted to provide feedback on the getConfiguredXxxx() vs setXxxx() methods.

The default pattern is that getConfiguredText() returns the initial values of your Text (kind of declarative pattern). During initialization of your Menu, the setter setText(..) will be called with the value returned by getConfiguredText().

To do something that is more dynamic you should call setText(..) directly.

If you want something that is mode dynamic, why don't you call setText(..) directly. You can do it in execInitAction() [called once at initialization equivalent to getConfiguredText()], in execPrepareAction() [hook method called every time the menu will be displayed] or if you know when the text should change you can do it then.

I just tried it. It works perfectly fine with Swing. With SWT it is a little more complicated (if you want to add a menu in the RCP Workbench): this is something we do not support yet (maybe things might be easier when we moved to e4).
icon14.gif  Re: Update the Client view any time later after the first time? [message #1062721 is a reply to message #1062234] Mon, 10 June 2013 13:44 Go to previous message
Ferran Siles Vila is currently offline Ferran Siles VilaFriend
Messages: 11
Registered: March 2013
Junior Member

Hello Jeremie,

Thank you so much for your feedback.
It works. Smile

Best
Previous Topic:renaming/deleting services in scout view
Next Topic:Scalability
Goto Forum:
  


Current Time: Sat Apr 27 01:55:12 GMT 2024

Powered by FUDForum. Page generated in 0.03591 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top