Search in sources :

Example 11 with SubjobContainer

use of org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer in project tdi-studio-se by Talend.

the class PartFactory method createEditPart.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.EditPartFactory#createEditPart(org.eclipse.gef.EditPart, java.lang.Object)
     */
@Override
public EditPart createEditPart(EditPart context, Object model) {
    EditPart part = null;
    if (model instanceof SubjobContainer) {
        part = new SubjobContainerPart();
    } else if (model instanceof Process) {
        part = new ProcessPart();
    } else if (model instanceof Node) {
        part = new NodePart();
    } else if (model instanceof Connection) {
        part = new ConnectionPart();
    } else if (model instanceof ConnectionLabel) {
        part = new ConnLabelEditPart();
    } else if (model instanceof MonitorConnectionLabel) {
        part = new MonitorConnectionLabelPart();
    } else if (model instanceof ConnectionPerformance) {
        part = new ConnectionPerformanceEditPart();
    } else if (model instanceof ConnectionTrace) {
        part = new ConnectionTraceEditPart();
    } else if (model instanceof ConnectionResuming) {
        part = new ConnectionResumingEditPart();
    } else if (model instanceof NodeLabel) {
        part = new NodeLabelEditPart();
    } else if (model instanceof NodeContainer) {
        if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerGEFService.class)) {
            ITestContainerGEFService testContainerService = (ITestContainerGEFService) GlobalServiceRegister.getDefault().getService(ITestContainerGEFService.class);
            if (testContainerService != null) {
                part = testContainerService.createEditorPart(model);
                if (part != null) {
                    part.setModel(model);
                    return part;
                }
            }
        }
        if (((NodeContainer) model).getNode().isSparkJoblet()) {
            if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkJobletProviderService.class)) {
                ISparkJobletProviderService sparkService = (ISparkJobletProviderService) GlobalServiceRegister.getDefault().getService(ISparkJobletProviderService.class);
                if (sparkService != null) {
                    part = (EditPart) sparkService.createEditorPart(model);
                    if (part != null) {
                        part.setModel(model);
                        return part;
                    }
                }
            }
        } else if (((NodeContainer) model).getNode().isSparkStreamingJoblet()) {
            if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkStreamingJobletProviderService.class)) {
                ISparkStreamingJobletProviderService sparkService = (ISparkStreamingJobletProviderService) GlobalServiceRegister.getDefault().getService(ISparkStreamingJobletProviderService.class);
                if (sparkService != null) {
                    part = (EditPart) sparkService.createEditorPart(model);
                    if (part != null) {
                        part.setModel(model);
                        return part;
                    }
                }
            }
        } else if (((NodeContainer) model).getNode().isStandardJoblet()) {
            part = new JobletContainerPart();
        } else if (((NodeContainer) model).getNode().isMapReduce()) {
            part = new JobletContainerPart();
        } else {
            part = new NodeContainerPart();
        }
    } else if (model instanceof Note) {
        part = new NoteEditPart();
    } else if (model instanceof NodeError) {
        part = new NodeErrorEditPart();
    } else if (model instanceof NodeProgressBar) {
        part = new NodeProgressBarPart();
    } else {
        return null;
    }
    // tell the newly created part about the model object
    part.setModel(model);
    return part;
}
Also used : NodeError(org.talend.designer.core.ui.editor.nodes.NodeError) NodeProgressBar(org.talend.designer.core.ui.editor.nodes.NodeProgressBar) NodeContainerPart(org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart) NodeProgressBarPart(org.talend.designer.core.ui.editor.nodes.NodeProgressBarPart) Node(org.talend.designer.core.ui.editor.nodes.Node) NodeLabelEditPart(org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart) Process(org.talend.designer.core.ui.editor.process.Process) NodeContainer(org.talend.designer.core.ui.editor.nodecontainer.NodeContainer) ConnectionLabel(org.talend.designer.core.ui.editor.connections.ConnectionLabel) MonitorConnectionLabel(org.talend.designer.core.ui.editor.connections.MonitorConnectionLabel) SubjobContainerPart(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart) ConnectionResuming(org.talend.designer.core.ui.editor.connections.ConnectionResuming) ConnectionResumingEditPart(org.talend.designer.core.ui.editor.connections.ConnectionResumingEditPart) NodeLabel(org.talend.designer.core.ui.editor.nodes.NodeLabel) SubjobContainer(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer) MonitorConnectionLabel(org.talend.designer.core.ui.editor.connections.MonitorConnectionLabel) ITestContainerGEFService(org.talend.designer.core.ITestContainerGEFService) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart) ISparkJobletProviderService(org.talend.core.ui.ISparkJobletProviderService) NodeErrorEditPart(org.talend.designer.core.ui.editor.nodes.NodeErrorEditPart) ConnectionPerformanceEditPart(org.talend.designer.core.ui.editor.connections.ConnectionPerformanceEditPart) ConnectionResumingEditPart(org.talend.designer.core.ui.editor.connections.ConnectionResumingEditPart) NodeErrorEditPart(org.talend.designer.core.ui.editor.nodes.NodeErrorEditPart) NodeLabelEditPart(org.talend.designer.core.ui.editor.nodes.NodeLabelEditPart) ConnectionPerformanceEditPart(org.talend.designer.core.ui.editor.connections.ConnectionPerformanceEditPart) ConnectionTraceEditPart(org.talend.designer.core.ui.editor.connections.ConnectionTraceEditPart) NoteEditPart(org.talend.designer.core.ui.editor.notes.NoteEditPart) EditPart(org.eclipse.gef.EditPart) ConnLabelEditPart(org.talend.designer.core.ui.editor.connections.ConnLabelEditPart) Connection(org.talend.designer.core.ui.editor.connections.Connection) NoteEditPart(org.talend.designer.core.ui.editor.notes.NoteEditPart) JobletContainerPart(org.talend.designer.core.ui.editor.jobletcontainer.JobletContainerPart) ConnectionPart(org.talend.designer.core.ui.editor.connections.ConnectionPart) ConnectionPerformance(org.talend.designer.core.ui.editor.connections.ConnectionPerformance) ConnectionTrace(org.talend.designer.core.ui.editor.connections.ConnectionTrace) ConnectionTraceEditPart(org.talend.designer.core.ui.editor.connections.ConnectionTraceEditPart) ISparkStreamingJobletProviderService(org.talend.core.ui.ISparkStreamingJobletProviderService) Note(org.talend.designer.core.ui.editor.notes.Note) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart) MonitorConnectionLabelPart(org.talend.designer.core.ui.editor.connections.MonitorConnectionLabelPart) ConnLabelEditPart(org.talend.designer.core.ui.editor.connections.ConnLabelEditPart)

