86 lines
3.5 KiB
Java
86 lines
3.5 KiB
Java
|
|
/*
|
||
|
|
* Copyright (c) 2006,2008 Declarative Engineering LLC.
|
||
|
|
* All rights reserved. This program and the accompanying materials
|
||
|
|
* are made available under the terms of the Declarative Engineering LLC
|
||
|
|
* verson 1 which accompanies this distribution, and is available at
|
||
|
|
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||
|
|
*/
|
||
|
|
package com.foundation.view.definition;
|
||
|
|
|
||
|
|
import com.foundation.metadata.Attribute;
|
||
|
|
import com.foundation.util.IManagedList;
|
||
|
|
import com.foundation.util.ManagedList;
|
||
|
|
import com.foundation.util.xml.IElement;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Association nodes are used by an association target or link to build an arbitrary tree of listeners to models which will indicate that the target value has been altered.
|
||
|
|
*/
|
||
|
|
public class AssociationNodePart extends AbstractPart implements IAssociationNodePart {
|
||
|
|
public static final Attribute EVENTS = registerCollection(AssociationNodePart.class, "events", AO_LAZY);
|
||
|
|
public static final Attribute ATTRIBUTES = registerCollection(AssociationNodePart.class, "attributes", AO_LAZY);
|
||
|
|
public static final Attribute ROW_TYPE_NAME = registerAttribute(AssociationNodePart.class, "rowTypeName");
|
||
|
|
/**
|
||
|
|
* AssociationNodePart constructor.
|
||
|
|
* <p><b>Warning: Only public for the purpose of creating reflections.</b></p>
|
||
|
|
*/
|
||
|
|
public AssociationNodePart() {
|
||
|
|
}//AssociationNodePart()//
|
||
|
|
/**
|
||
|
|
* AssociationNodePart constructor.
|
||
|
|
* @param parent The target which is defining this node.
|
||
|
|
* @param component The component referencing the attribute.
|
||
|
|
* @param documentElement The optional element of the document that defines this association. This is used for debugging.
|
||
|
|
*/
|
||
|
|
public AssociationNodePart(IComponentData component, IElement documentElement) {
|
||
|
|
super(component);
|
||
|
|
setDocumentElement(documentElement);
|
||
|
|
}//AssociationNodePart()//
|
||
|
|
/* (non-Javadoc)
|
||
|
|
* @see com.foundation.common.Entity#lazyLoadAttribute(com.foundation.metadata.Attribute)
|
||
|
|
*/
|
||
|
|
protected Object lazyLoadAttribute(Attribute attribute) {
|
||
|
|
Object result = null;
|
||
|
|
|
||
|
|
if(attribute == EVENTS) {
|
||
|
|
result = new ManagedList(5, 20);
|
||
|
|
}//if//
|
||
|
|
else if(attribute == ATTRIBUTES) {
|
||
|
|
result = new ManagedList(5, 20);
|
||
|
|
}//else if//
|
||
|
|
else {
|
||
|
|
result = super.lazyLoadAttribute(attribute);
|
||
|
|
}//else//
|
||
|
|
|
||
|
|
return result;
|
||
|
|
}//lazyLoadAttribute()//
|
||
|
|
/**
|
||
|
|
* Gets the event names that should be listened to for the leaf node.
|
||
|
|
* <p>Warning: This is only valid for leaf nodes.</p>
|
||
|
|
* @return The collection of String instances, one for each event listened to on the association's result.
|
||
|
|
*/
|
||
|
|
public IManagedList getEvents() {
|
||
|
|
return (IManagedList) getAttributeValue(EVENTS);
|
||
|
|
}//getEvents()//
|
||
|
|
/**
|
||
|
|
* Gets the attributes names that should be listened to for the leaf node.
|
||
|
|
* <p>Warning: This is only valid for leaf nodes.</p>
|
||
|
|
* @return The collection of String instances, one for each attribute listened to on the association's result.
|
||
|
|
*/
|
||
|
|
public IManagedList getAttributes() {
|
||
|
|
return (IManagedList) getAttributeValue(ATTRIBUTES);
|
||
|
|
}//getAttributes()//
|
||
|
|
/**
|
||
|
|
* Gets the qualified class name which defines what values this node applies to.
|
||
|
|
* @return The qualified class name of the row type supported by this association node.
|
||
|
|
*/
|
||
|
|
public String getRowTypeName() {
|
||
|
|
return (String) getAttributeValue(ROW_TYPE_NAME);
|
||
|
|
}//getRowTypeName()//
|
||
|
|
/**
|
||
|
|
* Sets the qualified class name which defines what values this node applies to.
|
||
|
|
* @param rowTypeName The qualified class name of the row type supported by this association node.
|
||
|
|
*/
|
||
|
|
public void setRowTypeName(String rowTypeName) {
|
||
|
|
setAttributeValue(ROW_TYPE_NAME, rowTypeName);
|
||
|
|
}//setRowTypeName()//
|
||
|
|
}//AssociationNodePart//
|