protected AddAction createAddAction(MetaProperty metaProperty, CollectionDatasource propertyDs, Table table, MetaClass propertyMetaClass) { Lookup.Handler addHandler = createAddHandler(metaProperty, propertyDs); AddAction addAction = new AddAction(table, addHandler, OPEN_TYPE); addAction.setWindowId(EntityInspectorBrowse.SCREEN_NAME); HashMap<String, Object> params = new HashMap<>(); params.put("entity", propertyMetaClass.getName()); MetaProperty inverseProperty = metaProperty.getInverse(); if (inverseProperty != null) params.put("parentProperty", inverseProperty.getName()); addAction.setWindowParams(params); addAction.setOpenType(OPEN_TYPE); addAction.setShortcut(configuration.getConfig(ClientConfig.class).getTableAddShortcut()); return addAction; }
/** * Constructor that allows to specify the action name and how the lookup screen opens. * @param target component containing this action * @param handler lookup handler. If null, an instance of {@link DefaultHandler} will be used. * @param openType how to open the editor screen * @param id action's name */ public AddAction(ListComponent target, @Nullable Window.Lookup.Handler handler, OpenType openType, String id) { super(id, null); this.target = target; this.handler = handler; this.openType = openType; Messages messages = AppBeans.get(Messages.NAME); this.caption = messages.getMainMessage("actions.Add"); this.icon = AppBeans.get(Icons.class).get(CubaIcon.ADD_ACTION); Configuration configuration = AppBeans.get(Configuration.NAME); ClientConfig clientConfig = configuration.getConfig(ClientConfig.class); setShortcut(clientConfig.getTableAddShortcut()); }