Example 12 with SubjobContainer

use of org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer in project tdi-studio-se by Talend.

the class SubjobBasicComposite method refresh.

@Override
public void refresh() {
    super.refresh();
    Element element = getElement();
    if (element != null && element instanceof SubjobContainer) {
        SubjobContainer process = (SubjobContainer) element;
        if (reloadBtn != null && !reloadBtn.isDisposed()) {
            reloadBtn.setEnabled(!process.isReadOnly());
        }
        if (saveBtn != null && !saveBtn.isDisposed()) {
            saveBtn.setEnabled(!process.isReadOnly());
        }
    }
}
Also used : SubjobContainer(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer) Element(org.talend.core.model.process.Element)

Example 13 with SubjobContainer

use of org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer in project tdi-studio-se by Talend.

the class ConnectionPart method isSelectable.

@Override
public boolean isSelectable() {
    Connection conn = (Connection) this.getModel();
    Node source = (Node) conn.getSource();
    Node target = (Node) conn.getTarget();
    SubjobContainer sourceSubjob = source.getNodeContainer().getSubjobContainer();
    SubjobContainer targetSubjob = target.getNodeContainer().getSubjobContainer();
    if (sourceSubjob != null) {
        if ((sourceSubjob == targetSubjob) && sourceSubjob.isCollapsed()) {
            return false;
        } else if (!conn.isActivate() && sourceSubjob.isCollapsed()) {
            if (sourceSubjob.getSubjobStartNode().getUniqueName().equals(source.getUniqueName())) {
                return super.isSelectable();
            }
            return false;
        }
    }
    return super.isSelectable();
}
Also used : SubjobContainer(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer) Node(org.talend.designer.core.ui.editor.nodes.Node) IConnection(org.talend.core.model.process.IConnection)

