Search in sources :

Example 86 with IComponent

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);
}
Also used : EDatabaseComponentName(org.talend.designer.core.ui.editor.process.EDatabaseComponentName) EList(org.eclipse.emf.common.util.EList) IComponent(org.talend.core.model.components.IComponent) ArrayList(java.util.ArrayList) EmfComponent(org.talend.designer.core.model.components.EmfComponent) HL7ConnectionItem(org.talend.core.model.properties.HL7ConnectionItem) HL7Connection(org.talend.core.model.metadata.builder.connection.HL7Connection)

Example 87 with IComponent

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;
}
Also used : IComponent(org.talend.core.model.components.IComponent) ArrayList(java.util.ArrayList)

Example 88 with IComponent

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;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) IComponent(org.talend.core.model.components.IComponent) Rectangle(org.eclipse.swt.graphics.Rectangle) IBrandingService(org.talend.core.ui.branding.IBrandingService) ExternalDbMapUiProperties(org.talend.designer.dbmap.external.data.ExternalDbMapUiProperties)

Example 89 with IComponent

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;
}
Also used : IComponent(org.talend.core.model.components.IComponent) MultiSchemaDialog(org.talend.designer.filemultischemas.ui.dialog.MultiSchemaDialog) Rectangle(org.eclipse.swt.graphics.Rectangle)

Example 90 with IComponent

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;
}
Also used : LabelledText(org.talend.commons.ui.swt.formtools.LabelledText) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) LabelledDirectoryField(org.talend.commons.ui.swt.formtools.LabelledDirectoryField) IComponent(org.talend.core.model.components.IComponent) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

Aggregations

IComponent (org.talend.core.model.components.IComponent)146 Node (org.talend.designer.core.ui.editor.nodes.Node)54 ArrayList (java.util.ArrayList)47 IElementParameter (org.talend.core.model.process.IElementParameter)36 Process (org.talend.designer.core.ui.editor.process.Process)36 Test (org.junit.Test)35 INode (org.talend.core.model.process.INode)33 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)22 List (java.util.List)15 Property (org.talend.core.model.properties.Property)15 FakePropertyImpl (org.talend.core.model.repository.FakePropertyImpl)15 NodeContainer (org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)13 IComponentsFactory (org.talend.core.model.components.IComponentsFactory)12 Connection (org.talend.designer.core.ui.editor.connections.Connection)12 HashMap (java.util.HashMap)11 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)10 DataNode (org.talend.designer.core.model.process.DataNode)10 HashSet (java.util.HashSet)9 IConnection (org.talend.core.model.process.IConnection)9 Rectangle (org.eclipse.swt.graphics.Rectangle)8