org.eclipse.palamedes.ui.preferences.stylesheets
Class StylesheetPersistenceData

java.lang.Object
  extended by org.eclipse.palamedes.ui.preferences.stylesheets.StylesheetPersistenceData

public class StylesheetPersistenceData
extends java.lang.Object

StylesheetPersistenceData stores information about a style sheet. It uniquely references contributed style sheets via their id. Contributed templates may be deleted or modified.


Constructor Summary
StylesheetPersistenceData(Stylesheet stylesheet, boolean enabled)
          Creates a new, user-added instance that is not linked to a contributed style sheet.
StylesheetPersistenceData(Stylesheet stylesheet, boolean enabled, java.lang.String id)
          Creates a new instance.
 
Method Summary
 java.lang.String getId()
          Returns the id of this style sheet store, or null if there is none.
 Stylesheet getStylesheet()
          Returns the style sheet encapsulated by the receiver.
 boolean isCustom()
          Returns whether the receiver represents a custom style sheet, i.e. is either a user-added style sheet or a contributed style sheet that has been modified.
 boolean isDeleted()
          Returns the deletion state of the stored style sheet.
 boolean isEnabled()
          Returns the enablement state of the contained template.
 boolean isModified()
          Returns whether the receiver represents a modified style sheet, i.e. a contributed style sheet that has been changed.
 boolean isUserAdded()
          Returns true if the contained style sheet was added by a user, i.e. does not reference a contributed style sheet.
 void revert()
          Reverts the template to its original setting.
 void setDeleted(boolean isDeleted)
          Sets the deletion state of the stored style sheet.
 void setEnabled(boolean isEnabled)
          Sets the enablement state of the contained style sheet.
 void setStylesheet(Stylesheet stylesheet)
          Sets the template encapsulated by the receiver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StylesheetPersistenceData

public StylesheetPersistenceData(Stylesheet stylesheet,
                                 boolean enabled)
Creates a new, user-added instance that is not linked to a contributed style sheet.

Parameters:
stylesheet - the style sheet which is stored by the new instance
enabled - whether the style sheet is enabled

StylesheetPersistenceData

public StylesheetPersistenceData(Stylesheet stylesheet,
                                 boolean enabled,
                                 java.lang.String id)
Creates a new instance. If id is not null, the instance is represents a style sheet that is contributed and can be identified via its id.

Parameters:
stylesheet - the style sheet which is stored by the new instance
enabled - whether the style sheet is enabled
id - the id of the style sheet, or null if a user-added instance should be created
Method Detail

getId

public java.lang.String getId()
Returns the id of this style sheet store, or null if there is none.

Returns:
the id of this style sheet store

isDeleted

public boolean isDeleted()
Returns the deletion state of the stored style sheet. This is only relevant of contributed style sheets.

Returns:
the deletion state of the stored style sheet

setDeleted

public void setDeleted(boolean isDeleted)
Sets the deletion state of the stored style sheet.

Parameters:
isDeleted - the deletion state of the stored style sheet

getStylesheet

public Stylesheet getStylesheet()
Returns the style sheet encapsulated by the receiver.

Returns:
the style sheet encapsulated by the receiver

setStylesheet

public void setStylesheet(Stylesheet stylesheet)
Sets the template encapsulated by the receiver.


isCustom

public boolean isCustom()
Returns whether the receiver represents a custom style sheet, i.e. is either a user-added style sheet or a contributed style sheet that has been modified.

Returns:
true if the contained style sheet is a custom style sheet and cannot be reconstructed from the contributed style sheets

isModified

public boolean isModified()
Returns whether the receiver represents a modified style sheet, i.e. a contributed style sheet that has been changed.

Returns:
true if the contained style sheet is contributed but has been modified, false otherwise

isUserAdded

public boolean isUserAdded()
Returns true if the contained style sheet was added by a user, i.e. does not reference a contributed style sheet.

Returns:
true if the contained style sheet was added by a user, false otherwise

revert

public void revert()
Reverts the template to its original setting.


isEnabled

public boolean isEnabled()
Returns the enablement state of the contained template.

Returns:
the enablement state of the contained template

setEnabled

public void setEnabled(boolean isEnabled)
Sets the enablement state of the contained style sheet.

Parameters:
isEnabled - the new enablement state of the contained style sheet