protected SimpleNamingModel<String> getTitleModel(){ if (!Strings.isEmpty(methodDefinition.getTitleKey())){ return new SimpleNamingModel<String>(methodDefinition.getTitleKey()); } return new SimpleNamingModel<String>(methodDefinition.getMethodId()); }
public List<IMethod> getMethods(IMethodContext context){ return definitionsStorages.stream() .flatMap(s -> s.getMethodsDefinitions(context).stream()) .sorted((c1, c2) -> { int ret = Integer.compare(c1.getOrder(), c2.getOrder()); if(ret==0) ret=c1.getMethodId().compareTo(c2.getMethodId()); return ret; }) .map(c -> c.getMethod(context)) .filter(Objects::nonNull) .collect(Collectors.toList()); }
protected void invoke(ODocument doc){ methodDefinition.invokeLinkedFunction(getContext(), doc); } }
@SuppressWarnings("rawtypes") protected void applyVisualSettings(Command commandComponent){ commandComponent.setIcon(getDefinition().getIcon()); commandComponent.setBootstrapType(getDefinition().getBootstrapType()); commandComponent.setChangingDisplayMode(getDefinition().isChangingDisplayMode()); commandComponent.setChandingModel(getDefinition().isChangingModel()); }
protected void applyBehaviors(Component component){ for ( Class<? extends Behavior> behavior : getDefinition().getBehaviors()) { try { component.add(behavior.newInstance()); } catch (InstantiationException | IllegalAccessException e) { LOG.error("Can't apply behaviors", e); } } }
@Override public void init(IMethodDefinition config, IMethodContext envData) { setMarkupId(config.getMethodId()); setLabelModel(new ResourceModel(config.getTitleKey())); }