Search in sources :

Example 96 with Attribute

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;
}
Also used : TabledAttributePlugin(com.ramussoft.gui.qualifier.table.TabledAttributePlugin) AttributePlugin(com.ramussoft.gui.common.AttributePlugin) Attribute(com.ramussoft.common.Attribute) TableCellEditor(javax.swing.table.TableCellEditor) DialogedTableCellEditor(com.ramussoft.gui.qualifier.table.DialogedTableCellEditor) DialogedTableCellEditor(com.ramussoft.gui.qualifier.table.DialogedTableCellEditor)

Example 97 with Attribute

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;
}
Also used : Attribute(com.ramussoft.common.Attribute)

Example 98 with 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();
}
Also used : Journaled(com.ramussoft.common.journal.Journaled) Attribute(com.ramussoft.common.Attribute) AttributeType(com.ramussoft.common.AttributeType) Qualifier(com.ramussoft.common.Qualifier)

Example 99 with Attribute

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);
        }
    }
}
Also used : QualifierSource(com.ramussoft.chart.QualifierSource) Attribute(com.ramussoft.common.Attribute)

Example 100 with 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);
    }
}
Also used : QualifierSource(com.ramussoft.chart.QualifierSource) FilterSource(com.ramussoft.chart.FilterSource) Attribute(com.ramussoft.common.Attribute) ElementSource(com.ramussoft.chart.ElementSource)

Aggregations

Attribute (com.ramussoft.common.Attribute)203 Qualifier (com.ramussoft.common.Qualifier)72 Element (com.ramussoft.common.Element)70 ArrayList (java.util.ArrayList)53 Engine (com.ramussoft.common.Engine)32 List (java.util.List)20 Row (com.ramussoft.database.common.Row)19 Hashtable (java.util.Hashtable)19 SQLException (java.sql.SQLException)16 AttributeType (com.ramussoft.common.AttributeType)15 FindObject (com.ramussoft.common.attribute.FindObject)11 AttributeEvent (com.ramussoft.common.event.AttributeEvent)11 ResultSet (java.sql.ResultSet)11 AttributePlugin (com.ramussoft.gui.common.AttributePlugin)10 AccessRules (com.ramussoft.common.AccessRules)9 Transaction (com.ramussoft.common.persistent.Transaction)9 HierarchicalPersistent (com.ramussoft.core.attribute.simple.HierarchicalPersistent)9 RowMapper (com.ramussoft.jdbc.RowMapper)9 Row (com.ramussoft.pb.Row)9 ImageIcon (javax.swing.ImageIcon)9