Search in sources :

Example 1 with SelectOwner

use of com.ramussoft.pb.idef.frames.SelectOwner in project ramus by Vitaliy-Yakovchuk.

the class FunctionOwnerAttributePlugin method getAttributeEditor.

@Override
public AttributeEditor getAttributeEditor(final Engine engine, final AccessRules rules, final Element element, Attribute attribute, AttributeEditor old) {
    if (old != null)
        old.close();
    return new AbstractAttributeEditor() {

        private SelectOwner component = new SelectOwner();

        @Override
        public Object setValue(Object value) {
            DataPlugin plugin = NDataPluginFactory.getDataPlugin(engine.getQualifier(element.getQualifierId()), engine, rules);
            component.setFunction((Function) plugin.findRowByGlobalId(element.getId()));
            return value;
        }

        @Override
        public Object getValue() {
            Row row = component.getOwner();
            if (row != null)
                return row.getElement().getId();
            return null;
        }

        @Override
        public JComponent getComponent() {
            return component;
        }
    };
}
Also used : AbstractAttributeEditor(com.ramussoft.gui.common.AbstractAttributeEditor) SelectOwner(com.ramussoft.pb.idef.frames.SelectOwner) Row(com.ramussoft.pb.Row) DataPlugin(com.ramussoft.pb.DataPlugin)

Aggregations

AbstractAttributeEditor (com.ramussoft.gui.common.AbstractAttributeEditor)1 DataPlugin (com.ramussoft.pb.DataPlugin)1 Row (com.ramussoft.pb.Row)1 SelectOwner (com.ramussoft.pb.idef.frames.SelectOwner)1