protected void addContextMenu() { List<RecordContextMenuHandler> recordContextMenuHandlers = ConstellioUI.getCurrent().getRecordContextMenuHandlers(); for (final RecordContextMenuHandler recordContextMenuHandler : recordContextMenuHandlers) { if (recordId != null && recordContextMenuHandler.isContextMenuForRecordId(recordId)) { contextMenu = recordContextMenuHandler.getForRecordId(recordId); break; } else if (recordVO != null && recordContextMenuHandler.isContextMenu(recordVO)) { contextMenu = recordContextMenuHandler.get(recordVO); break; } } if (contextMenu != null) { contextMenu.setAsContextMenuOf(this); contextMenu.addContextMenuComponentListener( new ComponentListener() { @Override public void onContextMenuOpenFromComponent(ContextMenuOpenedOnComponentEvent event) { if (recordId != null) { contextMenu.openFor(recordId); } else if (recordVO != null) { contextMenu.openFor(recordVO); } } }); } }
protected void addClickListener() { ClickListener clickListener = null; List<RecordNavigationHandler> recordNavigationHandlers = ConstellioUI.getCurrent().getRecordNavigationHandlers(); for (final RecordNavigationHandler recordNavigationHandler : recordNavigationHandlers) { if (recordId != null && recordNavigationHandler.isViewForRecordId(recordId)) { clickListener = new ClickListener() { @Override public void buttonClick(ClickEvent event) { recordNavigationHandler.navigateToView(recordId); } }; break; } else if (recordVO != null && recordNavigationHandler.isView(recordVO)) { clickListener = new ClickListener() { @Override public void buttonClick(ClickEvent event) { recordNavigationHandler.navigateToView(recordVO); } }; break; } } if (clickListener != null) { addClickListener(clickListener); } }
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); init( ConstellioFactories.getInstance().getModelLayerFactory(), ConstellioUI.getCurrentSessionContext()); }