jApp.jdic
Class Association

java.lang.Object
  extended by jApp.jdic.Association

public class Association
extends java.lang.Object

This class represents a file type association.

A file type association contains a description, the MIME type, file extension, and icon (file) name.

An association can be registered into or unregistered from the desktop system using methods of AssociationService.

Author:
Kustaa Nyholm
See Also:
AssociationService

Constructor Summary
Association(java.lang.String extension, java.lang.String mimeType, java.lang.String magic, java.lang.String icon, java.lang.String description)
          Creates an imutable file association that relates file name extension (".myext"), mime type ("application/vnd.mycompany.myext"), icon ("myAppDocIcon.png") and description ("A MyApp application Document")
 
Method Summary
 java.lang.String getDescription()
          Gets the description string for this association.
 java.lang.String getExtension()
          Gets the file name extension for this association.
 java.lang.String getIcon()
          Gets the icon name for this association.
 java.lang.String getMagicPattern()
          Gets the magic pattern xml fragment for this association.
 java.lang.String getMimeType()
          Gets the mime type for this association
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Association

public Association(java.lang.String extension,
                   java.lang.String mimeType,
                   java.lang.String magic,
                   java.lang.String icon,
                   java.lang.String description)
Creates an imutable file association that relates file name extension (".myext"), mime type ("application/vnd.mycompany.myext"), icon ("myAppDocIcon.png") and description ("A MyApp application Document")

Parameters:
extension - the extension including the preceding dot
mimeType - the mime type in the form type/subtype
magic - the magic xml fragment, can be null
icon - the icon name, including image type extension, excluding path
description - end user description of this association
Method Detail

getDescription

public java.lang.String getDescription()
Gets the description string for this association. This is a description intended for the application end user and which the Desktop (Gnome/KDE/Finder/Explorer) shows to the user for example in tooltips.

Returns:
the decription string

Example return value:


 "A MyApp document"
 

getMimeType

public java.lang.String getMimeType()
Gets the mime type for this association

Returns:
the mime type string

getMagicPattern

public java.lang.String getMagicPattern()
Gets the magic pattern xml fragment for this association.

Returns:
the xml fragment

An example xml fraction:

 "<magic priority="50"> 
        <match type="string" offset="0" value="diff\t"/>
        </magic>"
 

getExtension

public java.lang.String getExtension()
Gets the file name extension for this association. This always includes the preceding dot.

Returns:
the name extension

Example return value:


 ".ext"
 

getIcon

public java.lang.String getIcon()
Gets the icon name for this association. This is the pure file name including extension but excluding path because the icon will be loaded as resource stream from a class.

Example return value:


 "myDocumentIcon.png"
 

Returns:
the icon name