Announcement

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

    Adding popup menu for Calendar and Timeline events

    Smart GWT 4.0p (SmartClient Version: v9.0p_2013-07-15/PowerEdition Deployment (built 2013-07-15))

    I was able to add popup menu for certain events displayed on Calendar using

    Code:
    .addEventClickHandler(eventClickHandler);
    It works properly with the Calendar. Clicking on an event the clickHandler is triggered and can show popup menu as needed. Also clicking on the background grid a new event creation can be started.

    But with Timeline "the events those would show the popup menu" after the click we get the start new event dialog also.

    What we would like to see is be able to start new event even we click on an existing event, but be able to disable it on the fly if the event wants to show its popup menu instead of starting a new one.

    (Note: starting the event from the grid is very important for our clients, because they can start the new event clicking on the template (physically a simple event))

    Would it be possible? Thank you.

    #2
    Are you calling event.cancel() in the handler?

    Comment


      #3
      Yes, I tried, but had no effect.

      Comment


        #4
        Ok, this is fixed for tomorrow's build

        Comment


          #5
          SmartGWT 4.0p (SmartClient Version: v9.0p_2013-07-16/PowerEdition Deployment (built 2013-07-16))

          I am sorry, but this is not what we had requested. The event.cancel() doesn't seem to have effect starting a new event.

          Out event click handler looks like this:
          Code:
          eventClickHandler = new EventClickHandler() {
          	@Override
          	public void onEventClick(CalendarEventClick event) {
          		Object oKind = event.getEvent().getAttributeAsObject(EVENT_ATTRIBUTE_KIND);
          		if (oKind instanceof ClientAppointmentKind) {
          			ClientAppointmentKind appKind = (ClientAppointmentKind) oKind;
          			if (appKind == ClientAppointmentKind.REQUEST) {
          				sl.appointmentRequestPopupMenu.mRequest.showContextMenu();
          				event.cancel();
          			}
          		}
          	}
          };
          Now the new event screen NEVER comes up if clicking on any kind of events. With Calendar it is OK, because we have space to click on the grid. But in Timeline having a event (block) now we can not start a new event.

          We want to avoid starting the event creation screen only if we show our popup menu.

          It is very important for us, to be able starting a new events clicking on special events (blocks). Now it is broken.

          Any of these solutions would work for us:
          a1) add a method like .enableCanCreateEvents() to CalendarEventClick class (and we could enable it as needed (default false would be fine))
          a2) add one extra/different (event click) handler could control to start a new event or not
          b) add a few pixel (customizable) height gap for every lane bottom, so the user always can click on the grid itself. Created a screen shot for the better understanding.

          Please let me know how will we get it back. Thank you.
          Attached Files

          Comment


            #6
            We're a little unclear on what you actually want.

            1) When you click on the background of the timeline, you want to show the "New Event" window - this is "starting a new event"

            2) When you click on an EXISTING event, for some types of events, you want to show your own menu and NOT show the event editor - and for other types of events, you want to show the event editor - this is editing an existing event

            is that correct? or are you saying you want to show the "New Event" window when you click on an existing event? If so, that's not a documented behaviour - clicking on an event show's it's editor

            Comment


              #7
              1) Yes, always.

              2) For existing events we need to decide (based on the existing event) whether to
              2a) show our own popup menu
              2b) event is a block/template in our context, and user wants to create a new event there - so be able to start a new event (emulate the click may have happened on the grid)

              Before latest fix we were able to start a new event even the user clicked on existing event (understand it wasn't documented, but it worked that way). But fixing this we lost that behavior we really need.

              Hope I was clear enough, but please let me know if you need more details for better understanding. Thanks.

              Also a simplified pseudo code (EventClickHandler):
              Code:
                 if (event is "block in that Lane" ) { // indicates apppointments may come here
                    start "New Event" window // the lost behavior
                 } else {
                    show our own popup
                 }

              Comment


                #8
                Ok, we see what you're after and someone is looking into it - in the meantime, you can probably just manually call calendar.addEventButton.click() to show the default New Event editor as and when you choose (although it will have default times)

                Comment


                  #9
                  OK. Thank you, looking for the news from you.

                  (ImgButton doesn't have a click method I could call, but because it may confuse our users why times sometimes correct (from the grid) sometimes not (from event), so I think the better is to wait for your solution)

                  Comment


                    #10
                    Any update on this? Actually this is the last item we are waiting for before we could release. Thank you.

                    Comment


                      #11
                      We've added new APIs showEventEditor() and show[Event/NewEvent]Dialog() - those should hit the next nightly build.

                      Comment


                        #12
                        Note that these changes didn't make it into 4.0 until today - please test them out in a build dated July 26 or later

                        Comment


                          #13
                          OK, Thanks. Will check it tomorrow.

                          Comment


                            #14
                            Almost done

                            Smart GWT 4.0p (SmartClient Version: v9.0p_2013-07-28/PowerEdition Deployment (built 2013-07-28))

                            I am able to bring up the new event dialog. Providing the lane from the clicked event also works great.

                            But it uses the current date and time for the new event instead of the "location" the grid was clicked.

                            Code:
                            public void onEventClick(CalendarEventClick event) {
                              if ("need to show the popup menu") {
                                 // show popup
                              } else {
                                   CalendarEvent newEvent = new CalendarEvent();
                                   newEvent.setLane(event.getEvent().getLane());
                                   sl.timeline.showNewEventDialog(newEvent);
                               }
                            }
                            The main goal was to get the date and time from the "grid click". You mentioned in (#8) using addEventButton click would use the default times. With this method (with or without a paramter) we lose the date and time information.

                            Please let me know how to achieve it (populate the date and time to the new event dialog). Thank you for your help.
                            Last edited by miskolczi.peter; 28 Jul 2013, 13:11.

                            Comment


                              #15
                              You could do this via JSNI, but we'll add a couple of new APIs to make it easier. Should be present within a day or so.

                              Comment

                              Working...
                              X