Home
Categories
Dictionary
Download
Project Details
Changes Log
Tutorials
FAQ
License

Metadatas



MetaDatas are a ways to add informations on elements to filter actions depending on their value. Metadatas can be defined in the FileProperties associated xith a tab.

Metadata compatibility

Several methods in the FileProperties and the FileProperties class allow to check the compatibility of a FileProperties with a MetaData:

Not comparable keys

You can define at the static level a list of keys which should not be used when comparing MetaDatas. The associated method is MetaData.setNotComparableKeys(List)

Example

Suppose that we have two file types:
      MetaData textFileMeta = new MetaData();
      fileMeta.put("fileType", "text");

      MetaData imageFileMeta = new MetaData();
      fileMeta.put("fileType", "image");
We have a plugin where we want to open a text editor on the selected tab. We can use the following code to allow to open the editor only if the tab contains text:
      public void openEditor(FileProperties properties) {
         if (properties.isCompatibleWith(textFileMeta)) {
           ... open the text editor
         }
      }

See also


Categories: general | javafx | swing

Copyright 2006-2023 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences