Search in sources :

Example 76 with Qualifier

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

the class OtherElementPlugin method getAttributeEditor.

@Override
public AttributeEditor getAttributeEditor(final Engine engine, final AccessRules rules, final Element element, final Attribute attribute, String propertiesPrefix, AttributeEditor old) {
    if (old != null) {
        if ((old == otherElementEditor) && (this.attribute.equals(attribute)))
            return otherElementEditor;
        else
            old.close();
    }
    OtherElementPropertyPersistent p = (OtherElementPropertyPersistent) engine.getAttribute(null, attribute);
    final Qualifier qualifier = engine.getQualifier(p.getQualifier());
    this.attribute = attribute;
    otherElementEditor = new OtherElementEditor(engine, rules, qualifier, framework, propertiesPrefix);
    return otherElementEditor;
}
Also used : Qualifier(com.ramussoft.common.Qualifier) OtherElementPropertyPersistent(com.ramussoft.core.attribute.simple.OtherElementPropertyPersistent)

Example 77 with Qualifier

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

the class OtherElementPlugin method syncElement.

@Override
public void syncElement(Engine engine, QualifierImporter importer, Element sourceElement, Attribute sourceAttribute) {
    Long id = (Long) importer.getSourceValue(sourceElement, sourceAttribute);
    if (id == null)
        return;
    Element dest = importer.getDestinationElement(id);
    if (dest != null)
        engine.setAttribute(importer.getDestination(sourceElement), importer.getDestination(sourceAttribute), dest.getId());
    else {
        Element sourceElementValue = importer.getSource().getElement(id);
        if (sourceElementValue == null)
            return;
        Qualifier sq = importer.getSource().getQualifier(sourceElementValue.getQualifierId());
        Qualifier qualifier = importer.getDestination(sq);
        if (qualifier == null) {
            qualifier = engine.getQualifierByName(sq.getName());
        }
        if (qualifier == null)
            return;
        Element d = engine.getElement(sourceElementValue.getName(), qualifier.getId());
        if (d == null)
            return;
        engine.setAttribute(importer.getDestination(sourceElement), importer.getDestination(sourceAttribute), d.getId());
    }
}
Also used : Element(com.ramussoft.common.Element) Qualifier(com.ramussoft.common.Qualifier)

Example 78 with Qualifier

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

the class ElementListPreferenciesEditor method createComponent.

@Override
public JComponent createComponent(Attribute attribute, Engine engine, AccessRules accessRules) {
    JPanel basePanel = new JPanel(new BorderLayout());
    double[][] size = { { 5, TableLayout.FILL, 5 }, { 5, TableLayout.FILL, 5, TableLayout.FILL, 5, TableLayout.FILL, 5, TableLayout.FILL, 5, TableLayout.FILL, 5 } };
    JPanel panel = new JPanel(new TableLayout(size));
    panel.add(new JLabel(GlobalResourcesManager.getString("ElementList.Qualifier1")), "1, 1");
    panel.add(box1, "1, 3");
    panel.add(new JLabel(GlobalResourcesManager.getString("ElementList.Qualifier2")), "1, 5");
    panel.add(box2, "1, 7");
    panel.add(new JLabel(GlobalResourcesManager.getString("ElementList.Variants")), "1, 9");
    for (Qualifier qualifier : engine.getQualifiers()) {
        if (accessRules.canUpdateQualifier(qualifier.getId())) {
            box1.addItem(qualifier);
            box2.addItem(qualifier);
        }
    }
    if (attribute != null) {
        ElementListPropertyPersistent p = (ElementListPropertyPersistent) engine.getAttribute(null, attribute);
        box1.setSelectedItem(engine.getQualifier(p.getQualifier1()));
        box2.setSelectedItem(engine.getQualifier(p.getQualifier2()));
        box1.setEnabled(false);
        box2.setEnabled(false);
        if (p.getConnectionTypes() != null)
            variantsArea.setText(p.getConnectionTypes());
    }
    basePanel.add(panel, BorderLayout.NORTH);
    basePanel.add(new JScrollPane(variantsArea), BorderLayout.CENTER);
    return basePanel;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) ElementListPropertyPersistent(com.ramussoft.core.attribute.simple.ElementListPropertyPersistent) JLabel(javax.swing.JLabel) Qualifier(com.ramussoft.common.Qualifier) TableLayout(info.clearthought.layout.TableLayout)

Example 79 with Qualifier

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

the class IDEFPanel method modelProperties.

private void modelProperties() {
    Qualifier qualifier = ((NFunction) movingArea.getActiveFunction()).getQualifier();
    if (qualifier.isSystem()) {
        qualifier = dataPlugin.getBaseFunctionQualifier();
    }
    ModelPropertiesDialog dialog = new ModelPropertiesDialog(framework, qualifier, dataPlugin.getEngine(), dataPlugin.getAccessRules());
    dialog.setVisible(true);
}
Also used : ModelPropertiesDialog(com.ramussoft.idef0.ModelPropertiesDialog) NFunction(com.ramussoft.pb.data.negine.NFunction) Qualifier(com.ramussoft.common.Qualifier)

Example 80 with Qualifier

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

the class TableCellEditorFactory method createBaseQualifierEditor.

private TableCellEditor createBaseQualifierEditor() {
    List<Qualifier> qualifiers = engine.getQualifiers();
    Collections.sort(qualifiers, new Comparator<Qualifier>() {

        @Override
        public int compare(Qualifier o1, Qualifier o2) {
            return collator.compare(o1.getName(), o2.getName());
        }
    });
    JComboBox box = new JComboBox();
    box.addItem(null);
    for (Qualifier qualifier : qualifiers) box.addItem(qualifier);
    return new DefaultCellEditor(box);
}
Also used : JComboBox(javax.swing.JComboBox) Qualifier(com.ramussoft.common.Qualifier) DefaultCellEditor(javax.swing.DefaultCellEditor)

Aggregations

Qualifier (com.ramussoft.common.Qualifier)157 Attribute (com.ramussoft.common.Attribute)72 Element (com.ramussoft.common.Element)59 ArrayList (java.util.ArrayList)45 Engine (com.ramussoft.common.Engine)22 Row (com.ramussoft.database.common.Row)17 Row (com.ramussoft.pb.Row)14 List (java.util.List)12 Hashtable (java.util.Hashtable)11 QualifierEvent (com.ramussoft.common.event.QualifierEvent)10 ResultSet (java.sql.ResultSet)9 SQLException (java.sql.SQLException)9 AttributeType (com.ramussoft.common.AttributeType)8 RowSet (com.ramussoft.database.common.RowSet)8 DataPlugin (com.ramussoft.pb.DataPlugin)8 NFunction (com.ramussoft.pb.data.negine.NFunction)8 AttributeEvent (com.ramussoft.common.event.AttributeEvent)7 Journaled (com.ramussoft.common.journal.Journaled)7 RowMapper (com.ramussoft.jdbc.RowMapper)7 IEngine (com.ramussoft.common.IEngine)6