Package org.eclipse.birt.report.model.api.validators

# Class ThemeStyleNameValidator

java.lang.Object
org.eclipse.birt.report.model.validators.AbstractSemanticValidator
org.eclipse.birt.report.model.validators.AbstractElementValidator
org.eclipse.birt.report.model.api.validators.ThemeStyleNameValidator

public class ThemeStyleNameValidator extends org.eclipse.birt.report.model.validators.AbstractElementValidator
Validates the ducplicat style name in the theme.

### Rule

The rule is that one theme element doesn't allow duplicate style name to appear in this element.

### Applicability

This validator is only applied to `Theme`.

## Field Summary

### Fields inherited from class org.eclipse.birt.report.model.validators.AbstractSemanticValidator

`modules, name`

## Constructor Summary

Constructors
Constructor
Description
`ThemeStyleNameValidator()`

## Method Summary

Modifier and Type
Method
Description
`static ThemeStyleNameValidator`
`getInstance()`
Returns the singleton validator instance.
`List<SemanticException>`
`validate(org.eclipse.birt.report.model.core.Module module, org.eclipse.birt.report.model.core.DesignElement element)`
Validates the given element which is in report.
`List<SemanticException>`
`validateForAddingStyle(AbstractThemeHandle theme, String styleName)`
Validates whether the style with the given name can be added into the given theme element.
`List<SemanticException>`
`validateForRenamingStyle(AbstractThemeHandle theme, StyleHandle style, String styleName)`
Validates whether the style can be renamed to the given name.

### Methods inherited from class org.eclipse.birt.report.model.validators.AbstractSemanticValidator

`canApplyToDesign, canApplyToLibrary, getName, isInTemplateParameterDefinitionSlot, setModules, setName`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ThemeStyleNameValidator

public ThemeStyleNameValidator()

## Method Details

### getInstance

public static ThemeStyleNameValidator getInstance()
Returns the singleton validator instance.

Returns:
  the validator instance

### validateForAddingStyle

public List<SemanticException> validateForAddingStyle(AbstractThemeHandle theme, String styleName)
Validates whether the style with the given name can be added into the given theme element.

Parameters:
  `theme` - the theme element
  `styleName` - name of the style to add
Returns:
  error list, each of which is the instance of `SemanticException`.

### validateForRenamingStyle

public List<SemanticException> validateForRenamingStyle(AbstractThemeHandle theme, StyleHandle style, String styleName)
Validates whether the style can be renamed to the given name.

Parameters:
  `theme` - the theme element
  `style` - the style to rename
  `styleName` - the new name of the style to add
Returns:
  error list, each of which is the instance of `SemanticException`.

### validate

public List<SemanticException> validate(org.eclipse.birt.report.model.core.Module module, org.eclipse.birt.report.model.core.DesignElement element)
Description copied from class: `org.eclipse.birt.report.model.validators.AbstractElementValidator`
Validates the given element which is in report.

Specified by:
  `validate` in class `org.eclipse.birt.report.model.validators.AbstractElementValidator`
Parameters:
  `module` - the module
  `element` - the given element to validate
Returns:
  error list, each of which is the instance of `SemanticException`.