public void setStencil(T stencil) { stencilDs.setItem(stencil); } }
public void setProcInstance(ProcInstance procInstance) { this.procInstance = procInstance; procInstanceDs.setItem(procInstance); refreshProcRolesDs(); }
protected void setChartDescription(@Nullable AbstractChartDescription chartDescription) { if (chartDescription != null) { if (ChartType.SERIAL == chartDescription.getType()) { serialChartDs.setItem((SerialChartDescription) chartDescription); } else if (ChartType.PIE == chartDescription.getType()) { pieChartDs.setItem((PieChartDescription) chartDescription); } type.setValue(chartDescription.getType()); } }
@SuppressWarnings("unused") public void compareSnapshots() { entityDiffDs.setItem(null); EntitySnapshot firstSnap = null; EntitySnapshot secondSnap = null; Set selected = snapshotsTable.getSelected(); Object[] selectedItems = selected.toArray(); if ((selected.size() == 2)) { firstSnap = (EntitySnapshot) selectedItems[0]; secondSnap = (EntitySnapshot) selectedItems[1]; } else if (selected.size() == 1) { secondSnap = (EntitySnapshot) selectedItems[0]; firstSnap = snapshotsDs.getLatestSnapshot(); if (firstSnap == secondSnap) firstSnap = null; } if ((secondSnap != null) || (firstSnap != null)) { EntityDiff diff = diffDs.loadDiff(firstSnap, secondSnap); entityDiffDs.setItem(diff); } diffTable.refresh(); diffTable.expandAll(); }
public void setBandDefinition(BandDefinition bandDefinition) { bandDefinitionDs.setItem(bandDefinition); name.setEditable((bandDefinition == null || bandDefinition.getParent() != null) && isUpdatePermitted()); }
protected void uploadJson() { try (InputStream fileContent = importJsonField.getFileContent()) { String json = IOUtils.toString(Objects.requireNonNull(fileContent), UTF_8); Dashboard newDashboard = metadata.create(Dashboard.class); BeanUtils.copyProperties(converter.dashboardFromJson(json), newDashboard); dashboardDs.setItem(newDashboard); initParametersFrame(); initPaletteFrame(); canvasFrame.updateLayout(newDashboard); dashboardDs.refresh(); } catch (Exception e) { throw new DashboardException("Cannot import data from a file", e); } }
@SuppressWarnings("unchecked") @Override protected void internalOpenEditor(CollectionDatasource datasource, Entity newItem, Datasource parentDs, Map<String, Object> params) { initNewItem(newItem); table.setSelected(Collections.emptyList()); getFieldGroup().getDatasource().setItem(newItem); refreshOptionsForLookupFields(); enableEditControls(true); } });
/** * Adds AfterRemoveHandler for table's Remove action to reset the record contained in editDs. */ @SuppressWarnings("unchecked") protected void initBrowseRemoveAction() { ListComponent table = getTable(); Datasource editDs = getFieldGroup().getDatasource(); RemoveAction removeAction = (RemoveAction) table.getAction(RemoveAction.ACTION_ID); if (removeAction != null) removeAction.setAfterRemoveHandler(removedItems -> editDs.setItem(null)); }
@SuppressWarnings("unchecked") @Override public Datasource getItemDatasource(Entity item) { if (fieldDatasources == null) { fieldDatasources = new WeakHashMap<>(); } Object fieldDatasource = fieldDatasources.get(item); if (fieldDatasource instanceof Datasource) { return (Datasource) fieldDatasource; } Datasource datasource = DsBuilder.create() .setAllowCommit(false) .setMetaClass(getDatasource().getMetaClass()) .setRefreshMode(CollectionDatasource.RefreshMode.NEVER) .setViewName("_local") .buildDatasource(); ((DatasourceImplementation) datasource).valid(); datasource.setItem(item); fieldDatasources.put(item, datasource); return datasource; }
@Override public void setItem(ReportTemplate reportTemplate) { super.setItem(reportTemplate); setBands(reportTemplate.getReport().getBands()); if (isApplicable(reportTemplate.getReportOutputType())) { if (reportTemplate.getPivotTableDescription() == null) { pivotTableDs.setItem(createDefaultPivotTableDescription()); } else { pivotTableDs.setItem(reportTemplate.getPivotTableDescription()); } } initRendererTypes(); propertyTable.expandAll(); }
@Override @SuppressWarnings("IncorrectCreateEntity") public void init(Map<String, Object> params) { super.init(params); dataGenerator = new RandomPivotTableDataGenerator(); PivotTableDescription description = createDefaultPivotTableDescription(); pivotTableDs.setItem(description); initAggregationTable(); initPropertyTable(); pivotTableDs.addItemPropertyChangeListener(e -> showPreview()); }
protected Datasource createItemDatasource(E item) { EntityDataGridItems<E> items = getEntityDataGridItemsNN(); Datasource fieldDatasource = DsBuilder.create() .setAllowCommit(false) .setMetaClass(items.getEntityMetaClass()) .setRefreshMode(CollectionDatasource.RefreshMode.NEVER) .setViewName(View.LOCAL) .buildDatasource(); ((DatasourceImplementation) fieldDatasource).valid(); //noinspection unchecked fieldDatasource.setItem(item); return fieldDatasource; }
procInstanceDs.setItem(procInstance);
parentDs.setItem(item); if (AppBeans.get(EntityStates.class).isNew(item)) { ((DatasourceImplementation) parentDs).modified(item);
@Override public void postInit() { if (PersistenceHelper.isNew(getItem())) { Dashboard model = metadata.create(Dashboard.class); model.setVisualModel(metadata.create(RootLayout.class)); model.setCreatedBy(accessHelper.getCurrentSessionLogin()); dashboardDs.setItem(model); } else { Dashboard model = converter.dashboardFromJson(getItem().getDashboardModel()); dashboardDs.setItem(model); } String assistantBeanName = getDashboard().getAssistantBeanName(); if (StringUtils.isNotEmpty(assistantBeanName)) { dashboardDs.getItem().setAssistantBeanName(assistantBeanName); FieldGroup.FieldConfig assistantBeanNameField = fieldGroup2.getField("assistantBeanName"); LookupField lookupField = (LookupField) assistantBeanNameField.getComponent(); lookupField.setValue(assistantBeanName); } if (!accessHelper.getCurrentSessionLogin().equals(dashboardDs.getItem().getCreatedBy())) { availableCheckBox.setVisible(false); } importJsonField.addFileUploadSucceedListener(e -> uploadJson()); dropLayoutTools = new DropLayoutTools(this, modelConverter, dashboardDs); initParametersFrame(); initPaletteFrame(); initCanvasFrame(); ((AbstractDatasource) dashboardDs).setModified(false); }
/** * Adds a listener that reloads the selected record with the specified view and sets it to editDs. */ @SuppressWarnings("unchecked") protected void initBrowseItemChangeListener() { CollectionDatasource browseDs = getTable().getDatasource(); Datasource editDs = getFieldGroup().getDatasource(); browseDs.addItemChangeListener(e -> { if (e.getItem() != null) { Entity reloadedItem = getDsContext().getDataSupplier().reload( e.getDs().getItem(), editDs.getView(), null, e.getDs().getLoadDynamicAttributes()); editDs.setItem(reloadedItem); } }); }
protected void commitAndClose() { if (delegate.isModified()) { if (!validateAll()) return; try { userProfile.updateProfile(userDs.getItem()); } catch (ValidationException e) { showNotification(e.getLocalizedMessage(), NotificationType.ERROR); return; } User newUser = userProfile.getProfile(); userDs.setItem(newUser); UserSession userSession = userSessionSource.getUserSession(); userSession.setUser(newUser); pushUserSessionUpdate(userSession); showNotification(getMessage("profile.commitSuccess"), NotificationType.HUMANIZED); } close(COMMIT_ACTION_ID); }
datasource.setItem(instance); datasource.setAllowCommit(false);
/** * Method that is invoked by clicking Cancel button, discards changes and disables controls for editing. */ @SuppressWarnings("unchecked") public void cancel() { CollectionDatasource browseDs = getTable().getDatasource(); Datasource editDs = getFieldGroup().getDatasource(); Entity selectedItem = browseDs.getItem(); if (selectedItem != null) { Entity reloadedItem = getDsContext().getDataSupplier().reload( selectedItem, editDs.getView(), null, editDs.getLoadDynamicAttributes()); browseDs.setItem(reloadedItem); } else { editDs.setItem(null); } releaseLock(); disableEditControls(); } }
super.init(params); reportDataDs.setItem(metadata.create(ReportData.class));