Search in sources :

Example 16 with Attribute

use of com.ramussoft.common.Attribute in project ramus by Vitaliy-Yakovchuk.

the class RowTreeTableModel method setValueAt.

@Override
public void setValueAt(Object value, Object node, int column) {
    if (!saveValues[column])
        return;
    TreeTableNode row = (TreeTableNode) node;
    if (row.getRow() == null)
        return;
    Attribute a = row.getRow().getRowAttributes()[column + 1];
    Engine engine = row.getRow().getRowSet().getEngine();
    Qualifier q = engine.getQualifier(row.getRow().getElement().getQualifierId());
    if ((q.getAttributeForName() == a.getId()) && (value instanceof String)) {
        List<Element> list = engine.findElements(q.getId(), a, value);
        for (Element element : list) {
            if (element.getId() != row.getRow().getElementId()) {
                if (JOptionPane.showConfirmDialog(table, GlobalResourcesManager.getString("Warning.ElementsExists"), GlobalResourcesManager.getString("ConfirmMessage.Title"), JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION)
                    return;
                break;
            }
        }
    }
    row.getRow().startUserTransaction();
    row.getRow().setAttribute(column, value);
    row.getRow().endUserTransaction();
}
Also used : Attribute(com.ramussoft.common.Attribute) Element(com.ramussoft.common.Element) Qualifier(com.ramussoft.common.Qualifier) Engine(com.ramussoft.common.Engine)

Example 17 with Attribute

use of com.ramussoft.common.Attribute in project ramus by Vitaliy-Yakovchuk.

the class RowTreeTableModel method getColumnName.

@Override
public String getColumnName(int column) {
    Attribute attribute = rowSet.getAttributes()[column];
    String name = framework.getSystemAttributeName(attribute);
    if (name != null)
        return name;
    return "<html><body><center>" + attribute.getName() + "</center></body></html>";
}
Also used : Attribute(com.ramussoft.common.Attribute)

Example 18 with Attribute

use of com.ramussoft.common.Attribute in project ramus by Vitaliy-Yakovchuk.

the class TableView method getAttributes.

@Override
protected Attribute[] getAttributes() {
    Attribute[] attributes = super.getAttributes();
    List<Attribute> attrs = new ArrayList<Attribute>(attributes.length);
    TableViewProperties properties = getProperties();
    Qualifier q = getQualifier();
    int index = -1;
    for (int i = 0; i < attributes.length; i++) {
        if (attributes[i].getId() == q.getAttributeForName()) {
            index = i;
            break;
        }
    }
    if (index > 0) {
        Attribute a = attributes[index];
        attributes[index] = attributes[0];
        attributes[0] = a;
    }
    for (Attribute attribute : attributes) {
        if ((!properties.isPresent(attribute)) || (attribute.getId() == q.getAttributeForName())) {
            attrs.add(attribute);
        }
    }
    return attrs.toArray(new Attribute[attrs.size()]);
}
Also used : Attribute(com.ramussoft.common.Attribute) ArrayList(java.util.ArrayList) Qualifier(com.ramussoft.common.Qualifier)

Example 19 with Attribute

use of com.ramussoft.common.Attribute in project ramus by Vitaliy-Yakovchuk.

the class Hierarchy method toString.

public String toString(List<Attribute> list, GUIFramework framework) {
    Attribute[] attributes = getAttributes(list);
    StringBuffer sb = new StringBuffer("(");
    for (Attribute attribute : attributes) {
        if ((attributes.length > 0) && (attribute != attributes[0])) {
            sb.append("->");
        }
        String name = framework.getSystemAttributeName(attribute);
        if (name == null)
            name = attribute.getName();
        sb.append(name);
    }
    sb.append(")");
    return sb.toString();
}
Also used : Attribute(com.ramussoft.common.Attribute)

Example 20 with Attribute

use of com.ramussoft.common.Attribute in project ramus by Vitaliy-Yakovchuk.

the class ReportPlugin method setReportQualifierElementId.

public static void setReportQualifierElementId(Engine engine, Element element, long id) {
    Attribute attribute = getReportQualifierElementIdAttribute(engine);
    engine.setAttribute(element, attribute, id);
}
Also used : Attribute(com.ramussoft.common.Attribute)

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