public class IlvPalette extends Object
IlvPaletteSymbol
,
IlvPaletteCategory
Modifier and Type | Field and Description |
---|---|
static String |
PALETTE_DESCRIPTION_FILE
Constant defining the name of the xml file containing palette's
description: "palette.xml"
|
static int |
SMALLICON_SIZE
size of small icon representing the palette
|
Constructor and Description |
---|
IlvPalette()
Creates a new palette.
|
IlvPalette(ClassLoader classLoader)
Creates a new palette.
|
Modifier and Type | Method and Description |
---|---|
IlvPaletteCategory |
addCategory(IlvPaletteCategory parent,
String categoryID)
Add a category in the palette.
|
void |
addPaletteListener(PaletteListener l)
Adds a listener that listens to palette events.
|
IlvPaletteSymbol |
addSymbol(IlvPaletteCategory parent,
String symbolID)
Add a symbol in the palette.
|
String |
addValueSet(IlvPaletteSymbolParameterValueSet vset,
boolean checkDuplicates)
Adds a value set to this palette.
|
protected void |
fireCategoryAdded(IlvPaletteCategory parent,
IlvPaletteCategory category)
Fire an event when adding category to the category hierarchy.
|
protected void |
fireCategoryRemoved(IlvPaletteCategory parent,
IlvPaletteCategory category)
Fire an event when removing a category from the category hierarchy.
|
protected void |
fireSymbolAdded(IlvPaletteCategory parent,
IlvPaletteSymbol symbol)
Fire an event when adding a symbol into a category.
|
protected void |
fireSymbolRemoved(IlvPaletteCategory parent,
IlvPaletteSymbol symbol)
Fire an event when removing a symbol from a category.
|
protected void |
fireValueSetAdded(IlvPaletteSymbolParameterValueSet vset)
Fire an event when adding a value set to the palette.
|
protected void |
fireValueSetRemoved(IlvPaletteSymbolParameterValueSet vset)
Fire an event when removing a value set from the palette.
|
IlvPaletteCategory |
getCategory(String path)
Returns the first occurrence of a category matching the specified path.
|
int |
getChildCount(Object parent)
Returns the number of children in the specified parent
|
Enumeration |
getChildren(Object parent)
Returns and enumeration of the children of the specified parent.
|
Locale |
getDefaultLocale()
Returns the locale used to store name and description.
|
String |
getDescription()
Returns the palette description for the default locale.
|
String |
getDescription(Locale locale)
Returns the palette description for a given locale.
|
Icon |
getIcon()
Gets the icon associated to the palette
|
String |
getIconResourceName()
Returns the resource access string to the symbol icon
|
URL |
getIconURL()
Returns the string representation of the URL to the icon
|
URL |
getJarURL()
Returns the URL to the palette jar file.
|
String |
getName()
Returns the palette name for the default locale.
|
String |
getName(Locale locale)
Returns the palette name for a given locale.
|
String |
getPackageName()
Returns the package name in which the palette.xml file is located.
|
IlvPaletteObject |
getPaletteObject(String path)
Returns the first occurrence of a category or symbol matching the specified
path.
|
String |
getPaletteResourceName()
Returns the resource access name to palette.xml.
|
URL |
getPaletteURL()
Returns URL to access palette.xml
|
Object |
getParent(Object object)
Returns the parent of the specified object.
|
IlvPaletteCategory |
getRoot()
Returns the root category of this palette
|
ImageIcon |
getSmallIcon()
Gets the small size icon representing the palette
|
IlvPaletteSymbol |
getSymbol(String path)
Returns the first occurrence of a symbol matching the specified path.
|
IlvPaletteSymbol |
getSymbol(String cssResourceName,
String className)
Returns the first occurrence of a symbol that has the specified CSS
resource name and the specified class name.
|
IlvPaletteSymbolParameterValueSet |
getValueSet(int index)
Returns the value set with the given index.
|
IlvPaletteSymbolParameterValueSet |
getValueSet(String id)
Returns the value set with the given ID.
|
int |
getValueSetCount()
Returns the number of value sets of this palette.
|
IlvPaletteSymbolParameterValueSet[] |
getValueSets()
Returns all value sets added to this palette.
|
boolean |
isCategory(Object object)
Indicates if the specified object is an instance of IlvPaletteCategory
|
void |
load(URL urlOfPaletteXml)
Loads a palette by reading the content of the palette.xml file referenced
by the specified URL.
|
void |
removeAll()
Removes all categories and symbols from the palette.
|
void |
removePaletteListener(PaletteListener l)
Removed a listener that listens to palette events.
|
void |
removeValueSet(IlvPaletteSymbolParameterValueSet vset)
Removes a value set from this palette.
|
void |
replace(IlvPaletteObject oldObject,
IlvPaletteObject newObject)
Replaces the old palette object with the new palette object.
|
void |
setDefaultLocale(Locale locale)
Sets the locale used to store name and description.
|
void |
setDescription(Locale locale,
String description)
Sets the description of this palette for a given locale.
|
void |
setDescription(String description)
Sets the description of this palette for the default locale.
|
void |
setIconResourceName(String s)
Set the resource access string of the symbol's icon.
|
void |
setIconURL(URL iconurl)
Sets the url to the icon file.
|
void |
setName(Locale locale,
String name)
Sets the palette name for a given locale.
|
void |
setName(String name)
Sets the palette name for the default locale.
|
void |
setPackageName(String packageName)
Sets new package name.
|
void |
setRoot(IlvPaletteCategory root)
Sets the root category of the palette.
|
IlvPaletteCategory |
setRootCategory(String categoryID)
Creates a new category and sets it as root of this palette.
|
String |
toString()
Returns the name of the palette
|
public static final String PALETTE_DESCRIPTION_FILE
public static final int SMALLICON_SIZE
public IlvPalette()
public IlvPalette(ClassLoader classLoader)
classLoader
- The class loader to find the resources of the palette.public void load(URL urlOfPaletteXml) throws IOException
urlOfPaletteXml
- URL of the palette.xml fileIOException
public void setName(Locale locale, String name)
locale
- the locale use to store the namename
- the new name of this palettepublic String getName(Locale locale)
locale
- the localepublic void setName(String name)
setDefaultLocale(java.util.Locale)
to change the locale under which the name is
stored.name
- the namegetDefaultLocale()
public String getName()
setDefaultLocale(java.util.Locale)
to change the locale under which the name is
looked up.getDefaultLocale()
public void setDescription(Locale locale, String description)
locale
- the locale use to store the namedescription
- the new palette's descriptionpublic String getDescription(Locale locale)
locale
- the localepublic void setDescription(String description)
setDefaultLocale(java.util.Locale)
to change the locale under which the description
is stored.description
- the new descriptiongetDefaultLocale()
public String getDescription()
setDefaultLocale(java.util.Locale)
to change the locale under which the description
is looked up.getDefaultLocale()
public URL getIconURL()
public void setIconURL(URL iconurl)
getIconResourceName()
iconurl
- url of the iconpublic void setIconResourceName(String s)
getIconURL()
)s
- the new resource access stringpublic String getIconResourceName()
public IlvPaletteCategory addCategory(IlvPaletteCategory parent, String categoryID)
parent
- Category in which the new one will be addedcategoryID
- ID that will be given to the new categoryIlvPaletteCategory.add(IlvPaletteCategory)
public IlvPaletteSymbol addSymbol(IlvPaletteCategory parent, String symbolID)
parent
- Category in which the new symbol will be addedsymbolID
- ID that will be given to the new symbolpublic void replace(IlvPaletteObject oldObject, IlvPaletteObject newObject)
IlvPaletteSymbol
) or
palette categories (IlvPaletteCategory
). The new palette
object will have the same index as the old palette object. Note that by
replacing a palette category that contains children, these children will be
removed as well.oldObject
- The object to remove.newObject
- The object to add.public IlvPaletteSymbol getSymbol(String path)
path
- the path of the symbolpublic IlvPaletteCategory getCategory(String path)
path
- the path of the categorypublic IlvPaletteObject getPaletteObject(String path)
path
- the path of the categorypublic IlvPaletteSymbol getSymbol(String cssResourceName, String className)
cssResourceName
- The CSS resource name.className
- The class name.IlvPaletteSymbol.getCSSResourceName()
,
IlvPaletteSymbol.getClassName()
public void removeAll()
public String toString()
public Icon getIcon()
public ImageIcon getSmallIcon()
public IlvPaletteCategory getRoot()
public void setRoot(IlvPaletteCategory root)
If the old root is not null
a palette event for the old root
is fired through the categoryRemoved
method of
PaletteListener
. If the new root is not null
a
palette event for the new root is fired through the
categoryAdded
method of PaletteListener
.
root
- The new root category.PaletteEvent
,
PaletteListener
public IlvPaletteCategory setRootCategory(String categoryID)
categoryID
- The id of the root category.setRoot(ilog.views.symbology.palettes.IlvPaletteCategory)
public Enumeration getChildren(Object parent)
parent
- The parent categorypublic Object getParent(Object object)
object
- The objectpublic int getChildCount(Object parent)
parent
- The parent, an instance of IlvPaletteCategorypublic boolean isCategory(Object object)
public void addPaletteListener(PaletteListener l)
public void removePaletteListener(PaletteListener l)
protected void fireCategoryAdded(IlvPaletteCategory parent, IlvPaletteCategory category)
parent
- the new parent categorycategory
- the category addedPaletteListener
,
PaletteEvent
protected void fireCategoryRemoved(IlvPaletteCategory parent, IlvPaletteCategory category)
parent
- the old parent categorycategory
- the category removedPaletteListener
,
PaletteEvent
protected void fireSymbolAdded(IlvPaletteCategory parent, IlvPaletteSymbol symbol)
parent
- the new parent category of the symbolsymbol
- the symbol addedPaletteListener
,
PaletteEvent
protected void fireSymbolRemoved(IlvPaletteCategory parent, IlvPaletteSymbol symbol)
parent
- the old parent category of the symbolsymbol
- the symbol removedPaletteListener
,
PaletteEvent
public URL getJarURL()
public String getPackageName()
public void setPackageName(String packageName)
packageName
- The new name of the packagepublic String getPaletteResourceName()
public URL getPaletteURL()
public void setDefaultLocale(Locale locale)
null
for the locale of the default resource bundle.setName(String)
,
getName()
,
setDescription(String)
,
getDescription()
public Locale getDefaultLocale()
null
for the locale of the default resource bundle.setName(String)
,
getName()
,
setDescription(String)
,
getDescription()
public String addValueSet(IlvPaletteSymbolParameterValueSet vset, boolean checkDuplicates)
If the flag checkDuplicates
is true and a value set
representing the same values is already contained in this palette, the ID
of this value set is returned and the input value set is not added. In this
case, the typical code to add a value set and to work with the added value
set is this:
valueSet = palette.getValueSet(palette.addValueSet(valueSet, true));
If a different value set with the same ID is already contained in this palette, the ID of the input value set is modified to be unique, and the input value set is added. The modified ID is returned.
vset
- The value setcheckDuplicates
- Whether duplicates are checkedremoveValueSet(ilog.views.symbology.palettes.IlvPaletteSymbolParameterValueSet)
public void removeValueSet(IlvPaletteSymbolParameterValueSet vset)
vset
- The value setaddValueSet(ilog.views.symbology.palettes.IlvPaletteSymbolParameterValueSet, boolean)
public int getValueSetCount()
public IlvPaletteSymbolParameterValueSet getValueSet(int index)
public IlvPaletteSymbolParameterValueSet getValueSet(String id)
public IlvPaletteSymbolParameterValueSet[] getValueSets()
protected void fireValueSetAdded(IlvPaletteSymbolParameterValueSet vset)
vset
- the value set addedaddValueSet(ilog.views.symbology.palettes.IlvPaletteSymbolParameterValueSet, boolean)
,
PaletteListener
,
PaletteEvent
protected void fireValueSetRemoved(IlvPaletteSymbolParameterValueSet vset)
vset
- the value set removedremoveValueSet(ilog.views.symbology.palettes.IlvPaletteSymbolParameterValueSet)
,
PaletteListener
,
PaletteEvent
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.