PojoUi

I am just starting using Annotations, however I am trying to involve them in my coding as much as I can. One way I found is to develop a simple framework (which I hope to put it on-line an open-source project once I develop the first simple rules about it).
My idea is to generate automatically the visual aspect of an application using the MVC concept. This I thought that could be done by using annotations both in the Controller and the Model classes.
I thought that the class declaration could be as follows:
@UIContainer(id="onePanel")
public class MyModel{
}and for example in the Model class the code could be something like this:
@UIObject(type="JTextField", id="oneTextField",
     x=20, y=20, width=100, height=20
     controler="package.ClassName.methodName");
     value="this")
public String getName(){
     return this.name;
public void setName(String name){
     this.name = name;
}Now as you can see the above code is not a very good implementation. Now a big issue I am facing is that I want the framework the generate the UI
interface at run time rather then at compile time.
But my 'What if's never stop! I imagine when the user will want a button on his User Interface which will update a JTextField value (which would have also been generated by the framework). In that case I thought that some of the controller code could be as follows:
@UIObject(type="JButton", id="OneButton",
     x=20, y=20, width=100, height=100
     controler="null");
     value="Reset")
public void resetUserNameTextFieldValue(){
     // Here id my problem.
     onePanel.txtOne.setText("");
}I know perfectly that the code above will never run. First of all the generated objects (onePanel, txtOne) are no were created then in run time, and thus at compile time they do not exists!
I know that the framework I would like to develop could be stupid and unrealistic (in which case please tell me). I also do understand that i=even if possible, the way I am planning it would leave out much of the items provided by swing (Layouts, Borders, etc.).
However do you think something like the above is possible? Do you think that the compiler could be avoided from raising such errors? and also do you know if something like this already exists? so hopefully I could stop hearting my little brain ;) :)
Thanks in advance for any suggestions (even insulting one at the above idea, since that is one way of learning stuff after all :).

So you want to add Annotations to your business object that describe a UI for editing it? The idea itself isn't to bad, IMHO, but it got some flaws:
- What if any object has more than one UIs?
- How do you define more complex UIs?
I'd move the UI definition into an external file (take a look at Glade for C(++)/GTK or XUL from Mozilla for real-world examples). That way you can change the UI without the need to change the business objects.
And sending those files would probably be easier than sending the classes + Annotations in a sensible/compatible manner.
And an implementation-specific sidenode: Why is type a String and not a Class?

Similar Messages

Maybe you are looking for

  • 11.1.2.3 install issue

    I have just installed 11.1.2.3 Foundation only (so far) and have run through the configuration of SS and deployment to the app server.  I am able to start the WebLogic domain and access the WL admin console, but I'm unable to start any of the EPM win

  • Edit in Photoshop CS6 from LR4

    When I want to bring 2 images at once into Photoshop CS6 in order to put them side by side, I've tried Edit in & Open as Layers in Photoshop.  Then created a new canvas for these 2 images but don't know how to bring them into canvas.   The images see

  • Org.Unit   updated  regularly from HR ? :-(

    Hi guys, Just to be sure: 1. I can create a new org. unit (initially) from HR module right ? 2. If yes, Is it possible to maintain just 1 structure ? Ex: if a new department is created in HR, the change should be replicated to SRM automatically. Is i

  • Where can I get the patch for Oracle JMS to work with RDBMS 9.2.0.1

    Hi, In the following extract from Oracle documentation the patch is mentioned that needs to be applied. "You must apply a server-side patch for Oracle JMS, which ships with Oracle9iAS Release 2 (9.0.3) and the OTN release of OC4J, to work with an RDB

  • How to call two variable which are hold multiple value  in to for loop

    hi, i have 4 item ,Two Select List And Two Check Box .Class id And Section are select list and student id and subject id are check box .i want to insert More then one subject id in to table corresponding to more then one student id . eg. when i selec