Kendo UI - Difference between observable, ObservableObject and Model - object

What are the differences between the observable, ObservableObject and Model?
Thank You.

Model inherits from ObservableObject which inherits from Observable.
Observable provides support for events - the bind, unbind and trigger methods.
ObservableObject provides change tracking. Used by the DataSource and the MVVM framework.
Model provides identity (via the id field) and field definition. Used by the DataSource when schema.model is set.

Related

Implement Serializable in BaseLanguage Class

How can I implement Serializable in a class in BaseLanguage?
What I did so far:
Using MPS 3.3.4
Create new solution Project
Add new Model
Add module.JDK#project_stub as Dependency
Add jetbrains.mps.baseLanguage as Used Language
Add new Class
Trigger implements in editor.
Trigger AutoComplete
The editor now shows a list of available interfaces from java.lang namespace, like Clonable, Comparable and so on. However, there is no Serializable. The same behavior emerges when I try to implement Serializable in a Generator.
Is this a bug or am I missing something?
You perhaps did not import the java.io#java_stub model to your dependencies. Control + M while in the editor will do the job.
Vaclav

UML diagram: How to show interface that is implemented by most of the Classes in my class diagram

I have a interface like:
public interface MyEntity {
//HIbernate version
public long getOptLock();
//these method are used to keep track of Last modified timestamp
public void update();
public void persist();
}
Which is implemented by most of the classes in my object model. Now, i know how to show a interface realisation in a Class diagram.
The problem is since this particular interface is implemented by most of the classes it is making the class diagram cluttered. Is there a altenative way to show interface realisation?
The alternative way is to use the lollipop notation, right above every class that implements the interface:
See this image from msdn website.
For the full article see this link.

Should this be considered as a class in UML class diagram or as a type?

I am creating the class diagram for my project. I will use some WebViews in a class. My question is:
Should I write the WebView class in my UML class diagram or can I only use a WebView as a type?
For example, if a have a string: String a, in my class diagram, I will put a : String in the class attributes, but if I have WebView wv in my class, can I do the same as for the string and write in the class attributes: wv: WebView or I have to write the WebView class and then make an association with my class?
Short answer: you can do either.
Longer answer: UML doesn't constrain what you do here. There is no rule that says what types can be used as the value of attributes vs. what must be shown as associations.
Longest answer is actually a question: what do you want to communicate with the diagram? Class diagrams are good for showing structure - the links (associations) among classes. So: is the association between your class and your Webview instance interesting? For example, does the same instance of WebView also relate to some other object? Is there anything about that relationship that's interesting? Can the WebView instance outlive the instance of your class? And so on.
hth.

inheriting a GUI class in LWUIT 1.5

I'm trying to inherit a class that I made in the GUI Resource Editor of Lwuit to extend some functionality. I want to do something like:
public class MyCustomGUIForm extend CustomGUIForm{...}
Where CustomGUIForm its a Form that I create in the Resource Editor. Any idea??
I am going to explain you what I do for extend some functionallity in the Formsthat I create with the Resource Editor.
When you build a NetBeansProject with the Resource Editor, you get a StateMachine class wich allows you to modify/add some aspects of your apps navigation.
In the StateMachine class you can find a lot of methods related to the elements that you create in the Resource Editor.
For example:
You create a Form in the Resource Editor, called CustomGUIForm. After you save the .res, you should find some methods in the StateMachine class called beforeCustomGUIForm postCustomGUIForm and exitGUIForm, with this methods you can use the Form and add some functionality. You can observe that in StateMachine there are other methods for Commands that you build in the Resource Editor, ActionListeners, etc etc. Take a look to the overriden methods for the StateMachine, they could be usefull for you.
Let me know if you have more questions
While jmunoz gave the better answer for this just for completeness you can indeed inherit and override any component created by the resource editor.
In your Statemachine override:
protected Component createComponentInstance(String componentType, Class cls) {
if(cls == Form.class) {
return new MyFormInstance();
}
return null;
}
There is one drawback in this approach, all forms will now be MyFormInstance. This is or usable for some use cases and not so much for others.

Seam #Name on entity classes?

I've first seen annotating Seam entity classes here
http://www.developer.com/java/ejb/article.php/10931_3715171_5/Introducing-JBossreg-Seam.htm
and for whatever reason I've been doing so ever since:
#Entity
#Table (name= "GADGET")
#Name("gadget")
public class GadgetBean implements Serializable {
private String mDescription = "";
private String mType = "";
...
}
However, I do not use "entity components" like this anywhere in my views. Can anyone explain the use of this and what this gains? Is it a non-practice?
If you are not using any of these entity components in your views, you should remove the #Name annotation.
Seam is great, but seam components come with overhead in the way of interceptors firing every time you access a method in that class. Since you are not accessing these attributes in your view, there is no need to make them into seam components. You are incurring the interceptor overhead every time you use a getter or setter from your entity beans.
Seam-gen, the tool used to create seam projects, can also generate entities that are reverse-engineered from your database tables. By default, the seam-gen entity generator does NOT add the #Name annotation to these classes. That should tell you something!
Hope this helps.

Resources