sk.uniba.euromath.editor.widgets.namelist
Class DisplayableNameList<R extends BaseRule>

java.lang.Object
  extended by sk.uniba.euromath.editor.widgets.namelist.DisplayableNameList<R>
Type Parameters:
R - the rule type. Can be instance of AttributeRule or NewElementRule only.
Direct Known Subclasses:
DisplayableNameListImpl, SingleAttributeDNL

public abstract class DisplayableNameList<R extends BaseRule>
extends Object

Represents the displayable name list. There is one difference between 'DOM' and 'Real' namespace: When the list represents elements then they are equal. However, a local attribute (with null DOM namespace) has a 'real' namespace equal to its owner namespace.

Author:
Martin Vysny

Field Summary
 boolean isElement
          True if this object represents rules for element, false otherwise.
 String localNamespaceName
          The name of the namespace of all local names, as defined in a config file.
 String localNamespaceUri
          The namespace of all local names.
 
Constructor Summary
protected DisplayableNameList(String localNamespaceUri, boolean isElement)
          Basic constructor.
 
Method Summary
 String getDomNamespaceUri(int i)
          Returns the DOM namespace of the name.
 QName getDomQName(int i, String prefix)
          Returns the qname for the name.
abstract  QName getForeign(int i)
          Returns the foreign name.
 int getLength()
          Returns number of items in the list.
abstract  String getLocal(int i)
          Returns the local name.
abstract  String getNamespace(int i)
          Returns the namespace item.
static String getNamespaceDescription(String namespaceUri)
          Returns the name of the namespace, as defined in the config file.
 String getRealNamespaceDescription(int i)
          Returns the name of the namespace, as defined in the config file.
 String getRealNamespaceUri(int i)
          Returns the 'real' namespace of the name.
abstract  R getRule(int i)
          Returns the rule for the name as returned by the NameList class.
abstract  String[] getStrings()
          Returns array of a displayable representation of names.
abstract  DisplayableNameItemTypeEnum getType(int i)
          Determines the type of the item.
 boolean hasRule(int i)
          Determines if item can have a rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localNamespaceUri

public final String localNamespaceUri
The namespace of all local names.


isElement

public final boolean isElement
True if this object represents rules for element, false otherwise.


localNamespaceName

public final String localNamespaceName
The name of the namespace of all local names, as defined in a config file.

Constructor Detail

DisplayableNameList

protected DisplayableNameList(String localNamespaceUri,
                              boolean isElement)
Basic constructor.

Parameters:
localNamespaceUri - the namespace of the local elements/attributes.
isElement - true if this object will represent elements or attributes. There is a difference: elements from non-null namespace will have a prefix, attributes from non-null (local) namespace will have a prefix only if this namespace is different than a namespace of the owner element.
Method Detail

getStrings

public abstract String[] getStrings()
Returns array of a displayable representation of names.

Returns:
array of a displayable representation of names.

getType

public abstract DisplayableNameItemTypeEnum getType(int i)
Determines the type of the item.

Parameters:
i - index of the name, as in getStrings() array.
Returns:
item type.

hasRule

public final boolean hasRule(int i)
Determines if item can have a rule. Item can have a rule when it has valid index and it is local or foreign qname.

Parameters:
i - index
Returns:
true if the item can have rule.

getLocal

public abstract String getLocal(int i)
Returns the local name.

Parameters:
i - index of the name, as in getStrings() array.
Returns:
a local name, that can be used to query the name list.
Throws:
IndexOutOfBoundsException - if the index is out of bounds or does not denote a local name.

getForeign

public abstract QName getForeign(int i)
Returns the foreign name.

Parameters:
i - index of the name, as in getStrings() array.
Returns:
a foreign name, that can be used to query the name list.
Throws:
IndexOutOfBoundsException - if the index is out of bounds or does not denote a foreign qname.

getNamespace

public abstract String getNamespace(int i)
Returns the namespace item.

Parameters:
i - index of the name, as in getStrings() array.
Returns:
a namespace denoting foreign qnames that doesn't have schema loaded or doesn't have schema at all.
Throws:
IndexOutOfBoundsException - if the index is out of bounds or does not denote a namespace.

getDomNamespaceUri

public final String getDomNamespaceUri(int i)
Returns the DOM namespace of the name.

Parameters:
i - index of the name, as in getStrings() array.
Returns:
the namespace of the name.

getRealNamespaceUri

public final String getRealNamespaceUri(int i)
Returns the 'real' namespace of the name.

Parameters:
i - index of the name, as in getStrings() array.
Returns:
the namespace of the name.

getRealNamespaceDescription

public final String getRealNamespaceDescription(int i)
Returns the name of the namespace, as defined in the config file.

Parameters:
i - index of the name, as in getStrings() array.
Returns:
the name of the namespace, or namespaceUri if no name is defined.

getRule

public abstract R getRule(int i)
Returns the rule for the name as returned by the NameList class. Only local and foreign items can have a rule.

Parameters:
i - index of the name, as in getStrings() array.
Returns:
the rule.
Throws:
IndexOutOfBoundsException - if the index is out of bounds
IllegalArgumentException - if i does not denote local nor foreign items.

getDomQName

public final QName getDomQName(int i,
                               String prefix)
Returns the qname for the name.

Parameters:
i - index of the name, as in getStrings() array.
prefix - the prefix for the qname.
Returns:
the rule.
Throws:
IndexOutOfBoundsException - if the index is out of bounds
IllegalArgumentException - if i does not denote local nor foreign items.

getNamespaceDescription

public static final String getNamespaceDescription(String namespaceUri)
Returns the name of the namespace, as defined in the config file.

Parameters:
namespaceUri - the namespace to query.
Returns:
the name of the namespace, or namespaceUri if no name is defined.

getLength

public final int getLength()
Returns number of items in the list.

Returns:
number of items.


Copyright © 2003-2006 null. All Rights Reserved.