use of org.talend.components.api.properties.ComponentProperties in project tdi-studio-se by Talend.
the class GenericConnWizard method addPages.
@Override
public void addPages() {
ERepositoryObjectType repObjType = (ERepositoryObjectType) repNode.getProperties(EProperties.CONTENT_TYPE);
String typeName = repObjType.getType();
setWindowTitle(typeName);
Image wiardImage = wizardService.getWiardImage(typeName);
setDefaultPageImageDescriptor(ImageDescriptor.createFromImage(wiardImage));
((GenericConnectionItem) connectionItem).setTypeName(typeName);
IGenericWizardInternalService internalService = new GenericWizardInternalService();
ComponentWizard componentWizard = null;
if (creation) {
componentWizard = internalService.getComponentWizard(typeName, connectionProperty.getId());
} else {
String compPropertiesStr = connection.getCompProperties();
if (compPropertiesStr != null) {
ComponentProperties properties = ComponentsUtils.getComponentPropertiesFromSerialized(compPropertiesStr, connection, false);
if (properties != null) {
componentWizard = internalService.getTopLevelComponentWizard(properties, repNode.getId());
}
}
}
if (componentWizard == null) {
return;
}
List<Form> forms = componentWizard.getForms();
for (int i = 0; i < forms.size(); i++) {
Form form = forms.get(i);
boolean addContextSupport = false;
if (i == 0) {
// Add context support in the first form.
addContextSupport = true;
}
wizPage = new GenericConnWizardPage(connectionItem, isRepositoryObjectEditable(), existingNames, creation, form, compService, addContextSupport);
if (wizPage != null) {
wizPage.setTitle(form.getTitle());
wizPage.setDescription(form.getSubtitle());
if (creation) {
wizPage.setPageComplete(false);
} else {
wizPage.setPageComplete(isRepositoryObjectEditable());
}
}
addPage(wizPage);
}
}
use of org.talend.components.api.properties.ComponentProperties in project tdi-studio-se by Talend.
the class GenericContextUtil method setPropertiesForContextMode.
public static void setPropertiesForContextMode(String prefixName, Connection connection, Set<IConnParamName> paramSet) {
if (connection == null) {
return;
}
if (connection instanceof GenericConnection) {
GenericConnection genericConn = (GenericConnection) connection;
ComponentProperties componentProperties = getComponentProperties(genericConn);
String originalVariableName = prefixName + ConnectionContextHelper.LINE;
String genericVariableName = null;
for (IConnParamName param : paramSet) {
if (param instanceof GenericConnParamName) {
GenericConnParamName genericParam = (GenericConnParamName) param;
String paramVarName = genericParam.getContextVar();
genericVariableName = originalVariableName + paramVarName;
matchContextForAttribues(componentProperties, genericParam, genericVariableName);
}
}
updateComponentProperties(genericConn, componentProperties);
}
}
use of org.talend.components.api.properties.ComponentProperties in project tdi-studio-se by Talend.
the class Component method getElementParameterValueFromComponentProperties.
@Override
public Object getElementParameterValueFromComponentProperties(INode iNode, IElementParameter param) {
if (iNode != null) {
ComponentProperties iNodeComponentProperties = iNode.getComponentProperties();
if (iNodeComponentProperties != null && param instanceof GenericElementParameter) {
Properties paramProperties = ComponentsUtils.getCurrentProperties(iNodeComponentProperties, param.getName());
if (paramProperties != null) {
// update repository value
Property property = iNodeComponentProperties.getValuedProperty(param.getName());
if (property != null) {
if (property.getTaggedValue(IGenericConstants.REPOSITORY_VALUE) != null) {
param.setRepositoryValue(param.getName());
param.setRepositoryValueUsed(true);
}
}
Object value = ComponentsUtils.getGenericPropertyValue(iNodeComponentProperties, param.getName());
if (value == null && EParameterFieldType.TABLE.equals(param.getFieldType())) {
value = GenericTableUtils.getTableValues(iNodeComponentProperties.getProperties(param.getName()), param);
}
return value;
}
}
}
return null;
}
use of org.talend.components.api.properties.ComponentProperties 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.components.api.properties.ComponentProperties in project tdi-studio-se by Talend.
the class Component method setGenericPropertyValue.
@Override
public boolean setGenericPropertyValue(IElementParameter param) {
if (param == null || param.getName() == null) {
return false;
}
if (param instanceof GenericElementParameter) {
ComponentProperties componentProperties = ((Node) ((GenericElementParameter) param).getElement()).getComponentProperties();
Properties currentProperties = ComponentsUtils.getCurrentProperties(componentProperties, param.getName());
if (currentProperties == null) {
return false;
}
Property<?> property = componentProperties.getValuedProperty(param.getName());
if (property != null) {
property.setTaggedValue(IGenericConstants.REPOSITORY_VALUE, param.getName());
return true;
}
}
return false;
}
Aggregations