Interface MTDataPresenter


public interface MTDataPresenter
Implementors of this interface knows how to list/convert/present plugin-data of a given type to be able to show it in for example lists/browser.
  • Method Details

    • getProvider

      MTDataProvider getProvider()
      Returns the provider that this presenter can list/show data for.
    • findContent

      MTPluginDataQuery findContent(MTRepository repository, MTWorkspace workspace)
      Returns a query listing the available content in a workspace.
    • getTypeName

      String getTypeName()
      Returns the name of the data type being listed.
    • getTypeNamePlural

      String getTypeNamePlural()
      Returns the type name in plural.
    • getTypeIcon

      Icon getTypeIcon(int size)
      Returns an icon representing the type (16x16). It should be as close as possible to the requested size.
    • getFindIcon

      default Icon getFindIcon(int size)
      Returns the icon shown when searching for entities in a browser tab. The default implementation returns the type icon.
    • getPresentable

      Converts plugin-data to a presentable object.
    • isCreatable

      default boolean isCreatable()
      Returns true if new objects can be created by the user.
    • isEditable

      default boolean isEditable()
      Returns true if existing objects can be edited by the user.
      Returns:
    • isTitleEditable

      default boolean isTitleEditable(Optional<MTPluginData> value)
      Returns true if editing of titles is available in this model, both in general and for a specific value.
      Parameters:
      value - An optional value. If present the return value should reflect whether the title is editable for the specific value, otherwise it should reflect whether titles are editable in general. Models without title editing can just return false always.
    • isRemovable

      default boolean isRemovable()
      Returns true if existing objects can be removed by the user.
    • create

      default void create(Component invoker, Point p, Consumer<MTDataPresenter.Presentable> onPersisted)
      Creates a new object of the given type. It is up to the implementation whether it should be persisted right away or show an UI for creating the new object. onPersisted should be called when the new object has been persisted to storage.
    • edit

      default void edit(MTDataPresenter.Presentable toEdit, Component invoker, Point p)
      Edits an object of the given type.
    • remove

      default void remove(MTDataPresenter.Presentable toRemove)
      Removes an object of the given type.