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;
}
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());
}
}
}
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();
}
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();
}
}
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);
}
Aggregations