Home Forums FlexGanttFX Activity movement listener

Tagged: 

Viewing 6 reply threads
  • Author
    Posts
    • NHS
      Participant
      Post count: 8
      #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: 69
      #13023 |

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

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

      Dirk

    • NHS
      Participant
      Post count: 8
      #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: 8
      #13025 |

      It btw seems like a bug that this return null?

      purchaseOrderGanttChart.getGraphics().onActivityStartTimeChangeStartedProperty()…

      • Dirk Lemmermann
        Keymaster
        Post count: 69
        #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: 8
      #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: 69
        #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: 8
      #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: 69
        #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: 8
      #13032 |

      Nice!

Viewing 6 reply threads
  • You must be logged in to reply to this topic.