use of com.ramussoft.core.attribute.simple.ElementListPropertyPersistent in project ramus by Vitaliy-Yakovchuk.
the class ElistTable method updateShowBoolean.
private void updateShowBoolean() {
Engine engine = getEngine();
ElementListPropertyPersistent pp = (ElementListPropertyPersistent) engine.getAttribute(null, getAttribute());
String connectionTypes = pp.getConnectionTypes();
showBoolean = connectionTypes == null || connectionTypes.trim().length() == 0;
cached = getAttribute();
}
use of com.ramussoft.core.attribute.simple.ElementListPropertyPersistent in project ramus by Vitaliy-Yakovchuk.
the class ElistComponent method canDeleteAttribute.
private boolean canDeleteAttribute(int row) {
int index = table.convertRowIndexToModel(row);
Attribute attribute = list.get(index);
if (!rules.canDeleteAttribute(attribute.getId()))
return false;
ElementListPropertyPersistent p = (ElementListPropertyPersistent) engine.getAttribute(null, attribute);
if (!rules.canUpdateQualifier(p.getQualifier1()))
return false;
if (!rules.canUpdateQualifier(p.getQualifier2()))
return false;
return true;
}
use of com.ramussoft.core.attribute.simple.ElementListPropertyPersistent in project ramus by Vitaliy-Yakovchuk.
the class ElistComponent method deleteElement.
private void deleteElement(int row) {
int index = table.convertRowIndexToModel(row);
Attribute attribute = list.get(index);
ElementListPropertyPersistent p = (ElementListPropertyPersistent) engine.getAttribute(null, attribute);
Qualifier q1 = engine.getQualifier(p.getQualifier1());
if (q1 != null) {
q1.getAttributes().remove(attribute);
engine.updateQualifier(q1);
}
Qualifier q2 = engine.getQualifier(p.getQualifier2());
if (q2 != null) {
q2.getAttributes().remove(attribute);
engine.updateQualifier(q2);
}
engine.deleteAttribute(attribute.getId());
}
use of com.ramussoft.core.attribute.simple.ElementListPropertyPersistent in project ramus by Vitaliy-Yakovchuk.
the class ElementListPlugin method getAttributeEditor.
@Override
public AttributeEditor getAttributeEditor(Engine engine, AccessRules rules, Element element, Attribute attribute, String propertiesPrefix, AttributeEditor old) {
ElementListPropertyPersistent p = (ElementListPropertyPersistent) engine.getAttribute(null, attribute);
long qId = element.getQualifierId();
Qualifier qualifier;
boolean left;
if (p.getQualifier1() == qId) {
qualifier = engine.getQualifier(p.getQualifier2());
left = false;
} else {
qualifier = engine.getQualifier(p.getQualifier1());
left = true;
}
if (old != null) {
if ((old == elementListAttributeEditor) && (this.attribute.equals(attribute)) && (this.left == left)) {
elementListAttributeEditor.setElement(element);
return elementListAttributeEditor;
} else
old.close();
}
this.attribute = attribute;
this.left = left;
elementListAttributeEditor = new ElementListAttributeEditor(framework, qualifier, left, propertiesPrefix);
elementListAttributeEditor.setElement(element);
return elementListAttributeEditor;
}
use of com.ramussoft.core.attribute.simple.ElementListPropertyPersistent 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;
}
Aggregations