Search in sources :

Example 1 with ValueGetter

use of com.ramussoft.gui.qualifier.table.ValueGetter in project ramus by Vitaliy-Yakovchuk.

the class ElementAttributesEditor method reload.

protected void reload() {
    CloseEvent event = new CloseEvent(this);
    CloseListener[] listeners = getCloseListeners();
    for (CloseListener listener : listeners) {
        listener.closed(event);
        removeCloseListener(listener);
    }
    loadCurrentQualifierAttributes();
    Engine engine = framework.getEngine();
    AccessRules rules = framework.getAccessRules();
    getters = new ValueGetter[attributes.size()];
    renderers = new TableCellRenderer[attributes.size()];
    values = new Object[attributes.size()];
    saveValues = new boolean[attributes.size()];
    Arrays.fill(saveValues, true);
    Arrays.fill(getters, new ValueGetter() {

        @Override
        public Object getValue(TableNode node, int index) {
            return node.getValueAt(index);
        }
    });
    for (int i = 0; i < attributes.size(); i++) {
        Attribute attr = attributes.get(i).attribute;
        AttributePlugin plugin = framework.findAttributePlugin(attr);
        if (plugin instanceof TabledAttributePlugin) {
            ValueGetter getter = ((TabledAttributePlugin) plugin).getValueGetter(attr, engine, framework, this);
            if (getter != null)
                getters[i] = getter;
        }
        renderers[i] = plugin.getTableCellRenderer(engine, rules, attr);
    }
    loadElement();
}
Also used : CloseEvent(com.ramussoft.gui.qualifier.table.event.CloseEvent) TabledAttributePlugin(com.ramussoft.gui.qualifier.table.TabledAttributePlugin) AttributePlugin(com.ramussoft.gui.common.AttributePlugin) Attribute(com.ramussoft.common.Attribute) TabledAttributePlugin(com.ramussoft.gui.qualifier.table.TabledAttributePlugin) ValueGetter(com.ramussoft.gui.qualifier.table.ValueGetter) CloseListener(com.ramussoft.gui.qualifier.table.event.CloseListener) TableNode(com.ramussoft.gui.qualifier.table.TableNode) AccessRules(com.ramussoft.common.AccessRules) Engine(com.ramussoft.common.Engine)

Aggregations

AccessRules (com.ramussoft.common.AccessRules)1 Attribute (com.ramussoft.common.Attribute)1 Engine (com.ramussoft.common.Engine)1 AttributePlugin (com.ramussoft.gui.common.AttributePlugin)1 TableNode (com.ramussoft.gui.qualifier.table.TableNode)1 TabledAttributePlugin (com.ramussoft.gui.qualifier.table.TabledAttributePlugin)1 ValueGetter (com.ramussoft.gui.qualifier.table.ValueGetter)1 CloseEvent (com.ramussoft.gui.qualifier.table.event.CloseEvent)1 CloseListener (com.ramussoft.gui.qualifier.table.event.CloseListener)1