com.ihr.xbrl.dts
Class LabelsProviderBasic

java.lang.Object
  extended by com.ihr.xbrl.dts.LabelsProviderBasic
All Implemented Interfaces:
LabelsProvider

public class LabelsProviderBasic
extends java.lang.Object
implements LabelsProvider

This is a class that implements the basic LabelsProvider interface so an instance of this class can provide labels to concept definitions and keep the labels in an internal database to speed-up the process of obtaining labels.

This class contains the following property names:
"workingStatus" the property changes from false to true when the internal database is going to be constructed, and from true to false when the database has been finished.

Author:
Ignacio

Field Summary
static java.lang.String WORKINGSTATUS
          Property to indicate when the database is being constructed.
 
Constructor Summary
LabelsProviderBasic(LangsProvider p)
          The creation of a LabelsProviderBasic requires a LangsProvider object.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a PropertyChangeListener to the listener list.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Add a PropertyChangeListener for a specific property.
 java.lang.String getLabel(XBRLResource res)
          Returns a suitable label for the resource The language is obtained by asking the application for the preferred language.
 java.lang.String getLabel(XMLElementDefinition el)
          Returns a suitable label for the element The language is obtained by asking the application for the preferred language
 java.lang.String getLabel(XMLElementDefinition el, XBRLRoleType preferredRole)
          Returns a label for the element corresponding to the preferredRole
 XBRLRoleType getLabelRole()
          Returns the label role set
 java.util.Iterator<XBRLRoleType> getLabelRoles()
          Access to all label roles in label extended links in the DTS.
 java.beans.PropertyChangeListener[] getPropertyChangeListeners()
          Returns an array of all the listeners that were added to the PropertyChangeSupport object with addPropertyChangeListener().
 java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String propertyName)
          Returns an array of all the listeners which have been associated with the named property.
 boolean hasListeners(java.lang.String propertyName)
          Check if there are any listeners for a specific property, including those registered on all properties.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove a PropertyChangeListener from the listener list.
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Remove a PropertyChangeListener for a specific property.
 void setDTS(DTSContainer newDts)
          Sets the new dts.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WORKINGSTATUS

public static final java.lang.String WORKINGSTATUS
Property to indicate when the database is being constructed.

See Also:
Constant Field Values
Constructor Detail

LabelsProviderBasic

public LabelsProviderBasic(LangsProvider p)
The creation of a LabelsProviderBasic requires a LangsProvider object. The LangsProvider object will be responsible of returning the list of preferred languages in user preference order.

Parameters:
p -
Method Detail

setDTS

public void setDTS(DTSContainer newDts)
Sets the new dts. Rebuilds the labels database. This fires property "workingStatus" changes from false to true and from true to false when finished.

Specified by:
setDTS in interface LabelsProvider

getLabelRoles

public java.util.Iterator<XBRLRoleType> getLabelRoles()
Access to all label roles in label extended links in the DTS.

Returns:
Iterator<XBRLRoleType>

getLabelRole

public XBRLRoleType getLabelRole()
Returns the label role set

Returns:
XBRLRoleType

getLabel

public java.lang.String getLabel(XMLElementDefinition el)
Description copied from interface: LabelsProvider
Returns a suitable label for the element The language is obtained by asking the application for the preferred language

Specified by:
getLabel in interface LabelsProvider
Parameters:
el - XMLElementDefinition
Returns:
String

getLabel

public java.lang.String getLabel(XMLElementDefinition el,
                                 XBRLRoleType preferredRole)
Description copied from interface: LabelsProvider
Returns a label for the element corresponding to the preferredRole

Specified by:
getLabel in interface LabelsProvider
Parameters:
el - XMLElementDefinition (normally item or tuple concept)
preferredRole - XBRLRoleType of the preferred role
Returns:
String

getLabel

public java.lang.String getLabel(XBRLResource res)
Description copied from interface: LabelsProvider
Returns a suitable label for the resource The language is obtained by asking the application for the preferred language. In this case, labels can be obtained as follows:
  1. if the resource has a generic label, the generic label text is returned, if not
  2. calls the getFriendlyName(XMLFragment.NO_POSITION, this)
  3. if the resource has an ID, the content of the ID is returned, if not
  4. if the resource has an xlink:label, the content of the xlink:label attribute is returned, if not
  5. if the resource is simple type, then the string value of the resource is returned, if not
  6. a unique text is generated and returned.
Note: getFriendlyName() is not called as it would return very long names

Specified by:
getLabel in interface LabelsProvider
Returns:
String

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. The listener is registered for all properties. The same listener object may be added more than once, and will be called as many times as it is added. If listener is null, no exception is thrown and no action is taken.

Parameters:
listener - The PropertyChangeListener to be added

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener for a specific property. The listener will be invoked only when a call on firePropertyChange names that specific property. The same listener object may be added more than once. For each property, the listener will be invoked the number of times it was added for that property. If propertyName or listener is null, no exception is thrown and no action is taken.

Parameters:
propertyName - The name of the property to listen on.
listener - The PropertyChangeListener to be added

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties. If listener was added more than once to the same event source, it will be notified one less time after being removed. If listener is null, or was never added, no exception is thrown and no action is taken.

Parameters:
listener - The PropertyChangeListener to be removed

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific property. If listener was added more than once to the same event source for the specified property, it will be notified one less time after being removed. If propertyName is null, no exception is thrown and no action is taken. If listener is null, or was never added for the specified property, no exception is thrown and no action is taken.

Parameters:
propertyName - The name of the property that was listened on.
listener - The PropertyChangeListener to be removed

hasListeners

public boolean hasListeners(java.lang.String propertyName)
Check if there are any listeners for a specific property, including those registered on all properties. If propertyName is null, only check for listeners registered on all properties.

Parameters:
propertyName - the property name.
Returns:
true if there are one or more listeners for the given property

getPropertyChangeListeners

public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
Returns an array of all the listeners that were added to the PropertyChangeSupport object with addPropertyChangeListener().

If some listeners have been added with a named property, then the returned array will be a mixture of PropertyChangeListeners and PropertyChangeListenerProxys. If the calling method is interested in distinguishing the listeners then it must test each element to see if it's a PropertyChangeListenerProxy, perform the cast, and examine the parameter.

 PropertyChangeListener[] listeners = bean.getPropertyChangeListeners();
 for (int i = 0; i < listeners.length; i++) {
         if (listeners[i] instanceof PropertyChangeListenerProxy) {
     PropertyChangeListenerProxy proxy = 
                    (PropertyChangeListenerProxy)listeners[i];
     if (proxy.getPropertyName().equals("foo")) {
       // proxy is a PropertyChangeListener which was associated
       // with the property named "foo"
     }
   }
 }

Returns:
all of the PropertyChangeListeners added or an empty array if no listeners have been added
Since:
1.4
See Also:
PropertyChangeListenerProxy

getPropertyChangeListeners

public java.beans.PropertyChangeListener[] getPropertyChangeListeners(java.lang.String propertyName)
Returns an array of all the listeners which have been associated with the named property.

Parameters:
propertyName - The name of the property being listened to
Returns:
all of the PropertyChangeListeners associated with the named property. If no such listeners have been added, or if propertyName is null, an empty array is returned.
Since:
1.4


Copyright 2006-2009 Reporting Standard S.L., C/ Torrecilla del Puerto 1, 28043, Madrid, Espaņa