use of org.talend.components.api.wizard.ComponentWizardDefinition in project tdi-studio-se by Talend.
the class Component method addMainParameters.
public void addMainParameters(final List<ElementParameter> listParam, INode node) {
ElementParameter param;
param = new ElementParameter(node);
param.setName(EParameterName.UNIQUE_NAME.getName());
//$NON-NLS-1$
param.setValue("");
param.setDisplayName(EParameterName.UNIQUE_NAME.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.ADVANCED);
param.setNumRow(1);
param.setReadOnly(true);
param.setShow(false);
listParam.add(param);
param = new ElementParameter(node);
param.setName(EParameterName.COMPONENT_NAME.getName());
param.setValue(getName());
param.setDisplayName(EParameterName.COMPONENT_NAME.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.TECHNICAL);
param.setNumRow(1);
param.setReadOnly(true);
param.setShow(false);
listParam.add(param);
param = new ElementParameter(node);
param.setName(EParameterName.FAMILY.getName());
param.setValue(getOriginalFamilyName());
param.setDisplayName(EParameterName.FAMILY.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.TECHNICAL);
param.setNumRow(3);
param.setReadOnly(true);
param.setRequired(false);
param.setShow(false);
listParam.add(param);
// TUP-4142
if (canStart()) {
param = new ElementParameter(node);
param.setName(EParameterName.START.getName());
param.setValue(new Boolean(false));
param.setDisplayName(EParameterName.START.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.TECHNICAL);
param.setNumRow(5);
param.setReadOnly(true);
param.setRequired(false);
param.setShow(false);
listParam.add(param);
}
// TUP-4142
param = new ElementParameter(node);
param.setName(EParameterName.STARTABLE.getName());
param.setValue(new Boolean(canStart()));
param.setDisplayName(EParameterName.STARTABLE.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.TECHNICAL);
param.setNumRow(5);
param.setReadOnly(true);
param.setRequired(false);
param.setShow(false);
listParam.add(param);
// TUP-4142
param = new ElementParameter(node);
param.setName(EParameterName.SUBTREE_START.getName());
param.setValue(new Boolean(canStart()));
param.setDisplayName(EParameterName.SUBTREE_START.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.TECHNICAL);
param.setNumRow(5);
param.setReadOnly(true);
param.setRequired(false);
param.setShow(false);
listParam.add(param);
// TUP-4142
param = new ElementParameter(node);
param.setName(EParameterName.END_OF_FLOW.getName());
param.setValue(new Boolean(canStart()));
param.setDisplayName(EParameterName.END_OF_FLOW.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.TECHNICAL);
param.setNumRow(5);
param.setReadOnly(true);
param.setRequired(false);
param.setShow(false);
listParam.add(param);
param = new ElementParameter(node);
param.setName(EParameterName.ACTIVATE.getName());
param.setValue(new Boolean(true));
param.setDisplayName(EParameterName.ACTIVATE.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.TECHNICAL);
param.setNumRow(5);
param.setReadOnly(false);
param.setRequired(false);
param.setDefaultValue(param.getValue());
param.setShow(true);
listParam.add(param);
// TUP-4143
param = new ElementParameter(node);
param.setName(EParameterName.HELP.getName());
param.setValue(getTranslatedValue(PROP_HELP));
param.setDisplayName(EParameterName.HELP.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.TECHNICAL);
param.setNumRow(6);
param.setReadOnly(true);
param.setRequired(false);
param.setShow(false);
listParam.add(param);
param = new ElementParameter(node);
param.setName(EParameterName.UPDATE_COMPONENTS.getName());
param.setValue(new Boolean(false));
param.setDisplayName(EParameterName.UPDATE_COMPONENTS.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.TECHNICAL);
param.setNumRow(5);
param.setReadOnly(true);
param.setRequired(false);
param.setShow(false);
listParam.add(param);
//
param = new ElementParameter(node);
param.setName(EParameterName.IREPORT_PATH.getName());
param.setCategory(EComponentCategory.TECHNICAL);
param.setFieldType(EParameterFieldType.DIRECTORY);
param.setDisplayName(EParameterName.IREPORT_PATH.getDisplayName());
param.setNumRow(99);
param.setShow(false);
param.setValue(CorePlugin.getDefault().getPluginPreferences().getString(ITalendCorePrefConstants.IREPORT_PATH));
param.setReadOnly(true);
listParam.add(param);
ComponentWizardDefinition wizardDefinition = getWizardDefinition(node.getComponentProperties());
param = new ElementParameter(node);
//$NON-NLS-1$
param.setName("PROPERTY");
param.setCategory(EComponentCategory.BASIC);
param.setDisplayName(EParameterName.PROPERTY_TYPE.getDisplayName());
param.setFieldType(EParameterFieldType.PROPERTY_TYPE);
if (wizardDefinition != null) {
param.setRepositoryValue(wizardDefinition.getName());
}
//$NON-NLS-1$
param.setValue("");
param.setNumRow(1);
param.setShow(wizardDefinition != null);
ElementParameter newParam = new ElementParameter(node);
newParam.setCategory(EComponentCategory.BASIC);
newParam.setName(EParameterName.PROPERTY_TYPE.getName());
newParam.setDisplayName(EParameterName.PROPERTY_TYPE.getDisplayName());
newParam.setListItemsDisplayName(new String[] { TEXT_BUILTIN, TEXT_REPOSITORY });
newParam.setListItemsDisplayCodeName(new String[] { BUILTIN, REPOSITORY });
newParam.setListItemsValue(new String[] { BUILTIN, REPOSITORY });
newParam.setValue(BUILTIN);
newParam.setNumRow(param.getNumRow());
newParam.setFieldType(EParameterFieldType.TECHNICAL);
newParam.setShow(false);
//$NON-NLS-1$ //$NON-NLS-2$
newParam.setShowIf(param.getName() + " =='" + REPOSITORY + "'");
newParam.setReadOnly(param.isReadOnly());
newParam.setNotShowIf(param.getNotShowIf());
newParam.setContext(IGenericConstants.CONTEXT);
newParam.setSerialized(true);
newParam.setParentParameter(param);
newParam = new ElementParameter(node);
newParam.setCategory(EComponentCategory.BASIC);
newParam.setName(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
newParam.setDisplayName(EParameterName.REPOSITORY_PROPERTY_TYPE.getDisplayName());
newParam.setListItemsDisplayName(new String[] {});
newParam.setListItemsValue(new String[] {});
newParam.setNumRow(param.getNumRow());
newParam.setFieldType(EParameterFieldType.TECHNICAL);
//$NON-NLS-1$
newParam.setValue("");
newParam.setShow(false);
newParam.setRequired(true);
newParam.setReadOnly(param.isReadOnly());
//$NON-NLS-1$//$NON-NLS-2$
newParam.setShowIf(param.getName() + " =='" + REPOSITORY + "'");
newParam.setNotShowIf(param.getNotShowIf());
newParam.setContext(IGenericConstants.CONTEXT);
newParam.setSerialized(true);
newParam.setParentParameter(param);
listParam.add(param);
if (ComponentCategory.CATEGORY_4_DI.getName().equals(this.getPaletteType())) {
boolean isStatCatcherComponent = false;
/* for bug 0021961,should not show parameter TSTATCATCHER_STATS in UI on component tStatCatcher */
if (!isStatCatcherComponent) {
boolean tStatCatcherAvailable = ComponentsFactoryProvider.getInstance().get(EmfComponent.TSTATCATCHER_NAME, ComponentCategory.CATEGORY_4_DI.getName()) != null;
param = new ElementParameter(node);
param.setName(EParameterName.TSTATCATCHER_STATS.getName());
param.setValue(Boolean.FALSE);
param.setDisplayName(EParameterName.TSTATCATCHER_STATS.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.ADVANCED);
param.setNumRow(199);
param.setReadOnly(false);
param.setRequired(false);
param.setDefaultValue(param.getValue());
param.setShow(tStatCatcherAvailable);
listParam.add(param);
}
}
// GLiu Added for Task http://jira.talendforge.org/browse/TESB-4279
if (PluginChecker.isTeamEdition() && !ComponentCategory.CATEGORY_4_CAMEL.getName().equals(getPaletteType())) {
boolean defaultParalelize = Boolean.FALSE;
param = new ElementParameter(node);
param.setReadOnly(!defaultParalelize);
param.setName(EParameterName.PARALLELIZE.getName());
param.setValue(Boolean.FALSE);
param.setDisplayName(EParameterName.PARALLELIZE.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.ADVANCED);
param.setNumRow(200);
param.setShow(true);
param.setDefaultValue(param.getValue());
listParam.add(param);
param = new ElementParameter(node);
param.setReadOnly(!defaultParalelize);
param.setName(EParameterName.PARALLELIZE_NUMBER.getName());
param.setValue(2);
param.setDisplayName(EParameterName.PARALLELIZE_NUMBER.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.ADVANCED);
param.setNumRow(200);
//$NON-NLS-1$
param.setShowIf(EParameterName.PARALLELIZE.getName() + " == 'true'");
param.setDefaultValue(param.getValue());
listParam.add(param);
param = new ElementParameter(node);
param.setReadOnly(!defaultParalelize);
param.setName(EParameterName.PARALLELIZE_KEEP_EMPTY.getName());
param.setValue(Boolean.FALSE);
param.setDisplayName(EParameterName.PARALLELIZE_KEEP_EMPTY.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.ADVANCED);
param.setNumRow(200);
param.setShow(false);
param.setDefaultValue(param.getValue());
listParam.add(param);
}
}
use of org.talend.components.api.wizard.ComponentWizardDefinition in project tdi-studio-se by Talend.
the class GenericWizardService method createNodesFromComponentService.
@Override
public List<RepositoryNode> createNodesFromComponentService(RepositoryNode curParentNode) {
List<RepositoryNode> repNodes = new ArrayList<>();
Set<ComponentWizardDefinition> wizardDefinitions = internalService.getComponentService().getTopLevelComponentWizards();
for (ComponentWizardDefinition wizardDefinition : wizardDefinitions) {
String name = wizardDefinition.getName();
String displayName = wizardDefinition.getDisplayName();
//$NON-NLS-1$
String folder = "metadata/" + name;
int ordinal = 100;
ERepositoryObjectType repositoryType = internalService.createRepositoryType(name, displayName, name, folder, ordinal);
if (curParentNode != null) {
repNodes.add(internalService.createRepositoryNode(curParentNode, wizardDefinition.getDisplayName(), repositoryType, ENodeType.SYSTEM_FOLDER));
}
}
return repNodes;
}
use of org.talend.components.api.wizard.ComponentWizardDefinition in project tdi-studio-se by Talend.
the class Component method getRepositoryType.
@Override
public String getRepositoryType(Connection connection) {
String propertiesStr = null;
IGenericWizardService wizardService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
wizardService = (IGenericWizardService) GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
}
if (wizardService != null) {
propertiesStr = wizardService.getConnectionProperties(connection);
}
ComponentProperties properties = ComponentsUtils.getComponentPropertiesFromSerialized(propertiesStr, connection, false);
if (properties != null) {
ComponentWizardDefinition wizardDefinition = getWizardDefinition(properties);
if (wizardDefinition != null) {
return wizardDefinition.getName();
}
}
return null;
}
use of org.talend.components.api.wizard.ComponentWizardDefinition in project tdi-studio-se by Talend.
the class Component method getWizardDefinition.
private ComponentWizardDefinition getWizardDefinition(ComponentProperties componentProperties) {
ComponentWizardDefinition definition = null;
if (componentProperties == null) {
return null;
}
ComponentService service = ComponentsUtils.getComponentService();
List<ComponentWizard> componentWizards = service.getComponentWizardsForProperties(componentProperties, null);
for (ComponentWizard componentWizard : componentWizards) {
definition = componentWizard.getDefinition();
// Can we ensure it is the same wizard with metadata connection wizard by this way?
if (definition.isTopLevel()) {
return definition;
}
}
List<NamedThing> namedThings = componentProperties.getProperties();
for (NamedThing namedThing : namedThings) {
if (namedThing instanceof ComponentProperties) {
definition = getWizardDefinition((ComponentProperties) namedThing);
if (definition != null && definition.isTopLevel()) {
return definition;
}
}
}
return null;
}
Aggregations