[OPEN-144] Refactor EditForm and EditWindow to be extensible

Request new features or modifications for Extensible components

[OPEN-144] Refactor EditForm and EditWindow to be extensible

Postby r_honey » Fri Dec 17, 2010 2:47 am

EventEditForm and eventEditWindow currently seem to be designed as a sample that can be replaced if required.

However, both these classes provide a lot of routine plumbing and it would make sense to make these classes Extensible to re-use the existing functionality, and override methods where required.

Here are 2 quick changes that I propose for both these classes:
1) The UI is created inside initComponent or onRender methods. Both these classes should have a method called "createInterface" (or whatever seems suitable), and all Fields should be instantized in the new method. This new method should be called from initComponent or onRender.

This allows us to override the method and create custom fields (apart from the ones required by the Panel).
You need to call base class' initComponent and onRender from derived classes and so its not possible to extend both of these and override the appropriate method.

2) Similar to 1) above, the Footer bar should also be created in a custom method, which should be called from the place where the bar is created now.
r_honey
 
Posts: 62
Joined: Mon Dec 13, 2010 1:37 pm

Re: Refactor EventEditForm and EventEditWindow to be extensi

Postby brian.moeskau » Fri Dec 17, 2010 10:18 am

Yeah, I already have plans to redo these classes, but it will not happen before 1.0. My current thought is to create a base EventEditor class that both the window and form will extend, and that base class will contain all the shared plumbing code. That will make it much easier to create new custom editor views as well.
Personal Blog: Extraneous / Twitter: @bmoeskau / Meetup: Austin Bleeding Edge Web
User avatar
brian.moeskau
Site Admin
Site Admin
 
Posts: 1344
Joined: Sat Sep 18, 2010 5:00 pm
Location: Austin, Texas

Re: [OPEN-144] Refactor EditForm and EditWindow to be extens

Postby r_honey » Fri Dec 17, 2010 10:28 am

Thanks for the update. I read somewhere 1.0 is planned in February, so I thought this might get implemented before that. It would be good to have this, whenever possible.
r_honey
 
Posts: 62
Joined: Mon Dec 13, 2010 1:37 pm

Re: [OPEN-144] Refactor EditForm and EditWindow to be extens

Postby brian.moeskau » Fri Dec 17, 2010 10:33 am

The planned date is Feb. 1. There's a LOT to do before then, including an existing bug list (and coding is only part of it). If I end up ahead of schedule I may take a look at this. This close to a release it's usually a bad idea to change core functionality even if it sounds simple.
Personal Blog: Extraneous / Twitter: @bmoeskau / Meetup: Austin Bleeding Edge Web
User avatar
brian.moeskau
Site Admin
Site Admin
 
Posts: 1344
Joined: Sat Sep 18, 2010 5:00 pm
Location: Austin, Texas

Re: [OPEN-144] Refactor EditForm and EditWindow to be extens

Postby r_honey » Fri Dec 17, 2010 11:22 am

Thanks for the update Brian...
r_honey
 
Posts: 62
Joined: Mon Dec 13, 2010 1:37 pm

Re: [OPEN-144] Refactor EditForm and EditWindow to be extens

Postby r_honey » Sat Feb 19, 2011 2:27 pm

Hi Brian, Any update on when can this request be considered??
r_honey
 
Posts: 62
Joined: Mon Dec 13, 2010 1:37 pm

Re: [OPEN-144] Refactor EditForm and EditWindow to be extens

Postby brian.moeskau » Sat Feb 19, 2011 7:09 pm

1.0 final should be out within the next week or so (a little behind the original schedule). The priority for 1.1 will be getting recurrence implemented. While improving the edit views is important, it's not critical -- they can be easily overridden today as needed, it's just not as convenient as it could be. So it's still on the list, but not at the top at the moment.
Personal Blog: Extraneous / Twitter: @bmoeskau / Meetup: Austin Bleeding Edge Web
User avatar
brian.moeskau
Site Admin
Site Admin
 
Posts: 1344
Joined: Sat Sep 18, 2010 5:00 pm
Location: Austin, Texas

