Search in sources :

Example 6 with QualifierEvent

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

the class OtherElementPlugin method setFramework.

@Override
public void setFramework(GUIFramework framework) {
    super.setFramework(framework);
    final QualifierListener listener = new QualifierAdapter() {

        @Override
        public void qualifierDeleted(QualifierEvent event) {
            RowSetValue value = sets.get(event.getOldQualifier());
            if (value != null) {
                value.rowSet.close();
                sets.remove(event.getOldQualifier());
            }
        }
    };
    framework.getEngine().addQualifierListener(listener);
    framework.addCloseMainFrameListener(new CloseMainFrameAdapter() {

        @Override
        public void closed() {
            for (RowSetValue value : sets.values()) {
                try {
                    value.rowSet.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            sets.clear();
            OtherElementPlugin.this.framework.getEngine().removeQualifierListener(listener);
        }
    });
}
Also used : QualifierAdapter(com.ramussoft.common.event.QualifierAdapter) CloseMainFrameAdapter(com.ramussoft.gui.common.event.CloseMainFrameAdapter) QualifierListener(com.ramussoft.common.event.QualifierListener) QualifierEvent(com.ramussoft.common.event.QualifierEvent)

Example 7 with QualifierEvent

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

the class JournaledEngine method registerCreation.

private Qualifier registerCreation(Qualifier qualifier) {
    synchronized (swithJournalLock) {
        journal.store(new CreateQualifierCommand(this, qualifier));
    }
    QualifierEvent event = new QualifierEvent(this, null, qualifier);
    qualifierCreated(event);
    return qualifier;
}
Also used : QualifierEvent(com.ramussoft.common.event.QualifierEvent) CreateQualifierCommand(com.ramussoft.common.journal.command.CreateQualifierCommand)

Example 8 with QualifierEvent

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

the class UpdateQualifierCommand method undo.

@Override
public void undo(IEngine iEngine) {
    iEngine.updateQualifier(oldQualifier);
    QualifierEvent event = new QualifierEvent(engine, newQualifier, oldQualifier, true);
    for (Attribute attribute : deletedAttributes) {
        for (Entry<Long, Transaction> entry : hashtable.get(attribute.getId()).entrySet()) {
            iEngine.setBinaryAttribute(entry.getKey(), attribute.getId(), entry.getValue());
            Element element = iEngine.getElement(entry.getKey());
            AttributeEvent event2 = new AttributeEvent(engine, element, attribute, null, engine.getAttribute(element, attribute), true);
            engine.attributeChanged(event2);
        }
    }
    if (oldQualifier.getAttributeForName() != newQualifier.getAttributeForName())
        getEngine().updateElementNames(newQualifier, oldQualifier);
    engine.qualifierUpdated(event);
}
Also used : Transaction(com.ramussoft.common.persistent.Transaction) Attribute(com.ramussoft.common.Attribute) Element(com.ramussoft.common.Element) QualifierEvent(com.ramussoft.common.event.QualifierEvent) AttributeEvent(com.ramussoft.common.event.AttributeEvent)

Example 9 with QualifierEvent

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

the class DeleteQualifierCommand method undo.

@Override
public void undo(IEngine iEngine) {
    Qualifier old;
    if (system)
        old = iEngine.createSystemQualifier(qualifier.getId());
    else
        old = iEngine.createQualifier(qualifier.getId());
    QualifierEvent event = new QualifierEvent(engine, null, old, true);
    engine.qualifierCreated(event);
    iEngine.updateQualifier(qualifier);
    event = new QualifierEvent(engine, old, qualifier, true);
    engine.qualifierUpdated(event);
}
Also used : Qualifier(com.ramussoft.common.Qualifier) QualifierEvent(com.ramussoft.common.event.QualifierEvent)

Example 10 with QualifierEvent

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

the class DeleteQualifierCommand method redo.

@Override
public void redo(IEngine iEngine) {
    iEngine.deleteQualifier(qualifier.getId());
    QualifierEvent event = new QualifierEvent(engine, qualifier, null, true);
    engine.qualifierDeleted(event);
}
Also used : QualifierEvent(com.ramussoft.common.event.QualifierEvent)

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