use of com.ramussoft.common.Attribute in project ramus by Vitaliy-Yakovchuk.
the class ElementAttributesEditor method getCellEditor.
private TableCellEditor getCellEditor(int aRow) {
Attribute attribute = attributes.get(aRow).attribute;
AttributePlugin plugin = framework.findAttributePlugin(attribute);
TableCellEditor cellEditor = plugin.getTableCellEditor(framework.getEngine(), framework.getAccessRules(), attribute);
if (cellEditor == null) {
saveValues[aRow] = false;
cellEditor = new DialogedTableCellEditor(framework.getEngine(), framework.getAccessRules(), attribute, plugin, framework);
} else
saveValues[aRow] = plugin.isCellEditable();
return cellEditor;
}
use of com.ramussoft.common.Attribute in project ramus by Vitaliy-Yakovchuk.
the class Application method createAttribute.
/*
* Create attribute if not exists.
*/
private Attribute createAttribute(String attributeName, AttributeType attributeType, Engine engine) {
Attribute attribute = engine.getSystemAttribute(attributeName);
if (attribute == null) {
attribute = engine.createSystemAttribute(attributeType);
attribute.setName(attributeName);
engine.updateAttribute(attribute);
}
return attribute;
}
use of com.ramussoft.common.Attribute in project ramus by Vitaliy-Yakovchuk.
the class Application method patchData.
/*
* Create all needed system qualifiers and attributes.
*/
private void patchData(Engine engine) {
Journaled journal = (Journaled) engine;
journal.startUserTransaction();
Attribute textAttribute1 = createAttribute(TEXT_ATTRIBUTE1, new AttributeType("Core", "Text"), engine);
Attribute textAttribute2 = createAttribute(TEXT_ATTRIBUTE2, new AttributeType("Core", "Text"), engine);
Attribute doubleAttribute1 = createAttribute(DOUBLE_ATTRIBUTE1, new AttributeType("Core", "Double"), engine);
Qualifier qualifier1 = engine.getSystemQualifier(QUALIFIER1);
if (qualifier1 == null) {
qualifier1 = engine.createSystemQualifier();
qualifier1.getAttributes().add(textAttribute1);
qualifier1.getAttributes().add(textAttribute2);
qualifier1.getAttributes().add(doubleAttribute1);
qualifier1.setName(QUALIFIER1);
engine.updateQualifier(qualifier1);
}
journal.commitUserTransaction();
// User will not be able to undo these changes.
journal.setNoUndoPoint();
}
use of com.ramussoft.common.Attribute in project ramus by Vitaliy-Yakovchuk.
the class ChartSourceSelectPanel method addTableAttributes.
private void addTableAttributes() {
Attribute select = null;
List<QualifierSource> sources = chartSource.getQualifierSources();
if (sources.size() > 0) {
QualifierSource source = sources.get(0);
if (source.getQualifier().isSystem())
select = StandardAttributesPlugin.getAttributeForTable(framework.getEngine(), source.getQualifier());
}
for (Attribute attribute : framework.getEngine().getAttributes()) {
if (attribute.getAttributeType().toString().equals("Core.Table")) {
tableAttribute.addItem(attribute);
if (attribute.equals(select))
tableAttribute.setSelectedItem(attribute);
}
}
}
use of com.ramussoft.common.Attribute in project ramus by Vitaliy-Yakovchuk.
the class ChartSourceSelectPanel method save.
public void save() {
if (qualifierSelectPanel != null)
saveSelectedElements();
chartSource.setProperty(SOURCE_TYPE, (sourceType.getSelectedItem().equals(sourceTypeElements)) ? SOURCE_TYPE_ELEMENTS : SOURCE_TYPE_TABLE);
if (sourceType.getSelectedItem().equals(sourceTypeTable)) {
if (chartSource.getQualifierSources().size() > 0) {
QualifierSource source = chartSource.getQualifierSources().get(0);
if (source.getElementSources().size() > 0) {
ElementSource source2 = source.getElementSources().get(0);
source.getFilterSources().clear();
FilterSource filterSource = chartSource.createFilterSource();
Attribute selectedItem = (Attribute) tableAttribute.getSelectedItem();
if (selectedItem != null) {
filterSource.setAttribute(StandardAttributesPlugin.getTableElementIdAttribute(framework.getEngine()));
filterSource.setValue(Long.toString(source2.getElement().getId()));
source.getFilterSources().add(filterSource);
source.setQualifier(StandardAttributesPlugin.getTableQualifierForAttribute(framework.getEngine(), selectedItem));
source.setElementsLoadType(QualifierSource.ELEMENTS_LOAD_TYPE_ALL);
}
}
}
} else {
for (QualifierSource source : chartSource.getQualifierSources()) source.setElementsLoadType(QualifierSource.ELEMENTS_LOAD_TYPE_SELECTED);
}
}
Aggregations