Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JDIC API V2006 Release 0308
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jdesktop.jdic.filetypes
Class Association

    java.lang.Object
      org.jdesktop.jdic.filetypes.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 extensions, icon file, actions which are represented by `Action` objects, and stored MIME file name for Gnome/UNIX platforms.

An association could be registered into or unregistered from the system using certain methods of `AssociationService`. An association for a particular file type could be returned by certain methods of `AssociationService`.

See Also:
  `Action`, `AssociationService`

Constructor Summary
`Association()`

Method Summary
`boolean` | `addAction(Action action)` Adds a given action to the action list of this `Association`.
`boolean` | `addFileExtension(java.lang.String fileExt)` Adds one file extension to the file extension list of this `Association`.
`boolean` | `equals(java.lang.Object other)` Overrides the same method of `java.lang.Object`.
`Action` | `getActionByVerb(java.lang.String verb)` Returns the action, whose verb field is the same with the specified verb.
`java.util.List` | `getActionList()` Returns the action list of this `Association`.
`java.lang.String` | `getDescription()` Returns the description string of this `Association`.
`java.util.List` | `getFileExtList()` Returns the file extension list of this `Association`.
`java.lang.String` | `getIconFileName()` Returns the icon file name representing this `Association`.
`java.lang.String` | `getMimeType()` Returns the MIME type of this `Association`.
`java.lang.String` | `getName()` Returns the name of the MIME files the association is stored in for Gnome/Unix platforms.
`int` | `hashCode()` Overrides the same method of `java.lang.Object`.
`boolean` | `removeAction(Action action)` Removes a given action from the action list of this `Association`.
`boolean` | `removeFileExtension(java.lang.String fileExt)` Removes the given file extension from the file extension list of this `Association`.
`void` | `setDescription(java.lang.String description)` Sets the description string of this `Association`.
`void` | `setIconFileName(java.lang.String fileName)` Sets the icon file name representing this `Association`.
`void` | `setMimeType(java.lang.String mimeType)` Sets the MIME type of this `Association`.
`void` | `setName(java.lang.String name)` Returns the name of the MIME files the association is stored in for Gnome/Unix platforms.
`java.lang.String` | `toString()` Overrides the same method of `java.lang.Object`.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Association

    public Association()

Method Detail

### getName

    public java.lang.String getName()

  Returns the name of the MIME files the association is stored in for Gnome/Unix platforms.

  For Gnome/Unix platforms, the association is stored in plain text files: `name`.mime, `name`.keys and `name`.applications. While registering or unregistering an association using certain methods of `AssociationService`, the MIME files with the given name are created or removed.

  For Microsoft Windows platforms, the association is stored in the registry, this name is not used.

  Returns:
    the MIME file name.

### setName

    public void setName(java.lang.String name)

  Returns the name of the MIME files the association is stored in for Gnome/Unix platforms.

  Parameters:
    `name` - a given name value.

### getDescription

    public java.lang.String getDescription()

  Returns the description string of this `Association`.

  Returns:
    the description of this association.

### setDescription

    public void setDescription(java.lang.String description)

  Sets the description string of this `Association`.

  Parameters:
    `description` - a given description value.

### getMimeType

    public java.lang.String getMimeType()

  Returns the MIME type of this `Association`.

  Returns:
    the MIME type.

### setMimeType

    public void setMimeType(java.lang.String mimeType)

  Sets the MIME type of this `Association`.

  Parameters:
    `mimeType` - a given MIME type.

### addFileExtension

    public boolean addFileExtension(java.lang.String fileExt)

  Adds one file extension to the file extension list of this `Association`. If the given file extension already exists in the file extension list, no changes are made to the file extension list.

  The specified file extension could have a leading '.' character or not.

  For Microsoft Windows platforms, only the first file extension is used during registeration.

  Parameters:
    `fileExt` - a given file extension.
  Returns:
    `true` if the given file extension is added successfully to the file extension list; `false` otherwise.

### removeFileExtension

    public boolean removeFileExtension(java.lang.String fileExt)

  Removes the given file extension from the file extension list of this `Association`. If the file extension is not contained in the file extension list, no changes are made to the file extension list.

  The specified file extension may have a leading '.' character or not.

  Parameters:
    `fileExt` - a given file extension.
  Returns:
    `true` if the given file extension is removed successfully from the file extension list; `false` otherwise.

### getFileExtList

    public java.util.List getFileExtList()

  Returns the file extension list of this `Association`.

  Returns:
    the file extension list of the association.

### getIconFileName

    public java.lang.String getIconFileName()

  Returns the icon file name representing this `Association`.

  Returns:
    the icon file name for this association.

### setIconFileName

    public void setIconFileName(java.lang.String fileName)

  Sets the icon file name representing this `Association`.

  For Microsoft Windows platforms, the given icon file will be registered only if the given file extension list is not empty.

  Parameters:
    `fileName` - a given icon file name.

### addAction

    public boolean addAction(Action action)

  Adds a given action to the action list of this `Association`. If the given action already exists in the action list, no changes are made to the action list.

  A valid action should not have null verb or command field.

  For Microsoft Windows platforms, an association with non-empty action list would be valid for registration when the file extension list is not empty.

  Parameters:
    `action` - a given action.
  Returns:
    `true` if the given action is added successfully to the action list; `false` otherwise.

### removeAction

    public boolean removeAction(Action action)

  Removes a given action from the action list of this `Association`. If the action is not contained in the action list, no changes are made to the action list.

  A valid action should not have null verb or command field.

  Parameters:
    `action` - a given action.
  Returns:
    `true` if the given action is removed successfully from the action list; `false` otherwise.

### getActionList

    public java.util.List getActionList()

  Returns the action list of this `Association`.

  Returns:
    the action list of the association.

### getActionByVerb

    public Action getActionByVerb(java.lang.String verb)

  Returns the action, whose verb field is the same with the specified verb.

  Parameters:
    `verb` - the specified verb.
  Returns:
    the action with the specified verb; `null` if no approprate action is found.

### equals

    public boolean equals(java.lang.Object other)

  Overrides the same method of `java.lang.Object`.

  Determines whether or not two associations are equal. Two instances of `Association` are equal if the values of all the fields are the same.

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `other` - an object to be compared with this `Association`.
  Returns:
    `true` if the object to be compared is an instance of `Association` and has the same values; `false` otherwise.

### hashCode

    public int hashCode()

  Overrides the same method of `java.lang.Object`.

  Returns the hashcode for this `Association`.

  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    a hash code for this `Association`.``

### toString

    public java.lang.String toString()

  Overrides the same method of `java.lang.Object`.

  Returns a `String` that represents the value of this `Association`.

       The output of this object as a string would be like:
           MIME File Name:
           Description:
           MIME Type:
           Icon File:
           File Extension:
           Action List:
               Description:
               Verb:
               Command:

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a string representation of this `Association`.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JDIC API V2006 Release 0308
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

For more information and documentation on JDIC, see JDIC website.

That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, working code examples, license terms and bug report information.

Copyright (c) 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.