/** * Generates the components from the given configuration. * * @param groupDefinition * @return List */ public List<IBuildable> buildActionGroup(VLViewComponentXML groupDefinition) { if (groupDefinition == null) { return new ArrayList<>(); } List<IBuildable> buildables = ComponentUtils.resolveAndGenerate(controller, groupDefinition.getSubcomponents()); if (buildables == null) { return new ArrayList<>(); } return buildables; } }
/** * Resolve the model with the given identifier. * * @param controller * @param id * @return VLViewComponentXML */ public static Optional<VLViewComponentXML> resolveOptionalModel(AbstractViewController controller, String id) { VLViewComponentXML componentXML = resolveModel(controller, id); if (componentXML == null) { return Optional.empty(); } return Optional.of(componentXML); }
protected Node buildGroup(AbstractViewController controller, VLViewComponentXML groupConfig) { Node actionNode = null; // The action node String actionNodeId = groupConfig.getPropertyValue("actionNode"); VLViewComponentXML resolved = ComponentUtils.resolveModel(controller, actionNodeId); VBox wrapper = new VBox(); if (resolved != null) { actionNode = ComponentUtils.build(controller, resolved).getDisplay(); if (actionNode != null) { wrapper.getChildren().addAll(actionNode); } } return wrapper; }
/** * List passed in parameter is a list where components have not been resolved, mean id is empty, ref * is not empty * * @param controller * @param components * @return */ public static List<IBuildable> resolveAndGenerate(AbstractViewController controller, List<VLViewComponentXML> components) { Assert.notNull(components); Assert.notNull(controller); final List<VLViewComponentXML> resolvedComponents = resolveDefinitions(controller, components); return generate(controller, resolvedComponents); }
public void buildActions() { NodeHelper.setHVGrow(rightActionsLayout); rightActionsLayout.setAlignment(Pos.BOTTOM_RIGHT); rightActionsLayout.setSpacing(4); final VLViewComponentXML comp = ComponentUtils.resolveComponent(tabDefinition, ACTIONS_PATH); if (comp != null) { if (comp.hasSubComponent()) { final List<VLViewComponentXML> resolvedComponents = ComponentUtils.resolveDefinitions(controller, comp.getSubcomponents()); List<IBuildable> buildables = ComponentUtils.generate(controller, resolvedComponents); for (final IBuildable buildable : buildables) { rightActionsLayout.getChildren().add(buildable.getDisplay()); } } } }
VLViewComponentXML result = getFromCache(id).orElse(null); result = getFromLocalConfig(controller, id).orElse(null); if (result == null) { result = getFromRootStructureConfig(controller.getRootStructure(), id).orElse(null); result = getFromGlobalConfig(id).orElse(null);
if ((mtButtonCfg != null) && mtButtonCfg.hasSubComponent()) { VLViewComponentXML mtButtonCfgRef = mtButtonCfg.getSubcomponents().get(0); VLViewComponentXML resolved = ComponentUtils.resolveModel((AbstractViewController) controller, mtButtonCfgRef.getReference()); if (resolved != null) { Node button = ComponentUtils.buildMaterialButton((AbstractViewController) controller, resolved); getChildren().add(button);
final VLViewComponentXML actionsConfig = ComponentUtils.resolveComponent(tableConfiguration, "ModifyMenuActions"); final List<IBuildable> buttons = ComponentUtils.resolveAndGenerate(controller, actionsGroup.getSubcomponents());
/** * Resolve the model with the given identifier. Sometimes, the source {@link VLViewComponentXML} * holds some attributes to copied in the destination. * * @param controller * @param ref * @return VLViewComponentXML */ public static Optional<VLViewComponentXML> resolveDefinition(AbstractViewController controller, VLViewComponentXML ref) { Assert.notNull(controller); Assert.notNull(ref); // sometimes holds processor or controller not reference to something to // build if (StringUtils.isNotBlank(ref.getReference())) { Optional<VLViewComponentXML> optional = resolveDefinition(controller, ref.getReference()); optional.ifPresent(solved -> { copySourcesAttributes(ref, solved); }); return optional; } return Optional.empty(); }
/** * @{inheritedDoc} */ @Override public void buildFrom(IEmaginController controller, VLViewComponentXML configuration) { if (configuration != null && configuration.hasSubComponent()) { int index = 0; for (VLViewComponentXML refbtnConfig : configuration.getSubcomponents()) { VLViewComponentXML btnConfig = ComponentUtils.resolveDefinition((AbstractViewController)controller, refbtnConfig.getReference()).orElse(null); if (btnConfig != null) { String type = btnConfig.getPropertyValue("type", "FormInlineAction"); InlineAction action = (InlineAction) ComponentUtils.build(type, (AbstractViewController)controller, btnConfig); action.setRow(row, callerIndex); getChildren().add(action.getDisplay()); if(index == 0) { defaultInlineAction = action; } index++; } } } }
private void build() { maximizedWrapper.getChildren().clear(); topToolbar.getChildren().clear(); NodeHelper.styleClassSetAll(maximizedWrapper, configuration, HEADER_RIGHT_TOOLBAR); NodeHelper.styleClassSetAll(customWrapper, configuration, HEADER_RIGHT_TOOLBAR); final Iterator<VLViewComponentXML> it = configuration.getSubcomponents().iterator(); while (it.hasNext()) { final VLViewComponentXML conf = it.next(); // can be reference or controller if (StringUtils.isNotBlank(conf.getController())) { final String controller = conf.getController(); final AbstractViewController viewController = StandardViewUtils.forId(this.controller.getRootStructure(), controller); maximizedWrapper.getChildren().add(viewController.processedView()); } else { final VLViewComponentXML resolved = ComponentUtils.resolveDefinition(controller, conf).orElse(null); if (resolved != null) { final IBuildable buildable = ComponentUtils.generate(controller, resolved); NodeHelper.setTransparentFocus(buildable.getDisplay()); maximizedWrapper.getChildren().addAll(buildable.getDisplay()); } } if (conf.isSeparatorAfter() && it.hasNext()) { maximizedWrapper.getChildren().addAll(NodeHelper.headerVerticalSeparator()); } } bottomToolbar.setVisible(false); ellispsys = ToolbarUtils.ellipsisVActionsButton(configuration, controller, null); animateAddMaximizedWrapper(); }
public static IBuildable generate(AbstractViewController controller, VLViewComponentXML resolved) { String componentType = resolved.getPropertyValue("type"); if (StringUtils.isNotBlank(componentType)) { IBuildable buildable = build(controller, resolved); return buildable; } return null; }
/** * Process the view if configuration has defined default processor */ protected void doProcessing() { if (config().getRootComponent() != null) { final Node node = ComponentUtils.buildFromProcessor(this, config().getRootComponent()); if (node != null) { NodeHelper.setHVGrow(node); processedView(node); } } }
protected void doBuildCopyRight() { Optional<VLViewComponentXML> config = ComponentUtils.getFromGlobalConfig("CoreCopyright"); if (config.isPresent()) { copyright = (Copyright) Services.getBean("Copyright"); copyright.buildFrom(this, config.get()); } }
/** * * Generates {@link IBuildable} from given list of components. * * @param controller * @param components * @return {@link List} */ public static List<IBuildable> generate(AbstractViewController controller, List<VLViewComponentXML> resolved) { Assert.notNull(resolved); Assert.notNull(controller); List<IBuildable> result = new ArrayList<>(); for (VLViewComponentXML definition : resolved) { IBuildable buildable = generate(controller, definition); if (buildable != null) { result.add(buildable); } } return result; }
VLViewComponentXML result = getFromLocalConfig(controller, id).orElse(null); result = getFromRootStructureConfig(controller.getRootStructure(), id).orElse(null); result = getFromCache(id).orElse(null); result = getFromGlobalConfig(id).orElse(null);
private void buildNodes() { final List<VLViewComponentXML> resolved = ComponentUtils.resolveDefinitions(controller, contextMenuConfigList); final List<VLViewComponentXML> filtered = new ArrayList<>(); links = ComponentUtils.generate(controller, filtered); final Iterator<IBuildable> iterator = links.iterator(); while (iterator.hasNext()) {
/** * @param type * @param controller * @param wizardConfiguration * @return IBuildable */ public static IBuildable build(AbstractViewController controller, VLViewComponentXML configuration) { String componentType = configuration.getPropertyValue("type"); if (StringUtils.isNotBlank(componentType)) { IBuildable buildable = build(componentType, controller, configuration); return buildable; } return null; }
return buildFromProcessor(controller, configuration);
@Override public void buildFrom(IEmaginController controller, VLViewComponentXML configuration) { this.controller = (AbstractViewController) controller; List<IBuildable> links = ComponentUtils.resolveAndGenerate((AbstractViewController) controller, configuration.getSubcomponents()); if (links.size() > 1) { // prohibited!!!! but .. } if (links.size() == 1) { primaryMenuButton = links.get(0); Node button = primaryMenuButton.getDisplay(); topToolbar.getChildren().add(0, button); } }