Re: [OPEN-144] Refactor EditForm and EditWindow to be extens

Postby r_honey » Sun Feb 20, 2011 3:15 am

Thanks for the update Brian...
r_honey
 
Posts: 62
Joined: Mon Dec 13, 2010 1:37 pm

Re: [OPEN-144] Refactor EditForm and EditWindow to be extens

Postby alaindeseine » Mon Feb 21, 2011 10:32 am

EventEditForm.js
(11.72 KiB) Downloaded 3808 times
Hi Brian,

I get into the same problem of adding "custom" fields to the event edit form.

Here is my solution to achieve this in less than 10 lines of code.

This solution preserve the original code and take advantage of existing mechanisms.

Modifications create two new property (customLeftFields and customRightFields). These properties are array of fields, and if not empty they are added at the end of the "rightFields" and "leftFields" local vars of the initComponent method.

I attach the modified source file to the post.

I hope you will find this piec of code cool and if you can add it to the project.

Here is the implementation :
Code: Select all
...

         Ext.ensible.cal.EventMappings = {
            // These are the same fields as defined in the standard EventRecord object but the
            // names and mappings have all been customized. Note that the name of each field
            // definition object (e.g., 'EventId') should NOT be changed for the default fields
            // as it is the key used to access the field data programmatically.
             EventId   : {name: 'event_id', mapping:'event_id', type:'int'}
            ,CalendarId   : {name: 'calendar_id', mapping: 'calendar_id', type: 'int'}
            ,Title      : {name: 'title', mapping: 'title'}
            ,StartDate   : {name: 'start_date', mapping: 'start_date', type: 'date', dateFormat: 'c'}
            ,EndDate   : {name: 'end_date', mapping: 'end_date', type: 'date', dateFormat: 'c'}
            ,RRule      : {name: 'reccurence_rule', mapping: 'reccurence_rule'}
            ,Location   : {name: 'location', mapping: 'location'}
            ,Notes      : {name: 'notes', mapping: 'notes'}
            ,Url      : {name: 'url', mapping: 'url'}
            ,IsAllDay   : {name: 'all_day', mapping: 'all_day', type: 'boolean'}
            ,Reminder   : {name: 'reminder', mapping: 'reminder'}
       
            // We can also add some new fields that do not exist in the standard EventRecord:
            // Here you add your "custom" field definition for the store
            ,custom      : {name: 'custom', mapping:'custom'}
         };

         // Here you implement the custom field
         var customField = new Ext.form.TextField({
             fieldLabel   : 'Custom field'
            ,id      : 'custom'
            ,name      : 'custom'
            ,anchor      : '90%'
         });
         
         this.calendar   = new Ext.ensible.cal.CalendarPanel({
             xtype         : 'extensible.calendarpanel'
            ,eventStore      : this.eventStore
            ,calendarStore      : this.calendarStore
            ,border         : false
            ,id         :'app-calendar'
            ,region         : 'center'
            ,activeItem      : 4 // month view
            ,editModal      : true
                           
                           // And here you pass th ecustom field to the new property "customLeftFields" to the edit form via the "editViewCfg" property.
                           ,editViewCfg      : {
                               customLeftFields   : [customField]
                           }
      ...
      }



Best regards,

Alain Deseine.
alaindeseine
 
Posts: 45
Joined: Sat Oct 30, 2010 7:04 am
Location: BUHY, France

Re: [OPEN-144] Refactor EditForm and EditWindow to be extens

Postby r_honey » Mon Feb 21, 2011 11:00 am

Thanks Alian for sharing the code, but this is not quite how I imagine this, or would like it to be.

For our needs, we would like to change existing fields (e.g. Note should be HtmlEditor for us), and place our custom fields between the default fields. So, my request to Brian would be for a more extensible architecture, where you can override defaults fields too (And Brian, I am willing to wait for the 1.1 release for this request :))
r_honey
 
Posts: 62
Joined: Mon Dec 13, 2010 1:37 pm

Next

Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 1 guest

cron