-
21 May 2008 6:00 AM #1
[CLOSED] [beta3] Generics for AppEvent missing in View and Controller
[CLOSED] [beta3] Generics for AppEvent missing in View and Controller
Hi,
am I wrong or shouldn't the class AppEvent be typized with inherited classes of Object in the definitions of:
protected void View.fireEvent(AppEvent event)
public abstract void Controller.handleEvent(AppEvent event)
Otherwise, it would not be possible to use typization in overridden methods of inherited classes of View and Controller.
Can you pls. confirm?
Thanks,
Joachim
-
21 May 2008 7:14 AM #2
Similiar in class Validator
Similiar in class Validator
I think the same holds true for Validator.validate(final Field field, final String value), where Field should support generics in the class Validator.
-
21 May 2008 7:23 AM #3
Similar problem for StoreSorter
Similar problem for StoreSorter
should probably readCode:StoreSorter.compare(Store store, ...
Code:StoreSorter.compare(Store<M> store, ...
-
21 May 2008 9:50 AM #4
First, these issues are not bugs. This post belongs in Open Discussion.
No, you can define your data type in your listener. It does not matter that the event was created without specifying a type.am I wrong or shouldn't the class AppEvent be typized with inherited classes of Object in the definitions of:
protected void View.fireEvent(AppEvent event)
public abstract void Controller.handleEvent(AppEvent event)
No, the validator validates the raw string value, not the typed value.I think the same holds true for Validator.validate(final Field field, final String value), where Field should support generics in the class Validator.
Yes, I have made the change.StoreSorter.compare(Store store, ...
should probably read StoreSorter.compare(Store<M> store, ...
-
26 May 2008 8:58 AM #5
Darell,
sure, we can continue the thread in Open Discussion. Let's use http://extjs.com/forum/showthread.ph...337#post173337 for that.
Frankly, I am not sure I understood your remark on AppEvent. Could you please elaborate on this?
I understand that I can override handleEvent for a non-typized AppEvent argument and then just cast it into a class. However, this would not be the ideal way IMHO and also gives a warning I would like to avoid if possible.
Thanks,
Joachim
-
26 May 2008 1:51 PM #6
I have changed Validator to use generics:I think the same holds true for Validator.validate(final Field field, final String value), where Field should support generics in the class Validator.
Code:public interface Validator<Data, F extends Field<Data>> { /** * Validates the fields value. * * @param field the field * @param value the value to validate * @return <code>null</code> if validation passes, otherwise the error * message */ public String validate(F field, String value); }I am not sure I understand what you are asking. handleEvent needs to work with multiple events and data types. It does not make sense to have to pass the data type in the class declaration. Are you suggesting:Frankly, I am not sure I understood your remark on AppEvent. Could you please elaborate on this?
public abstract class View<Data> {
protected abstract void handleEvent(AppEvent<Data> event);
}
-
28 May 2008 10:28 PM #7
Go to the open discussion
Go to the open discussion
I suggest using wildcard for View and Controller handleEvent method. See http://extjs.com/forum/showthread.php?p=173337
-
29 May 2008 4:00 AM #8
Darell,
thanks for your reply. No, I was not suggesting the code you provided, but rather wildcards as zaccret proposed, i.e.:
public abstract class View {
protected abstract void handleEvent(AppEvent<?> event);
}
-
12 Jun 2008 1:24 AM #9
It has been fixed in Controller class in beta5 but not in View class.
-
12 Jun 2008 5:29 AM #10
I agree, a fix for View as well would be great. Thanks!


Reply With Quote