Search in sources :

Example 31 with Journaled

use of com.ramussoft.common.journal.Journaled in project ramus by Vitaliy-Yakovchuk.

the class QualifiersQualifierAttributesDialog method onOk.

@Override
protected void onOk() {
    Qualifier qualifier = StandardAttributesPlugin.getQualifiersQualifier(engine);
    qualifier.getAttributes().clear();
    for (Row row : view.getSelectedRows()) {
        qualifier.getAttributes().add(engine.getAttribute(StandardAttributesPlugin.getAttributeId(engine, row.getElement())));
    }
    ((Journaled) engine).startUserTransaction();
    engine.updateQualifier(qualifier);
    ((Journaled) engine).commitUserTransaction();
    super.onOk();
}
Also used : Journaled(com.ramussoft.common.journal.Journaled) Qualifier(com.ramussoft.common.Qualifier) Row(com.ramussoft.database.common.Row)

Example 32 with Journaled

use of com.ramussoft.common.journal.Journaled in project ramus by Vitaliy-Yakovchuk.

the class DFDSRoleOptionsDialog method onOk.

@Override
protected void onOk() {
    if (!isCanOk()) {
        JOptionPane.showMessageDialog(this, ResourceLoader.getString("you_should_enter_name_or_at_least_on_added_elemen"));
        return;
    }
    if (!isOkStreamName()) {
        if (JOptionPane.showConfirmDialog(this, ResourceLoader.getString("you_entered_exists_stream_continue"), ResourceLoader.getString("warning"), JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
            return;
        }
    }
    DFDSRole role = (DFDSRole) object;
    Journaled journaled = (Journaled) dataPlugin.getEngine();
    journaled.startUserTransaction();
    Function function = object.getFunction();
    function.setFont(fontChooser.getSelFont());
    function.setBackground(backgroundColorChooser.getColor());
    function.setForeground(foregroundColorChooser.getColor());
    role.setAlternativeText(sectorNameEditor.getAlternativeTextField().getText());
    Stream stream = sectorRowsEditor.getStream();
    if (stream == null) {
        stream = sectorNameEditor.findStreamByName();
        if (stream == null) {
            stream = (Stream) dataPlugin.createRow(dataPlugin.getBaseStream(), true);
        }
    }
    final String t = sectorNameEditor.getArrowName();
    if (!t.equals("")) {
        if (!t.equals(stream.getName()) && sectorNameEditor.findStreamByName(stream.getName()) != null) {
            stream = (Stream) dataPlugin.createRow(dataPlugin.getBaseStream(), true);
        }
    }
    if (t.equals("")) {
        if (!stream.isEmptyName()) {
            stream = (Stream) dataPlugin.createRow(dataPlugin.getBaseStream(), true);
            stream.setEmptyName(true);
        }
    } else {
        stream.setName(t);
    }
    stream.setRows(sectorRowsEditor.getRows());
    role.setStream(stream, ReplaceStreamType.SIMPLE);
    // sector.setStreamAddedByRefactor(false);
    final Row[] rs = sectorRowsEditor.getRows();
    role.setRows(rs);
    if (rs != null) {
        RectangleVisualOptions ops = new RectangleVisualOptions();
        ops.bounds = function.getBounds();
        ops.background = function.getBackground();
        ops.font = function.getFont();
        ops.foreground = function.getForeground();
        for (Row row : rs) if (row != null) {
            IDEF0Plugin.setDefaultRectangleVisualOptions(dataPlugin.getEngine(), row.getElement(), ops);
        }
    }
    journaled.commitUserTransaction();
    setVisible(false);
}
Also used : DFDSRole(com.ramussoft.pb.dfds.visual.DFDSRole) Journaled(com.ramussoft.common.journal.Journaled) Function(com.ramussoft.pb.Function) RectangleVisualOptions(com.ramussoft.idef0.attribute.RectangleVisualOptions) Stream(com.ramussoft.pb.Stream) Row(com.ramussoft.pb.Row)

Example 33 with Journaled

use of com.ramussoft.common.journal.Journaled in project ramus by Vitaliy-Yakovchuk.

the class FunctionOptionsDialog method apptype.

private void apptype() {
    Engine e = dataPlugin.getEngine();
    if (e instanceof Journaled)
        ((Journaled) e).startUserTransaction();
    function.setFont(getJFontChooser().getSelFont());
    function.setBackground(getJColorChooser().getColor());
    function.setForeground(getJColorChooser1().getColor());
    final JList jList = selectOwner.getJList();
    if (jList.getSelectedIndex() == 0)
        function.setOwner(null);
    else {
        function.setOwner((Row) jList.getSelectedValue());
    }
    function.setType(functionType.getType());
    AccessRules rules = dataPlugin.getAccessRules();
    Element element = ((NFunction) function).getElement();
    for (int index = attributes.size() - 1; index >= 0; index--) {
        Attribute attribute = attributes.get(index);
        if (rules.canUpdateElement(element.getId(), attribute.getId())) {
            Object value = attributeEditors.get(index).getValue();
            if (!equals(value, values.get(index)))
                e.setAttribute(element, attribute, value);
        }
    }
    if (e instanceof Journaled)
        ((Journaled) e).commitUserTransaction();
}
Also used : Journaled(com.ramussoft.common.journal.Journaled) NFunction(com.ramussoft.pb.data.negine.NFunction) Attribute(com.ramussoft.common.Attribute) Element(com.ramussoft.common.Element) AccessRules(com.ramussoft.common.AccessRules) IDEF0Object(com.ramussoft.pb.idef.visual.IDEF0Object) Engine(com.ramussoft.common.Engine) JList(javax.swing.JList)

Example 34 with Journaled

use of com.ramussoft.common.journal.Journaled in project ramus by Vitaliy-Yakovchuk.

the class DiagramOptionsDialog method onOk.

@Override
protected void onOk() {
    Engine engine = framework.getEngine();
    ((Journaled) engine).startUserTransaction();
    function.setStatus(statusPanel.getStatus());
    if (!function.getCreateDate().equals(createDate.getDate()))
        function.setCreateDate(createDate.getDate());
    if (!function.getRevDate().equals(revDate.getDate()))
        function.setRevDate(revDate.getDate());
    if (!function.getAuthor().equals(author.getText()))
        function.setAuthor(author.getText());
    String newSize = String.valueOf(sizesBox.getSelectedItem());
    if (horizontalPageCountBox.getSelectedIndex() != 0)
        newSize += "x" + horizontalPageCountBox.getSelectedItem();
    if (!newSize.equals(function.getPageSize())) {
        function.setPageSize(newSize);
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                framework.propertyChanged(IDEF0TabView.UPDATE_SIZES);
            }
        });
    }
    ((Journaled) engine).commitUserTransaction();
    super.onOk();
}
Also used : Journaled(com.ramussoft.common.journal.Journaled) Engine(com.ramussoft.common.Engine)

Aggregations

Journaled (com.ramussoft.common.journal.Journaled)34 Engine (com.ramussoft.common.Engine)9 Attribute (com.ramussoft.common.Attribute)7 Element (com.ramussoft.common.Element)7 Qualifier (com.ramussoft.common.Qualifier)7 ArrayList (java.util.ArrayList)7 IOException (java.io.IOException)6 Row (com.ramussoft.database.common.Row)5 DataPlugin (com.ramussoft.pb.DataPlugin)5 FileIEngineImpl (com.ramussoft.core.impl.FileIEngineImpl)4 NDataPlugin (com.ramussoft.pb.data.negine.NDataPlugin)4 AttributeType (com.ramussoft.common.AttributeType)3 MemoryDatabase (com.ramussoft.database.MemoryDatabase)3 TreeTableNode (com.ramussoft.gui.qualifier.table.TreeTableNode)3 ModelParaleler (com.ramussoft.idef0.ModelParaleler)3 Function (com.ramussoft.pb.Function)3 Row (com.ramussoft.pb.Row)3 TreePath (javax.swing.tree.TreePath)3 AccessRules (com.ramussoft.common.AccessRules)2 IEngine (com.ramussoft.common.IEngine)2