Search in sources :

Example 11 with ElementListPropertyPersistent

use of com.ramussoft.core.attribute.simple.ElementListPropertyPersistent in project ramus by Vitaliy-Yakovchuk.

the class ProjectionConnectionPlugin method getConnection.

@SuppressWarnings("unchecked")
@Override
public Connection getConnection(Data data, Qualifier qualifier, String name) {
    Hashtable<String, EConnection> hash = (Hashtable<String, EConnection>) data.get("Projections.Hash");
    List<String> nulls = (List<String>) data.get("Projections.Nulls");
    if (hash == null) {
        hash = new Hashtable<String, EConnection>();
        data.put("Projections.Hash", hash);
    }
    if (nulls == null) {
        nulls = new Vector<String>();
        data.put("Projections.Nulls", nulls);
    }
    EConnection connection = hash.get(name);
    if (connection == null) {
        if (nulls.indexOf(name) >= 0)
            return null;
        for (Attribute attribute : data.getAttributes()) {
            if ((attribute.getName().equals(name) && (attribute.getAttributeType().toString().equals("Core.ElementList")))) {
                ElementListPropertyPersistent property = (ElementListPropertyPersistent) data.getEngine().getAttribute(null, attribute);
                if (property != null) {
                    connection = new EConnection(attribute, property);
                }
            }
        }
    }
    if (connection == null)
        nulls.add(name);
    else
        hash.put(name, connection);
    return connection;
}
Also used : Attribute(com.ramussoft.common.Attribute) Hashtable(java.util.Hashtable) ElementListPropertyPersistent(com.ramussoft.core.attribute.simple.ElementListPropertyPersistent) List(java.util.List)

Example 12 with ElementListPropertyPersistent

use of com.ramussoft.core.attribute.simple.ElementListPropertyPersistent in project ramus by Vitaliy-Yakovchuk.

the class StandardAttributesPlugin method initQualifiers.

private void initQualifiers(Engine engine) {
    qualifiers = engine.createSystemQualifier();
    attributes = engine.createSystemQualifier();
    qualifiers.setName(QUALIFIERS_QUALIFIER);
    attributes.setName(ATTRIBUTES_QUALIFIER);
    aList = engine.createSystemAttribute(new AttributeType("Core", "ElementList", false));
    aList.setName(QUALIFIER_ATTRIBUTES);
    aQualifierId = engine.createSystemAttribute(new AttributeType("Core", "Long", true));
    aQualifierId.setName(QUALIFIER_ID);
    engine.updateAttribute(aQualifierId);
    aAttributeId = engine.createSystemAttribute(new AttributeType("Core", "Long", true));
    aAttributeId.setName(ATTRIBUTE_ID);
    engine.updateAttribute(aAttributeId);
    nameAttribute = engine.createSystemAttribute(new AttributeType("Core", "Text", true));
    nameAttribute.setName(ATTRIBUTE_NAME);
    engine.updateAttribute(nameAttribute);
    attributeTypeName = engine.createSystemAttribute(new AttributeType("Core", "Text", true));
    attributeTypeName.setName(ATTRIBUTE_TYPE_NAME);
    engine.updateAttribute(attributeTypeName);
    ElementListPropertyPersistent property = new ElementListPropertyPersistent();
    property.setQualifier1(qualifiers.getId());
    property.setQualifier2(attributes.getId());
    engine.setAttribute(null, aList, property);
    qualifiers.getSystemAttributes().add(aList);
    qualifiers.getSystemAttributes().add(aQualifierId);
    qualifiers.getSystemAttributes().add(nameAttribute);
    qualifiers.setAttributeForName(nameAttribute.getId());
    Attribute h = (Attribute) engine.getPluginProperty("Core", HierarchicalPlugin.HIERARHICAL_ATTRIBUTE);
    qualifiers.getSystemAttributes().add(h);
    attributes.getSystemAttributes().add(aList);
    attributes.getSystemAttributes().add(h);
    attributes.getSystemAttributes().add(aAttributeId);
    attributes.getSystemAttributes().add(nameAttribute);
    attributes.getSystemAttributes().add(attributeTypeName);
    attributes.setAttributeForName(nameAttribute.getId());
    engine.updateQualifier(qualifiers);
    engine.updateQualifier(attributes);
    engine.updateAttribute(aList);
}
Also used : Attribute(com.ramussoft.common.Attribute) AttributeType(com.ramussoft.common.AttributeType) ElementListPropertyPersistent(com.ramussoft.core.attribute.simple.ElementListPropertyPersistent)

Aggregations

ElementListPropertyPersistent (com.ramussoft.core.attribute.simple.ElementListPropertyPersistent)12 Attribute (com.ramussoft.common.Attribute)6 Qualifier (com.ramussoft.common.Qualifier)6 Engine (com.ramussoft.common.Engine)4 ElementListPersistent (com.ramussoft.core.attribute.simple.ElementListPersistent)3 List (java.util.List)3 BorderLayout (java.awt.BorderLayout)2 JPanel (javax.swing.JPanel)2 AccessRules (com.ramussoft.common.AccessRules)1 AttributeType (com.ramussoft.common.AttributeType)1 Element (com.ramussoft.common.Element)1 IEngine (com.ramussoft.common.IEngine)1 SelectType (com.ramussoft.gui.qualifier.table.SelectType)1 TreeTableNode (com.ramussoft.gui.qualifier.table.TreeTableNode)1 SelectionEvent (com.ramussoft.gui.qualifier.table.event.SelectionEvent)1 Row (com.ramussoft.pb.Row)1 NRow (com.ramussoft.pb.data.negine.NRow)1 TableLayout (info.clearthought.layout.TableLayout)1 AdjustmentEvent (java.awt.event.AdjustmentEvent)1 AdjustmentListener (java.awt.event.AdjustmentListener)1