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;
}
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());
}
}
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;
}
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);
}
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);
}
Aggregations