Interface DropImport


public interface DropImport
A DropImport is a service that can be registered into the extension framework to support drag-and-drop operations onto the modeling area of Modeling Tool. For example, a DropImport can be registered so that when a user drops a URL onto the modeling area, a new vertex is created that uses the URL to display some data.

Each instance of DropImport i considered unique so if two drop imports can handle the same drop, they will both be called to handle the drop. The intent is that they might be doing very different things with the drop data.
Author:
Per-Erik
  • Method Details

    • canImport

      boolean canImport(DataFlavor flavor, MTCompleteModel dropTarget, Point dropLocation)
      Returns true if this drop import can read data of the given data flavor and attach it to the given model, returns false otherwise. What 'attach' means is up to the implementation, but a true return value will cause a call to importData, where the attachment is made by the implementation.
      Parameters:
      flavor - The flavor of the data that is about to be imported
      dropTarget - The model to import to, or attach data to.
      dropLocation - The location in the model where the drop will take place
      Returns:
      true if this drop import can read data of the given data flavor and attach it (import it) to the given model.
    • canImport

      boolean canImport(DataFlavor flavor, MTCompleteEdge dropTarget, Point dropLocation)
      Returns true if this drop import can read data of the given data flavor and attach it to the given edge, returns false otherwise. What 'attach' means is up to the implementation, but a true return value will cause a call to importData, where the attachment is made by the implementation.
      Parameters:
      flavor - The flavor of the data that is about to be imported
      dropTarget - The edge to import to, or attach data to.
      dropLocation - The location in the model where the drop will take place
      Returns:
      true if this drop import can read data of the given data flavor and attach it (import it) to the given edge.
    • canImport

      boolean canImport(DataFlavor flavor, MTCompleteVertex dropTarget, Point dropLocation)
      Returns true if this drop import can read data of the given data flavor and attach it to the given vertex, returns false otherwise. What 'attach' means is up to the implementation, but a true return value will cause a call to importData, where the attachment is made by the implementation.
      Parameters:
      flavor - The flavor of the data that is about to be imported
      dropTarget - The vertex to import to, or attach data to.
      dropLocation - The location in the model where the drop will take place
      Returns:
      true if this drop import can read data of the given data flavor and attach it (import it) to the given vertex.
    • canImport

      boolean canImport(DataFlavor flavor, MTCompleteSymbol dropTarget, Point dropLocation)
      Returns true if this drop import can read data of the given data flavor and attach it to the given symbol, returns false otherwise. What 'attach' means is up to the implementation, but a true return value will cause a call to importData, where the attachment is made by the implementation.
      Parameters:
      flavor - The flavor of the data that is about to be imported
      dropTarget - The symbol to import to, or attach data to.
      dropLocation - The location in the model where the drop will take place
      Returns:
      true if this drop import can read data of the given data flavor and attach it (import it) to the given symbol.
    • canImportContextless

      boolean canImportContextless(DataFlavor flavor)
      Returns true if this drop import can read data of the given data flavor and make use of it without any context such as a vertex or model. A true return value will cause a call to importData, where the drop import can react to the data drop.
      Parameters:
      flavor - The flavor of the data that is about to be imported
      Returns:
      true if this drop import can read data of the given data flavor and wants to process the drop.
    • importData

      Future<Boolean> importData(Object data, DataFlavor flavor, MTCompleteModel model, Point dropLocation, MTRemoteChangeHandler defaultErrorHandler)
      Imports the data, that is, attaches the data to the model in some meaningful way. The parameter data will always be an instance of flavor.getRepresentationClass().
      Parameters:
      data - The data object to import.
      flavor - The flavor of the data.
      model - The model to import to.
      dropLocation - The location in the model where the drop will take place
      defaultErrorHandler - The default error handler which can be used to handle out-of-date/lock errors.
      Returns:
      A future containing a boolean representing if the import was made successfully or not. It is a future rather than a direct return since some imports might need to do lenghty operations before the import can be fully executed.
      See Also:
    • importData

      Future<Boolean> importData(Object data, DataFlavor flavor, MTCompleteEdge edge, Point dropLocation, MTRemoteChangeHandler defaultErrorHandler)
      Imports the data, that is, attaches the data to the edge in some meaningful way. The parameter data will always be an instance of flavor.getRepresentationClass().
      Parameters:
      data - The data object to import.
      flavor - The flavor of the data.
      edge - The edge to import to.
      dropLocation - The location in the model where the drop will take place
      defaultErrorHandler - The default error handler which can be used to handle out-of-date/lock errors.
      Returns:
      A future containing a boolean representing if the import was made successfully or not. It is a future rather than a direct return since some imports might need to do lenghty operations before the import can be fully executed.
      See Also:
    • importData

      Future<Boolean> importData(Object data, DataFlavor flavor, MTCompleteVertex vertex, Point dropLocation, MTRemoteChangeHandler defaultErrorHandler)
      Imports the data, that is, attaches the data to the vertex in some meaningful way. The parameter data will always be an instance of flavor.getRepresentationClass().
      Parameters:
      data - The data object to import.
      flavor - THe flavor of the data.
      vertex - The vertex to import to.
      dropLocation - The location in the model where the drop will take place
      defaultErrorHandler - The default error handler which can be used to handle out-of-date/lock errors.
      Returns:
      A future containing a boolean representing if the import was made successfully or not. It is a future rather than a direct return since some imports might need to do lenghty operations before the import can be fully executed.
      See Also:
    • importData

      Future<Boolean> importData(Object data, DataFlavor flavor, MTCompleteSymbol symbol, Point dropLocation, MTRemoteChangeHandler defaultErrorHandler)
      Imports the data, that is, attaches the data to the symbol in some meaningful way. The parameter data will always be an instance of flavor.getRepresentationClass().
      Parameters:
      data - The data object to import.
      flavor - THe flavor of the data.
      symbol - The symbol to import to.
      dropLocation - The location in the model where the drop will take place
      defaultErrorHandler - The default error handler which can be used to handle out-of-date/lock errors.
      Returns:
      A future containing a boolean representing if the import was made successfully or not. It is a future rather than a direct return since some imports might need to do lenghty operations before the import can be fully executed.
      See Also:
    • importData

      Future<Boolean> importData(Object data, DataFlavor flavor)
      Imports the data, that is, attaches the data to the model in some meaningful way. The parameter data will always be an instance of flavor.getRepresentationClass().
      Parameters:
      data - The data object to import.
      flavor - The flavor of the data.
      Returns:
      A future containing a boolean representing if the import was made successfully or not. It is a future rather than a direct return since some imports might need to do lenghty operations before the import can be fully executed.
      See Also: