Search in sources :

Example 1 with SparkStreamingSubjobContainerFigure

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

the class SubjobContainerPart method createFigure.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
     */
@Override
protected IFigure createFigure() {
    SubjobContainer container = (SubjobContainer) this.getModel();
    Boolean isDisplaySubjobs = (container).isDisplayed();
    if (!isDisplaySubjobs) {
        Figure figure = new FreeformLayer();
        figure.setLayoutManager(new FreeformLayout());
        return figure;
    }
    IProcess2 process = container.getProcess();
    //$NON-NLS-1$
    Object obj = process.getAdditionalProperties().get("FRAMEWORK");
    SubjobContainerFigure subjobContainer = null;
    if ("Spark Streaming".equals(obj) && !(process.getProperty().getItem() instanceof JobletProcessItem)) {
        //$NON-NLS-1$
        subjobContainer = new SparkStreamingSubjobContainerFigure(container);
    } else {
        subjobContainer = new SubjobContainerFigure(container);
    }
    return subjobContainer;
}
Also used : SparkStreamingSubjobContainerFigure(org.talend.designer.core.ui.editor.subjobcontainer.sparkstreaming.SparkStreamingSubjobContainerFigure) FreeformLayout(org.eclipse.draw2d.FreeformLayout) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) SparkStreamingSubjobContainerFigure(org.talend.designer.core.ui.editor.subjobcontainer.sparkstreaming.SparkStreamingSubjobContainerFigure) IProcess2(org.talend.core.model.process.IProcess2) FreeformLayer(org.eclipse.draw2d.FreeformLayer) IFigure(org.eclipse.draw2d.IFigure) SparkStreamingSubjobContainerFigure(org.talend.designer.core.ui.editor.subjobcontainer.sparkstreaming.SparkStreamingSubjobContainerFigure) Figure(org.eclipse.draw2d.Figure)

Example 2 with SparkStreamingSubjobContainerFigure

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

the class SubjobContainerPart method propertyChange.

/*
     * (non-Javadoc)
     * 
     * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
     */
@Override
public void propertyChange(PropertyChangeEvent evt) {
    String prop = evt.getPropertyName();
    if (SubjobContainer.UPDATE_SUBJOB_CONTENT.equals(prop)) {
        refresh();
        List<AbstractGraphicalEditPart> childrens = getChildren();
        for (AbstractGraphicalEditPart part : childrens) {
            part.refresh();
        }
    } else if (SubjobContainer.UPDATE_SUBJOB_CONNECTIONS.equals(prop)) {
        refreshSourceConnections();
    } else if (SubjobContainer.UPDATE_SUBJOB_TITLE_COLOR.equals(prop)) {
        if (getFigure() instanceof SubjobContainerFigure) {
            ((SubjobContainerFigure) getFigure()).updateSubJobTitleColor();
            refreshVisuals();
        }
    } else if (SubjobContainer.UPDATE_SUBJOB_DISPLAY.equals(prop)) {
        List<NodeContainer> tmpList = new ArrayList<NodeContainer>(((SubjobContainer) getModel()).getNodeContainers());
        ((SubjobContainer) getModel()).getNodeContainers().clear();
        refreshChildren();
        List elems = ((Process) getParent().getModel()).getElements();
        elems.remove(getModel());
        EditPart parent = getParent();
        parent.refresh();
        ((SubjobContainer) getModel()).getNodeContainers().addAll(tmpList);
        elems.add(getModel());
        parent.refresh();
    } else if ("UPDATE_SPARKSTREAMING_STATUS".equals(prop)) {
        if (getFigure() instanceof SparkStreamingSubjobContainerFigure) {
            ((SparkStreamingSubjobContainerFigure) getFigure()).updateData();
            refreshVisuals();
        }
    } else {
        // can only be UPDATE_SUBJOB_DATA, need to modify if some others are added
        if (getFigure() instanceof SubjobContainerFigure) {
            ((SubjobContainerFigure) getFigure()).updateData();
            refreshVisuals();
        }
    }
}
Also used : SparkStreamingSubjobContainerFigure(org.talend.designer.core.ui.editor.subjobcontainer.sparkstreaming.SparkStreamingSubjobContainerFigure) AbstractGraphicalEditPart(org.eclipse.gef.editparts.AbstractGraphicalEditPart) SparkStreamingSubjobContainerFigure(org.talend.designer.core.ui.editor.subjobcontainer.sparkstreaming.SparkStreamingSubjobContainerFigure) AbstractGraphicalEditPart(org.eclipse.gef.editparts.AbstractGraphicalEditPart) ConnectionEditPart(org.eclipse.gef.ConnectionEditPart) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) EditPart(org.eclipse.gef.EditPart) NodeEditPart(org.eclipse.gef.NodeEditPart) NodeContainer(org.talend.designer.core.ui.editor.nodecontainer.NodeContainer) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

SparkStreamingSubjobContainerFigure (org.talend.designer.core.ui.editor.subjobcontainer.sparkstreaming.SparkStreamingSubjobContainerFigure)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Figure (org.eclipse.draw2d.Figure)1 FreeformLayer (org.eclipse.draw2d.FreeformLayer)1 FreeformLayout (org.eclipse.draw2d.FreeformLayout)1 IFigure (org.eclipse.draw2d.IFigure)1 ConnectionEditPart (org.eclipse.gef.ConnectionEditPart)1 EditPart (org.eclipse.gef.EditPart)1 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1 NodeEditPart (org.eclipse.gef.NodeEditPart)1 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)1 IProcess2 (org.talend.core.model.process.IProcess2)1 JobletProcessItem (org.talend.core.model.properties.JobletProcessItem)1 NodeContainer (org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)1