Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 25 10:31
    TDesjardins commented #75
  • Aug 24 10:52
    FrankHossfeld closed #75
  • Aug 24 10:52
    FrankHossfeld commented #75
  • Aug 24 10:52

    FrankHossfeld on 75

    (compare)

  • Aug 24 10:52

    FrankHossfeld on development

    #75 - Global caching and normal… Merge branch 'issue/75' into de… (compare)

  • Aug 24 10:51

    FrankHossfeld on 75

    #75 - Global caching and normal… (compare)

  • Aug 24 10:37
    FrankHossfeld commented #75
  • Aug 24 09:40
    FrankHossfeld closed #76
  • Aug 24 09:40
    FrankHossfeld commented #76
  • Aug 24 09:40

    FrankHossfeld on 76

    (compare)

  • Aug 24 09:40

    FrankHossfeld on development

    #76 - Add time stamp to generat… Merge branch 'issue/76' into de… (compare)

  • Aug 24 09:39

    FrankHossfeld on 76

    #76 - Add time stamp to generat… (compare)

  • Aug 24 06:52
    FrankHossfeld milestoned #76
  • Aug 24 06:52
    FrankHossfeld assigned #76
  • Aug 24 06:52
    FrankHossfeld labeled #76
  • Aug 24 06:52
    FrankHossfeld opened #76
  • Aug 23 14:23
    FrankHossfeld milestoned #75
  • Aug 23 14:22
    FrankHossfeld labeled #75
  • Aug 23 14:22
    FrankHossfeld assigned #75
  • Aug 23 14:22
    FrankHossfeld opened #75
