Announcement

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

    Timeline and how to create events clicking on the day

    Hi, everybody!

    In a timeline widget, is there a way(using handlers, for example) to create events just clicking on the day(cell), like a regular Calendar does?

    What I want is to add events in a timeline by clicking on a cell(day) and showing the quick event dialog, instead of using the "add event" button and select a lane.

    If yes, how can I show the quick event dialog box?
    If no way, can anyone point me to some directions to "simulate" this?

    I'm using SmartGWT 3.1p LGPL(build 2013-02-12) on Ubuntu 12.10 with Google Chrome.

    I tried that:

    Code:
    addDayBodyClickHandler(new DayBodyClickHandler() {
    			
    			@Override
    			public void onDayBodyClick(DayBodyClickEvent event) {
    				// show quick event dialog
    			}
    		});
    and that

    Code:
    public class CustomTimeline extends Timeline implements HasCellClickHandlers, 
    HasCellSelectionChangedHandlers{
    
    public CustomTimeline(){
        ....
    
    this.addCellClickHandler(new CellClickHandler() {
    			
    			@Override
    			public void onCellClick(CellClickEvent event) {
    				SC.say("onCellClick");				
    			}
    		});
    		
    		this.addCellSelectionChangedHandler(new CellSelectionChangedHandler() {
    			
    			@Override
    			public void onCellSelectionChanged(CellSelectionChangedEvent event) {
    				SC.say("onCellSelectionChanged");				
    			}
    		});
    
    }
    
    @Override
    	public HandlerRegistration addCellSelectionChangedHandler(
    			CellSelectionChangedHandler handler) {
    		// TODO Auto-generated method stub
    		return doAddHandler(handler, CellSelectionChangedEvent.getType());
    	}
    
    	@Override
    	public HandlerRegistration addCellClickHandler(CellClickHandler handler) {
    		// TODO Auto-generated method stub
    		return doAddHandler(handler, CellClickEvent.getType());
    	}
    }


    Thanks
    Last edited by viniciushmol; 15 Feb 2013, 05:29. Reason: To clarify the question

    #2
    No help on this?

    Comment


      #3
      I have the same issue, I think it is not yet supported right?

      Comment


        #4
        Looking for the same

        Using SNAPSHOT_v9.0d_2013-05-28/PowerEdition Deployment (built 2013-05-28) and looking for this solution too: starting a new event clicking on the grid (we have our own event editor and we would like to use the same mechanism we use with Calendar now).

        Any suggestion? Thanks.

        Comment


          #5
          We'll add this in the coming days, behaving in the same way as it does for other calendars

          Comment


            #6
            Great, thanks. (We are going to use it in the EventAddedHandler)

            Comment


              #7
              Is it possible to extend CalendarEventAdded with some time information inside the starting slot (start time)?

              Using Timeline we use DAY/HOUR header, but would be nice to know also the start time would be 00, 15, 30, or 45 minutes? (percentage of the column width or something similar would be enough)

              Having the ability to define HOUR/15MINUTES header would be nice as well.

              Comment


                #8
                Do you mean setEventSnapGap(15)?

                Comment


                  #9
                  That's a nice feature, but actually we don't allow resizing existing events.

                  What would be nice to know: if a user clicks on the timeline grid and we handle it, be able to refine the start time (not only the slot start time - as actually works for Calendar).

                  Code:
                  timeline.addEventAddedHandler(new EventAddedHandler() {
                  @Override
                  public void onEventAdded(CalendarEventAdded event) {
                     System.out.println("start: " + event.getEvent().getStartDate());
                     System.out.println("end: " + event.getEvent().getEndDate());
                     ...
                    }
                  });
                  Calendar tested with setEventSnapGap(15) but had no effect (wherever I click inside the slot, it still returns with the slot start time).

                  But back to the Timeline: we use it for searching a free slot. If we know the click inside one cell, we can initiate the new appointment starting at 00, 15, 30, or 45 minutes (we have one column for an hour).


                  Another problem for calendar: if I select one or two slots (30 minutes or 60 minutes), the end date is always 1 hour later.
                  If I select 3 slots (90 minutes) or more, then the end time is correct, but actually we can not use the end because it returns 60 minutes for both 30 and 60 (1 or 2 slots)

                  Comment


                    #10
                    To show datetime fields in the detailed editor for events, see dateEditingStyle - we've also just fixed a bug that meant the "Lane" was not passed through to that editor for new events.

                    Comment


                      #11
                      That's OK. Starting event from Timeline is working with Lane filled in. Thank you.


                      May I have two additional questions:


                      1) Is it possible to customize the Lane title in the new event dialog too (as we do the EventName and SaveButton)?

                      2) Back to the minutes. What we would like to calculate the minutes from the click itself. So, it he user click in the "4th section" (between 75% and 100%) of the cell we would like to initiate the event start time to 45 instead of 00. Is it possible?

                      (If we could have the click coordinates between the cell (width and height) that would be enough for us)

                      Comment


                        #12
                        1) We've just internationalized all of the strings in these two editors - new attributes with obvious names with hit the nightly builds from June 12

                        2) We'll most likely add this, with a tie to eventSnapGap - in your case you would set it to 15 and we would return the nearest snapGap to the left of the mouse when it's clicked. In the meantime, you could probably do it yourself with a combination of timelineView.getEventRow/Column(), getOffsetX() and headerLevel.headerWidth (possibly via backgroundClick())

                        Comment


                          #13
                          1) Thank you.

                          2) Sounds very good if you could add it.
                          Now I can't see timeline.getEventRow() nor getEventColumn(). Are these wrapped for Smart GWT?

                          Comment


                            #14
                            timelineView, which is a subcomponent (a ListGrid) of Calendar

                            Comment


                              #15
                              Should I use getCanvasAutoChild for accessing the sub component, correct?
                              Code:
                              ListGrid timelineView = (ListGrid) timeline.getCanvasAutoChild("timelineView");
                              Actually throws this excpetion:
                              Code:
                              java.lang.ClassCastException:
                              com.smartgwt.client.widgets.Canvas cannot be cast to com.smartgwt.client.widgets.grid.ListGrid

                              Comment

                              Working...
                              X