Home Forums FlexGanttFX Activity movement listener

Tagged: 

  • Author
    Posts
  • NHS
    Participant
    Post count: 26
    #13022 |

    I would like to update my datamodel each time any activity is moved by the user. How is this best done?

  • Dirk Lemmermann
    Keymaster
    Post count: 64
    #13023 |

    GraphicsBase.setOnActivityXYZ(….) methods are available for you to listen to changes.

    Example: gantt.getGraphics().setOnActivityStartTimeChanged(….).

    Dirk

  • NHS
    Participant
    Post count: 26
    #13024 |

    Thanks. I am using a MutableCompletableActivityBase<PurchaseOrder>. Is is possible to change so only start date/time can be visual changed. So it is no possible to change end date/time? also not possible to set progress using the UI

  • NHS
    Participant
    Post count: 26
    #13025 |

    It btw seems like a bug that this return null?

    purchaseOrderGanttChart.getGraphics().onActivityStartTimeChangeStartedProperty()…

    • Dirk Lemmermann
      Keymaster
      Post count: 64
      #13027 |

      No, this is correct. Nobody listens to this change within the framework. This is event support for the application using the events. Or is this returning null AFTER you set a listener?

  • NHS
    Participant
    Post count: 26
    #13028 |

    In my test it always returns null – so it is not pos even adding a listener.

    Do you have any example code on how to turn off editing features

    • Dirk Lemmermann
      Keymaster
      Post count: 64
      #13029 |

      I checked the code and “yes”, it is a bug. A stupid copy / paste bug.

      
          private ActivityEventHandlerProperty onActivityStartTimeChangeStarted;
      
          public final ObjectProperty<EventHandler<ActivityEvent>> onActivityStartTimeChangeStartedProperty() {
              if (onActivityStartTimeChangeStarted == null) {
                  onActivityStartTimeChangeStarted = new ActivityEventHandlerProperty(
                          "onActivityStartTimeChangeStarted", //$NON-NLS-1$
                          ActivityEvent.START_TIME_CHANGE_STARTED);
              }
      
              return onActivityStartTimeChangeFinished;
          }
      

      I am accidentally returning the onActivityStartTimeChange”FINISHED” property.Since this method is not used by the framework itself it is not causing any issues inside the framework, but obviously it is bad for any application using it.

  • NHS
    Participant
    Post count: 26
    #13030 |

    Aha – I am not using now – so all good.

    If posible share an example of turning off eating feature in the graphics

    • Dirk Lemmermann
      Keymaster
      Post count: 64
      #13031 |
      
      gantt.getGraphics().setActivityEditingCallback(param -> {
         switch(param.getEditMode()) {
            case PERCENTAGE_COMPLETE_CHANGE:
               return false;
            default:
               return true;
         }
      });
      
      
      // turn off all
      gantt.getGraphics().setActivityEditingCallback(param -> false);
      
  • NHS
    Participant
    Post count: 26
    #13032 |

    Nice!

You must be logged in to reply to this topic.