Example 14 with SubjobContainer

use of org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer in project tdi-studio-se by Talend.

the class ComponentSettingsView method createDynamicComposite.

/**
     * yzhang Comment method "createDynamicComposite".
     * 
     * @param parent
     * @param element
     * @param category
     */
private void createDynamicComposite(final Composite parent, Element element, EComponentCategory category) {
    // DynamicComposite dc = null;
    getParentMap().put(ComponentSettingsView.PARENT, parent);
    getCategoryMap().put(ComponentSettingsView.CATEGORY, category);
    if (element instanceof Node) {
        IComponent component = ((Node) element).getComponent();
        IGenericWizardService wizardService = null;
        boolean generic = false;
        if (EComponentType.GENERIC.equals(component.getComponentType())) {
            generic = true;
            if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
                wizardService = (IGenericWizardService) GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
            }
        }
        tabFactory.getTabbedPropertyComposite().setCompactViewVisible(false);
        if (category == EComponentCategory.BASIC) {
            // getElementMap().put(ComponentSettingsView.ELEMENT, element);
            createButtonListener();
            boolean isCompactView = true;
            if (ComponentSettingsView.TABLEVIEW.equals(getPreference().getString(TalendDesignerPrefConstants.VIEW_OPTIONS))) {
                isCompactView = false;
            }
            tabFactory.getTabbedPropertyComposite().setCompactViewVisible(true);
            tabFactory.getTabbedPropertyComposite().setCompactView(isCompactView);
            // Generic
            if (generic && wizardService != null) {
                Composite composite = wizardService.creatDynamicComposite(parent, element, EComponentCategory.BASIC, true);
                if (composite instanceof MultipleThreadDynamicComposite) {
                    dc = (MultipleThreadDynamicComposite) composite;
                }
            } else {
                dc = new MissingSettingsMultiThreadDynamicComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, category, element, isCompactView);
            }
        } else if (category == EComponentCategory.DYNAMICS_SETTINGS) {
            dc = new AdvancedContextComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, element);
        } else if (category == EComponentCategory.SQL_PATTERN) {
            dc = new SQLPatternComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, element);
        } else if (category == EComponentCategory.ADVANCED) {
            dc = new MissingSettingsMultiThreadDynamicComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, category, element, true);
            // Generic
            if (generic && wizardService != null) {
                Composite composite = wizardService.creatDynamicComposite(parent, element, EComponentCategory.ADVANCED, true);
                if (composite instanceof MultipleThreadDynamicComposite) {
                    dc = (MultipleThreadDynamicComposite) composite;
                }
            }
        } else {
            dc = new MultipleThreadDynamicComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, category, element, true);
        }
    } else if (element instanceof Connection) {
        dc = new MainConnectionComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, category, element);
    } else if (element instanceof Note) {
        if (category == EComponentCategory.BASIC) {
            if (parent.getLayout() instanceof FillLayout) {
                FillLayout layout = (FillLayout) parent.getLayout();
                layout.type = SWT.VERTICAL;
                layout.marginHeight = 0;
                layout.marginWidth = 0;
                layout.spacing = 0;
            }
            ScrolledComposite scrolled = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
            scrolled.setExpandHorizontal(true);
            scrolled.setExpandVertical(true);
            scrolled.setMinWidth(600);
            scrolled.setMinHeight(400);
            Composite composite = tabFactory.getWidgetFactory().createComposite(scrolled);
            scrolled.setContent(composite);
            composite.setLayout(new FormLayout());
            FormData d = new FormData();
            d.left = new FormAttachment(0, 0);
            d.right = new FormAttachment(100, 0);
            d.top = new FormAttachment(0, 0);
            d.bottom = new FormAttachment(100, 0);
            composite.setLayoutData(d);
            AbstractNotePropertyComposite c1 = new BasicNotePropertyComposite(composite, (Note) element, tabFactory);
            // AbstractNotePropertyComposite c2 = new TextNotePropertyComposite(composite, (Note) element,
            // tabFactory);
            // FormData data = new FormData();
            // data.top = new FormAttachment(c1.getComposite(), 20, SWT.DOWN);
            // data.left = new FormAttachment(0, 0);
            // data.right = new FormAttachment(100, 0);
            // c2.getComposite().setLayoutData(data);
            parent.layout();
        }
    } else if (element instanceof SubjobContainer) {
        if (category == EComponentCategory.BASIC) {
            dc = new SubjobBasicComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, element);
        }
    } else {
        tabFactory.getTabbedPropertyComposite().setCompactViewVisible(false);
        dc = new MultipleThreadDynamicComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, category, element, true);
    }
    if (parent.getChildren().length == 0) {
        if (parent.getLayout() instanceof FillLayout) {
            FillLayout layout = (FillLayout) parent.getLayout();
            layout.type = SWT.VERTICAL;
            layout.marginHeight = 0;
            layout.marginWidth = 0;
            layout.spacing = 0;
        }
        Composite composite = tabFactory.getWidgetFactory().createComposite(parent);
        composite.setLayout(new FormLayout());
        FormData d = new FormData();
        d.left = new FormAttachment(2, 0);
        d.right = new FormAttachment(100, 0);
        d.top = new FormAttachment(5, 0);
        d.bottom = new FormAttachment(100, 0);
        composite.setLayoutData(d);
        Label alertText = new Label(composite, SWT.NONE);
        //$NON-NLS-1$
        alertText.setText(Messages.getString("ComponentSettingsView.noAdvancedSetting"));
        alertText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
        parent.layout();
    }
    if (dc != null) {
        dc.refresh();
    }
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) MainConnectionComposite(org.talend.designer.core.ui.editor.properties.connections.MainConnectionComposite) Composite(org.eclipse.swt.widgets.Composite) SubjobBasicComposite(org.talend.designer.core.ui.views.subjob.SubjobBasicComposite) AbstractNotePropertyComposite(org.talend.designer.core.ui.editor.properties.notes.AbstractNotePropertyComposite) MissingSettingsMultiThreadDynamicComposite(org.talend.designer.core.ui.views.properties.composites.MissingSettingsMultiThreadDynamicComposite) BasicNotePropertyComposite(org.talend.designer.core.ui.editor.properties.notes.BasicNotePropertyComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) IComponent(org.talend.core.model.components.IComponent) Node(org.talend.designer.core.ui.editor.nodes.Node) INode(org.talend.core.model.process.INode) AbstractNotePropertyComposite(org.talend.designer.core.ui.editor.properties.notes.AbstractNotePropertyComposite) Connection(org.talend.designer.core.ui.editor.connections.Connection) IConnection(org.talend.core.model.process.IConnection) ConnectionLabel(org.talend.designer.core.ui.editor.connections.ConnectionLabel) Label(org.eclipse.swt.widgets.Label) MissingSettingsMultiThreadDynamicComposite(org.talend.designer.core.ui.views.properties.composites.MissingSettingsMultiThreadDynamicComposite) FillLayout(org.eclipse.swt.layout.FillLayout) SubjobBasicComposite(org.talend.designer.core.ui.views.subjob.SubjobBasicComposite) BasicNotePropertyComposite(org.talend.designer.core.ui.editor.properties.notes.BasicNotePropertyComposite) SubjobContainer(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer) Note(org.talend.designer.core.ui.editor.notes.Note) IGenericWizardService(org.talend.core.runtime.services.IGenericWizardService) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) MainConnectionComposite(org.talend.designer.core.ui.editor.properties.connections.MainConnectionComposite) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 15 with SubjobContainer

