use of com.ramussoft.core.attribute.simple.ElementListPersistent in project ramus by Vitaliy-Yakovchuk.
the class ElistTable method getCellRenderer.
@Override
public TableCellRenderer getCellRenderer(int row, int column) {
row = convertRowIndexToModel(row);
column = convertColumnIndexToModel(column);
ElementListPersistent lp = (ElementListPersistent) getModel().getValueAt(row, column);
if (lp == null)
return textRenderer;
if (cached != getAttribute())
updateShowBoolean();
if (showBoolean)
return booleanRenderer;
return textRenderer;
}
use of com.ramussoft.core.attribute.simple.ElementListPersistent in project ramus by Vitaliy-Yakovchuk.
the class QualifierPreferencesPanel method updateAttributesInOrder.
@SuppressWarnings("unchecked")
private void updateAttributesInOrder(List<Attribute> qAttributes) {
Attribute attributeId = (Attribute) engine.getPluginProperty("Core", StandardAttributesPlugin.ATTRIBUTE_ID);
List<ElementListPersistent> list = (List<ElementListPersistent>) attributeEditor.getValue();
List<Attribute> attributes = new ArrayList<Attribute>(list.size());
for (ElementListPersistent pr : list) {
Element element2 = engine.getElement(pr.getElement2Id());
Long id2 = (Long) engine.getAttribute(element2, attributeId);
Attribute attribute = engine.getAttribute(id2);
attributes.add(attribute);
if (qAttributes.indexOf(attribute) < 0)
qAttributes.add(attribute);
}
List<Attribute> rem = new ArrayList<Attribute>();
for (Attribute a : qAttributes) if (attributes.indexOf(a) < 0)
rem.add(a);
for (Attribute r : rem) qAttributes.remove(r);
}
use of com.ramussoft.core.attribute.simple.ElementListPersistent in project ramus by Vitaliy-Yakovchuk.
the class ElistTabView method addRow.
private void addRow(ElistPanel elistPanel, Row row) {
ElementListPersistent p = new ElementListPersistent();
if (left == elistPanel) {
p.setElement1Id(row.getElementId());
p.setElement2Id(right.getSelectedRows().get(0).getElementId());
} else {
p.setElement1Id(left.getSelectedRows().get(0).getElementId());
p.setElement2Id(row.getElementId());
}
if (value.indexOf(p) < 0)
value.add(p);
}
use of com.ramussoft.core.attribute.simple.ElementListPersistent in project ramus by Vitaliy-Yakovchuk.
the class ElistTableModel method getValueAt.
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
Element element = left.getElement(rowIndex);
List<ElementListPersistent> value = data.get(element);
if (value == null) {
value = new ArrayList<ElementListPersistent>();
data.put(element, value);
}
Element c = top.getElement(columnIndex);
for (ElementListPersistent p : value) {
if (revert) {
if (p.getElement1Id() == c.getId())
return p;
} else {
if (p.getElement2Id() == c.getId())
return p;
}
}
return null;
}
use of com.ramussoft.core.attribute.simple.ElementListPersistent in project ramus by Vitaliy-Yakovchuk.
the class ElementListPlugin method syncElement.
@SuppressWarnings("unchecked")
@Override
public void syncElement(Engine engine, QualifierImporter importer, Element sourceElement, Attribute sourceAttribute) {
List<ElementListPersistent> list = (List) importer.getSourceValue(sourceElement, sourceAttribute);
List<ElementListPersistent> set = null;
if (list != null) {
for (ElementListPersistent p : list) if ((p != null) && (p.getElement1Id() == sourceElement.getId())) {
if (set == null)
set = new ArrayList<ElementListPersistent>(list.size());
Element element1 = importer.getDestinationElement(p.getElement1Id());
Element element2 = importer.getDestinationElement(p.getElement2Id());
if ((element1 != null) && (element2 != null)) {
ElementListPersistent d = new ElementListPersistent(element1.getId(), element2.getId());
set.add(d);
}
}
}
if (set != null)
engine.setAttribute(importer.getDestination(sourceElement), importer.getDestination(sourceAttribute), set);
}
Aggregations