use of org.talend.designer.core.model.components.ElementParameter in project tdi-studio-se by Talend.
the class GenericWizardPage method getContextParameters.
public List<IElementParameter> getContextParameters() {
List<IElementParameter> contextParameters = new ArrayList<>();
for (IElementParameter parameter : baseElement.getElementParameters()) {
if (parameter instanceof GenericElementParameter) {
GenericElementParameter genericElementParameter = (GenericElementParameter) parameter;
if (genericElementParameter.isSupportContext()) {
contextParameters.add(parameter);
}
List<ElementParameter> relatedParameters = ComponentsUtils.getRelatedParameters(genericElementParameter);
for (ElementParameter relatedParameter : relatedParameters) {
if (relatedParameter instanceof GenericElementParameter && ((GenericElementParameter) relatedParameter).isSupportContext()) {
contextParameters.add(relatedParameter);
}
}
}
}
return contextParameters;
}
use of org.talend.designer.core.model.components.ElementParameter in project tdi-studio-se by Talend.
the class Component method addValidationRuleType.
private ElementParameter addValidationRuleType(INode node, int rowNb) {
ElementParameter parentParam = new ElementParameter(node);
parentParam.setName(EParameterName.VALIDATION_RULE_TYPE.getName());
parentParam.setDisplayName(EParameterName.VALIDATION_RULE_TYPE.getDisplayName());
parentParam.setFieldType(EParameterFieldType.VALIDATION_RULE_TYPE);
parentParam.setCategory(EComponentCategory.VALIDATION_RULES);
parentParam.setNumRow(rowNb);
parentParam.setReadOnly(false);
parentParam.setShow(true);
//$NON-NLS-1$
parentParam.setShowIf(EParameterName.VALIDATION_RULES.getName() + " == 'true'");
parentParam.setContext(IGenericConstants.CONTEXT);
parentParam.setRepositoryValue(ERepositoryCategoryType.VALIDATIONRULES.getName());
parentParam.setValue("");
ElementParameter newParam = new ElementParameter(node);
newParam.setCategory(EComponentCategory.VALIDATION_RULES);
newParam.setName(EParameterName.VALIDATION_RULE_TYPE.getName());
newParam.setDisplayName(EParameterName.VALIDATION_RULE_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(rowNb);
newParam.setFieldType(EParameterFieldType.TECHNICAL);
newParam.setShow(true);
//$NON-NLS-1$ //$NON-NLS-2$
newParam.setShowIf(parentParam.getName() + " =='" + REPOSITORY + "'");
newParam.setReadOnly(false);
newParam.setContext(IGenericConstants.CONTEXT);
newParam.setParentParameter(parentParam);
newParam = new ElementParameter(node);
newParam.setCategory(EComponentCategory.VALIDATION_RULES);
newParam.setName(EParameterName.REPOSITORY_VALIDATION_RULE_TYPE.getName());
newParam.setDisplayName(EParameterName.REPOSITORY_VALIDATION_RULE_TYPE.getDisplayName());
newParam.setListItemsDisplayName(new String[] {});
newParam.setListItemsValue(new String[] {});
newParam.setNumRow(rowNb);
newParam.setFieldType(EParameterFieldType.TECHNICAL);
//$NON-NLS-1$
newParam.setValue("");
newParam.setShow(false);
newParam.setRequired(true);
newParam.setContext(IGenericConstants.CONTEXT);
newParam.setParentParameter(parentParam);
return parentParam;
}
use of org.talend.designer.core.model.components.ElementParameter in project tdi-studio-se by Talend.
the class Component method addValidationRulesParameters.
private void addValidationRulesParameters(final List<ElementParameter> listParam, INode node) {
ElementParameter param;
param = new ElementParameter(node);
param.setName(EParameterName.VALIDATION_RULES.getName());
param.setValue(new Boolean(false));
param.setDisplayName(EParameterName.VALIDATION_RULES.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.VALIDATION_RULES);
param.setNumRow(1);
param.setReadOnly(false);
param.setRequired(false);
param.setDefaultValue(param.getValue());
param.setShow(true);
listParam.add(param);
listParam.add(addValidationRuleType(node, 3));
}
use of org.talend.designer.core.model.components.ElementParameter in project tdi-studio-se by Talend.
the class Component method addPropertyParameters.
private void addPropertyParameters(final List<ElementParameter> listParam, final INode node, String formName, EComponentCategory category) {
ComponentProperties props = node.getComponentProperties();
Form form = props.getForm(formName);
List<ElementParameter> parameters = ComponentsUtils.getParametersFromForm(node, this.isInitializing(), category, props, form);
props.setValueEvaluator(new ComponentContextPropertyValueEvaluator(node));
ComponentService componentService = ComponentsUtils.getComponentService();
for (ElementParameter parameter : parameters) {
if (parameter instanceof GenericElementParameter) {
GenericElementParameter genericElementParameter = (GenericElementParameter) parameter;
genericElementParameter.setComponentService(componentService);
}
}
listParam.addAll(parameters);
}
use of org.talend.designer.core.model.components.ElementParameter 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);
}
}
Aggregations