use of org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer in project tdi-studio-se by Talend.

the class ComponentSettingsView method setPropertiesViewerTitle.

/**
     * yzhang Comment method "setPropertiesViewerTitle".
     * 
     * @param elem
     */
private void setPropertiesViewerTitle(Element elem) {
    String label = null;
    Image image = null;
    if (elem instanceof Node) {
        label = ((Node) elem).getLabel();
        String uniqueName = ((Node) elem).getUniqueName();
        if (!label.equals(uniqueName)) {
            //$NON-NLS-1$ //$NON-NLS-2$
            label = label + "(" + uniqueName + ")";
        }
        image = CoreImageProvider.getComponentIcon(((Node) elem).getComponent(), ICON_SIZE.ICON_24);
    } else if (elem instanceof Connection) {
        label = ((Connection) elem).getElementName();
        image = ImageProvider.getImage(EImage.RIGHT_ICON);
    } else if (elem instanceof Note) {
        //$NON-NLS-1$
        label = Messages.getString("ComponentSettingsView.note");
        image = ImageProvider.getImage(EImage.PASTE_ICON);
    } else if (elem instanceof SubjobContainer) {
        //$NON-NLS-1$
        label = Messages.getString("ComponentSettingsView.subjob");
        image = ImageProvider.getImage(EImage.PASTE_ICON);
    } else if (elem instanceof ConnectionLabel) {
        label = ((ConnectionLabel) elem).getConnection().getElementName();
        image = ImageProvider.getImage(EImage.RIGHT_ICON);
    }
    tabFactory.setTitle(label, image);
    super.setTitleToolTip(label);
}
Also used : SubjobContainer(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer) Node(org.talend.designer.core.ui.editor.nodes.Node) INode(org.talend.core.model.process.INode) Note(org.talend.designer.core.ui.editor.notes.Note) Connection(org.talend.designer.core.ui.editor.connections.Connection) IConnection(org.talend.core.model.process.IConnection) ConnectionLabel(org.talend.designer.core.ui.editor.connections.ConnectionLabel) Image(org.eclipse.swt.graphics.Image) EImage(org.talend.commons.ui.runtime.image.EImage)

Aggregations

SubjobContainer (org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer)21 Node (org.talend.designer.core.ui.editor.nodes.Node)17 List (java.util.List)11 SubjobContainerPart (org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart)10 ArrayList (java.util.ArrayList)9 NodePart (org.talend.designer.core.ui.editor.nodes.NodePart)9 NodeContainer (org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)8 IConnection (org.talend.core.model.process.IConnection)7 INode (org.talend.core.model.process.INode)7 Connection (org.talend.designer.core.ui.editor.connections.Connection)7 Note (org.talend.designer.core.ui.editor.notes.Note)5 HashMap (java.util.HashMap)4 EditPart (org.eclipse.gef.EditPart)4 ConnectionLabel (org.talend.designer.core.ui.editor.connections.ConnectionLabel)4 NoteEditPart (org.talend.designer.core.ui.editor.notes.NoteEditPart)4 ProcessPart (org.talend.designer.core.ui.editor.process.ProcessPart)4 Point (org.eclipse.draw2d.geometry.Point)3 IComponent (org.talend.core.model.components.IComponent)3 ISubjobContainer (org.talend.core.model.process.ISubjobContainer)3 IGraphicalNode (org.talend.core.ui.process.IGraphicalNode)3