Search in sources :

Example 16 with QualifierEvent

use of com.ramussoft.common.event.QualifierEvent in project ramus by Vitaliy-Yakovchuk.

the class HierarchicalPlugin method init.

@Override
public void init(final Engine engine, AccessRules accessor) {
    super.init(engine, accessor);
    hierarhicalAttribute = engine.getSystemAttribute(HIERARHICAL_ATTRIBUTE);
    if (hierarhicalAttribute == null) {
        hierarhicalAttribute = engine.createSystemAttribute(new AttributeType(getName(), getTypeName(), true));
        hierarhicalAttribute.setName(HIERARHICAL_ATTRIBUTE);
        engine.updateAttribute(hierarhicalAttribute);
    }
    engine.setPluginProperty(getName(), HIERARHICAL_ATTRIBUTE, hierarhicalAttribute);
    engine.addQualifierListener(new QualifierAdapter() {

        @Override
        public void qualifierCreated(QualifierEvent event) {
            if (event.isJournaled())
                return;
            if (StandardAttributesPlugin.isDisableAutoupdate(engine))
                return;
            Qualifier qualifier = event.getNewQualifier();
            if (qualifier.isSystem())
                return;
            qualifier.getSystemAttributes().add(hierarhicalAttribute);
            engine.updateQualifier(qualifier);
        }
    });
}
Also used : QualifierAdapter(com.ramussoft.common.event.QualifierAdapter) AttributeType(com.ramussoft.common.AttributeType) QualifierEvent(com.ramussoft.common.event.QualifierEvent) Qualifier(com.ramussoft.common.Qualifier)

Aggregations

QualifierEvent (com.ramussoft.common.event.QualifierEvent)16 Qualifier (com.ramussoft.common.Qualifier)10 QualifierAdapter (com.ramussoft.common.event.QualifierAdapter)7 Attribute (com.ramussoft.common.Attribute)4 AttributeType (com.ramussoft.common.AttributeType)3 Element (com.ramussoft.common.Element)3 AttributeEvent (com.ramussoft.common.event.AttributeEvent)3 ElementAdapter (com.ramussoft.common.event.ElementAdapter)3 ElementEvent (com.ramussoft.common.event.ElementEvent)3 Engine (com.ramussoft.common.Engine)2 IEngine (com.ramussoft.common.IEngine)2 ElementAttributeListener (com.ramussoft.common.event.ElementAttributeListener)2 IEngineImpl (com.ramussoft.core.impl.IEngineImpl)2 ActionEvent (com.ramussoft.gui.common.event.ActionEvent)2 ActionListener (com.ramussoft.gui.common.event.ActionListener)2 TabbedEvent (com.ramussoft.gui.common.event.TabbedEvent)2 ViewTitleEvent (com.ramussoft.gui.common.event.ViewTitleEvent)2 JDBCTemplate (com.ramussoft.jdbc.JDBCTemplate)2 RowMapper (com.ramussoft.jdbc.RowMapper)2 ResultSet (java.sql.ResultSet)2