@Override public BindableProxy getProxyForModel(Object model) { if (model instanceof BindableProxy) { return (BindableProxy) model; } return (BindableProxy) DataBinder.forModel(model).getModel(); }
@Override public List<CaseStageItemViewImpl> getCaseStageComponentList() { return caseStageList.getModel().stream() .map(caseStage -> stages.getComponent(caseStage)) .filter(Optional::isPresent) .map(Optional::get) .collect(toList()); }
@SuppressWarnings("unchecked") public static <T> T newInstance(final Class<?> pojoType) { if (null != pojoType) { return (T) DataBinder.forType(pojoType).getModel(); } return null; }
private void executeOnlyIfActive(final Consumer<CaseInstanceSummary> consumer) { final CaseInstanceSummary caseInstanceSummary = this.caseInstanceSummary.getModel(); if (caseInstanceSummary.getStatus() == CaseStatus.OPEN) { consumer.accept(caseInstanceSummary); } } }
private void executeOnlyIfActive(final Consumer<CaseInstanceSummary> consumer){ final CaseInstanceSummary caseInstanceSummary = this.caseInstanceSummary.getModel(); final CaseStatusEnum status = CaseStatusEnum.fromStatus(caseInstanceSummary.getStatus()); if(status == CaseStatusEnum.ACTIVE){ consumer.accept(caseInstanceSummary); } }
@SuppressWarnings("unchecked") public static <T, V> void setProxiedValue(final T pojo, final String fieldName, final V value) { if (null != pojo && null != fieldName) { HasProperties hasProperties = (HasProperties) DataBinder.forModel(pojo).getModel(); hasProperties.set(fieldName, value); } }
@SuppressWarnings("unchecked") public static <T, R> R getProxiedValue(final T pojo, final String fieldName) { R result = null; if (null != pojo && null != fieldName) { HasProperties hasProperties = (HasProperties) DataBinder.forModel(pojo).getModel(); result = (R) hasProperties.get(fieldName); } return result; }
@SuppressWarnings("unchecked") public static <T> T clone(final T pojo) { if (null != pojo) { final BindableProxy proxy = (BindableProxy) DataBinder.forModel(pojo).getModel(); return (T) proxy.deepUnwrap(); } return null; }
private Binding bindNestedProperty(final Object component, final String property, final Converter<?, ?> converter, final Function<BindableProxyAgent<?>, Supplier<Map<Class<? extends GwtEvent>, HandlerRegistration>>> registrar, final Optional<Supplier<Object>> uiGetter, final StateSync initialState) { final DataBinder nestedBinder = createNestedBinder(property, initialState); final String subProperty = property.substring(property.indexOf('.') + 1); final BindableProxyAgent<?> nestedAgent = ((BindableProxy<?>) nestedBinder.getModel()).getBindableProxyAgent(); nestedBinder.addBinding(subProperty, nestedAgent.bindHelper(component, subProperty, converter, registrar, uiGetter, initialState)); final Binding binding = new Binding(property, component, converter, null); bindings.put(property, binding); return binding; }
private Binding bindNestedProperty(final Object component, final String property, final Converter<?, ?> converter, final Function<BindableProxyAgent<?>, Supplier<Map<Class<? extends GwtEvent>, HandlerRegistration>>> registrar, final Optional<Supplier<Object>> uiGetter, final StateSync initialState) { final DataBinder nestedBinder = createNestedBinder(property, initialState); final String subProperty = property.substring(property.indexOf('.') + 1); final BindableProxyAgent<?> nestedAgent = ((BindableProxy<?>) nestedBinder.getModel()).getBindableProxyAgent(); nestedBinder.addBinding(subProperty, nestedAgent.bindHelper(component, subProperty, converter, registrar, uiGetter, initialState)); final Binding binding = new Binding(property, component, converter, null); bindings.put(property, binding); return binding; }
private void createCaseInstance() { presenter.createCaseInstance(caseTemplatesList.getValue(), ownerNameInput.getValue(), roleAssignmentList.getModel()); }
private void createCaseInstance() { presenter.createCaseInstance(caseTemplatesList.getValue(), ownerNameInput.getValue(), roleAssignmentList.getModel()); }
@EventHandler("trigger") public void onProcessNodeTrigger(@ForEvent("click") Event e) { processNodeSummary.getModel().getCallbacks().get(0).getCommand().execute(); } }
@Override public MapBindableProxy getProxyForModel(Map<String, Object> model) { Map<String, Object> content = DataBinder.forMap(dynamicDefinition.getPropertyTypes()).getModel(); helper.prepareMapContent(content, context.getAvailableForms().get(field.getCreationForm()), model, context); return (MapBindableProxy) content; }
private void verifyNoDetails(ProcessInstanceLogSummary model) { verify(detailsLink, never()).setAttribute("href", "#11544612157000"); verify(detailsInfoDiv, never()).setId("11544612157000"); when(logSummary.getModel()).thenReturn(model); when(detailsInfoDiv.hasChildNodes()).thenReturn(false); view.loadProcessInstanceLogsDetails(mouseEvent); verify(presenter, never()).loadTaskDetails(2L, date, workItemView); verify(presenter, never()).loadWorkItemDetails(model.getWorkItemId(), workItemView); } }
private void verifyHumanTaskDetails(ProcessInstanceLogSummary model) { verify(detailsLink).setAttribute("href", "#123"); verify(detailsInfoDiv).setId("123"); when(logSummary.getModel()).thenReturn(model); when(detailsInfoDiv.hasChildNodes()).thenReturn(false); view.loadProcessInstanceLogsDetails(mouseEvent); verify(presenter).loadTaskDetails(2L, date, workItemView); }
@Test public void testRemoveActiveFilter(){ final List<ActiveFilterItem> model = new ArrayList<>(); when(activeFiltersList.getModel()).thenReturn(model); model.add(new ActiveFilterItem<>("key1", null, null, null, null)); model.add(new ActiveFilterItem<>("key2", null, null, null, null)); view.removeActiveFilter(new ActiveFilterItem<>("key1", null, null, null, null)); view.removeActiveFilter(new ActiveFilterItem<>("key3", null, null, null, null)); assertEquals(1, model.size()); verify(activeFiltersList, times(2)).getModel(); } }
public void initContext(MapModelRenderingContext context) { FormDefinition form = context.getRootForm(); Map<String, PropertyType> modelProperties = generateModelDefinition(form, context); Map<String, Object> content = DataBinder.forMap(modelProperties).getModel(); Map<String, Object> contextModel = context.getModel() != null ? context.getModel() : new HashMap<>(); prepareMapContent(content, form, contextModel, context); context.setModel(content); }
private void verifySystemTaskDetails(ProcessInstanceLogSummary model) { verify(detailsLink).setAttribute("href", "#123"); verify(detailsInfoDiv).setId("123"); when(logSummary.getModel()).thenReturn(model); when(detailsInfoDiv.hasChildNodes()).thenReturn(false); view.loadProcessInstanceLogsDetails(mouseEvent); verify(presenter).loadWorkItemDetails(model.getWorkItemId(), workItemView); }