use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.
the class ValidationRulesUtil method filterNeededComponents.
public static List<IComponent> filterNeededComponents(Item item, ERepositoryObjectType type) {
EDatabaseComponentName name = EDatabaseComponentName.getCorrespondingComponentName(item, type);
String productNameWanted = filterProductNameWanted(name, item);
boolean hl7Related = false;
boolean hl7Output = false;
if (item instanceof HL7ConnectionItem) {
hl7Related = true;
EList list = ((HL7Connection) ((HL7ConnectionItem) item).getConnection()).getRoot();
if (list != null && list.size() > 0) {
hl7Output = true;
}
}
Set<IComponent> components = ComponentsFactoryProvider.getInstance().getComponents();
List<IComponent> neededComponents = new ArrayList<IComponent>();
EmfComponent emfComponent = null;
for (IComponent component : components) {
if (component instanceof EmfComponent) {
emfComponent = (EmfComponent) component;
String componentProductname = emfComponent.getRepositoryType();
boolean value = true;
if (type == ERepositoryObjectType.METADATA_CON_TABLE) {
if (emfComponent.getName().toUpperCase().endsWith(MAP)) {
value = false;
}
}
if (hl7Output && !component.getName().equals("tHL7Output")) {
//$NON-NLS-1$
value = false;
} else if (hl7Related && !hl7Output && !component.getName().equals("tHL7Input")) {
// bug15632
value = false;
}
boolean flag = filterComponent(component, name, type);
if (((componentProductname != null && productNameWanted.endsWith(componentProductname)) && value) || flag) {
neededComponents.add(emfComponent);
}
}
}
return sortFilteredComponnents(item, type, neededComponents);
}
use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.
the class ValidationRulesUtil method sortFilteredComponnents.
private static List<IComponent> sortFilteredComponnents(Item item, ERepositoryObjectType type, List<IComponent> neededComponents) {
List<IComponent> normalTopComponents = new ArrayList<IComponent>();
List<IComponent> specialTopComponents = new ArrayList<IComponent>();
for (IComponent component : neededComponents) {
String name = component.getName();
if (name.contains(OUTPUT) || name.contains(INPUT)) {
normalTopComponents.add(component);
} else if (isSpecialTop(item, type, component)) {
specialTopComponents.add(component);
}
}
List<IComponent> sortedComponents = new ArrayList<IComponent>();
sortedComponents.addAll(specialTopComponents);
sortedComponents.addAll(normalTopComponents);
// add the left components
neededComponents.removeAll(specialTopComponents);
neededComponents.removeAll(normalTopComponents);
sortedComponents.addAll(neededComponents);
return sortedComponents;
}
use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.
the class MapperMain method createUI.
/**
* Create a shell and init the mapper into it.
*
* @param display
* @return the created shell
*/
public Shell createUI(Display display) {
Shell shell = new Shell(display, SWT.APPLICATION_MODAL | SWT.BORDER | SWT.RESIZE | SWT.CLOSE | SWT.MIN | SWT.MAX | SWT.TITLE);
if (!MapperMain.isStandAloneMode()) {
IComponent component = connector.getComponent();
shell.setImage(CoreImageProvider.getComponentIcon(component, ICON_SIZE.ICON_32));
}
// Shell shell = new Shell(display);
// shell.setImage(ImageProviderMapper.getImage(ImageInfo.MAPPER_ICON));
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
String productName = brandingService.getFullProductName();
//$NON-NLS-1$ //$NON-NLS-2$
shell.setText(productName + " - " + connector.getComponent().getName() + " - " + connector.getUniqueName());
ExternalDbMapUiProperties uiProperties = mapperManager.getUiManager().getUiProperties();
Rectangle boundsMapper = uiProperties.getBoundsMapper();
if (uiProperties.isShellMaximized()) {
shell.setMaximized(uiProperties.isShellMaximized());
} else {
// // move shell at outer of display zone to avoid visual effect on loading
// Rectangle tmpBoundsMapper = new Rectangle(-boundsMapper.width, boundsMapper.y, boundsMapper.width,
// boundsMapper.height);
// shell.setBounds(tmpBoundsMapper);
boundsMapper = uiProperties.getBoundsMapper();
if (boundsMapper.x < 0) {
boundsMapper.x = 0;
}
if (boundsMapper.y < 0) {
boundsMapper.y = 0;
}
shell.setBounds(boundsMapper);
}
createUI(shell);
shell.open();
return shell;
}
use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.
the class MultiSchemasMain method createDialog.
public Dialog createDialog(Shell parentShell) {
MultiSchemaDialog dialog = new MultiSchemaDialog(parentShell, this);
IComponent component = connector.getComponent();
dialog.setIcon(CoreImageProvider.getComponentIcon(component, ICON_SIZE.ICON_32));
dialog.setTitle("Talend Open Studio - " + connector.getUniqueName());
Rectangle boundsMapper = ExternalMultiSchemasUIProperties.getBoundsMapper();
if (ExternalMultiSchemasUIProperties.isShellMaximized()) {
dialog.setMaximized(ExternalMultiSchemasUIProperties.isShellMaximized());
dialog.setSize(boundsMapper);
parentShell.setBounds(boundsMapper);
} else {
boundsMapper = ExternalMultiSchemasUIProperties.getBoundsMapper();
if (boundsMapper.x < 0) {
boundsMapper.x = 0;
}
if (boundsMapper.y < 0) {
boundsMapper.y = 0;
}
dialog.setSize(boundsMapper);
}
dialog.open();
return dialog;
}
use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.
the class PropertySetDialog method createDialogArea.
/**
* Create contents of the dialog
*
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
final GridLayout gridLayout = new GridLayout();
gridLayout.marginLeft = 10;
gridLayout.marginTop = 10;
gridLayout.marginHeight = 10;
container.setLayout(gridLayout);
dieOnErrorButton = new Button(container, SWT.CHECK);
//$NON-NLS-1$
dieOnErrorButton.setText("Die on error");
lookupInParallelButton = new Button(container, SWT.CHECK);
//$NON-NLS-1$
lookupInParallelButton.setText("Lookup in parallel");
lookupInParallelButton.setEnabled(true);
IComponent tempNode = ComponentsFactoryProvider.getInstance().get("tParallelize", //$NON-NLS-1$
ComponentCategory.CATEGORY_4_DI.getName());
if (tempNode == null) {
lookupInParallelButton.setVisible(false);
}
enableAutoConvertTypeBtn = new Button(container, SWT.CHECK);
//$NON-NLS-1$
enableAutoConvertTypeBtn.setText(Messages.getString("PropertySetDialog.Button.enable"));
final Group storeOnDiskGroup = new Group(container, SWT.NONE);
storeOnDiskGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
storeOnDiskGroup.setText("Store on disk");
storeOnDiskGroup.setLayout(new GridLayout(3, false));
directoryField = new LabelledDirectoryField(storeOnDiskGroup, "Temp data directory path:");
sizeField = new LabelledText(storeOnDiskGroup, "Max buffer size(nb of rows):");
Label label = new Label(storeOnDiskGroup, SWT.NONE);
label.setText("*");
label.setToolTipText("Required filed.");
init();
addListener();
updateStatus();
//
return container;
}
Aggregations