Frank Hossfeld
@FrankHossfeld
@schubec_twitter please test #66
Frank Hossfeld
@FrankHossfeld
@schubec_twitter HI, just checked the start-method of a AbstractComponentController. The component is attached and I am able to search for a div with id ‚myId‘. Can you provide the code of the PayPal button.
Frank Hossfeld
@FrankHossfeld
problem seams not related to Nalu.
schubec
@schubec_twitter
@FrankHossfeld There is no 1.3.2 (-Snapshot) in Maven Central
Frank Hossfeld
@FrankHossfeld
@schubec_twitter Mmmh, surprising ... I see, that 1.3.2-SNAPSHOT is deployed ... please can you verify it using this version: 1.3.2-SNAPSHOT
schubec
@schubec_twitter
NOW, it works, but 20 minutes ago, it did not.
thanks
schubec
@schubec_twitter
something is strange. i deleted all caches, i have snapshot 1.3.2, but the getRoute() is missing.
But i see it in your commit on github
so it must be a local problem
Frank Hossfeld
@FrankHossfeld
Can you see the getRoute method in the event class of the artifact?
schubec
@schubec_twitter
no. but i will try tomorrow or so again. last time i waited for changes in Domino which Ahamad pushed and I got then 5 hours later. don't know...
schubec
@schubec_twitter
Today I have getRoute()in the event - thank you!
A new question occured:
Could it be, that:
In Controllers I am using this.handlerRegistrations.add( to add EventBus Listeners
Nalu takes care of "destroying" those listeners, when the component is changed. That does work.
But: When I logout of my application, I change the SHELL to /login/login, then I re-login to /application/mycontroller and then my Navigation Controller with the menu items comes back to live but the event handlers are added AGAIN

so now when I am listening for

        this.handlerRegistrations.add(
            eventBus.addHandler(RouterStateEvent.TYPE, evt -> {
                if(evt.getState() == RouterState.ROUTING_DONE) {
                    getComponent().setHighlightMenuitem(evt.getRoute());

                }

            })
        );

the setHighlightMenuitemis called twice

am i doing something wrong or is that a bug?
Frank Hossfeld
@FrankHossfeld
@schubec_twitter No, you are not doing something wong and it is not a bug. In case you route to new hash with different shells, I expect these two events.
Please confirm, that the route of the first event is ‚/myShel/"‚ and of the second event is „/myShell/myRouteToController/"
We can discuss to suppress the first event.
schubec
@schubec_twitter
I have to test on Monday. I THINK if I logout/login 3 times, I get 3 events
But I will check and get back to you
Also: you have STATE, why not 1 event and state Shell changed and 1 routed
I am on mobile, so typing is hard...
Frank Hossfeld
@FrankHossfeld
There, where the events get fired, it is not clear why a routiung occurs …
schubec
@schubec_twitter
Hi! I just tested it. I think there are way too many events. I will send you a PM.
schubec
@schubec_twitter

Hi! I am using the Nalu eventbus (SimpleEventbus) and it's events. I have an event like

import org.gwtproject.event.shared.Event;

public class UserChangedEvent extends Event<UserChangedEvent.EventHandler> {
    public static Event.Type<UserChangedEvent.EventHandler> TYPE = new Event.Type<>();
    private final User user;

    public UserChangedEvent(User user) {
        this.user = user;
    }

    @Override
    public Event.Type<UserChangedEvent.EventHandler> getAssociatedType() {
        return TYPE;
    }

    @Override
    public void dispatch(UserChangedEvent.EventHandler handler) {
        handler.onUserChanged(this);
    }

    public User getUser() {
        return user;
    }

    public interface EventHandler {
        void onUserChanged(UserChangedEvent event);
    }
}

I wanted to make it generic, so instead of a "User" I have a <T>. So I changed the code to:

public abstract class ModelChangedEvent<T> extends Event<ModelChangedEvent.EventHandler<T>> {
    public static Event.Type<ModelChangedEvent.EventHandler<T>> TYPE = new Event.Type<>();
    private final T model;

    public ModelChangedEvent(T user) {
        this.model = user;
    }

    @Override
    public Event.Type<ModelChangedEvent.EventHandler<T>> getAssociatedType() {
        return TYPE;
    }

    @Override
    public void dispatch(ModelChangedEvent.EventHandler<T> handler) {
        handler.onModelChanged(this);
    }

    public T getModel() {
        return model;
    }

    public interface EventHandler {
        void onUserChanged(ModelChangedEvent<T> event);
    }
}

but that does not compile. I tried all possible combinations I guess. Here is a Screenshot, so you can "see" the problem:

image.png
Is the Nalu/SimpleEventbus capable of generic Models?
From my git repo, i dug out an 8 years old code, which used to have generics:
package com.schubec.sgwt.client.buses.events;

import java.util.ArrayList;
import java.util.List;

import com.schubec.sgwt.client.models.SchubecModel;
import com.schubec.sgwt.client.models.UserModel;

public abstract class SchubecModelEvent<S extends SchubecModel> extends BroadcastableEvent<SchubecModelEventHandler<S>> {

    private ModelsChangeType type;
    private List<S> models = new ArrayList<S>();

    public SchubecModelEvent() {
        super(null);
    }

    public ModelsChangeType getModelsChangeType() {
        return type;
    }

    public SchubecModelEvent(ModelsChangeType type, S model, UserModel source) {
        super(source);
        this.type = type;
        this.models.add(model);
    }

    public SchubecModelEvent(ModelsChangeType type, List<S> models, UserModel source) {
        super(source);
        this.type = type;
        this.models.addAll(models);
    }

    protected void setChangeType(ModelsChangeType type) {
        this.type = type;
    }

    protected void setModels(List<S> models) {
        this.models = new ArrayList<S>(models);
    }

    @Override
    protected void dispatch(SchubecModelEventHandler<S> handler) {
        switch (type) {
        case Created:
            handler.onModelsCreated(models);
            break;
        case Modified:
            handler.onModelsModified(models);
            break;
        case Removed:
            handler.onModelsRemoved(models);
            break;
        }
    }

    public List<S> getModels() {
        return new ArrayList<S>(models);
    }
}
So I know, that event bus should support generics. But I think it uses a different approach (The 8 year old code is not from me).
So, (how) can I use generics with Nalu/SimpleEventbus? Thank you!
Frank Hossfeld
@FrankHossfeld
Hi @schubec_twitter
Nalu uses the classes from the gwt-event module migrated by Thomas Broyer. So, this problem is related to gwt-event and not to Nalu.
And please can you test the event handler problem. THink, it is solved.
Frank Hossfeld
@FrankHossfeld
Not sure, if this is the problem (can't test it atm) but I think it must be: public interface EventHandler<T>...
schubec
@schubec_twitter

Not sure, if this is the problem (can't test it atm) but I think it must be: public interface EventHandler<T>...

Hi! Yes, already tried that. The problem is somewhere else I think:

public static Event.Type<UserLoadedEvent.EventHandler> TYPE = new Event.Type<>(); cannot be extended by a generic type <T>, because it is static
but i do not know how to solve that.
schubec
@schubec_twitter
seems like Generics are not possible here.
Frank Hossfeld
@FrankHossfeld
have you tried: public static Event.Type<UserLoadedEvent.EventHandler<T>> TYPE = new Event.Type<>(); cannot be extended by a generic type <T>, ?
schubec
@schubec_twitter
i tried that, but i get: cannot make a static reference to the non-static type t
I think this is just not possible with static/generics
I looked at the old code from 9 years ago. what i just noticed, this is an abstract class.
so i think, it was not possible 9 years ago and it is not possible now.
schubec
@schubec_twitter

And please can you test the event handler problem. THink, it is solved.

Yes, works. Thank you!

Frank Hossfeld
@FrankHossfeld
/@all anybody using the plugin feature atm in Nalu based projects?
schubec
@schubec_twitter
@FrankHossfeld I am NOT using the plug-in feature.
Raúl Pampliega Mayoral
@RaulPampliegaMayoral
@FrankHossfeld we are Not using it too
Frank Hossfeld
@FrankHossfeld
So, no need to replace it in the next major version …