Interface EditorFactory


public interface EditorFactory
Edit factories create editors for a certain types.
Author:
Per-Erik
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns an editor for the given edit support.
    Returns a representative, displayable name for this editor factory.
    getSupport(Object toEdit, String requestedContext)
    Returns a support object that will tell if this editor factory can create editors for the given object.
    Returns a globaly unique identifier for this editor factory.
  • Method Details

    • getSupport

      EditSupport getSupport(Object toEdit, String requestedContext)
      Returns a support object that will tell if this editor factory can create editors for the given object. The support will be used both to create the editor and to start the editing with the editor.
      Parameters:
      toEdit - The object to edit
      requestedContext - Some editors might have different editing contexts and this parameter is used to request a specific context from the editor. If the editor cannot parse the request, it must be ignored. Otherwise the requested context should be set before showing/starting the editor. An example of a context might be a SettingsEditor that has a tab for application settings and a tab for proxy settings. The two contexts can be identified by "app" and "proxy" respectively. The identification is completely up to the implementation so any users of a factory that need a specific context must know about the implementation details of the editor. An empty string or null both means that any context will do.
      Returns:
      A support object able to tell if this factory can create editors for the given object. Taking the requestedContext into account is up to the implementation.
    • getUUID

      UUID getUUID()
      Returns a globaly unique identifier for this editor factory.
      Returns:
      a globaly unique identifier for this editor factory.
    • getName

      String getName()
      Returns a representative, displayable name for this editor factory.
      Returns:
      a representative, displayable name for this editor factory.
    • getEditor

      Editor getEditor(EditSupport support)
      Returns an editor for the given edit support. If the edit support is not recognized by this factory, the behaviour is undefined and may cause exceptions. If the edit support is recognized but returns false from EditSupport.isSupporting(), the behaviour is undefined and may cause exceptions. The returned value may be the same editor for every and any call to this method. However, the editor must not alter the state of any UI as a result of this call. If the returned editor is in use for another editor support and the editor isEditing(), then a call to this method must not cancel or stop the ongoing edit. In short, the state of the returned editor must remain unchanged as a result of this call, unless the returned editor is newly created.
      Parameters:
      support - An edit support returned from this factory's getSupport
      Returns:
      an editor for the given edit support if the support is recognized by this factory and returns true from isSupporting().