Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Calendar Custom Event Handlers or Editor Form

    I am having trouble modifying the Calendar Event Editor Form. I don't simply want to add fields. I actually want to change the behavior of the Calendar click and other events. I couldn't find a way of replacing the default handlers. If there is a way to do this, please let me know. I only saw the ability to add more handlers.

    I instead tried to customize the event editor form. I tried adding entire CanvasItems to the form to add functionality to it. However, now the event editor won't display at all. If the handlers cannot be replaced as I would like, please let me know if there is some reason the form wouldn't show.

    Thanks!

    Here is some test code:
    Code:
    		Calendar calendar = new Calendar();
    		calendar.setDataSource(eventDS);
    		calendar.setAutoFetchData(true);
    		calendar.setEventEditorFields(new TextItem("test"), new EventEditorForm());
    
    ...
    
    public EventEditorForm() {
    		setCanvas(createEditorCanvas());
    	}
    
    	private Canvas createEditorCanvas() {
    		HLayout mainLayout = new HLayout();
    		DataSource dataSource = new DataSource();
    
            DataSourceTextField firstNameField = new DataSourceTextField("firstName", "First Name", 50, true);
            DataSourceTextField lastNameField = new DataSourceTextField("lastName", "Last Name", 50, true);
            DataSourceTextField emailField = new DataSourceTextField("email", "Email", 100, true);
    
            DataSourcePasswordField passwordField = new DataSourcePasswordField("password", "Password", 20, true);
    
            dataSource.setFields(firstNameField, lastNameField, emailField, passwordField);
    
    		
    		final DynamicForm form = new DynamicForm();
            form.setDataSource(dataSource);
            form.setUseAllDataSourceFields(true);
    
            HeaderItem header = new HeaderItem();
            header.setDefaultValue("Registration Form");
    
            PasswordItem passwordItem = new PasswordItem();
            passwordItem.setName("password");
    
            PasswordItem passwordItem2 = new PasswordItem();
            passwordItem2.setName("password2");
            passwordItem2.setTitle("Password Again");
            passwordItem2.setRequired(true);
            passwordItem2.setLength(20);
    
            MatchesFieldValidator matchesValidator = new MatchesFieldValidator();
            matchesValidator.setOtherField("password");
            matchesValidator.setErrorMessage("Passwords do not match");        
            passwordItem2.setValidators(matchesValidator);
    
            CheckboxItem acceptItem = new CheckboxItem();
            acceptItem.setName("acceptTerms");
            acceptItem.setTitle("I accept the terms of use.");
            acceptItem.setRequired(true);
            acceptItem.setWidth(150);
    
            ButtonItem validateItem = new ButtonItem();
            validateItem.setTitle("Validate");
            validateItem.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    form.validate(false);
                }
            });
    
            form.setFields(header, passwordItem, passwordItem2, acceptItem, validateItem);
            
            form.setValue("firstName", "Bob");
            form.setValue("email", "bob@.com");
            form.setValue("password", "sekrit");
            form.setValue("password2", "fatfinger");  
            	
    		return form;
    	}
    Debug log:
    Code:
    00:05:49.221:WARN:Log:ClassFactory.addGlobalID: ID:'isc_ButtonItem_21' for object '[ButtonItem ID:isc_ButtonItem_21 name:isc_OID_13]' collides with ID of existing object '[ButtonItem ID:isc_ButtonItem_21 name:isc_OID_13]'. The global reference to this object will be replaced
    00:05:49.224:WARN:DynamicForm:isc_OID_3_eventEditor:[Class TextItem] form item defined with no 'name' property - Value will not be saved. To explicitly exclude a form item from the set of values to be saved, set 'shouldSaveValue' to false for this item.
    Global Log Priorities updated: Logging messages at priority 'Debug' and above for category 'layout'.
    00:06:12.310:MUP1:INFO:layout:isc_OID_3_eventDialog:adding newMembers: [HLayout ID:isc_OID_3_eventDialog_header]
    00:06:12.310:MUP1:DEBUG:layout:isc_OID_3_eventDialog:resizing [HLayout ID:isc_OID_3_eventDialog_header]: 390w 
    00:06:12.313:MUP1:INFO:layout:isc_OID_3_eventDialog_header:adding newMembers: [Canvas ID:isc_Canvas_89]
    00:06:12.313:MUP1:DEBUG:layout:isc_OID_3_eventDialog_header:resizing [Canvas ID:isc_Canvas_89]: 20h 
    00:06:12.315:MUP1:INFO:layout:isc_OID_3_eventDialog_header:adding newMembers: [ImgButton ID:isc_OID_3_eventDialog_closeButton]
    00:06:12.317:MUP1:INFO:layout:isc_OID_3_eventDialog:adding newMembers: [Layout ID:isc_OID_3_eventDialog_body]
    00:06:12.317:MUP1:DEBUG:layout:isc_OID_3_eventDialog:resizing [Layout ID:isc_OID_3_eventDialog_body]: 390w 
    00:06:12.320:MUP1:DEBUG:layout:isc_OID_3_eventDialog:resizing [Layout ID:isc_OID_3_eventDialog_body]: 390w 73h
    00:06:12.322:MUP1:DEBUG:layout:isc_OID_3_eventDialog_body:resizing [DynamicForm ID:isc_DynamicForm_23]: 390w 
    00:06:12.444:MUP1:DEBUG:layout:isc_OID_3_eventDialog_body:centering wrt visible breadth: 390
    00:06:12.452:MUP1:INFO:layout:isc_OID_3_eventDialog_body:layoutChildren (reason: initial draw):
    layout specified size: 390w x 73h
    drawn size: 390w x 73h
    available size: 390w x 73h (length)
       [DynamicForm ID:isc_DynamicForm_23]
          60 drawn length (policyLength: 60) (inherent size)
          390 drawn breadth (breadth policy: fill)
    
    00:06:12.470:MUP1:DEBUG:layout:isc_OID_3_eventDialog_header:resizing [Canvas ID:isc_Canvas_89]: 20h 370w
    00:06:12.477:MUP1:DEBUG:layout:isc_OID_3_eventDialog_header:centering wrt visible breadth: 20
    00:06:12.477:MUP1:INFO:layout:isc_OID_3_eventDialog_header:layoutChildren (reason: initial draw):
    layout specified size: 390w x 20h
    drawn size: 390w x 20h
    available size: 390w (length) x 20h
       [Canvas ID:isc_Canvas_89]
          370 drawn length (resizeLength: 370) (policyLength: *) (no length specified)
          20 drawn breadth (breadth policy: fill)
       [ImgButton ID:isc_OID_3_eventDialog_closeButton]
          18 drawn length (resizeLength: 18) (policyLength: 18) (explicit size)
          18 drawn breadth (explicit size)
    
    00:06:12.478:MUP1:DEBUG:layout:isc_OID_3_eventDialog:centering wrt visible breadth: 390
    00:06:12.485:MUP1:INFO:layout:isc_OID_3_eventDialog:layoutChildren (reason: initial draw):
    layout specified size: 400w x 100h
    drawn size: 400w x 100h
    available size: 390w x 93h (length)
       [HLayout ID:isc_OID_3_eventDialog_header]
          20 drawn length (resizeLength: 20) (policyLength: 20) (explicit size)
          390 drawn breadth (breadth policy: fill)
       [Layout ID:isc_OID_3_eventDialog_body]
          73 drawn length (resizeLength: 73) (policyLength: *) (no length specified)
          390 drawn breadth (breadth policy: fill)
    
    00:06:16.384:MUP7:INFO:layout:isc_OID_3_eventEditorLayout:adding newMembers: [HLayout ID:isc_OID_3_eventEditorLayout_header]
    00:06:16.384:MUP7:DEBUG:layout:isc_OID_3_eventEditorLayout:resizing [HLayout ID:isc_OID_3_eventEditorLayout_header]: 90w 
    00:06:16.387:MUP7:INFO:layout:isc_OID_3_eventEditorLayout_header:adding newMembers: [Canvas ID:isc_Canvas_90]
    00:06:16.387:MUP7:DEBUG:layout:isc_OID_3_eventEditorLayout_header:resizing [Canvas ID:isc_Canvas_90]: 20h 
    00:06:16.389:MUP7:INFO:layout:isc_OID_3_eventEditorLayout_header:adding newMembers: [ImgButton ID:isc_OID_3_eventEditorLayout_closeButton]
    00:06:16.391:MUP7:INFO:layout:isc_OID_3_eventEditorLayout:adding newMembers: [Layout ID:isc_OID_3_eventEditorLayout_body]
    00:06:16.391:MUP7:DEBUG:layout:isc_OID_3_eventEditorLayout:resizing [Layout ID:isc_OID_3_eventEditorLayout_body]: 90w 
    00:06:16.401:MUP7:DEBUG:layout:isc_OID_3_eventEditorLayout:resizing [Layout ID:isc_OID_3_eventEditorLayout_body]: 90w 73h
    00:06:16.404:MUP7:DEBUG:layout:isc_OID_3_eventEditorLayout_header:resizing [Canvas ID:isc_Canvas_90]: 20h 70w
    00:06:16.410:MUP7:DEBUG:layout:isc_OID_3_eventEditorLayout_header:centering wrt visible breadth: 20
    00:06:16.410:MUP7:INFO:layout:isc_OID_3_eventEditorLayout_header:layoutChildren (reason: initial draw):
    layout specified size: 90w x 20h
    drawn size: 90w x 20h
    available size: 90w (length) x 20h
       [Canvas ID:isc_Canvas_90]
          70 drawn length (resizeLength: 70) (policyLength: *) (no length specified)
          20 drawn breadth (breadth policy: fill)
       [ImgButton ID:isc_OID_3_eventEditorLayout_closeButton]
          18 drawn length (resizeLength: 18) (policyLength: 18) (explicit size)
          18 drawn breadth (explicit size)
    
    00:06:16.413:MUP7:DEBUG:layout:isc_OID_3_eventEditorLayout_body:resizing [HLayout ID:isc_HLayout_49]: 90w 
    00:06:16.413:MUP7:DEBUG:layout:isc_OID_3_eventEditorLayout_body:resizing [HLayout ID:isc_HLayout_49]: 90w 53h
    00:06:18.086:MUP2:WARN:drawing:isc_OID_3_eventEditorLayout:draw() called on widget with current drawn state: handleDrawn, ignoring. [Stack trace not supported in this browser]
    Last edited by dres; 25 Jan 2009, 00:12.
Working...
X