org.jboss.forge.addon.ui.input.InputComponentFactory Java Examples
The following examples show how to use
org.jboss.forge.addon.ui.input.InputComponentFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DetectFractionsCommand.java From thorntail-addon with Eclipse Public License 1.0 | 6 votes |
@Override public void initializeUI(UIBuilder builder) throws Exception { InputComponentFactory factory = builder.getInputComponentFactory(); Project project = getSelectedProject(builder); inputDir = factory.createInput("inputDir", DirectoryResource.class).setLabel("Input Directory") .setDescription("Directory containing the compiled project sources").setRequired(true) .setDefaultValue(getTargetDirectory(project)); build = factory.createInput("build", Boolean.class).setLabel("Build Project?") .setDescription("Build project before attempting to auto-detect"); depend = factory.createInput("depend", Boolean.class) .setLabel("Add Missing Fractions as Project Dependencies?") .setDescription("Add missing fractions as project dependencies"); builder.add(inputDir).add(build).add(depend); }
Example #2
Source File: CamelCommandsHelper.java From fabric8-forge with Apache License 2.0 | 5 votes |
public static List<InputOptionByGroup> createUIInputsForCamelEndpoint(String camelComponentName, String uri, int maxOptionsPerPage, boolean consumerOnly, boolean producerOnly, CamelCatalog camelCatalog, InputComponentFactory componentFactory, ConverterFactory converterFactory, UIContext ui) throws Exception { if (camelComponentName == null && uri != null) { camelComponentName = endpointComponentName(uri); } Map<String, String> currentValues = uri != null ? camelCatalog.endpointProperties(uri) : Collections.EMPTY_MAP; return doCreateUIInputsForCamel(camelComponentName, currentValues, maxOptionsPerPage, consumerOnly, producerOnly, camelCatalog, componentFactory, converterFactory, ui, true); }
Example #3
Source File: SetupCommand.java From thorntail-addon with Eclipse Public License 1.0 | 5 votes |
@Override public void initializeUI(UIBuilder builder) { InputComponentFactory inputFactory = builder.getInputComponentFactory(); httpPort = inputFactory.createInput("httpPort", Integer.class) .setLabel("HTTP Port").setDescription("HTTP Port Thorntail will listen to") .setDefaultValue(ThorntailConfiguration.HTTP_PORT_DEFAULT_VALUE); contextPath = inputFactory.createInput("contextPath", String.class) .setLabel("Context Path").setDescription("The context path of the web application") .setDefaultValue(ThorntailConfiguration.CONTEXT_PATH_DEFAULT_VALUE); portOffset = inputFactory.createInput("portOffset", Integer.class) .setLabel("HTTP Port Offset").setDescription("HTTP Port Offset") .setDefaultValue(ThorntailConfiguration.PORT_OFFSET_DEFAULT_VALUE); Project project = Projects.getSelectedProject(getProjectFactory(), builder.getUIContext()); if (project != null) { project.getFacetAsOptional(ThorntailFacet.class) .ifPresent((facet) -> { ThorntailConfiguration config = facet.getConfiguration(); httpPort.setDefaultValue(config.getHttpPort()); contextPath.setDefaultValue(config.getContextPath()); portOffset.setDefaultValue(config.getPortOffset()); }); } builder.add(httpPort).add(contextPath).add(portOffset); }
Example #4
Source File: CreateTestClassCommand.java From thorntail-addon with Eclipse Public License 1.0 | 5 votes |
@Override public void initializeUI(UIBuilder builder) throws Exception { InputComponentFactory inputFactory = builder.getInputComponentFactory(); targetPackage = inputFactory.createInput("targetPackage", String.class) .setLabel("Package Name") .setRequired(true) .setDescription("The package name where this type will be created"); targetPackage.getFacet(HintsFacet.class).setInputType(InputType.JAVA_PACKAGE_PICKER); targetPackage.setValueConverter(new PackageRootConverter(getProjectFactory(), builder)); targetPackage.setDefaultValue(calculateDefaultPackage(builder.getUIContext())); named = inputFactory.createInput("named", String.class) .setLabel("Type Name").setRequired(true) .setDescription("The type name"); named.addValidator((context) -> { if (!Types.isSimpleName(named.getValue())) context.addValidationError(named, "Invalid java type name."); }); asClient = inputFactory.createInput(ThorntailConfiguration.TEST_AS_CLIENT_FLAG_CONFIGURATION_ELEMENT, Boolean.class) .setLabel("As Client").setDescription("Sets test mode to as client."); archiveType = inputFactory.createSelectOne(ThorntailConfiguration.TEST_TYPE_CONFIGURATION_ELEMENT, String.class) .setLabel("Archive Type") .setDescription("Sets type of default archive") .setValueChoices(ARCHIVE_TYPES); builder.add(targetPackage) .add(named) .add(asClient) .add(archiveType); }
Example #5
Source File: AddFractionCommand.java From thorntail-addon with Eclipse Public License 1.0 | 5 votes |
@Override public void initializeUI(UIBuilder builder) throws Exception { InputComponentFactory factory = builder.getInputComponentFactory(); fractionElements = factory.createSelectMany("fractions", FractionDescriptor.class) .setLabel("Fraction List") .setDescription("Fraction list"); UIContext uiContext = builder.getUIContext(); if (uiContext.getProvider().isGUI()) { fractionElements.setItemLabelConverter(FractionDescriptor::getName); } else { fractionElements.setItemLabelConverter(FractionDescriptor::getArtifactId); } Project project = Projects.getSelectedProject(getProjectFactory(), uiContext); final Collection<FractionDescriptor> fractions; if (project != null && project.hasFacet(ThorntailFacet.class)) { fractions = project.getFacet(ThorntailFacet.class).getFractions(); } else { fractions = ThorntailFacet.getAllFractionDescriptors(); } final List<FractionDescriptor> nonInternalfractions = fractions.stream() .filter(f -> !f.isInternal()) .collect(Collectors.toList()); fractionElements.setValueChoices(nonInternalfractions); builder.add(fractionElements); }
Example #6
Source File: CamelCommandsHelper.java From fabric8-forge with Apache License 2.0 | 4 votes |
public static List<InputOptionByGroup> createUIInputsForCamelComponent(String camelComponentName, Map<String, String> currentValues, int maxOptionsPerPage, CamelCatalog camelCatalog, InputComponentFactory componentFactory, ConverterFactory converterFactory, UIContext ui) throws Exception { return doCreateUIInputsForCamel(camelComponentName, currentValues, maxOptionsPerPage, false, false, camelCatalog, componentFactory, converterFactory, ui, false); }