LWUIT Container capture event - lwuit

I have a Containerwith so many Labels added inside it. When I try to capture the pointerReleased event in this Container, I have found some problems. The event only is captured when I released in the free area of the Container, no when I made the release over the Labels. Is there any way to encapsulate this event? I mean when I will do the realase over the main Container(instead I'm on a Label), the event must be launched.
Here you can take a look at my Container

You should look at the lead component feature added in LWUIT 1.5, it allows you to define a component that manages the entire hierarchy of container/component and all events for every component in the hierarchy are sent to it.
This adds another benefit of handling the style synchronization between all the different elements (e.g. if you use a button all components will become pressed together).

I dont' find any cool solution, so finally I propagate the pointerReleased from the Labelsto the Container.

Related

gtm.start firing twice (or more) on the same page causing two Container Loaded events

I have an issue on any page within a specific domain, where for every page load I have two Container Loaded events. Now this wouldn't bother me normally, but the DataLayer object I need only loads in the second gtm.start event, while my tag fires on the first gtm.start, so that the DLV is undefined when I need it.
Can I do anything GTM-side so that the DLV populates on the first Container Loaded event?
enter image description here
The container loaded more times than needed.
I think the problem is your website has 3 GTM installed. So the sequence here is very important.
You might need to check with your engineer or you can do it yourslef.
Currently the order looks like:
GTM-A.js
Datalayer you need
GTM-B.js
GTM-C.js
So I would recommend your order should adjust to
Datalayer you need
GTM-A.js
GTM-B.js
GTM-C.js
The core idea is make your datalayer push before any gtm.js code. This would make sure the GTM containers detect the datalayer you need when loading.
Otherwise. Make the datalayer push with an event name. So you can make your page_view event with that datalayer event.
But not very recommend this way. Only if you can not modify the order.

eclipse RCP4 Add Toolbar to Parts

How to model a toolbar ONCE and render it in some Parts/Views (not in the default place which is the window!)? Using the model level (and maybe Addons?)
I have currently
Eclipse 2022.03-4.23
Application.e4xmi with that Toolbar but
Gets added dynamically using an Addon that listens to "PART_ADDED" event topic which
Leads to a NPE due to other event topic "UIEvents.Part.TOPIC_TOOLBAR" within a framework method in a class called LazyStackRenderer
So the guy before me had written an Addon to dynamically add the Toolbar to the parts. Maybe to make the buttons save/print per part or because the main layout has two stacks and only the parts stack is relevant.
Appreciate any help! I searched a lot but no success!
I solved it so far. The dynamically created MParts were not added as children to the container (in my case the PartStack) in the first place and also had to comment the adding of placeholder objects that carry the same information of the parts. This dynamic step was done as a reaction to the topic #UIEventTopic(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE) in some written Addon.
I am not a 100% sure that discarding the placeholders is safe but still this is the best trail I have ever reached.
I hope this would help others!
Thank you #greg-449

Where to put state that's needed by different GWT activities?

I'm currently working on a GWT application and I'm still a little fuzzy on how it all fits together (the joy of having to make changes without first coming to an understanding of the whole framework, although that might be difficult anyway).
We have a few Activities that all correspond to parts of the UI (e.g. main content, a toolbar and a list of things). I'm not really sure whether that's even how Activities are intended but I guess I can't really change that easily now. My problem now is that the list of things holds state (the current selection) that the main content also needs and in a way the toolbar too (at least the toolbar currently has it – I'm beyond asking).
But what would actually be an appropriate place to store that? I guess coupling the actual view implementations together and storing the selection only in the list isn't such a bright idea.
I see two main solutions here:
keep the state within each activity and keep them synchronized through events (on the EventBus). That is: the "list of things" has a current selection, main view has one too, so does the toolbar; and each time that value changes, the activity that's making the change fires an event on the event bus so that the other activities can update their state, so that all activities have the same value in their own state.
use a singleton object (if you're using GIN and dependency injection, simply annotate the object with #Singleton and inject it in all the activities) to keep the state at a central place. The activities register event handlers on the state holder object to be notified when it changes. That is, each time an activity calls setCurrentSelection (for example), an event is fired (for example a ValueChangeEvent), and because all activities listen for it, they can update their view or whatever depending on the new value. You can choose to either dispatch the event on the event bus (similar to the PlaceController) or have the state holder implement HasValueChangeHandlers. Just make sure to unregister the handlers when the activities stop to avoid memory leaks (dispatching on the event bus makes it easier: simply register the handlers on the bus passed as argument to the start method and they'll be unregistered automatically when the activity stops, and you don't even have to think about it).
Actually, PlaceController is a good example of such shared state (the current place).

GWT UiBinders Interaction between modules

Im new to GWT, this should be a simple question i hope.
Imagine that i made two Uibinders Modules or two independent widgets.(this a simplify example to expose my problem)
one is a set of buttons (ButtonPanel) and the other image to been show when i press a button from the previous panel(ImagePAnel) with a label to be the title of the image.
How can i reach the wiget the imagePanel to actuate when there are a handler click from the buttons in the (ButtonPanel)
Thanks for the help.
I recommend you to use MVP Pattern for Development and add all events in the Presenter.
Or Else you can use the following technique within the UIBinder's Java File
#UiHandler(value={"openButton"})
public void onOpenButtonClick(ClickEvent clickEvent){
//ADD THE BUTTON LOGIC HERE
}
Just Create an Object of the Images & the ImagePanel to be loaded and add it on button click using this.
I can't say I understand exactly what you are trying to accomplish but in general the best way for different components in a GUI application to communicate is to use the eventbus pattern. There's one global Eventbus object in the application that lets components subscribe to a specified type of event that are fired from any place in your application. This way you avoid spaghetti code and your components are loosely coupled.
http://code.google.com/webtoolkit/articles/mvp-architecture.html#events
I typically create a third component that is the container for the Button and Image components you defined. This component sets itself as a callback for the two and contains logic to integrate the two.

GWT MVP - maintaining multiple displays that are separate of one another

I have a GWT App and I am using GWT MVP with Places / Activities.
My application layout is something like
MENU | CONTENT
The Menu and the Content displays will change dynamically and one changes separately from the other. What I mean by this is that when the Content display changes I do not want to have to update the Menu display and vice versa. Both displays need to be able to respond to PlaceChangeEvents and update themselves when these occur. The problem is that each display should only update in response to certain PlaceChangeEvents, ignoring PlaceChangeEvents that are directed at the other display. However this does not work using the 'standard' GWT MVP pattern because even when each display has it's own ActivityManager they will automatically pick up ALL PlaceChangeEvents because there is a single PlaceController listening on a single EventBus. The only way I can see to do this is by having two EventBus's and two PlaceControllers - one for the Menu and one for the Content. So my question is whether this is a good solution or is there a simpler/better way that I am missing? One problem with this solution is that the PlaceHistoryHandler can only be registered with one of the EventBus's.
Place changes are actually controlled by ActivityMappers. They get a Place and return the corresponding Activity. This is where you control how Places are mapped to Activities:
You need to create two ActivityMappers (MenuActivityMapper, ContentActivityMapper) and then instantiate two ActivityManagers each with it's own ActivityMappers. Then for each ActivityManager you call setDisplay(AcceptsOneWidget display) where for each you pass in an area (display) where it will show it's content.
For menu you will probably only use one Activity, since it's available in all Places. So MenuActivityMapper.getActivity() will always return the same instance of the MenuActivity. To enable MenuActivity to still adapt it's look based on place changes, MenuActivity should listen to PlaceChangeEvents.